Context7 MCP server
Current, version-specific library docs and code examples for AI coding assistants over MCP; keyless use or an optional API key.
Developer toolsGuided#mcp#documentation#code-examples#ai-agents#upstash
Fork copies the collection into your workspace, without the publisher's secrets, so you can add your own key and send requests. Star saves it to your starred APIs (Account › Marketplace) and helps others find it.
Overview
Context7 (by Upstash) serves current, version-specific documentation and code examples for thousands of libraries, frameworks and SDKs to AI coding assistants, so they stop writing code against APIs that changed after their training. Its remote MCP server at https://mcp.context7.com/mcp exposes two tools: find a library's Context7 ID, then ask that library's docs a focused question. It works without a key at lower limits; a free account and API key raise them.
- Endpoint (Streamable HTTP):
https://mcp.context7.com/mcp; OAuth variant:https://mcp.context7.com/mcp/oauth - Auth: optional
Authorization: Bearer <API key>(keys look likectx7sk-...) - Protocol: answers
server/discover(2026-07-28) and the older initialize handshake; no session id. The server has no prompts or resources.
Tools (checked live with tools/list on 2026-11-18)
| Tool | What it does | Arguments |
|---|---|---|
resolve-library-id | Finds Context7 library IDs for a library name, ranked for your task; lists versions | libraryName, query (both required) |
query-docs | Returns documentation snippets and code examples for one library ID and one question | libraryId (/org/project or /org/project/version), query (required); language (optional) |
The server asks models to call resolve first (unless the user gave an ID) and to stop after about three calls per question.
Add it to your AI client
Claude Code (terminal; add --scope user to use it in every project):
claude mcp add --transport http context7 https://mcp.context7.com/mcpClaude Desktop / claude.ai: Settings > Connectors > Add custom connector, then enter a name and the URL https://mcp.context7.com/mcp. Custom connectors cannot send a header, so use the /mcp/oauth URL there if you want your account's limits.
Cursor: add to ~/.cursor/mcp.json (or .cursor/mcp.json in a project):
{
"mcpServers": {
"context7": {
"url": "https://mcp.context7.com/mcp"
}
}
}VS Code (GitHub Copilot agent mode): add to .vscode/mcp.json:
{
"servers": {
"context7": {
"type": "http",
"url": "https://mcp.context7.com/mcp"
}
}
}With an API key, add the header to the snippets: Claude Code --header "Authorization: Bearer YOUR_API_KEY"; Cursor and VS Code "headers": {"Authorization": "Bearer YOUR_API_KEY"}. Clients that support MCP OAuth can use https://mcp.context7.com/mcp/oauth instead and sign in in the browser, no key to copy. Context7 also ships a setup CLI (npx ctx7 setup) that configures supported agents for you.
Credentials (optional)
- Sign in at https://context7.com and open the dashboard: https://context7.com/dashboard?tab=settings
- In the API Keys card, click Create API Key, name it, and leave Write access off (only needed for the admin API).
- Copy the key at once (it is shown one time) into
context7ApiKey. The collection sends it asAuthorization: Bearer; leave it empty to stay anonymous.
Run order
- Start here: resolve Next.js, query its docs, then query a pinned version.
- More examples: Express and FastAPI.
- Plain HTTP: server/discover, tools/list and a tools/call as raw JSON-RPC.
Limits
Anonymous use is rate-limited. The Free plan includes a monthly allowance of calls (with a small daily bonus after it runs out); paid plans add calls and private repositories. Current numbers: https://context7.com/plans
Common errors
| What you see | Meaning | What to do |
|---|---|---|
isError: true, "Invalid API key ... should start with 'ctx7sk'" | Key mistyped or revoked | Fix context7ApiKey or clear it to go anonymous |
isError: true, "Library ... not found" | Wrong or private library ID | Copy the exact ID from resolve-library-id |
isError: true, "Library X has been redirected to this library: Y" | The ID moved | Use the new ID from the message |
| Quota or rate-limit refusal | Anonymous or monthly limit reached | Add an API key, or wait for the next period |
| Off-topic snippets | Query mixes several topics or the name was misspelled | One concept per call; official names (Next.js, not nextjs) |
Links
- Context7 docs: https://context7.com/docs
- Client setup (all clients): https://context7.com/docs/resources/all-clients
- API keys: https://context7.com/docs/howto/api-keys
- Source: https://github.com/upstash/context7
Endpoints 10
1. Start here
- MCPFind a library ID (resolve-library-id)
{{mcpUrl}}Turns a library name into Context7 library IDs (format /org/project), ranked by how well they fit your task. Each match lists title, ID, description, number… - MCPQuery a library's docs (query-docs)
{{mcpUrl}}Fetches current documentation and code examples for one library ID and one focused question, with the source file of each snippet. Keep query to a single… - MCPQuery a specific version
{{mcpUrl}}The same query pinned to one release by adding the version to the ID (/vercel/next.js/v16.2.9); versions come from the resolve result. Use it when a project…
2. More examples
- MCPResolve: Express
{{mcpUrl}}Resolves a name that matches several libraries: Express itself and related packages such as express-rate-limit. Pick the ID whose description fits your task,… - MCPQuery: Express rate limiting
{{mcpUrl}}Asks the express-rate-limit library's docs how to limit requests per client on an Express app, including the options for window size and the store. A good… - MCPResolve: a Python library (FastAPI)
{{mcpUrl}}Resolves FastAPI to show Context7 covers Python as well as JavaScript. The result lists several IDs (the FastAPI website docs, its API reference, community… - MCPQuery: FastAPI dependencies
{{mcpUrl}}Asks FastAPI's docs for a dependency that opens and closes a database session per request, with language set to Python. The ID is the FastAPI website docs…
3. The same calls as plain HTTP
- POSTserver/discover (plain HTTP)
{{mcpUrl}}Plain HTTP version of what the native client does first on a 2026-07-28 server: one POST that returns supported protocol versions, capabilities, server name… - POSTtools/list (plain HTTP)
{{mcpUrl}}Lists the tools with their JSON Schema inputSchema in one stateless POST. Compare the names with the native requests above; if a server renames a tool, this… - POSTtools/call resolve-library-id (plain HTTP)
{{mcpUrl}}Calls resolve-library-id with a raw JSON-RPC body: params.name is the tool, params.arguments its input, _meta carries the protocol version and client info,…
API details
- Base URL
https://mcp.context7.com/mcp- Authentication
- A bearer token in the Authorization header
- Operations
- 10 operations on 10 pathsPOST 10
- Main resources
- 1. Start here 32. More examples 43. The same calls as plain HTTP 3
- Description format
- Swastik Codes guided collection, API version
checked against the docs on 2026-11-18 - Links
- Documentation
How to test the Context7 MCP server in Swastik Codes
- Open the APISelect “Fork & run in Swastik Codes” on this page. Sign in or create a free account if asked.
- Fork it into your workspaceChoose a workspace. You get your own copy of the Context7 MCP server collection, without the publisher's secrets.
- Add your credentialsThis API uses A bearer token in the Authorization header. Add yours in the collection's variables or an environment; the requests already reference it.
- Send a requestPick an endpoint, for example “Find a library ID (resolve-library-id)” (POST {{mcpUrl}}), and press Send. Check the response, add tests and run the whole collection with the runner.
Frequently asked questions
What is the Context7 MCP server?
Current, version-specific library docs and code examples for AI coding assistants over MCP; keyless use or an optional API key. It is listed under Developer tools and has 10 endpoints.
Who publishes the Context7 MCP server?
It is listed from Context7's public API description (an OpenAPI document), not published by Context7 on Swastik Codes. Anyone who controls context7.com can claim the profile by adding a DNS TXT record.
What is the base URL of the Context7 MCP server?
Requests go to https://mcp.context7.com/mcp. Endpoint paths are added to this base URL.
How do I authenticate with the Context7 MCP server?
With A bearer token in the Authorization header.
How many endpoints does the Context7 MCP server have?
10 operations on 10 paths (10 POST). The largest groups are 1. Start here, 2. More examples, 3. The same calls as plain HTTP.
Is forking the Context7 MCP server free?
Yes. Forking copies the collection into your workspace for free. It has been starred 0 times and forked 0 times.