🔍

Context7 MCP Server

Updated June 2026✓ Official

Context7 is Upstash's documentation-retrieval MCP server, and it exists to solve one specific failure mode: a coding model answering from year-old training data, inventing APIs that were never shipped, or writing config for a package version you are not running. Built by Upstash, it is officially maintained and best for Search.

by Upstash

About

Context7 is Upstash's documentation-retrieval MCP server, and it exists to solve one specific failure mode: a coding model answering from year-old training data, inventing APIs that were never shipped, or writing config for a package version you are not running. Instead of guessing, the agent calls Context7 and gets version-specific documentation and code examples pulled from the library's own source, injected straight into the prompt. In practice you append "use context7" to a request — "Create a Next.js middleware that checks for a valid JWT in cookies and redirects unauthenticated users to /login. use context7" — and the docs arrive before the code is written. The MCP surface is deliberately two tools. `resolve-library-id` turns a plain library name into a Context7-compatible ID, taking both a `libraryName` and the user's actual `query` so results can be ranked by relevance rather than string match. `query-docs` then fetches documentation for an exact ID such as `/vercel/next.js` or `/mongodb/docs`. You can skip the resolve step entirely by naming the ID in your prompt ("use library /supabase/supabase for API and docs"), and you can pin a version just by mentioning it ("How do I set up Next.js 14 middleware?"). Setup is a single command, `npx ctx7 setup`, which authenticates over OAuth, generates an API key and installs the integration; `--cursor`, `--claude` and `--opencode` target a specific agent, and `npx ctx7 remove` reverses it. Notably it ships in two modes: classic MCP, or a CLI-plus-Skills mode where the agent shells out to `ctx7 library` and `ctx7 docs` commands with no MCP server at all. To wire it manually, point your client at the hosted endpoint `https://mcp.context7.com/mcp` and pass your key as an `Authorization: Bearer` header — a free key from context7.com/dashboard mainly buys higher rate limits. Two honest caveats from Upstash's own README: the indexed library docs are community-contributed, so accuracy is not guaranteed and pages carry a Report button; and the public repo holds only the MCP server, while the API backend, parsing engine and crawling engine are private. Companion packages include the `ctx7` CLI, `@upstash/context7-sdk`, and Vercel AI SDK tool bindings.

Not yet measured
not scored

The repository is confirmed to exist, but nothing about this server has been measured yet — no remote endpoint to handshake and no repository-freshness signal collected. Absence of evidence, not evidence of a problem.

What was measured

  • Source verification100/100 · weight 25

    The repository URL was confirmed to resolve against the live GitHub API and is not archived.

  • Provenance90/100 · weight 10

    Published and maintained by the vendor of the service it connects to, rather than by a third party.

  • Listing ↔ repository match100/100 · weight 5

    The listing name lines up with the linked repository upstash/context7.

What could not be measured

These contributed nothing to the score — not a penalty, not a zero. They are why the confidence reads the way it does.

  • Live MCP handshakeunknown

    No remote endpoint to handshake — this server installs and runs locally over stdio, so there is nothing to probe from the outside.

  • Measured uptimeunknown

    No probe history recorded for this server yet.

  • Tool-schema stabilityunknown

    Drift is a difference between two successive checks, and this server has none recorded.

  • Repository maintenanceunknown

    No repository-freshness reading has been collected for this server yet.

Installation

npm / npx
npx ctx7 setup

ctx7 confirmed live on the npm registry — checked August 17, 2026.

The most-copied Context7 setup on the internet references a tool that has not existed since December 2025. get-library-docs was removed in v2.0.0 and replaced by query-docs, and the rule snippets, Copilot config blocks and blog posts that name it are all still circulating — including the README published with the current npm package, 4.0.2, which carries a GitHub Copilot config listing "tools": ["get-library-docs", "resolve-library-id"]. The repository README is the one that is current. Two other things are worth knowing before you install: the recommended path is now the ctx7 CLI rather than a hand-written MCP entry, and it can set Context7 up with no MCP server at all, as a skill that shells out to CLI commands. Which of those two you pick is the actual decision here, and it depends on how much of your context window you are willing to spend.

