Context7 MCP Server

Widget generated by MCP Showcase

Introduction

The Context7 MCP server, developed by Upstash, provides AI agents with access to up-to-date documentation and code examples for programming libraries and frameworks. Trusted by teams at companies like OpenAI, Netflix, Vercel, and Google, Context7 maintains a massive index of over 118,000 libraries to ensure AI coding assistants always work with current, accurate documentation.

The server exposes two complementary tools that work together in a streamlined workflow. The first tool, resolve-library-id, translates a plain-language library or package name into a Context7-compatible identifier, ranking matches by name similarity, source reputation, documentation coverage, and benchmark score.

The second tool, query-docs, retrieves targeted documentation and code snippets for a specific library concept using that identifier. Together, they eliminate outdated or hallucinated code by grounding AI responses in the latest official documentation, making it ideal for use in agents like Claude, Cursor, and Codex.

Use Cases

1. Resolving the correct library reference When you're unsure of the exact package name or need to find the authoritative source for a library, the resolve tool identifies the best-matching Context7 ID.

  • Sample prompt: Find the Context7 library ID for the Next.js framework by Vercel so I can pull its documentation.

2. Retrieving up-to-date framework documentation Fetch current documentation for a specific feature to avoid relying on the model's outdated training data.

  • Sample prompt: Get the latest Next.js App Router documentation and show me how to set up dynamic route segments with the /vercel/next.js library.

3. Getting accurate code examples for implementation Pull real, working code snippets scoped to a single concept to accelerate development.

  • Sample prompt: Show me current code examples for setting up authentication with JWT in Express.js using the official docs.

4. Version-specific documentation lookup Query documentation for a particular version of a library to match your project's dependencies.

  • Sample prompt: Retrieve the useEffect cleanup function documentation from React version 18 specifically.

5. Comparing libraries before adoption Use the resolve tool to compare multiple matching libraries by reputation, snippet coverage, and benchmark score before committing.

  • Sample prompt: Search for available ORM libraries for TypeScript and tell me which one has the best documentation coverage and source reputation.

6. Debugging with authoritative guidance Combine both tools to diagnose issues by consulting the official documentation for a specific behavior.

  • Sample prompt: I'm getting a hydration error in Next.js. Resolve the library and find the official docs on server-side rendering and hydration mismatches.

7. Learning a new library from scratch Fetch structured documentation to onboard quickly onto an unfamiliar technology.

  • Sample prompt: I'm new to Supabase. Find the library and get me the documentation on setting up row-level security policies.

8. Exploring integration between two concepts Query how two features of a library interact within a single, focused request.

  • Sample prompt: Using the Prisma docs, explain how migrations and the schema definition work together in a PostgreSQL setup.

Details

MCP Server URL:
https://mcp.context7.com/mcp
Type:
HTTP Stream
Authentication:
None

Tools

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.
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.

Want to create a similar playground for your MCP?