home / mcp / context7 mcp server
Context7 MCP Server
Configuration
View docs{
"mcpServers": {
"2511319-context7": {
"url": "https://mcp.context7.com/mcp"
}
}
}Context7 MCP provides up-to-date code documentation and sample prompts in your prompts, allowing you to fetch current library docs and code examples directly in your development workflow. It integrates with multiple MCP clients and supports both remote HTTP and local STDIO server configurations, giving you fast access to accurate, context-specific information for libraries you use.
You enable Context7 MCP in your prompt by telling your MCP client to load Context7. Then you ask for up-to-date library docs or code samples, and the MCP server returns precise, context-aware results. Start by configuring a Context7 MCP server in your client, choose a remote HTTP connection if you want a centralized server, or a local STDIO setup to run Context7 directly from your machine.
Prerequisites: Node.js 18 or newer and your preferred MCP client (Cursor, Windsurf, Claude Desktop, or any compatible MCP client). Follow the concrete steps below to set up either a remote HTTP connection or a local STDIO server.
{
"mcpServers": {
"context7": {
"type": "http",
"url": "https://mcp.context7.com/mcp",
"args": []
}
}
}{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp"]
}
}
}If you prefer different runtimes, you can run the Context7 MCP server with these local configurations as examples. Use the same mcpServers structure and replace the command/args as shown.
{
"mcpServers": {
"context7": {
"command": "bunx",
"args": ["-y", "@upstash/context7-mcp"]
}
}
}{
"mcpServers": {
"context7": {
"command": "deno",
"args": ["run","--allow-env=NO_DEPRECATION,TRACE_DEPRECATION","--allow-net","npm:@upstash/context7-mcp"]
}
}
}{
"mcpServers": {
"context7": {
"command": "docker",
"args": ["run","-i","--rm","context7-mcp"]
}
}
}Some clients show Windows-specific commands. For example, you can start from a Windows CMD shell with the following structure, translating it into your client’s configuration format.
{
"mcpServers": {
"context7": {
"command": "cmd",
"args": ["/c", "npx", "-y", "@upstash/context7-mcp@latest"]
}
}
}Run Context7 MCP with the least-privilege environment possible. Use a dedicated port when configuring HTTP transport if your client supports port control, and prefer secure URLs (https). Keep the MCP server version up to date and monitor for updates in your MCP client as well.
If you encounter module resolution or TLS-related issues, try alternative runtimes like bunx or deno, ensure you are using Node.js v18 or higher, and consider using the latest package name in your command.
To run your own Context7 MCP server locally, follow the development flow: install dependencies, build, and run the server. Use the provided CLI will you run the server with your chosen transport.
Context7 provides two core tools you can call from your prompts: resolve-library-id to map a library name to a Context7-compatible ID, and get-library-docs to fetch documentation for a specific library ID. You can fine-tune the results with an optional topic and adjust the tokens limit.
Keep your API surface minimal by only enabling the MCP server for trusted clients. Rotate any credentials used for access and monitor usage to prevent exposure of sensitive project information.
- resolve-library-id: Converts a library name to a Context7-compatible library ID. - get-library-docs: Retrieves documentation for a given library ID.
Resolves a general library name into a Context7-compatible library ID.
Fetches documentation for a library using a Context7-compatible library ID, with optional topic and token limits.