Skip to main content
AgentsUse

MCP server, by Upstash

Context7 MCP Server

Context7 MCP server that injects current, version-specific documentation and code examples into the model prompt.

Streamable HTTP (remote)Checked 2026-11-03Config checked

Quick facts

Transport
Streamable HTTP (remote)
Runs as
remote (@upstash/context7-mcp)
Review state
Config checked against the official source on 2026-11-03; not locally tested by AgentsUse.

What it does

Context7 supplies current, version-specific library documentation and code examples to a coding agent. The README describes the problem as models relying on outdated or generic information, which produces year-old examples, hallucinated APIs and answers for old package versions. Context7 retrieves documentation and examples straight from the source and puts them in the agent's context at query time. Typical prompts add use context7, or name a library ID directly, for example use library /supabase/supabase.

It works in two modes. CLI plus Skills installs a skill that guides the agent to fetch documentation with ctx7 commands, with no MCP required. MCP mode registers the Context7 MCP server so the agent calls the tools natively. The command npx ctx7 setup authenticates through OAuth, generates an API key and installs the skill; the README says the ctx7 CLI requires Node.js 22.13 or newer, and the Context7 troubleshooting page lists Node.js v20 or higher for the MCP package. Flags such as --cursor, --claude and --opencode target a specific agent, and npx ctx7 remove undoes the setup.

The MCP server has two tools. resolve-library-id takes a required libraryName and a required query, which ranks results by relevance, and returns a Context7-compatible library ID. query-docs takes a required libraryId such as /mongodb/docs or /vercel/next.js, a required query describing the question or task, and an optional language used to rank code examples in that language first. The CLI equivalents are ctx7 library and ctx7 docs. If you already know the library, give its ID in the prompt so Context7 can skip the matching step, and mention a version in the prompt, such as Next.js 16, to have it match that version.

Configuration for a remote client uses the server URL https://mcp.context7.com/mcp and the Authorization: Bearer YOUR_API_KEY header. The README recommends a free API key from context7.com/dashboard for higher rate limits. The Context7 documentation also describes running the server locally with --transport (stdio by default, or http), --port (default 3000) and --api-key, and a CONTEXT7_API_KEY environment variable, with the flag taking precedence. Its HTTP mode requires a credential on every request by default and is stateless, so a GET or DELETE on /mcp returns 405.

The troubleshooting page lists the failure modes. Rate limit errors are answered by adding an API key. A 401 Unauthorized means checking that the key is correct and starts with ctx7sk, and that the header or argument format matches the transport. ERR_MODULE_NOT_FOUND can be worked around with bunx or deno in place of npx, and request timeouts on Windows or macOS can be worked around by using the full path to Node.js and the installed package. Connectivity can be checked with curl https://mcp.context7.com/ping, and debug logs are enabled with DEBUG=*.

Configuration

Set up with npx ctx7 setup on Node.js 18 or newer. Setup authenticates via OAuth, generates an API key, and installs the skill in CLI plus Skills or MCP mode. For manual MCP configuration, use the server URL https://mcp.context7.com/mcp and pass the API key in the Authorization: Bearer YOUR_API_KEY header.

MCP config (placeholders)
{"mcpServers":{"context7":{"type":"streamable-http","url":"https://mcp.context7.com/mcp","headers":{"Authorization":"Bearer YOUR_API_KEY"}}}}

Source: https://github.com/upstash/context7. Placeholders only. Replace them in your own environment, and never commit real keys to a repository.

The official documentation lists no required environment variables.

Tools and features on record

  • resolve-library-id Config checked

    Resolves a library name into a Context7-compatible ID. Inputs: libraryName (required) and query (required, used to rank results by relevance).

  • query-docs Config checked

    Retrieves documentation for an exact library ID such as /mongodb/docs or /vercel/next.js. Inputs: libraryId (required), query (required) and language (optional, ranks code examples in that language first).

  • ctx7 library Config checked

    CLI command that searches the Context7 index by library name and returns matching libraries with their IDs.

  • ctx7 docs Config checked

    CLI command that retrieves documentation for a library by its Context7-compatible ID and a query.

  • npx ctx7 setup Config checked

    Authenticates through OAuth, generates an API key and installs the skill in CLI plus Skills or MCP mode. Target an agent with --cursor, --claude or --opencode. Remove with npx ctx7 remove.

  • Library IDs and versions Config checked

    Name a library ID in the prompt, such as /supabase/supabase, to skip matching. Mention a version in the prompt to get documentation matched to it.

  • Rules and skills Config checked

    A rule in CLAUDE.md or Cursor Settings can make the agent use Context7 for library documentation without being asked.

  • Local server flags Config checked

    --transport (stdio or http), --port (default 3000) and --api-key, with CONTEXT7_API_KEY as an environment variable. The flag takes precedence over the variable.

Security notes

Security notes
  • The README states that Context7 projects are community-contributed, and that accuracy, completeness and security of library documentation cannot be guaranteed. Projects are maintained by their owners, not by Context7. A Report button on a project page lets you flag suspicious or harmful content.
  • Retrieved documentation goes straight into the model context. Documentation text is third-party content and can contain instructions aimed at the model, so keep high-impact tools such as shell or deployment access behind your client's approval prompts.
  • The README states that this repository hosts the MCP server's source code, while the API backend, parsing engine and crawling engine are private. The documentation retrieval itself is a hosted service, so queries are sent to Context7.
  • Your queries, which may describe your code, are sent to the hosted service when you use the remote server. Keep proprietary details out of the query text.
  • An API key is passed in the Authorization Bearer header for remote use or --api-key for stdio. Keep real keys out of repositories. The development guide documents CONTEXT7_API_KEY as an environment variable alternative.
  • If you run the HTTP transport yourself, the documentation says it requires a credential on every request by default, and that MCP_AUTH_ENFORCEMENT=observe accepts requests without credentials on /mcp. Leave the default unless you control the network.
  • npx ctx7 setup writes a skill and an API key into your agent's setup. Review what it installs, and use npx ctx7 remove to take it out.

An MCP server runs with the permissions of the process you start it from. Scope credentials to the narrowest access the job needs, and review what the client will send before connecting anything sensitive.

Stacks featuring this server

Sources and freshness

Checked 2026-11-03. Config-checked means the configuration and feature list trace to the official source above; it does not mean AgentsUse ran the server. Send corrections through the contact page. Back to the MCP server index.