Context7
Context7
Section titled “Context7”Context7 provides up-to-date documentation for libraries and frameworks, ensuring Claude has accurate API references instead of outdated training data.
Configuration
Section titled “Configuration”{ "mcpServers": { "context7": { "command": "npx", "args": ["-y", "@upstash/context7-mcp"] } }}Available Tools
Section titled “Available Tools”resolve-library-id
Section titled “resolve-library-id”Finds the Context7-compatible library ID for documentation lookup.
Parameters:
libraryName— Library name to search for
Example:
resolve-library-id("react")→ Returns: "/facebook/react"get-library-docs
Section titled “get-library-docs”Fetches documentation for a specific library.
Parameters:
context7CompatibleLibraryID— Library ID from resolve-library-idtopic(optional) — Focus area (e.g., “hooks”, “routing”)mode—codefor API references,infofor conceptspage— Pagination (1-10)
Example:
get-library-docs("/facebook/react", topic="hooks", mode="code")→ Returns: Current React hooks documentation with examplesUse Cases
Section titled “Use Cases”Research Libraries
Section titled “Research Libraries”/research Next.js App RouterContext7 fetches current Next.js documentation for accurate analysis.
Feature Development
Section titled “Feature Development”/feature Add authentication with NextAuthContext7 provides current NextAuth API for correct implementation.
Debugging Library Issues
Section titled “Debugging Library Issues”/fix "useEffect cleanup not working"Context7 retrieves correct useEffect patterns from React docs.
Command Integration
Section titled “Command Integration”| Command | How Context7 Helps |
|---|---|
/feature | Accurate library APIs for implementation |
/research | Current documentation for analysis |
/fix | Correct patterns for debugging library issues |
/plan | Accurate estimates based on real API complexity |
Best Practices
Section titled “Best Practices”Specify Topics
Section titled “Specify Topics”For focused results, use the topic parameter:
get-library-docs("/vercel/next.js", topic="app-router")Use Correct Mode
Section titled “Use Correct Mode”mode="code"— API references, code examplesmode="info"— Conceptual guides, architecture
Handle Pagination
Section titled “Handle Pagination”If context is insufficient, try additional pages:
get-library-docs(..., page=2)Troubleshooting
Section titled “Troubleshooting”Library Not Found
Section titled “Library Not Found”If resolve-library-id returns no results:
- Check spelling
- Try alternative names (e.g., “nextjs” vs “next.js”)
- Some libraries may not be indexed
Outdated Results
Section titled “Outdated Results”Context7 indexes popular libraries. Less common libraries may have delayed updates.