How to Stop Cursor From Using Outdated APIs
To stop Cursor from using outdated APIs, give its agent a live documentation source and a rule that tells it to check that source before it writes code. The most direct way is a docs MCP server such as Context7, installed with one command (npx ctx7 setup --cursor), which returns current, version-specific library docs on demand. Then name the library version your project runs, and let type checks and tests catch what still slips through.
In short:
- Install a docs MCP server:
npx ctx7 setup --cursoradds Context7. - Add a project rule in
.cursor/rulesthat tells Cursor to look up the docs before it writes library code. - Name the library version from your lockfile in the prompt or the rule.
- Run the type checker and tests after each agent edit.
Cursor removed its @Docs feature in version 3.14.2, so older guides that tell you to index docs with @Docs no longer apply. A docs MCP server takes its place: it gives the agent a maintained, versioned docs index, where @Docs gave it a crawl of one site. What else is left is Cursor's web search, pasted links, and local Markdown files. This guide covers when each one fits.
We build Context7, so weigh that. The rules, version pinning, and checks below help no matter which docs source you use.
Why Does Cursor Suggest Outdated APIs?
Three things stack up. First, the model Cursor runs learned from code written before its training cutoff, so anything released after that date is missing. Second, older versions dominate what it did learn: a library's previous major version has had years to collect tutorials, Stack Overflow answers, and blog posts, while the current one has had months. Third, the model does not know which version you have installed. Cursor can read your package.json, but nothing makes it check before it writes a familiar-looking call.
The result is code that looks right and often compiles. The mistake surfaces later as a deprecation warning, a type error, or a bug. Use the table below to match what you see to its cause.
Fix 1: Give Cursor a Live Docs Source
This has the biggest impact, because it replaces memory with a lookup. Install Context7 in Cursor with one command:
$ npx ctx7 setup --cursorThe command asks whether Cursor should reach Context7 through the MCP server or through the ctx7 CLI and a skill, signs you in, and writes the config. In MCP mode it adds a context7 server, with your API key, to ~/.cursor/mcp.json, plus a skill that tells Cursor's agent when to use it. Add --api-key YOUR_API_KEY on machines where a browser sign-in is not possible.
Add --project to write the setup into the repo instead, including .cursor/mcp.json and an always-applied rule in .cursor/rules/context7.mdc. That config file holds your API key, so if you plan to commit it, add --oauth as well: the file then has no key, and each teammate signs in from Cursor.
If you prefer to edit the config by hand, point Cursor at the hosted server at https://mcp.context7.com/mcp with your API key, which you create in the Context7 dashboard. If the file is committed to Git, use Cursor's ${env:NAME} syntax in the header so the key stays out of the repo. Put this in ~/.cursor/mcp.json for every project, or in .cursor/mcp.json for one project:
{
"mcpServers": {
"context7": {
"url": "https://mcp.context7.com/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_KEY"
}
}
}
}Fix 2: Tell Cursor When to Use It
An MCP server only helps when Cursor calls it. The agent decides when to use a tool, and for a library it thinks it knows, it often answers from memory. Context7 gives it two tools: resolve-library-id finds the library and its indexed versions, and query-docs returns focused docs for one topic. A project rule makes calling them the default.
Cursor reads project rules from .cursor/rules. Each rule is an .mdc file with a short frontmatter block, and a plain .md file in that folder is ignored. Create one by typing /create-rule in Agent, or open Customize in the sidebar, go to Rules, and click Add Rule. If you ran ctx7 setup with --project, it already wrote .cursor/rules/context7.mdc, so edit that one instead of adding a second. Cursor also reads AGENTS.md in the project root, which helps if teammates use other agents.
A rule beats a trigger phrase typed into every prompt: it lives in the repo and still applies when someone forgets. A rule like this works:
.cursor/rules/context7.mdc
---
alwaysApply: true
---
Use Context7 to fetch current documentation for any library before writing code.
Check package.json or the lockfile for the installed version, and use the
matching versioned library ID when Context7 lists one.
Run the type checker after editing code that touches a library API.Fix 3: Pin the Version Your Project Uses
Current docs are not always the right docs. If your app is on Next.js 15 and the lookup returns Next.js 16 docs, Cursor writes Next.js 16 code into a Next.js 15 app. Tell it which version you run.
The installed range is in package.json. The exact resolved version is in package-lock.json, pnpm-lock.yaml, or yarn.lock. Name it in the prompt, or put it in the rule for libraries you are mid-migration on.
Context7 library IDs can carry a version, and resolve-library-id lists the versions Context7 has indexed for a library. For a project on Next.js 15, the ID looks like this:
/vercel/next.js/v15.1.8If you ask for a version that is not indexed, Context7 returns an error that lists the versions it has, so Cursor can pick the closest one. When none is close enough, paste a link to the library's docs for your version rather than letting Cursor fall back to memory.
Does Cursor Have Built-In Docs Support?
Not the way it used to. The @Docs feature let you add a documentation site for Cursor to crawl and index, then reference it in chat. Cursor removed it in version 3.14.2, which Cursor staff confirmed on the Cursor community forum in August 2026.
Cursor's suggested replacements are web search, pasted links, local Markdown files, and rules. Here is how they compare with a docs MCP server:
Fix 4: Catch What Slips Through
No docs source catches everything. Put cheap checks between Cursor's edit and your commit.
Type-check. Most outdated calls in TypeScript fail here: a removed export, a changed signature, a Promise where an object used to be. Run tsc --noEmit, or your project's typecheck script, after agent edits. Cursor's agent can run it for you if the rule asks.
Run the tests. An old pattern that still compiles, like a changed default, shows up as a failing test rather than a type error.
Read deprecation warnings. Frameworks warn before they remove an API. If the dev server or build prints one for code Cursor just wrote, treat it as a bug.
Lint for deprecated APIs. In TypeScript projects, the @typescript-eslint/no-deprecated rule flags calls to anything marked @deprecated. It needs typed linting turned on.
Use codemods for big upgrades. React and Next.js ship codemods for their breaking changes, and they are more reliable than asking an agent to rewrite every call by hand.
The Same Fix for Claude Code, Codex and Copilot
This is not only a Cursor problem. Every coding agent writes from training data unless you give it something better, and the fixes above carry over. The setup command takes a flag per agent:
- Best Claude Code MCP servers: The MCP servers to install in Claude Code first, with one install command each.
- MCP server list: Compare useful MCP servers for AI coding agents and developer workflows.
Frequently asked questions
How do I stop Cursor from using outdated APIs?
Give Cursor a live documentation source and a rule that says when to use it. Install Context7 with npx ctx7 setup --cursor, add a project rule that tells Cursor to use it, and name the library version your project uses. Type checks and tests catch whatever still slips through.
Why does Cursor keep suggesting deprecated code?
The model Cursor runs learned from code written before its training cutoff, and older versions of popular libraries have far more examples online than current ones. It also does not check your installed version unless something tells it to. Deprecated code often still compiles, so the mistake shows up later.
Does Cursor still have @Docs?
No. Cursor removed @Docs in version 3.14.2, as Cursor staff confirmed on the community forum. Cursor now suggests pasting documentation links, keeping docs as local Markdown files you @-mention, or using rules. A docs MCP server such as Context7 gives the agent a maintained, versioned index instead.
How do I make Cursor use Context7 automatically?
Add a project rule in .cursor/rules with alwaysApply: true that tells Cursor to fetch current documentation with Context7 before writing code for any library. npx ctx7 setup --cursor --project writes one to .cursor/rules/context7.mdc for you. Add --oauth so the MCP config it writes holds no API key, then commit the new files so the whole team gets the same behavior.
How do I get Cursor to use docs for my exact library version?
Check package.json or your lockfile for the installed version, and name it in the prompt or rule. Context7's resolve-library-id tool lists the indexed versions of a library, and query-docs accepts versioned IDs such as /vercel/next.js/v15.1.8. Without a version, you get the library's default docs.
Is Context7 free to use in Cursor?
Yes. The Free plan includes a monthly allowance of API calls. Pro costs $10 per seat per month with 2,000 API calls per seat, and Pro teamspaces can add private repositories. See context7.com/plans for current limits.
Install Context7 in Cursor in One Command
Run npx ctx7 setup --cursor, and Cursor's agent can look up current, version-specific library docs before it writes code.