# Stop AI from using outdated APIs

> Your AI writes code against old library versions and invents functions that no longer exist.

This setup is for developers whose AI assistant keeps suggesting deprecated APIs or functions that do not exist. Context7 fetches current, version-specific documentation for a library into the agent's context, and GitHub lets the agent check that the plan fits your actual code. You end up with suggestions based on the docs for the version you use.

## Steps

1. **Add Context7**: In Cursor, open Settings > MCP and add Context7, either the remote server at mcp.context7.com/mcp or the local @upstash/context7-mcp package via npx. In Claude Code, run claude mcp add with the same server. Check that the resolve-library-id and get-library-docs tools show up.
   Tip: An optional Context7 API key raises rate limits if you hit them.
2. **Name the library**: In your prompt, name the library and the version you use, for example Next.js 15 or Prisma 6, and add use context7. The agent resolves the library, pulls the matching docs and writes code from them. Look at the tool call to see which docs it fetched.
   Tip: Add a Cursor rule or CLAUDE.md line telling the agent to use Context7 for library questions, so you do not have to repeat it.
3. **Check against your repo**: Add the GitHub MCP server with a read-only fine-grained token for your repository. Ask the agent to read your package.json or lock file and existing usage before it changes anything. It can then flag gaps between the docs and the version you actually have installed.
   Tip: In a local checkout, the agent can already read files; GitHub helps when you work across repos or branches.

## Prompts to try

- Use context7 to show me how to set up route handlers in Next.js 15, then update app/api/users/route.ts.
- Check which version of Prisma we use in package.json and fetch the matching docs for relation queries.
- Use context7 and rewrite this Tailwind config for Tailwind CSS v4.
- Is the useFormState hook still the right API in our React version? Check the docs before answering.
- Compare our current Stripe SDK calls with the latest docs and list anything deprecated.

## What you need

- Cursor or Claude Code
- Node.js if you run Context7 locally
- A GitHub account and read-only token for the repository check
- Optionally a Context7 API key for higher limits

## Limits

- Docs quality depends on the library's own documentation; thin docs give thin answers.
- Fetched docs use context space, so very broad questions can crowd out your code.
- The agent still has to choose the right version, so state it clearly in the prompt.

## Security notes

- Context7 only reads public documentation.
- Scope the GitHub token to the repositories you work in.

## MCP servers

- [Context7 MCP Server](https://github.com/upstash/context7): docs-read
- [GitHub MCP Server](https://github.com/github/github-mcp-server): repository-read, issue-write, pull-request-write

## FAQ

**Is Context7 free?**

Context7 has a free tier you can use without an account. An API key from context7.com gives higher rate limits; check their site for current plans.

**Does it cover every library?**

It covers a large index of popular libraries, but not all of them. If a library is missing, the agent falls back to its training data, so check its output against the official docs.

**Does my code get sent to Context7?**

The agent sends library names and search topics to Context7 to fetch docs. Your source code stays between your editor, GitHub and the model provider.

**Do I need GitHub for this to work?**

No. Context7 alone fixes most outdated suggestions. GitHub adds a check against your repository, which helps when the agent works outside your local checkout.

## Tools

- **[GitHub](https://suiteintent.com/t/github?m=GB)**: Code hosting, issues and pull requests. · Best for: Teams reviewing code through pull requests · Free plan · 10000