Setting up Context7

  1. 1.Run the setup command

    One command does the whole thing: it authenticates over OAuth, generates an API key and installs the integration. It will ask whether you want CLI plus Skills mode or MCP mode. Target a specific agent with --cursor, --claude or --opencode. Node 18 or newer is required for the CLI itself; the MCP server package needs Node 20.18.1 or newer as of 3.2.5, which dropped Node 18 when it moved to undici 7.

    shell
    npx ctx7 setup
  2. 2.Choose CLI plus Skills, or MCP

    CLI plus Skills installs a skill that teaches your agent to run ctx7 library and ctx7 docs as shell commands — no MCP server, no tool schemas loaded into every request, and the docs arrive only when the agent decides to fetch them. MCP mode registers the server so the two tools are always present. On a coding agent that already has a shell, the CLI mode is usually the cheaper choice; MCP mode is the one to take when the client has no shell access or when you want the tools visible in the client tool list.

    shell
    # what the skill mode actually runs
    ctx7 library next.js "middleware jwt cookies"
    ctx7 docs /vercel/next.js "middleware jwt cookies"
  3. 3.Or wire the hosted server by hand

    There is no local server to run in the normal case: Context7 is a hosted endpoint at https://mcp.context7.com/mcp, and the API key travels as an Authorization: Bearer header. A free key from context7.com/dashboard mainly buys higher rate limits — anonymous use works until you cross a per-IP threshold, at which point the server fires an MCP elicitation asking you to sign in rather than silently degrading.

    mcp.json
    {
      "mcpServers": {
        "context7": {
          "type": "http",
          "url": "https://mcp.context7.com/mcp",
          "headers": {
            "Authorization": "Bearer YOUR_API_KEY"
          }
        }
      }
    }
  4. 4.Add a rule so you stop typing "use context7"

    Out of the box you trigger it by appending use context7 to a prompt. ctx7 setup installs a skill that fires on library questions automatically; if you configured things manually, add the rule yourself — Cursor Settings then Rules, or CLAUDE.md for Claude Code. This is the single change that moves Context7 from a thing you remember to a thing that works.

    CLAUDE.md
    Always use Context7 when I need library/API documentation, code generation,
    setup or configuration steps without me having to explicitly ask.
  5. 5.Name the library ID when you already know it

    Every question otherwise costs two calls: resolve-library-id to turn a name into an ID, then query-docs against that ID. Naming the ID in the prompt skips the first one. IDs look like /vercel/next.js, /supabase/supabase or /mongodb/docs. Versions work the same way — mention the version in the sentence and Context7 matches it, which is the entire point of the product.

    prompt
    Implement basic authentication with Supabase.
    use library /supabase/supabase for API and docs.
  6. 6.Ask one concept per query

    A deliberate constraint rather than a style preference. The 3.2.3 release rewrote the query-docs description to tell callers to make a separate query per concept, because combining distinct topics in one query returns diluted, shallow results — the retrieval is a vector search, so a query spanning two subjects matches the middle of neither. The server also caps itself at three tool calls per question to stop an agent grinding through your context window.

    shell
    # instead of one query spanning both
    ctx7 docs /vercel/next.js "route handlers"
    ctx7 docs /vercel/next.js "middleware matcher config"

What it can do

Two MCP tools, and the small surface is the design. Both are read-only and carry the readOnlyHint annotation, so a client that surfaces tool safety will show them as non-destructive.

resolve-library-id

Turns a plain library name into a Context7 ID. Requires both libraryName and query — the query is not decoration, it is what ranks and deduplicates the candidate libraries by what you are actually trying to do.

query-docs

Fetches documentation for an exact library ID. Takes libraryId and query. This is the tool that replaced get-library-docs in v2.0.0, along with the rename of context7CompatibleLibraryID to libraryId.

ctx7 library (CLI)

The CLI equivalent of resolve-library-id — searches the index by name and returns matching libraries with their IDs.

ctx7 docs (CLI)

The CLI equivalent of query-docs. Same retrieval, invoked as a shell command, which is how the skill mode avoids loading tool schemas into every request.

What people use it for

Stop the model writing config for a version you are not running

How do I set up Next.js 14 middleware? use context7

Version matching is the thing Context7 does that a web search in the loop does not. Naming the version in the sentence is the whole interface — there is no version parameter to pass.

Pin the library when the name is ambiguous

Implement row level security policies. use library /supabase/supabase for API and docs.

Skips resolve-library-id entirely, which halves the calls and removes the chance of the resolver picking a fork, a mirror or a similarly named package.

Get real examples for a library released after the model was trained

Configure a Cloudflare Worker script to cache JSON API responses for five minutes. use context7

This is the failure mode Context7 exists for: the model has a confident answer from year-old training data and no way to know it is stale. The docs arrive before the code is written rather than after it fails.

Which one should you use?

Context7 is a context source rather than a tool that does something to your project, so the real comparison is against the other ways docs reach the model.

A web search or fetch tool

When you need something that is not a library — a changelog thread, an issue, a blog post. Context7 wins on library documentation specifically because it is version-aware and returns ranked snippets rather than a page you then have to pay to read into context.

The library docs in your repo or an AGENTS.md

