Context7 Platform -- Up-to-date docs for AI agents
feat: improved readme
Josh7641e71e8542
diff --git a/README.md b/README.mdindex 56e99235..34774e95 100644--- a/README.md+++ b/README.md@@ -1,34 +1,66 @@-# Context7 MCP Server+# Context7 MCP - Up-to-date Docs For Any Cursor Prompt-In this repository, we provide an MCP Server for [Context7](https://context7.com), which offers access to high-quality documentation for popular libraries.+## ❌ Without Context7-This lets you use Cursor, Windsurf, Claude Desktop, or any MCP Client, to use natural language to search and access documentation for libraries, e.g.:+LLMs rely on outdated or generic information about the libraries you use. You get:-- "What are the main features of React hooks?"-- "How do I implement authentication with Next.js?"-- "Rate limiting with Redis"-- "Get examples of using React Query"+- ❌ Code examples are outdated and based on year-old training data+- ❌ Hallucinated APIs don't even exist+- ❌ Generic answers for old package versions-## Usage+## ✅ With Context7++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 context7` to your question in Cursor:++```+"How do I use the new Next.js `after` function? use context7"+```++```+"How do I invalidate a query in React Query? use context7"+```++```+"How do I protect a route with NextAuth? use context7"+```++Context7 fetches up-to-date documentation and working code examples right into your LLM’s context.++- 1️⃣ Ask your question naturally+- 2️⃣ Tell the LLM to `use context7`+- 3️⃣ Get working code answers++No tab-switching, no hallucinated APIs that don't exist, no outdated code generations.++## 🛠️ Getting Started### Requirements- Node.js >= v18.0.0- Cursor, Windsurf, Claude Desktop or another MCP Client-### How to use locally+### Install in Cursor-#### Installing for Cursor+Go to: `Settings` -> `Cursor Settings` -> `MCP` -> `Add new global MCP server`-Add this command to the MCP list in Cursor. For more info, check the [Cursor MCP](https://docs.cursor.com/context/model-context-protocol) docs.+Paste this into your Cursor `~/.cursor/mcp.json` file. See [Cursor MCP docs](https://docs.cursor.com/context/model-context-protocol) for more info.-```bash-npx -y @upstash/context7-mcp+```json+{+ "mcpServers": {+ "context7": {+ "command": "npx",+ "args": ["-y", "@upstash/context7-mcp"]+ }+ }+}```-#### Installing for Windsurf+### Install in Windsurf-Add this to your Windsurf MCP config file. For more info, check the [Windsurf MCP](https://docs.windsurf.com/windsurf/mcp) docs.+Add this to your Windsurf MCP config file. See [Windsurf MCP docs](https://docs.windsurf.com/windsurf/mcp) for more info.```json{@@ -41,14 +73,14 @@ Add this to your Windsurf MCP config file. For more info, check the [Windsurf MC}```-### Tools+### Available Tools-- `list-available-docs`: Lists all available documentation libraries from Context7- - `libraryName`: Optional library name to search for and rerank results based on-- `get-library-documentation`: Retrieves documentation for a specific library with options for:- - `libraryName`: Name of the library to retrieve docs for- - `topic`: Specific topic within the library- - `tokens`: Maximum tokens to retrieve (default: 5000)+- `resolve-library-id`: Resolves a general npm package name into a Context7-compatible library ID.+ - `libraryName` (optional): Search and rerank results+- `get-library-docs`: Fetches documentation for a library using a Context7-compatible library ID.+ - `context7CompatibleLibraryID` (required)+ - `topic` (optional): Focus the docs on a specific topic (e.g., "routing", "hooks")+ - `tokens` (optional, default 5000): Max number of tokens to return## Development@@ -58,27 +90,27 @@ Clone the project and run:npm install```-You can use the following commands to format and lint the code:+Format and lint:```bashnpm run formatnpm run lint```-### Building+Build:```bashnpm run build```-### Local Configuration+### Local Configuration Example```json{"mcpServers": {"context7": {- "command": "node",- "args": ["/ABSOLUTE/PATH/TO/PARENT/FOLDER/context7-mcp/build/index.js"]+ "command": "npx",+ "args": ["tsx", "/path/to/folder/context7-mcp/src/index.ts"]}}}@@ -86,8 +118,6 @@ npm run build### Testing with MCP Inspector-You can also use the MCP Inspector to test the tools by following the MCP documentation for setting up the inspector.-```bashnpx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp```