Home / MCP / Context7 MCP Server

Context7 MCP Server

Provides up-to-date Context7 docs and code examples via HTTP or local stdio MCP connections.

javascript
38.8kstars
Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
    "mcpServers": {
        "context7_http_cursor": {
            "url": "https://mcp.context7.com/mcp"
        }
    }
}

Context7 MCP serves up-to-date, version-specific code documentation and examples directly in your prompts. It fetches current library docs, code snippets, and usage guidance from Context7’s sources so you can write accurate, runnable code without chasing out-of-date references.

How to use

You enable Context7 MCP in your prompt workflow to inject live, Context7-compatible docs and code examples. Include a directive like: use context7 in your prompt so your MCP client fetches the latest library docs and examples as you work. You can also add a rule in your MCP client to auto-invoke Context7 for code questions, so you never have to type the trigger.

How to install

Prerequisites: Node.js 18 or higher and an MCP client (Cursor, Claude Code, VS Code, Windsurf, or other MCP clients). You can run Context7 MCP locally or connect to a remote MCP server.

Install the MCP server client tooling using your preferred runtime. Below are representative examples shown across many environments. Use the exact command and flags as written in your chosen environment.

Local runtime example (stdio transport) using npm/npx to run the MCP package directly.

Configuration and usage notes

Context7 MCP supports both remote HTTP servers and local stdio servers. Remote HTTP connections require a URL and optionally an API key header; local stdio connections run the MCP server as a child process and communicate via standard I/O.

Common API key handling uses the CONTEXT7_API_KEY environment variable or a --api-key CLI option. Pick the method your client and environment prefer.

Security and keys

Keep your API key secret. Use environment variables or secure secret managers where possible. If you expose a key in configuration, prefer restricting it to read-only documentation access.

Available tools

Context7 MCP provides two core tools that you can call from prompts to fetch up-to-date docs and IDs.

Available tools

resolve-library-id

Resolves a library name to a Context7-compatible library ID.

get-library-docs

Fetches documentation for a library using a Context7-compatible library ID.