MCP server

Context7 MCP

MCP server published on npm as @upstash/context7-mcp, with a hosted endpoint. Transports: stdio, streamable-http. Maintained in upstash/context7.

Checked 2026-10-31

Install

Claude Code
claude mcp add context7 -- npx -y @upstash/context7-mcp

Hosted endpoint: https://mcp.context7.com/mcp

Commands come from the project's own docs or registry entry. Check them against the source before you run them.

Loading poll...

Context7 gives a coding agent current, version-specific documentation and code examples for the libraries you use, so it stops guessing API names from old training data. It works over MCP with two tools, or through a CLI plus a skill. The code is MIT licensed, and there is a free plan. We checked the README, docs site and pricing page on 31 October 2026.

Quick facts

Maintainer

Upstash (upstash/context7)

License

MIT

MCP tools

resolve-library-id, query-docs

CLI

ctx7 library, ctx7 docs

Remote endpoint

https://mcp.context7.com/mcp (OAuth variant: /mcp/oauth)

Local package

@upstash/context7-mcp

Runtime for local use

Node.js 20 or newer (troubleshooting page); the ctx7 CLI needs 22.13 or newer (README)

Last push we saw

30 Oct 2026

Free plan

$0, 1,000 API calls a month, public repositories

Pro plan

$10 per seat per month, 2,000 calls per seat, private repositories

Extra calls on Pro

$5 per 1,000

Enterprise

Custom; SOC-2, SSO and self-hosting listed

The repo also ships a TypeScript SDK, Vercel AI SDK tools and a pi.dev extension. We cover only the MCP server and CLI here.

The problem it solves

Ask an agent to write code against a library that changed last quarter and you often get a confident answer in last year's style. It calls a function that was renamed, passes an argument that was dropped, or invents one outright. The README names three failures: examples based on old training data, hallucinated APIs and generic answers for old package versions.

Context7 works by looking up the real documentation for the library and version you name, then putting the relevant parts into the agent's context. You do not switch tabs, and the agent does not rely on memory.

The README's own examples show how light the prompt can be:

Create a Next.js proxy that checks for a valid JWT in cookies
and redirects unauthenticated users to `/login`. use context7

The phrase "use context7" is the trigger. You can also put it in a standing rule so you never type it.

How it works, step by step

  1. You ask a question that involves a library.
  2. The agent calls resolve-library-id with the library name and your question. Context7 returns matching libraries and their IDs, ranked by how well they fit the question.
  3. The agent calls query-docs with the chosen ID and the question. Context7 returns relevant documentation and code examples as text.
  4. The agent writes code with that text in context.

If you already know the library, skip step 2 by naming the ID in the prompt. The README's example:

Implement basic authentication with Supabase. use library /supabase/supabase for API and docs.

The slash form tells Context7 exactly which library to load. IDs look like /vercel/next.js or /mongodb/docs.

The two tools

Tool

Parameters

Returns

resolve-library-id

query (required), libraryName (required)

Matching libraries with Context7-compatible IDs

query-docs

libraryId (required), query (required), language (optional)

Relevant documentation and code examples as text

The language field ranks examples in the language you write first. That is useful for libraries with many language bindings.

Two modes

The README describes two ways to use Context7:

  • CLI plus skills. A skill tells the agent to run ctx7 commands. No MCP server is involved.
  • MCP. The agent calls the two tools natively.

The CLI route avoids loading tool schemas, which saves a little context. The MCP route is simpler where your client has good MCP support. npx ctx7 setup lets you choose.

Install it in each agent

The quickest path for most people is one command:

npx ctx7 setup

Per the README, it signs you in with OAuth, generates an API key and installs the right skill. Flags such as --cursor, --claude and --opencode target one agent. npx ctx7 remove undoes it. For manual setup, Context7's all-clients page has the exact snippets below.

Claude Code

Remote:

claude mcp add --scope user --header "Authorization: Bearer YOUR_API_KEY" --transport http context7 https://mcp.context7.com/mcp

Local:

claude mcp add --scope user context7 -- npx -y @upstash/context7-mcp --api-key YOUR_API_KEY

--scope user makes it available in all projects. Drop it for local scope, or use --scope project to share a config in .mcp.json. Do not commit your key there.

Cursor

Go to Cursor Settings, Tools and MCP, then add a server. In mcp.json the remote form is:

{
  "mcpServers": {
    "context7": {
      "url": "https://mcp.context7.com/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_API_KEY"
      }
    }
  }
}

For a local server use "command": "npx" with "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]. Cursor rules can hold the "always use Context7" line.

Codex

OpenAI's Codex docs use Context7 as their own example:

codex mcp add context7 -- npx -y @upstash/context7-mcp

Context7's page adds the key form and a TOML alternative:

[mcp_servers.context7]
url = "https://mcp.context7.com/mcp"
http_headers = { "Authorization" = "Bearer YOUR_API_KEY" }

That lives in ~/.codex/config.toml. For the local variant, Context7 suggests startup_timeout_sec = 20, which helps when npx is slow to start.

Gemini CLI