For anything about your own code and conventions. Context7 knows nothing about your project — it answers "how does this library work", never "how do we use it here". The two are complements, not alternatives.

Serena MCP

When the missing context is your own codebase rather than a dependency. Serena gives symbol-level retrieval over your project; Context7 gives version-matched documentation for what your project imports.

GitHub MCP Server

When you want the repository itself — issues, pull requests, file contents, CI. Reading a library's source through GitHub answers documentation questions too, at considerably more tokens and with no version resolution.

Every command, environment variable, and endpoint above was read from the project’s own documentation on 2026-08-15: upstash/context7 README, Same repo — packages/mcp/CHANGELOG.md, npm — @upstash/context7-mcp, npm — ctx7 CLI.

Browse all MCP server setup guides.

Frequently Asked Questions

Why does get-library-docs not work in Context7?
Because it was removed. v2.0.0, published 2025-12-29, deleted get-library-docs and replaced it with query-docs; the same release made query required on resolve-library-id and renamed the context7CompatibleLibraryID parameter to libraryId. The name survives because it is baked into rule templates, blog posts and client config snippets — including the README shipped with the current npm package, 4.0.2, which still lists it in a GitHub Copilot config block. If your agent is calling get-library-docs, the fix is in your rule file, not in your setup.
Do I need an API key for Context7?
No, but you want one. Anonymous use works; the free key from context7.com/dashboard buys higher rate limits. What happens when you cross the anonymous per-IP threshold is unusually well handled — since 3.2.0 the backend signals it with an X-Context7-Auth-Prompt header and the MCP server raises an elicitation/create request, so a client that supports elicitation prompts you to sign in instead of appending nag text into the tool result or failing.
Should I use Context7 as an MCP server or as a CLI skill?
The CLI plus Skills mode is the better default on a coding agent that has shell access, because nothing is loaded into context until the agent decides to fetch docs — no tool schemas in every request. MCP mode is right when the client cannot run shell commands, when you want the tools listed in the client UI, or when several clients should share one configured endpoint. ctx7 setup asks you which one you want, and npx ctx7 remove reverses whichever it installed.
Can I self-host Context7?
Not meaningfully. The public repository contains the MCP server, the CLI and the SDKs; the API backend, the parsing engine and the crawling engine are private. So running the open-source part still points at Upstash infrastructure at mcp.context7.com. There is a developer guide for running the MCP server locally, but local here means the protocol layer, not the index.
How accurate is Context7 documentation?
Upstash is direct about this: the indexed projects are community-contributed, maintained by their owners rather than by Context7, and accuracy, completeness and security are not guaranteed. Every project page carries a Report button for suspicious or harmful content. In practice this means Context7 is much better than the model guessing and is not a substitute for the official docs on anything security-sensitive — check the source when the answer touches auth, permissions or key handling.
Why do I get Invalid input: expected string, received undefined?
An argument-name mismatch, usually from a model echoing phrasing out of the tool description rather than the schema. The server now ships a compatibility shim for exactly this: userQuery and question are rewritten to query on either tool, and context7CompatibleLibraryID, libraryID and libraryName are rewritten to libraryId on query-docs. The published schemas are unchanged, so the canonical names are still what tools/list advertises — if you are seeing this error, you are on a build older than that shim.
Why do my Context7 requests hang or return 503?
Both were real, both are fixed, and both are worth knowing if you have pinned a version. 4.0.1 stopped forcing SSE on every response — that had pushed concurrent upstream streams from about ten to over five thousand and exhausted the gateway pool, returning 503 reset reason: overflow. 4.0.2 then added a 60-second timeout to the backend calls, where previously a stalled call rode undici's roughly 300-second default, and disabled SSE keepalives so hung exchanges can be reaped by proxy idle timeouts. Upgrade rather than diagnose.
Does Context7 work behind a corporate proxy?
From 3.2.5 onward, yes. Earlier versions bundled undici 6, and on Node 26 and above its setGlobalDispatcher wrote a global-dispatcher symbol the built-in fetch no longer reads — so HTTPS_PROXY and custom CA settings were silently ignored and requests failed with ENOTFOUND behind CONNECT proxies. undici 7 writes both symbols and restores proxy and CA support. That release is also what raised the floor to Node 20.18.1. Separately, 3.2.2 added validation of Enterprise-Managed Auth tokens so clients can authenticate through an enterprise IdP such as Okta.
What is Context7 MCP Server?
Context7 is an MCP server built by Upstash. Context7 is Upstash's documentation-retrieval MCP server, and it exists to solve one specific failure mode: a coding model answering from year-old training data, inventing APIs that were never shipped, or writing config for a package version you are not running. Instead of guessing, the agent calls Context7 and gets version-specific documentation and code examples pulled from the library's own source, injected straight into the prompt. In practice you append "use context7" to a request — "Create a Next.js middleware that checks for a valid JWT in cookies and redirects unauthenticated users to /login. use context7" — and the docs arrive before the code is written. The MCP surface is deliberately two tools. `resolve-library-id` turns a plain library name into a Context7-compatible ID, taking both a `libraryName` and the user's actual `query` so results can be ranked by relevance rather than string match. `query-docs` then fetches documentation for an exact ID such as `/vercel/next.js` or `/mongodb/docs`. You can skip the resolve step entirely by naming the ID in your prompt ("use library /supabase/supabase for API and docs"), and you can pin a version just by mentioning it ("How do I set up Next.js 14 middleware?"). Setup is a single command, `npx ctx7 setup`, which authenticates over OAuth, generates an API key and installs the integration; `--cursor`, `--claude` and `--opencode` target a specific agent, and `npx ctx7 remove` reverses it. Notably it ships in two modes: classic MCP, or a CLI-plus-Skills mode where the agent shells out to `ctx7 library` and `ctx7 docs` commands with no MCP server at all. To wire it manually, point your client at the hosted endpoint `https://mcp.context7.com/mcp` and pass your key as an `Authorization: Bearer` header — a free key from context7.com/dashboard mainly buys higher rate limits. Two honest caveats from Upstash's own README: the indexed library docs are community-contributed, so accuracy is not guaranteed and pages carry a Report button; and the public repo holds only the MCP server, while the API backend, parsing engine and crawling engine are private. Companion packages include the `ctx7` CLI, `@upstash/context7-sdk`, and Vercel AI SDK tool bindings.
Who built Context7 MCP Server?
Context7 MCP Server was built by Upstash.
Is Context7 MCP Server free?
Yes, Context7 MCP Server has a free option. This MCP server is free and open-source. Check the GitHub repository for details.
How do I install Context7 MCP Server?
Install Context7 MCP Server with npm: npx ctx7 setup
What does Context7 MCP Server integrate with?
Context7 MCP Server integrates with Claude Desktop, Cursor, VS Code, Windsurf, Cline, Zed, Continue.

