PRIMARY tool for fetching library/framework documentation.
Fetch up-to-date documentation and code examples for any library using Context7's HTTP API. This skill replicates Context7 MCP functionality with token-efficient progressive disclosure.
This skill should be the FIRST choice for library/framework documentation.
Trigger patterns:
Benefits over WebFetch/WebSearch:
API Key Required: Set CONTEXT7_API_KEY environment variable. Get key from https://context7.com/dashboard
export CONTEXT7_API_KEY="your-api-key"
Exception: Skip search if user provides exact ID format (/org/project or /org/project/version)
Use scripts/context7_client.py search to resolve library names to Context7 IDs.
Basic search:
python scripts/context7_client.py search "React"
Output format:
Found 3 results for 'React':
1. React
ID: /facebook/react
Description: JavaScript library for building user interfaces
2. React Router
ID: /remix-run/react-router
Description: Declarative routing for React
Selection criteria:
Common patterns:
# Framework search
python scripts/context7_client.py search "Next.js"
# Returns: /vercel/next.js
# Database client
python scripts/context7_client.py search "MongoDB"
# Returns: /mongodb/docs
# UI library
python scripts/context7_client.py search "shadcn"
# Returns: /shadcn/ui
Use scripts/context7_client.py docs with resolved library ID.
Basic fetch:
python scripts/context7_client.py docs vercel/next.js
With topic filter:
python scripts/context7_client.py docs vercel/next.js --topic routing
With token limit:
python scripts/context7_client.py docs vercel/next.js --tokens 3000
Specific version:
python scripts/context7_client.py docs vercel/next.js/v15.1.8
Combined parameters:
python scripts/context7_client.py docs vercel/next.js --topic "app router" --tokens 2000
/org/project (e.g., /vercel/next.js)/org/project/version (e.g., /vercel/next.js/v15.1.8)vercel/next.js and /vercel/next.js--topic: Focus on specific subject (e.g., "routing", "hooks", "authentication")--tokens: Limit documentation size (default: 5000)--json: Raw JSON for programmatic parsingCommon errors:
"Context7 API key required"
"Authentication failed"
"Library not found"
"Rate limited. Retry after X seconds"
Network errors
# Search for Next.js
python scripts/context7_client.py search "Next.js"
# Fetch App Router docs
python scripts/context7_client.py docs vercel/next.js --topic "app router"
# Direct fetch (known ID)
python scripts/context7_client.py docs facebook/react --topic hooks --tokens 2000
# Search for library
python scripts/context7_client.py search "Tailwind CSS"
# Fetch specific version docs
python scripts/context7_client.py docs tailwindlabs/tailwindcss/v3.4.0
Progressive disclosure vs MCP:
Best practices:
Python client for Context7 API with CLI interface. Handles authentication, search, and documentation fetching. Can be executed directly without loading to context.
Detailed API reference including endpoints, authentication, rate limits, and error codes. Load into context if deeper API understanding is needed for debugging or advanced usage.