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 Context7 MCP pulls up-to-date, version-specific documentation and code examples straight from the source — and places them directly into your prompt. Add use con
Add this skill
npx mdskills install upstash/context7Well-documented MCP server providing up-to-date library documentation with clear setup and usage
123[](https://cursor.com/en/install-mcp?name=context7&config=eyJ1cmwiOiJodHRwczovL21jcC5jb250ZXh0Ny5jb20vbWNwIn0%3D)45# Context7 MCP - Up-to-date Code Docs For Any Prompt67[](https://context7.com) [](https://smithery.ai/server/@upstash/context7-mcp) [](https://www.npmjs.com/package/@upstash/context7-mcp) [](./LICENSE)89[](./i18n/README.zh-TW.md) [](./i18n/README.zh-CN.md) [](./i18n/README.ja.md) [](./i18n/README.ko.md) [](./i18n/README.es.md) [](./i18n/README.fr.md) [-purple>)](./i18n/README.pt-BR.md) [](./i18n/README.it.md) [](./i18n/README.id-ID.md) [](./i18n/README.de.md) [](./i18n/README.ru.md) [](./i18n/README.uk.md) [](./i18n/README.tr.md) [](./i18n/README.ar.md) [](./i18n/README.vi.md)1011## ❌ Without Context71213LLMs rely on outdated or generic information about the libraries you use. You get:1415- ❌ Code examples are outdated and based on year-old training data16- ❌ Hallucinated APIs that don't even exist17- ❌ Generic answers for old package versions1819## ✅ With Context72021Context7 MCP pulls up-to-date, version-specific documentation and code examples straight from the source — and places them directly into your prompt.2223Add `use context7` to your prompt (or [set up a rule](#add-a-rule) to auto-invoke):2425```txt26Create a Next.js middleware that checks for a valid JWT in cookies27and redirects unauthenticated users to `/login`. use context728```2930```txt31Configure a Cloudflare Worker script to cache32JSON API responses for five minutes. use context733```3435Context7 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.3637## Installation3839> [!NOTE]40> **API Key Recommended**: Get a free API key at [context7.com/dashboard](https://context7.com/dashboard) for higher rate limits.4142<details>43<summary><b>Install in Cursor</b></summary>4445Go to: `Settings` -> `Cursor Settings` -> `MCP` -> `Add new global MCP server`4647Pasting the following configuration into your Cursor `~/.cursor/mcp.json` file is the recommended approach. You may also install in a specific project by creating `.cursor/mcp.json` in your project folder. See [Cursor MCP docs](https://docs.cursor.com/context/model-context-protocol) for more info.4849> Since Cursor 1.0, you can click the install button below for instant one-click installation.5051#### Cursor Remote Server Connection5253[](https://cursor.com/en/install-mcp?name=context7&config=eyJ1cmwiOiJodHRwczovL21jcC5jb250ZXh0Ny5jb20vbWNwIn0%3D)5455```json56{57 "mcpServers": {58 "context7": {59 "url": "https://mcp.context7.com/mcp",60 "headers": {61 "CONTEXT7_API_KEY": "YOUR_API_KEY"62 }63 }64 }65}66```6768#### Cursor Local Server Connection6970[](https://cursor.com/en/install-mcp?name=context7&config=eyJjb21tYW5kIjoibnB4IC15IEB1cHN0YXNoL2NvbnRleHQ3LW1jcCJ9)7172```json73{74 "mcpServers": {75 "context7": {76 "command": "npx",77 "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]78 }79 }80}81```8283</details>8485<details>86<summary><b>Install in Claude Code</b></summary>8788Run this command. See [Claude Code MCP docs](https://code.claude.com/docs/en/mcp) for more info.8990#### Claude Code Local Server Connection9192```sh93claude mcp add --scope user context7 -- npx -y @upstash/context7-mcp --api-key YOUR_API_KEY94```9596#### Claude Code Remote Server Connection9798```sh99claude mcp add --scope user --header "CONTEXT7_API_KEY: YOUR_API_KEY" --transport http context7 https://mcp.context7.com/mcp100```101102> Remove `--scope user` to install for the current project only.103104</details>105106<details>107<summary><b>Install in Opencode</b></summary>108109Add this to your Opencode configuration file. See [Opencode MCP docs](https://opencode.ai/docs/mcp-servers) for more info.110111#### Opencode Remote Server Connection112113```json114"mcp": {115 "context7": {116 "type": "remote",117 "url": "https://mcp.context7.com/mcp",118 "headers": {119 "CONTEXT7_API_KEY": "YOUR_API_KEY"120 },121 "enabled": true122 }123}124```125126#### Opencode Local Server Connection127128```json129{130 "mcp": {131 "context7": {132 "type": "local",133 "command": ["npx", "-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"],134 "enabled": true135 }136 }137}138```139140</details>141142<details>143<summary><b>Install with ctx7 setup</b></summary>144145Set up Context7 MCP for your coding agents:146147```bash148npx ctx7 setup149```150151Authenticates via OAuth, generates an API key, and configures the MCP server and rule for your agents. Use `--cursor`, `--claude`, or `--opencode` to target a specific agent.152153</details>154155**[Other IDEs and Clients →](https://context7.com/docs/resources/all-clients)**156157<details>158<summary><b>OAuth Authentication</b></summary>159160Context7 MCP server supports OAuth 2.0 authentication for MCP clients that implement the [MCP OAuth specification](https://modelcontextprotocol.io/specification/2025-03-26/basic/authorization).161162To use OAuth, change the endpoint from `/mcp` to `/mcp/oauth` in your client configuration:163164```diff165- "url": "https://mcp.context7.com/mcp"166+ "url": "https://mcp.context7.com/mcp/oauth"167```168169OAuth is only available for remote HTTP connections. For local MCP connections using stdio transport, use API key authentication instead.170171</details>172173## Important Tips174175### Add a Rule176177To avoid typing `use context7` in every prompt, add a rule to your MCP client to automatically invoke Context7 for code-related questions:178179- **Cursor**: `Cursor Settings > Rules`180- **Claude Code**: `CLAUDE.md`181- Or the equivalent in your MCP client182183**Example rule:**184185```txt186Always use Context7 MCP when I need library/API documentation, code generation, setup or configuration steps without me having to explicitly ask.187```188189### Use Library Id190191If you already know exactly which library you want to use, add its Context7 ID to your prompt. That way, Context7 MCP server can skip the library-matching step and directly continue with retrieving docs.192193```txt194Implement basic authentication with Supabase. use library /supabase/supabase for API and docs.195```196197The slash syntax tells the MCP tool exactly which library to load docs for.198199### Specify a Version200201To get documentation for a specific library version, just mention the version in your prompt:202203```txt204How do I set up Next.js 14 middleware? use context7205```206207Context7 will automatically match the appropriate version.208209## Available Tools210211Context7 MCP provides the following tools that LLMs can use:212213- `resolve-library-id`: Resolves a general library name into a Context7-compatible library ID.214 - `query` (required): The user's question or task (used to rank results by relevance)215 - `libraryName` (required): The name of the library to search for216217- `query-docs`: Retrieves documentation for a library using a Context7-compatible library ID.218 - `libraryId` (required): Exact Context7-compatible library ID (e.g., `/mongodb/docs`, `/vercel/next.js`)219 - `query` (required): The question or task to get relevant documentation for220221## More Documentation222223- [More MCP Clients](https://context7.com/docs/resources/all-clients) - Installation for 30+ clients224- [Adding Libraries](https://context7.com/docs/adding-libraries) - Submit your library to Context7225- [Troubleshooting](https://context7.com/docs/resources/troubleshooting) - Common issues and solutions226- [API Reference](https://context7.com/docs/api-guide) - REST API documentation227- [Developer Guide](https://context7.com/docs/resources/developer) - Run Context7 MCP locally228229## Disclaimer2302311- 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.2322332- 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.234235## 🤝 Connect with Us236237Stay updated and join our community:238239- 📢 Follow us on [X](https://x.com/context7ai) for the latest news and updates240- 🌐 Visit our [Website](https://context7.com)241- 💬 Join our [Discord Community](https://upstash.com/discord)242243## 📺 Context7 In Media244245- [Better Stack: "Free Tool Makes Cursor 10x Smarter"](https://youtu.be/52FC3qObp9E)246- [Cole Medin: "This is Hands Down the BEST MCP Server for AI Coding Assistants"](https://www.youtube.com/watch?v=G7gK8H6u7Rs)247- [Income Stream Surfers: "Context7 + SequentialThinking MCPs: Is This AGI?"](https://www.youtube.com/watch?v=-ggvzyLpK6o)248- [Julian Goldie SEO: "Context7: New MCP AI Agent Update"](https://www.youtube.com/watch?v=CTZm6fBYisc)249- [JeredBlu: "Context 7 MCP: Get Documentation Instantly + VS Code Setup"](https://www.youtube.com/watch?v=-ls0D-rtET4)250- [Income Stream Surfers: "Context7: The New MCP Server That Will CHANGE AI Coding"](https://www.youtube.com/watch?v=PS-2Azb-C3M)251- [AICodeKing: "Context7 + Cline & RooCode: This MCP Server Makes CLINE 100X MORE EFFECTIVE!"](https://www.youtube.com/watch?v=qZfENAPMnyo)252- [Sean Kochel: "5 MCP Servers For Vibe Coding Glory (Just Plug-In & Go)"](https://www.youtube.com/watch?v=LqTQi8qexJM)253254## ⭐ Star History255256[](https://www.star-history.com/#upstash/context7&Date)257258## 📄 License259260MIT261
Full transparency — inspect the skill content before installing.