Repo Health

Local install

Local/stdio install — runs on your machine, so there is no remote endpoint to verify live. Trust signal below is from the source repo.

Repo recency not yet available for this server.

Quick Info

Install Type
npm
Author
Upstash
Categories
3
Integrations
7

Related Servers

💻

Everything

Reference/test server with prompts, resources, and tools. Perfect for testing MCP implementations.

Local
💻

Git

Tools to read, search, and manipulate Git repositories. Full Git operations support.

Local
🧠

Memory

Knowledge graph-based persistent memory system. Store and retrieve contextual information.

Local
🤖

Sequential Thinking MCP Server

a single structured-reasoning tool that lets a model plan, revise and branch its own chain of thought instead of answering in one shot. Published by Anthropic as part of the official modelcontextprotocol/servers monorepo (89,000+ stars, actively maintained), it exposes exactly one tool — sequential_thinking — and that tool is the whole product. Each call carries a `thought` string plus bookkeeping fields: `thoughtNumber`, `totalThoughts`, and `nextThoughtNeeded`, which the model flips to false when it is done. The interesting fields are the optional ones. `isRevision` and `revisesThought` let the model go back and correct an earlier step rather than plowing ahead on a bad assumption; `branchFromThought` and `branchId` let it fork into an alternative line of reasoning and carry both forward; `needsMoreThoughts` lets it extend past its own original estimate when a problem turns out to be deeper than it looked. In practice you never call the tool by hand. You connect the server to an MCP host and ask a question that deserves more than one pass — plan a PostgreSQL 14 to 16 migration and revise if downtime exceeds five minutes, work out why a deploy only fails in production, compare three architectures and branch when an assumption breaks. You can tell it is working when the host inspector shows repeated sequential_thinking calls with a rising `thoughtNumber` rather than a single response. Install with `npx -y @modelcontextprotocol/server-sequential-thinking` — note the hyphenated package name, which differs from both the `sequentialthinking` directory in the repo and the Docker image `mcp/sequentialthinking`, a mismatch that breaks a lot of copied configs. A Docker image is published alongside the npm package, and the README carries one-click VS Code install buttons for both transports. Set `DISABLE_THOUGHT_LOGGING=true` if you do not want every thought written to the server log.

Local
💻

21st.dev Magic

Create crafted UI components inspired by the best 21st.dev design engineers.

Local

Sponsored

Better Stack

Free Plan

Get alerted when your APIs, browser tests, payment pipelines, or MCP server dependencies go down. Used by 100K+ developers.

Start monitoring free →