Add this to ~/.gemini/settings.json:

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

Note the extra Accept header that Context7's page includes for Gemini CLI. The same page offers a local command form too.

VS Code

In .vscode/mcp.json, VS Code's format uses servers:

{
  "servers": {
    "context7": {
      "type": "http",
      "url": "https://mcp.context7.com/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_API_KEY"
      }
    }
  }
}

A stdio version uses "type": "stdio" with the same npx command and args. For Copilot's cloud agent, Context7 notes that secrets must be named with a COPILOT_MCP_ prefix, for example COPILOT_MCP_CONTEXT7_API_KEY.

Compatibility at a glance

Agent

Remote

Local npx

Setup helper

Claude Code

Yes

Yes

npx ctx7 setup --claude

Cursor

Yes

Yes

npx ctx7 setup --cursor

Codex

Yes

Yes

codex mcp add

Gemini CLI

Yes

Yes

Edit settings.json

VS Code with Copilot

Yes

Yes

Edit mcp.json

Context7's docs list setup for 30 or more clients, including OpenCode, Windsurf, Zed, Warp, Amp, Kiro and the Copilot CLI.

Auth, keys and pricing

Key or no key. The README says an API key is recommended for higher rate limits, which implies basic use works without one. A key starts with ctx7sk. For private repositories you need a key and the Pro plan.

OAuth. Change the endpoint from /mcp to /mcp/oauth for clients that implement MCP OAuth. The docs say OAuth works only for remote HTTP connections. For stdio, use the API key.

Plans, from the pricing page:

Free

Pro

Enterprise

Price

$0

$10 per seat per month

Custom

Included calls

1,000 a month

2,000 per seat a month

Custom

Extra calls

Blocked after limit, with 20 bonus calls a day

$5 per 1,000

Custom

Repositories

Public

Public and private

Public and private

Team features

No

Yes

Yes

Support

Community

Email

Dedicated

The pricing page says each search request and each context request counts as one call. It also says Pro limits are per seat, not shared across a team. Private repository parsing is charged at $5 per 1M tokens when you add or refresh one.

One call is one tool call from the agent. A single question can use two: one to resolve the ID, one to query. That means 1,000 free calls is nearer 500 questions if the agent resolves every time. Giving the library ID in your prompt halves it.

Real tasks with copy-ready prompts

Build against a new API version

Using Next.js 16, write a proxy that redirects unauthenticated users
to /login. use context7

Skip the lookup

Show me the Supabase email and password sign-up call.
use library /supabase/supabase for API and docs.

Upgrade a dependency

We are on React Router 6 and want to move to 7. use context7 to read
the migration guide, then list every file in src/ that uses an API that
changed. Do not edit anything yet.

Check a config option

What is the exact option name for caching JSON responses in a
Cloudflare Worker? use context7 and quote the docs you used.

Add a standing rule

Put this in CLAUDE.md, AGENTS.md or Cursor Rules, as the README suggests:

Always use Context7 when I need library/API documentation, code
generation, setup or configuration steps without me having to
explicitly ask.

For rule file layouts, see our CLAUDE.md starter template and AGENTS.md starter template.

Security and trust

Context7 is a pipe from a third-party index into your agent's context. Two things follow.

The content is community contributed. The README's disclaimer says projects in Context7 are developed and maintained by their owners, that Upstash cannot guarantee the accuracy, completeness or security of all library documentation, and that suspicious content can be reported with the Report button on the project page. Documentation text can carry instructions, so treat it the way you treat any fetched web text.

Your question leaves your machine. With the remote server, the query you pass goes to Context7. Do not put secrets or private code into a docs question. Keep queries about the library, not your codebase.

Keys. Treat the API key like any token. Use --scope user rather than a committed project file, or an environment variable where your client allows it. The security policy lists 1.0.x as the supported version line for the MCP package and asks for private vulnerability reports through GitHub.

