context7-mcp
upstash/context7
Fetch current documentation for libraries and frameworks instead of relying on training data.
What is context7-mcp?
Context7 is a documentation lookup skill that retrieves current API references, setup guides, and code examples for popular libraries and frameworks like React, Next.js, Prisma, and Supabase. Use it when answering questions about library setup, configuration, API methods, or code generation to ensure accuracy with the latest versions.
- Resolves library names to their Context7 documentation IDs
- Fetches current documentation for specific concepts within libraries
- Supports version-specific lookups when users mention particular versions
- Returns relevant code examples from official documentation
- Handles multi-concept questions by splitting into separate targeted queries
How to install context7-mcp
npx skills add https://github.com/upstash/context7 --skill context7-mcpHow to use context7-mcp
- 1.When a user asks about a library or framework, extract the library name and what they want to know
- 2.Call resolve-library-id with the library name and a brief query to find the correct documentation ID
- 3.Select the best match from results, preferring exact names and higher benchmark scores
- 4.Call query-docs with the library ID and a specific concept to look up
- 5.If the question covers multiple distinct concepts, make separate query-docs calls for each
- 6.Incorporate the fetched documentation and code examples into your response, citing the library version when relevant
Use cases
- User asks 'How do I configure Next.js middleware?' — fetch Next.js docs for middleware configuration
- User requests 'Write a Prisma query to find users with posts' — fetch Prisma docs for query syntax
- User asks 'What are the Supabase authentication methods?' — fetch Supabase docs for auth API
- User mentions 'React 19 hooks' — resolve and fetch React 19-specific documentation
- User needs setup help for a framework they're unfamiliar with
- Frontend developers working with React, Vue, Svelte, or similar frameworks
- Full-stack developers using Next.js, Express, or other backend frameworks
- Developers integrating databases like Prisma or Supabase
- Anyone needing current API references or code examples for popular libraries
context7-mcp FAQ
Split multi-topic questions into separate query-docs calls per concept (e.g., routing and auth as two calls) unless the question is about how the concepts interact. Combined queries dilute ranking and return shallow results.
When users mention a version (e.g., 'React 19' or 'Next.js 15'), use the version-specific library ID from the resolve-library-id results if available.
Prefer official or primary packages over community forks. Choose based on exact name match, higher benchmark scores, and relevance to the user's question.
Yes, the skill works with any library that has documentation in Context7. Use resolve-library-id to find the correct ID for any library name.
Yes, include the library version and cite the documentation when relevant to help users understand the context and currency of the information.
Full instructions (SKILL.md)
Source of truth, from upstash/context7.
name: context7-mcp description: This skill should be used when the user asks about libraries, frameworks, API references, or needs code examples. Activates for setup questions, code generation involving libraries, or mentions of specific frameworks like React, Vue, Next.js, Prisma, Supabase, etc.
When the user asks about libraries, frameworks, or needs code examples, use Context7 to fetch current documentation instead of relying on training data.
When to Use This Skill
Activate this skill when the user:
- Asks setup or configuration questions ("How do I configure Next.js middleware?")
- Requests code involving libraries ("Write a Prisma query for...")
- Needs API references ("What are the Supabase auth methods?")
- Mentions specific frameworks (React, Vue, Svelte, Express, Tailwind, etc.)
How to Fetch Documentation
Step 1: Resolve the Library ID
Call resolve-library-id with:
libraryName: The library name extracted from the user's questionquery: What to look up in the library's documentation (improves relevance ranking)
Step 2: Select the Best Match
From the resolution results, choose based on:
- Exact or closest name match to what the user asked for
- Higher benchmark scores indicate better documentation quality
- If the user mentioned a version (e.g., "React 19"), prefer version-specific IDs
Step 3: Fetch the Documentation
Call query-docs with:
libraryId: The selected Context7 library ID (e.g.,/vercel/next.js)query: What to look up in the library's documentation, scoped to a single concept
If the user's question spans multiple distinct concepts (e.g. routing and auth and caching), make a separate query-docs call per concept with the same library ID, unless the question is about how the concepts interact — combined queries dilute ranking and return shallow results for each topic.
Step 4: Use the Documentation
Incorporate the fetched documentation into your response:
- Answer the user's question using current, accurate information
- Include relevant code examples from the docs
- Cite the library version when relevant
Guidelines
- Be specific: Describe what to look up in the library's documentation, but keep each query to a single concept
- One topic per query: Split multi-topic questions into separate
query-docscalls — resolve the library ID once, then query per concept, unless the question is about how the concepts interact - Version awareness: When users mention versions ("Next.js 15", "React 19"), use version-specific library IDs if available from the resolution step
- Prefer official sources: When multiple matches exist, prefer official/primary packages over community forks
Related skills
More from upstash/context7 and the wider catalog.

documentation-lookup
Fetch current documentation for libraries and frameworks instead of relying on training data.

find-docs
Retrieve current documentation, API references, and code examples for any developer library or framework.

context7-cli
CLI for fetching library docs, managing AI coding skills, and configuring Context7 MCP.

upstash
Serverless Redis, queues, rate limiting, vector DB, file storage, and sandboxed containers—all Upstash products in one skill.

upstash-qstash-js
HTTP-based message queue and task scheduler for serverless and edge runtimes.

upstash-ratelimit-js
Rate limiting for serverless and edge apps using Upstash Redis and TypeScript/JavaScript.