Up-to-date code docs for any prompt. This MCP server exposes the Context7 platform’s capabilities, focusing on prompt-driven code documentation workflows and MCP-style interactions. It serves as a practical example for developers integrating an MCP server with topics around LLM, MCP, and vibe-coding.
🛠️ Key Features
Context7 MCP server with up-to-date code docs for prompts
Topics: llm, mcp, mcp-server, vibe-coding
Readme excerpt provides installation and quick reference hints
🚀 Use Cases
Serving dynamic, prompt-based documentation for codebases
Integrating with MCP clients to fetch up-to-date docs
Demonstrating MCP server capabilities in tutorials or catalogs
⚡ Developer Benefits
Grounded in real MCP server data and readme snippets
Clear topic tagging facilitates SEO and discoverability
Lightweight, example-driven description for catalog pages
⚠️ Limitations
Readme excerpt is partial; ensure full source review for exact commands
Server data provided as a snapshot; verify current version offline
Topics
llmmcpmcp-servervibe-coding
Captured live from the server via tools/list.
resolve-library-id
Resolves a package/product name to a Context7-compatible library ID and returns matching libraries.
You MUST call this function before 'Query Documentation' tool to obtain a valid Context7-compatible library ID UNLESS the user explicitly provides a library ID in the format '/org/project' or '/org/project/version' in their query.
Each result includes:
- Library ID: Context7-compatible identifier (format: /org/project)
- Name: Library or package name
- Description: Short summary
- Code Snippets: Number of available code examples
- Source Reputation: Authority indicator (High, Medium, Low, or Unknown)
- Benchmark Score: Quality indicator (100 is the highest score)
- Versions: List of versions if available. Use one of those versions if the user provides a version in their query. The format of the version is /org/project/version.
For best results, select libraries based on name match, source reputation, snippet coverage, benchmark score, and relevance to your use case.
Selection Process:
1. Analyze the query to understand what library/package the user is looking for
2. Return the most relevant match based on:
- Name similarity to the query (exact matches prioritized)
- Description relevance to the query's intent
- Documentation coverage (prioritize libraries with higher Code Snippet counts)
- Source reputation (consider libraries with High or Medium reputation more authoritative)
- Benchmark Score: Quality indicator (100 is the highest score)
Response Format:
- Return the selected library ID in a clearly marked section
- Provide a brief explanation for why this library was chosen
- If multiple good matches exist, acknowledge this but proceed with the most relevant one
- If no good matches exist, clearly state this and suggest query refinements
For ambiguous queries, request clarification before proceeding with a best-guess match.
IMPORTANT: Do not call this tool more than 3 times per question. If you cannot find what you need after 3 calls, use the best result you have.
Parameters2
query
string
required
What to look up in the library's documentation. This is used to rank library results by relevance to what the user is trying to accomplish. The query is sent to the Context7 API for processing. Do not include any sensitive or confidential information such as API keys, passwords, credentials, personal data, or proprietary code in your query.
libraryName
string
required
Library name to search for and retrieve a Context7-compatible library ID. Use the official library name with proper punctuation — e.g., 'Next.js' instead of 'nextjs', 'Customer.io' instead of 'customerio', 'Three.js' instead of 'threejs'.
Raw schema
{
"type": "object",
"properties": {
"query": {
"type": "string",
"description": "What to look up in the library's documentation. This is used to rank library results by relevance to what the user is trying to accomplish. The query is sent to the Context7 API for processing. Do not include any sensitive or confidential information such as API keys, passwords, credentials, personal data, or proprietary code in your query."
},
"libraryName": {
"type": "string",
"description": "Library name to search for and retrieve a Context7-compatible library ID. Use the official library name with proper punctuation — e.g., 'Next.js' instead of 'nextjs', 'Customer.io' instead of 'customerio', 'Three.js' instead of 'threejs'."
}
},
"required": [
"query",
"libraryName"
],
"$schema": "https://json-schema.org/draft/2020-12/schema"
}
query-docs
Retrieves and queries up-to-date documentation and code examples from Context7 for any programming library or framework.
You must call 'Resolve Context7 Library ID' tool first to obtain the exact Context7-compatible library ID required to use this tool, UNLESS the user explicitly provides a library ID in the format '/org/project' or '/org/project/version' in their query.
Do not call this tool more than 3 times per question.
Parameters2
libraryId
string
required
Exact Context7-compatible library ID (e.g., '/mongodb/docs', '/vercel/next.js', '/supabase/supabase', '/vercel/next.js/v14.3.0-canary.87') retrieved from 'resolve-library-id' or directly from user query in the format '/org/project' or '/org/project/version'.
query
string
required
What to look up in the library's documentation, scoped to a single concept. Be specific and include relevant details, but keep each query to one topic — if the user's question spans multiple distinct concepts, make a separate call per concept instead of combining them, unless the question is about how the concepts interact. Good: 'How to set up authentication with JWT in Express.js' or 'React useEffect cleanup function examples'. Bad (too vague): 'auth' or 'hooks'. Bad (too broad): 'routing and auth and caching in Next.js'. The query is sent to the Context7 API for processing. Do not include any sensitive or confidential information such as API keys, passwords, credentials, personal data, or proprietary code in your query.
Raw schema
{
"type": "object",
"properties": {
"libraryId": {
"type": "string",
"description": "Exact Context7-compatible library ID (e.g., '/mongodb/docs', '/vercel/next.js', '/supabase/supabase', '/vercel/next.js/v14.3.0-canary.87') retrieved from 'resolve-library-id' or directly from user query in the format '/org/project' or '/org/project/version'."
},
"query": {
"type": "string",
"description": "What to look up in the library's documentation, scoped to a single concept. Be specific and include relevant details, but keep each query to one topic — if the user's question spans multiple distinct concepts, make a separate call per concept instead of combining them, unless the question is about how the concepts interact. Good: 'How to set up authentication with JWT in Express.js' or 'React useEffect cleanup function examples'. Bad (too vague): 'auth' or 'hooks'. Bad (too broad): 'routing and auth and caching in Next.js'. The query is sent to the Context7 API for processing. Do not include any sensitive or confidential information such as API keys, passwords, credentials, personal data, or proprietary code in your query."
}
},
"required": [
"libraryId",
"query"
],
"$schema": "https://json-schema.org/draft/2020-12/schema"
}
LLMs rely on outdated or generic information about the libraries you use. You get:
❌ Code examples are outdated and based on year-old training data
❌ Hallucinated APIs that don't even exist
❌ Generic answers for old package versions
✅ With Context7
Context7 pulls up-to-date, version-specific documentation and code examples straight from the source — and places them directly into your prompt.
txt
Create a Next.js middleware that checks for a valid JWT in cookies
and redirects unauthenticated users to `/login`. use context7
txt
Configure a Cloudflare Worker script to cache
JSON API responses for five minutes. use context7
txt
Show me the Supabase auth API for email/password sign-up.
Context7 fetches up-to-date code examples and documentation right into your LLM's context. No tab-switching, no hallucinated APIs that don't exist, no outdated code generation.
Works in two modes:
CLI + Skills — installs a skill that guides your agent to fetch docs using ctx7 CLI commands (no MCP required)
MCP — registers a Context7 MCP server so your agent can call documentation tools natively
Installation
NOTE
API Key Recommended: Get a free API key at context7.com/dashboard for higher rate limits.
Set up Context7 for your coding agents with a single command. The ctx7 CLI requires Node.js 18 or newer.
bash
npx ctx7 setup
Authenticates via OAuth, generates an API key, and installs the appropriate skill. You can choose between CLI + Skills or MCP mode. Use --cursor, --claude, or --opencode to target a specific agent.
To remove the generated setup later, run npx ctx7 remove. If you globally installed the CLI with npm install -g ctx7, remove that package separately with npm uninstall -g ctx7.
To configure manually, use the Context7 server URL https://mcp.context7.com/mcp with your MCP client and pass your API key via the Authorization: Bearer YOUR_API_KEY header. See the link below for client-specific setup instructions.
If you already know exactly which library you want to use, add its Context7 ID to your prompt. That way, Context7 can skip the library-matching step and directly retrieve docs.
txt
Implement basic authentication with Supabase. use library /supabase/supabase for API and docs.
The slash syntax tells Context7 exactly which library to load docs for.
Specify a Version
To get documentation for a specific library version, just mention the version in your prompt:
txt
How do I set up Next.js 14 middleware? use context7
Context7 will automatically match the appropriate version.
Add a Rule
If you installed via ctx7 setup, a skill is configured automatically that triggers Context7 for library-related questions. To set up a rule manually instead, add one to your coding agent:
Cursor: Cursor Settings > Rules
Claude Code: CLAUDE.md
Or the equivalent in your coding agent
Example rule:
txt
Always use Context7 when I need library/API documentation, code generation, setup or configuration steps without me having to explicitly ask.
Available Tools
CLI Commands
ctx7 library <name> <query>: Searches the Context7 index by library name and returns matching libraries with their IDs.
ctx7 docs <libraryId> <query>: Retrieves documentation for a library using a Context7-compatible library ID (e.g., /mongodb/docs, /vercel/next.js).
MCP Tools
resolve-library-id: Resolves a general library name into a Context7-compatible library ID.
query (required): The user's question or task (used to rank results by relevance)
libraryName (required): The name of the library to search for
query-docs: Retrieves documentation for a library using a Context7-compatible library ID.
libraryId (required): Exact Context7-compatible library ID (e.g., /mongodb/docs, /vercel/next.js)
query (required): The question or task to get relevant documentation for
1- Context7 projects are community-contributed and while we strive to maintain high quality, we cannot guarantee the accuracy, completeness, or security of all library documentation. Projects listed in Context7 are developed and maintained by their respective owners, not by Context7. If you encounter any suspicious, inappropriate, or potentially harmful content, please use the "Report" button on the project page to notify us immediately. We take all reports seriously and will review flagged content promptly to maintain the integrity and safety of our platform. By using Context7, you acknowledge that you do so at your own discretion and risk.
2- This repository hosts the MCP server’s source code. The supporting components — API backend, parsing engine, and crawling engine — are private and not part of this repository.