Limits and known issues

  • Monthly call cap. The free tier blocks after 1,000 calls, with a small daily allowance after that.
  • Node versions differ by component. The troubleshooting page says Node 20 or newer for the MCP package, while the README says the ctx7 CLI needs 22.13 or newer. If setup fails, check node --version first.
  • Local `npx` start-up trouble. Troubleshooting covers ERR_MODULE_NOT_FOUND (try bunx or deno), a uriTemplate.js error (use --node-options=--experimental-vm-modules), TLS errors, and request timeouts on Windows and macOS that need the full path to Node. The remote server skips all of that.
  • Coverage depends on the index. If a library is not in Context7, or its docs are thin, the answer will be too. The docs have an Adding Libraries page for owners.
  • Setup helper bugs. At the time we checked, the tracker showed a bug where OpenCode 2.x setup writes the server entry to the wrong config location (#3597) and open fixes for it. If you use OpenCode, check the file by hand.
  • Quality varies. Docs retrieval is not reasoning. The agent can still misread what it was given. Ask it to quote what it used.

Alternatives

Option

Choose it when

Fetch MCP

You want the agent to read one specific docs URL

Firecrawl MCP

You need to crawl a docs site you point it at

Brave Search MCP or Exa MCP

The answer is in blog posts and forums, not official docs

Serena MCP

The question is about your own code, not a library

A local docs/ folder plus a rule

The library is internal and small

Context7 and Serena are different jobs. One tells the agent about libraries, the other about your repo. Many setups use both next to GitHub MCP and Playwright MCP. The full list is in the MCP servers hub.

Which agents it works best with

Any MCP client can use it. Where it helps most is where the model's training data lags the library: fast-moving frameworks and SDKs. Claude Code and Codex users get the least friction because a one-line command adds it and a rule file keeps it on. Cursor users can put the rule in Cursor Rules. Gemini CLI needs the extra Accept header.

A model that already knows a stable library well gains less, and for that case the lookup mostly adds cost.

Our take

We did not test Context7 for this page. This is an editorial read of the docs.

The idea is sound and the install is easy. Two tools, one slash-prefixed ID, a rule file. That is about as small as an MCP server gets, and a small surface is good.

The question to ask is not "does it work" but "how often does my agent get a library wrong". If it rarely does, a lookup per question is wasted budget. If you work on fast-moving stacks, pinned old versions, or less common libraries, it can pay for itself fast. Pin the library ID in the prompt to save calls.

Mind the quota maths. A free key and 1,000 calls goes quickly when the agent resolves and queries on every question. Put the ID in your rules for the libraries you use daily.

Setup checklist

  1. Check node --version, or skip it and use the remote endpoint.
  2. Create a free key at context7.com/dashboard.
  3. Run npx ctx7 setup, or add the server by hand for your agent.
  4. Add the "always use Context7" rule to your rule file.
  5. Try one prompt with "use context7" and check that both tools were called.
  6. Add library IDs for the libraries you use most.
  7. Watch your call count in the dashboard in the first week.

Frequently asked questions

Is Context7 free? Yes, there is a Free plan with 1,000 API calls a month for public repositories. Pro is $10 per seat per month.

Do I need an API key? It is recommended for higher limits and needed for private repositories.

What tools does the MCP server expose? resolve-library-id and query-docs.

How do I get docs for a specific version? Name the version in your prompt, such as Next.js 16, and Context7 matches it.

Can I run it without Node.js? Yes, use the remote server URL.

*Product names are used descriptively. We are not affiliated with Upstash or Context7.*

Mentioned here

Works with

Tried it with one of these? Vote below: works for me, or not.

Questions

Is Context7 free?

There is a Free plan at $0 with 1,000 API calls a month for public repositories. Pro is $10 per seat per month with 2,000 calls per seat, per the pricing page.

Do I need an API key?

The README recommends a free key for higher rate limits. The docs show anonymous access working, and a key is required for private repositories.

What tools does the MCP server expose?

Two: resolve-library-id and query-docs. The CLI offers ctx7 library and ctx7 docs.

How do I get docs for a specific version?

Mention the version in your prompt, for example 'Next.js 16', or pass a library ID with a version. The README says Context7 matches the version automatically.

Can I run it without Node.js?

Yes. Use the remote server at https://mcp.context7.com/mcp, which needs no local runtime.

Loading poll...

Reviews

Loading reviews…

Write a review

Your rating

Up to 1000 characters. Stars alone are enough.

Sources

  1. github.com/upstash/context7
  2. raw.githubusercontent.com/upstash/context7/master/README.md
  3. context7.com/docs/resources/all-clients
  4. context7.com/docs/resources/troubleshooting
  5. context7.com/plans
  6. developers.openai.com/codex/mcp
  7. code.claude.com/docs/en/mcp

Similar

  • browser-use MCP

    Browser Use is an open-source Python library for AI browser agents, and our entry covers its MCP route.

    • MCP server
    • Official

    browser-use · 119,597 stars

  • Scrapling MCP Server

    Scrapling is a Python web scraping framework from D4Vinci, described on GitHub as handling everything from a single request to a full-scale crawl, and this entry is its MCP server.

    • MCP server

    D4Vinci · 90,477 stars

  • Netdata MCP

    Netdata is an observability platform, and this entry is its hosted MCP endpoint at app.netdata.cloud, reached over streamable HTTP.

    • MCP server

    netdata · 81,227 stars

  • claude-flow MCP

    Claude Flow is published on npm as claude-flow, and its repository now sits at ruvnet/ruflo, which the GitHub description calls the original agent harness for deploying multi-agent swarms and coordinating autonomous workflows.

    • MCP server

    ruvnet · 80,298 stars

  • Chrome DevTools MCP

    MCP server published on npm as chrome-devtools-mcp. Transports: stdio. Maintained in ChromeDevTools/chrome-devtools-mcp.

    • MCP server

    ChromeDevTools · 54,503 stars

  • tldraw MCP

    tldraw is an infinite-canvas SDK for React, and this entry is a hosted MCP endpoint run on a tldraw Workers address, reachable over streamable HTTP and SSE.

    • MCP server

    tldraw · 51,163 stars

Part of the Wbcom Designs family

The all-in-one WordPress community stack

Also ours: wbcomdesigns.comvapvarun.combrndle.com