Retrieve up-to-date library documentation from Context7. Use when working with libraries/frameworks (React, Next.js, Vue, Express, etc.) to get current API docs, code examples, and best practices. Prevents hallucinating outdated APIs.
Fetches up-to-date, version-specific documentation and code examples from Context7. Use this when you need accurate, current information about libraries and frameworks.
Get a Context7 API key for higher rate limits (optional but recommended):
~/.profile or ~/.zprofile):
export CONTEXT7_API_KEY="your-api-key-here"
Without an API key, the service works with rate limits.
Find the library ID first:
{baseDir}/docs.py search <library-name> [query]
Fetch documentation for a specific library:
{baseDir}/docs.py docs <library-id> <query>
# Find the React library
{baseDir}/docs.py search react "hooks"
# Get documentation about useEffect
{baseDir}/docs.py docs /facebook/react "useEffect cleanup"
# Search for Next.js
{baseDir}/docs.py search nextjs "app router"
# Get Next.js docs about server components
{baseDir}/docs.py docs /vercel/next.js "server components data fetching"
# Search for a specific version
{baseDir}/docs.py docs /vercel/next.js/v15.1.8 "middleware authentication"
search to find the correct library IDdocs with the library ID and your specific question