{"skill":{"slug":"context7","displayName":"Context7 MCP","summary":"Context7 MCP - Intelligent documentation search and context for any library","description":"---\nname: context7\ndescription: Context7 MCP - Intelligent documentation search and context for any library\nmetadata:\n  version: 1.0.3\n  tags: [\"documentation\", \"search\", \"context\", \"mcp\", \"llm\"]\n  clawdbot:\n    requires:\n      bins: [\"node\"]\n      npm: true\n    install:\n      - id: \"skill-install\"\n        kind: \"skill\"\n        source: \"clawdhub\"\n        slug: \"context7\"\n        label: \"Install Context7 skill\"\n---\n\n# Context7 MCP\n\nContext7 provides intelligent documentation search and context for any library, powered by LLMs.\n\n## Setup\n\n1. Copy `.env.example` to `.env` and add your Context7 API key:\n   ```bash\n   cp .env.example .env\n   ```\n\n   Add your API key to `.env`:\n   ```\n   CONTEXT7_API_KEY=your-api-key-here\n   ```\n\n   Get your key from [context7.com/dashboard](https://context7.com/dashboard)\n\n2. Install dependencies:\n   ```bash\n   npm install\n   ```\n\n## Usage\n\nContext7 provides two main commands:\n\n### Search Command\n\nSearch for libraries by name with intelligent LLM-powered ranking:\n\n```bash\nnpx tsx query.ts search <library_name> <query>\n\n# Examples:\nnpx tsx query.ts search \"nextjs\" \"setup ssr\"\nnpx tsx query.ts search \"react\" \"useEffect cleanup\"\nnpx tsx query.ts search \"better-auth\" \"authentication flow\"\n```\n\nThis calls the Context7 Search API:\n```\nGET https://context7.com/api/v2/libs/search?libraryName=<name>&query=<query>\n```\n\n**Response includes:**\n- id: Library ID (e.g., `/vercel/next.js`)\n- name: Display name\n- trustScore: Source reputation (0-100)\n- benchmarkScore: Quality indicator (0-100)\n- versions: Available version tags\n\n### Context Command\n\nRetrieve intelligent, LLM-reranked documentation context:\n\n```bash\nnpx tsx query.ts context <owner/repo> <query>\n\n# Examples:\nnpx tsx query.ts context \"vercel/next.js\" \"setup ssr\"\nnpx tsx query.ts context \"facebook/react\" \"useState hook\"\n```\n\nThis calls the Context7 Context API:\n```\nGET https://context7.com/api/v2/context?libraryId=<repo>&query=<query>&type=txt\n```\n\n**Response includes:**\n- title: Documentation section title\n- content: Documentation text/snippet\n- source: URL to source page\n\n### Quick Reference\n\n```bash\n# Search for documentation\nnpx tsx query.ts search \"library-name\" \"your search query\"\n\n# Get context from a specific repo\nnpx tsx query.ts context \"owner/repo\" \"your question\"\n```\n\n## Best Practices\n\nGet the most out of the Context7 API with these best practices:\n\n### Optimize Search Relevance\n\nWhen using the `/libs/search` endpoint, always include the user's original question in the query parameter. This allows the API to use LLM-powered ranking to find the most relevant library for the specific task, rather than relying on a simple name match.\n\n**Example:** If a user asks about SSR in Next.js, search with:\n- `libraryName=nextjs`\n- `query=setup+ssr`\n\nThis ensures the best ranking for the specific task.\n\n### Use Specific Library IDs\n\nFor the fastest and most accurate results with the `/context` endpoint, provide the full libraryId (e.g., `/vercel/next.js`). If you already know the library the user is asking about, skipping the search step and calling the context endpoint directly reduces latency.\n\n### Leverage Versioning\n\nTo ensure documentation accuracy for older or specific project requirements, include the version in the libraryId using the `/owner/repo/version` format. You can find available version tags in the response from the search endpoint.\n\n### Choose the Right Response Type\n\nTailor the `/context` response to your needs using the `type` parameter:\n- Use `type=json` when you need to programmatically handle titles, content snippets, and source URLs (ideal for UI display).\n- Use `type=txt` when you want to pipe the documentation directly into an LLM prompt as plain text.\n\n### Filter by Quality Scores\n\nWhen programmatically selecting a library from search results, use the `trustScore` and `benchmarkScore` to prioritize high-quality, reputable documentation sources for your users.\n\n### Find Navigation Pages\n\nFind navigation and other pages in this documentation by fetching the `llms.txt` file at:\n```\nhttps://context7.com/docs/llms.txt\n```\n\n## API Reference\n\n### Context7 REST API\n\n**Search Endpoint:**\n```\nGET https://context7.com/api/v2/libs/search\n  ?libraryName=<library_name>\n  &query=<user_query>\n```\n\n**Context Endpoint:**\n```\nGET https://context7.com/api/v2/context\n  ?libraryId=<owner/repo>\n  &query=<user_query>\n  &type=txt|json\n```\n\n## Troubleshooting\n\n**No results found?**\n- Check your API key is valid\n- Verify the library name is correct (e.g., 'react' not 'React')\n\n**Authentication errors?**\n- Ensure CONTEXT7_API_KEY is set in `.env`\n- Check your key hasn't expired at context7.com/dashboard\n\n## License\n\nMIT\n","tags":{"latest":"1.0.3","documentation":"1.0.0","library-search":"1.0.0","mcp":"1.0.0"},"stats":{"comments":3,"downloads":9547,"installsAllTime":77,"installsCurrent":77,"stars":17,"versions":4},"createdAt":1768362931439,"updatedAt":1778485733200},"latestVersion":{"version":"1.0.3","createdAt":1769015493568,"changelog":"Added best practices section for search, context, versioning, and quality filtering","license":null},"metadata":{"setup":[],"os":null,"systems":null},"owner":{"handle":"thesethrose","userId":"s17anavdz6094c0kjr1a6rhfgn884j9p","displayName":"Seth Rose","image":"https://avatars.githubusercontent.com/u/10383809?v=4"},"moderation":null}