MCP serverPartly tested (needs an account)

Current docs for code libraries

Context7

An MCP server by Upstash that gives your agent up-to-date documentation for code libraries, so it stops guessing old or wrong function names.

Works with
Claude Code, Codex CLI, Gemini CLI
Good for
Web developers, Build an app

What it does

An AI assistant learned from data that can be a year old or more. For this reason, it sometimes uses a function that has changed or a function that does not exist. The code looks right, but it fails.

Context7 fixes this. When you ask a question about a code library, Context7 fetches the current documentation for that library. It puts the documentation into the assistant's prompt. The assistant then writes code from fresh text.

Context7 works in two modes. In the first mode, a skill tells the assistant to run the ctx7 command-line tool. In the second mode, a Context7 MCP server gives the assistant two tools. One tool finds the library (resolve-library-id). The other tool fetches the documentation (query-docs). The npx ctx7 setup command lets you choose a mode. Since ctx7 0.9.0 (3 November 2026) you can also search the docs of all libraries in one step from your terminal, for example npx ctx7 search "react server actions". Since ctx7 0.11.0 (9 November 2026) npx ctx7 code searches and reads a library's source code at the version its docs describe.

A free API key gives you higher limits. You can get it at context7.com/dashboard. The documentation comes from the community. The README says Context7 cannot promise that it is accurate, complete, or safe. Check important code yourself.

Who it is for

People who build with libraries that change fast, such as Next.js, React, or Supabase. It helps most when your assistant keeps writing old code.

Example prompts

  • "Create a Next.js middleware that sends logged-out users to /login. use context7"
  • "How do I set up Next.js 14 middleware? use context7"
  • "Show me the Supabase sign-up with email and password. use context7"
  • "Implement basic authentication with Supabase. use library /supabase/supabase for API and docs."

The last prompt names the library ID. This lets Context7 skip the step that finds the library.

How to install

npx ctx7 setup

How to use it

Add "use context7" to your request, for example "build a Next.js page with the newest app router API. use context7". The agent fetches current docs for the library and writes code from them.

Other assistants

The npx ctx7 setup command has flags for Cursor, Claude Code, and OpenCode only. For Codex CLI, use the plugin or add the MCP server by hand.

Codex CLI plugin:

codex plugin marketplace add upstash/context7
codex plugin add context7@context7-marketplace

Codex CLI MCP server, with your key:

codex mcp add context7 -- npx -y @upstash/context7-mcp --api-key YOUR_API_KEY

For Gemini CLI, open ~/.gemini/settings.json. Add this inside mcpServers:

json
"context7": {
  "httpUrl": "https://mcp.context7.com/mcp",
  "headers": {
    "Authorization": "Bearer YOUR_API_KEY",
    "Accept": "application/json, text/event-stream"
  }
}

Check it works

Ask a question about a library and end it with "use context7". In MCP mode, the assistant should call resolve-library-id and then query-docs. In skill mode, it should run ctx7 commands. In Claude Code, you can also run claude mcp list.

Common problems

  • The setup command fails: The ctx7 tool needs Node.js 22.13 or newer. Check your version with node --version.
  • You reach a rate limit: Get a free API key at context7.com/dashboard. The setup command can create one for you.
  • It says "Your Context7 session has expired": Answer Y to sign in again. In scripts it prints a notice and goes on without your account.
  • Codex shows a startup timeout error: Raise startup_timeout_ms in the Codex config. The Context7 docs suggest 40_000.
  • The assistant ignores Context7: Add "use context7" to the request. Or add a rule to your CLAUDE.md file.

What to watch out for

  • Your library question goes to a hosted service run by Upstash.
  • A free API key is advised, because the free use has limits. The setup command opens a sign-in.
  • Documentation is community content. Check important code yourself.
  • Since MCP server 4.5.0 an optional research preview adds a submit-docs-feedback tool. It is off unless you add --research-preview, CONTEXT7_RESEARCH_PREVIEW=1 or ?research_preview=1 to the server URL. When it is on, the server tells the agent to send Context7 a score, what was wrong and a short comment after each answer, so parts of your task can reach Context7.
  • Since MCP server 4.6.0 (9 November 2026) the same research preview switch also adds two more tools: query-code, which searches and reads a library's source code, and get-upgrade-guide, which lists what changes between two versions of a library. With the switch on you get all three preview tools, the feedback tool included. Without it the server still has only its two usual tools (release 4.6.0).

Licence and author

Licence
MIT
Author
Upstash
Source code
github.com/upstash/context7

How we tested it

We installed it on an empty test computer on 12 Oct 2026. Partly tested: installed in a clean test system, but its main features need an account or key we did not use.

Test level

No documentation lookup was run, so the hosted service and its limits were not tested. The install line (npx ctx7 setup) was not run, because it opens a sign-in. We registered the server with our own claude mcp add command instead.

Technical details of the test
Date
12 Oct 2026
Method
In a clean container with no account we started npx -y @upstash/context7-mcp, sent the MCP initialize and tools/list requests, and it answered with 2 tools (resolve-library-id and query-docs). We also registered it with claude mcp add, and claude mcp list reported it as connected. We did not call the tools.

Checked again on 10 Nov 2026

Alternatives

  • cloudflare-docs-mcp: Gives current documentation, but only for Cloudflare.
  • exa-mcp: Searches the whole web. Context7 covers library documentation only.

FAQ

Do I need to type "use context7" every time? No. The ctx7 setup command installs a skill that triggers Context7 for library questions. You can also add a rule to CLAUDE.md.

How do I remove it? Run npx ctx7 remove. If you installed the tool with npm install -g ctx7, also run npm uninstall -g ctx7.

Can I ask for one version of a library? Yes. Write the version in your prompt, for example "Next.js 14". Context7 picks the matching version.

Is it free? The README offers a free API key. It does not state the limits. Check context7.com for current plans.

Sources

  • github.com/upstash/context7
  • github.com/upstash/context7/releases/tag/%40upstash%2Fcontext7-mcp%404.5.0
  • github.com/upstash/context7/releases/tag/ctx7%400.9.0
  • github.com/upstash/context7/releases/tag/%40upstash%2Fcontext7-mcp%404.6.0
  • github.com/upstash/context7/releases/tag/ctx7%400.11.0