USP
Unlike relying on LLM training data, Context7 fetches real-time, version-aware documentation directly from source, ensuring your generated code and answers are always accurate and up-to-date, preventing common API hallucinations.
Use cases
- 01Fetching current API syntax and configuration options
- 02Generating code examples for specific library versions
- 03Debugging library-specific behavior and setup issues
- 04Migrating between library versions with accurate guidance
- 05Getting CLI tool usage instructions
Detected files (8)
skills/find-docs/SKILL.mdskillShow content (6326 bytes)
--- name: find-docs description: >- Retrieves up-to-date documentation, API references, and code examples for any developer technology. Use this skill whenever the user asks about a specific library, framework, SDK, CLI tool, or cloud service -- even for well-known ones like React, Next.js, Prisma, Express, Tailwind, Django, or Spring Boot. Your training data may not reflect recent API changes or version updates. Always use for: API syntax questions, configuration options, version migration issues, "how do I" questions mentioning a library name, debugging that involves library-specific behavior, setup instructions, and CLI tool usage. Use even when you think you know the answer -- do not rely on training data for API details, signatures, or configuration options as they are frequently outdated. Always verify against current docs. Prefer this over web search for library documentation and API details. --- # Documentation Lookup Retrieve current documentation and code examples for any library using the Context7 CLI. Make sure the CLI is up to date before running commands: ```bash npm install -g ctx7@latest ``` Or run directly without installing: ```bash npx ctx7@latest <command> ``` ## Workflow Two-step process: resolve the library name to an ID, then query docs with that ID. ```bash # Step 1: Resolve library ID ctx7 library <name> <query> # Step 2: Query documentation ctx7 docs <libraryId> <query> ``` You MUST call `ctx7 library` first to obtain a valid library ID UNLESS the user explicitly provides a library ID in the format `/org/project` or `/org/project/version`. IMPORTANT: Do not run these commands more than 3 times per question. If you cannot find what you need after 3 attempts, use the best result you have. ## Step 1: Resolve a Library Resolves a package/product name to a Context7-compatible library ID and returns matching libraries. ```bash ctx7 library react "How to clean up useEffect with async operations" ctx7 library nextjs "How to set up app router with middleware" ctx7 library prisma "How to define one-to-many relations with cascade delete" ``` Always pass a `query` argument — it is required and directly affects result ranking. Use the user's intent to form the query, which helps disambiguate when multiple libraries share a similar name. Do not include any sensitive or confidential information such as API keys, passwords, credentials, personal data, or proprietary code in your query. ### Result fields 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 is `/org/project/version`. ### Selection process 1. Analyze the query to understand what library/package the user is looking for 2. Select 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 (higher is better, 100 is the maximum) 3. If multiple good matches exist, acknowledge this but proceed with the most relevant one 4. If no good matches exist, clearly state this and suggest query refinements 5. For ambiguous queries, request clarification before proceeding with a best-guess match ### Version-specific IDs If the user mentions a specific version, use a version-specific library ID: ```bash # General (latest indexed) ctx7 docs /vercel/next.js "How to set up app router" # Version-specific ctx7 docs /vercel/next.js/v14.3.0-canary.87 "How to set up app router" ``` The available versions are listed in the `ctx7 library` output. Use the closest match to what the user specified. ## Step 2: Query Documentation Retrieves up-to-date documentation and code examples for the resolved library. ```bash ctx7 docs /facebook/react "How to clean up useEffect with async operations" ctx7 docs /vercel/next.js "How to add authentication middleware to app router" ctx7 docs /prisma/prisma "How to define one-to-many relations with cascade delete" ``` ### Writing good queries The query directly affects the quality of results. Be specific and include relevant details. Do not include any sensitive or confidential information such as API keys, passwords, credentials, personal data, or proprietary code in your query. | Quality | Example | |---------|---------| | Good | `"How to set up authentication with JWT in Express.js"` | | Good | `"React useEffect cleanup function with async operations"` | | Bad | `"auth"` | | Bad | `"hooks"` | Use the user's full question as the query when possible, vague one-word queries return generic results. The output contains two types of content: **code snippets** (titled, with language-tagged blocks) and **info snippets** (prose explanations with breadcrumb context). ## Authentication Works without authentication. For higher rate limits: ```bash # Option A: environment variable export CONTEXT7_API_KEY=your_key # Option B: OAuth login ctx7 login ``` ## Error Handling If a command fails with a quota error ("Monthly quota reached" or "quota exceeded"): 1. Inform the user their Context7 quota is exhausted 2. Suggest they authenticate for higher limits: `ctx7 login` 3. If they cannot or choose not to authenticate, answer from training knowledge and clearly note it may be outdated Do not silently fall back to training data — always tell the user why Context7 was not used. ## Common Mistakes - Library IDs require a `/` prefix — `/facebook/react` not `facebook/react` - Always run `ctx7 library` first — `ctx7 docs react "hooks"` will fail without a valid ID - Use descriptive queries, not single words — `"React useEffect cleanup function"` not `"hooks"` - Do not include sensitive information (API keys, passwords, credentials) in queriesplugins/claude/context7/skills/context7-mcp/SKILL.mdskillShow content (2124 bytes)
--- 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 question - `query`: The user's full question (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`: The user's specific question ### 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**: Pass the user's full question as the query for better results - **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 forksplugins/cursor/context7/skills/context7-mcp/SKILL.mdskillShow content (2124 bytes)
--- 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 question - `query`: The user's full question (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`: The user's specific question ### 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**: Pass the user's full question as the query for better results - **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 forksskills/context7-cli/SKILL.mdskillShow content (2939 bytes)
--- name: context7-cli description: Use the ctx7 CLI to fetch library documentation, manage AI coding skills, and configure Context7 MCP. Activate when the user mentions "ctx7" or "context7", needs current docs for any library, wants to install/search/generate skills, or needs to set up Context7 for their AI coding agent. --- # ctx7 CLI The Context7 CLI does three things: fetches up-to-date library documentation, manages AI coding skills, and sets up Context7 MCP for your editor. Make sure the CLI is up to date before running commands: ```bash npm install -g ctx7@latest ``` Or run directly without installing: ```bash npx ctx7@latest <command> ``` ## What this skill covers - **[Documentation](references/docs.md)** — Fetch current docs for any library. Use when writing code, verifying API signatures, or when training data may be outdated. - **[Skills management](references/skills.md)** — Install, search, suggest, list, remove, and generate AI coding skills. - **[Setup](references/setup.md)** — Configure Context7 MCP for Claude Code / Cursor / OpenCode. ## Quick Reference ```bash # Documentation ctx7 library <name> <query> # Step 1: resolve library ID ctx7 docs <libraryId> <query> # Step 2: fetch docs # Skills ctx7 skills install /owner/repo # Install from a repo (interactive) ctx7 skills install /owner/repo name # Install a specific skill ctx7 skills search <keywords> # Search the registry ctx7 skills suggest # Auto-suggest based on project deps ctx7 skills list # List installed skills ctx7 skills remove <name> # Uninstall a skill ctx7 skills generate # Generate a custom skill with AI (requires login) # Setup ctx7 setup # Configure Context7 MCP (interactive) ctx7 login # Log in for higher rate limits + skill generation ctx7 whoami # Check current login status ``` ## Authentication ```bash ctx7 login # Opens browser for OAuth ctx7 login --no-browser # Prints URL instead of opening browser ctx7 logout # Clear stored tokens ctx7 whoami # Show current login status (name + email) ``` Most commands work without login. Exceptions: `skills generate` always requires it; `ctx7 setup` requires it unless `--api-key` or `--oauth` is passed. Login also unlocks higher rate limits on docs commands. Set an API key via environment variable to skip interactive login entirely: ```bash export CONTEXT7_API_KEY=your_key ``` ## Common Mistakes - Library IDs require a `/` prefix — `/facebook/react` not `facebook/react` - Always run `ctx7 library` first — `ctx7 docs react "hooks"` will fail without a valid ID - Repository format for skills is `/owner/repo` — e.g., `ctx7 skills install /anthropics/skills` - `skills generate` requires login — run `ctx7 login` firstskills/context7-mcp/SKILL.mdskillShow content (2124 bytes)
--- 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 question - `query`: The user's full question (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`: The user's specific question ### 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**: Pass the user's full question as the query for better results - **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 forksplugins/claude/context7/.mcp.jsonmcp_serverShow content (86 bytes)
{ "context7": { "type": "http", "url": "https://mcp.context7.com/mcp" } }plugins/context7-power/mcp.jsonmcp_serverShow content (94 bytes)
{ "mcpServers": { "context7": { "url": "https://mcp.context7.com/mcp" } } }.claude-plugin/marketplace.jsonmarketplaceShow content (380 bytes)
{ "name": "context7-marketplace", "owner": { "name": "Upstash" }, "plugins": [ { "name": "context7-plugin", "source": "./plugins/claude/context7", "description": "Up-to-date documentation lookup. Pull version-specific documentation and code examples directly from source repositories into your LLM context.", "version": "1.0.0" } ] }
README

