# How to Stop Cursor From Using Outdated APIs

URL: https://context7.com/cursor-outdated-apis
Updated: 2026-10-12

How to stop Cursor from using outdated APIs: give it a live docs source like Context7, add a project rule, pin your library version, and type-check the rest.

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.

Cursor removed its @Docs feature in version 3.14.2, so older guides that tell you to index docs with @Docs no longer apply. What is left is Cursor's web search, pasted links, local Markdown files, and MCP servers. 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.

| Symptom                                                             | Likely cause                                                | Fix                                                                              |
| ------------------------------------------------------------------- | ----------------------------------------------------------- | -------------------------------------------------------------------------------- |
| Runtime error: `useRouter` from `next/router` in an App Router page | A Pages Router pattern from older training data             | Look up the current API. App Router hooks come from `next/navigation`.           |
| A removed function, like `ReactDOM.render` on React 19              | Removed in a major release after years in tutorials         | Fetch docs for your version. React 19 uses `createRoot` from `react-dom/client`. |
| Old config syntax, like `@tailwind base` in a Tailwind v4 project   | v3 examples far outnumber v4 examples                       | Pin docs to v4, which uses `@import "tailwindcss"`.                              |
| `middleware.ts` flagged as deprecated in a Next.js 16 app           | A file convention renamed after the model's cutoff          | Rename to `proxy.ts` (a codemod does it), unless you need the edge runtime.      |
| Type error: params or `cookies()` used without await                | Next.js 15 made these async; Next.js 16 removed sync access | Check the docs for your exact major version, then await them.                    |
| Code runs but follows another major version's patterns              | Docs or examples for a different version than you installed | Name the version from `package.json` and use a versioned library ID.             |

## 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:

```bash
npx ctx7 setup --cursor
```

The 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. The API key is optional; without it, Context7 works at lower anonymous rate limits. 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:

```json
{
  "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`**

```md
---
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:

```text
/vercel/next.js/v15.1.8
```

If 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:

| Option                     | How it works                                         | Good for                                               | Watch out for                                                              |
| -------------------------- | ---------------------------------------------------- | ------------------------------------------------------ | -------------------------------------------------------------------------- |
| Cursor web search          | The agent searches the web when it decides to        | Release notes, error messages, brand-new announcements | Results depend on what ranks, which may be a tutorial for an older version |
| Pasted docs link           | You paste a URL into the prompt                      | One page you already know is right                     | One page at a time, and you have to find it first                          |
| Local Markdown + @-mention | You copy docs into the repo and @-mention the file   | Internal docs and short reference pages                | A snapshot you have to update by hand                                      |
| Project rules              | Standing instructions in .cursor/rules               | Conventions, like which API your team uses             | Rules guide behavior. They are not a docs source.                          |
| Context7 MCP               | The agent queries a maintained index of library docs | Library and framework APIs, version-specific lookups   | Covers indexed libraries; private repos need a paid teamspace              |

## 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:

| Agent                     | Setup command               | Where standing instructions go                   |
| ------------------------- | --------------------------- | ------------------------------------------------ |
| Claude Code               | `npx ctx7 setup --claude`   | `CLAUDE.md`                                      |
| Codex                     | `npx ctx7 setup --codex`    | `AGENTS.md`                                      |
| GitHub Copilot in VS Code | `npx ctx7 setup --vscode`   | `.github/copilot-instructions.md` or `AGENTS.md` |
| GitHub Copilot CLI        | `npx ctx7 setup --copilot`  | `AGENTS.md` or `.github/copilot-instructions.md` |
| OpenCode                  | `npx ctx7 setup --opencode` | `AGENTS.md`                                      |

- [Best Claude Code plugins](https://context7.com/claude-code-plugins.md): Find Claude Code plugins and MCP servers for docs, GitHub, search, and local work.
- [MCP server list](https://context7.com/mcp-server-list.md): 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. There is a free monthly allowance, and the MCP server also works without an API key at lower rate limits. 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.

## Related guides

- [Up-to-date docs for coding agents](https://context7.com/up-to-date-documentation-for-coding-agents.md): Understand why coding agents need current, version-specific documentation.
- [Versioned library docs for AI tools](https://context7.com/versioned-library-documentation.md): Pin documentation to the exact library version your project uses.
- [MCP server list](https://context7.com/mcp-server-list.md): Compare useful MCP servers for AI coding agents and developer workflows.
- [Best Claude Code plugins](https://context7.com/claude-code-plugins.md): Find Claude Code plugins and MCP servers for docs, GitHub, search, and local work.