Context7 Platform - Up-to-date Code Docs For Any Prompt
❌ Without Context7
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.
Create a Next.js middleware that checks for a valid JWT in cookies
and redirects unauthenticated users to `/login`. use context7
Configure a Cloudflare Worker script to cache
JSON API responses for five minutes. use context7
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
ctx7CLI 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:
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 CONTEXT7_API_KEY header. See the link below for client-specific setup instructions.
Manual Installation / Other Clients →
Important Tips
Use Library Id
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.
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:
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:
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
More Documentation
- CLI Reference - Full CLI documentation
- MCP Clients - Manual MCP installation for 30+ clients
- Adding Libraries - Submit your library to Context7
- Troubleshooting - Common issues and solutions
- API Reference - REST API documentation
- Developer Guide - Run Context7 MCP locally
Disclaimer
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.
🤝 Connect with Us
Stay updated and join our community:
- 📢 Follow us on X for the latest news and updates
- 🌐 Visit our Website
- 💬 Join our Discord Community
📺 Context7 In Media
- Better Stack: "Free Tool Makes Cursor 10x Smarter"
- Cole Medin: "This is Hands Down the BEST MCP Server for AI Coding Assistants"
- Income Stream Surfers: "Context7 + SequentialThinking MCPs: Is This AGI?"
- Julian Goldie SEO: "Context7: New MCP AI Agent Update"
- JeredBlu: "Context 7 MCP: Get Documentation Instantly + VS Code Setup"
- Income Stream Surfers: "Context7: The New MCP Server That Will CHANGE AI Coding"
- AICodeKing: "Context7 + Cline & RooCode: This MCP Server Makes CLINE 100X MORE EFFECTIVE!"
- Sean Kochel: "5 MCP Servers For Vibe Coding Glory (Just Plug-In & Go)"
⭐ Star History
📄 License
MIT