### Install context7 MCP Server on Windows Source: https://github.com/jiquanzhong/context7/blob/master/docs/README.zh-CN.md Configuration for installing and running the context7 MCP server on Windows. This example uses 'cmd' and 'npx' to execute the package, requiring an API key. The configuration is intended for clients like Cline. ```json { "mcpServers": { "github.com/upstash/context7-mcp": { "command": "cmd", "args": ["/c", "npx", "-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"], "disabled": false, "autoApprove": [] } } } ``` -------------------------------- ### Install Context7 MCP via Smithery (Bash) Source: https://github.com/jiquanzhong/context7/blob/master/docs/README.zh-TW.md This command installs the Context7 MCP server using the Smithery CLI. It requires a client name and your Smithery API key. This method automates the setup process. ```bash npx -y @smithery/cli@latest install @upstash/context7-mcp --client --key ``` -------------------------------- ### Install Claude Local Server Source: https://github.com/jiquanzhong/context7/blob/master/docs/README.zh-CN.md Command to add the Context7 MCP local server using the 'claude' CLI. It requires specifying the context name and the package to install. ```shell claude mcp add context7 -- npx -y @upstash/context7-mcp --api-key YOUR_API_KEY ``` -------------------------------- ### Install context7 MCP Server in Copilot Coding Agent Source: https://github.com/jiquanzhong/context7/blob/master/docs/README.zh-CN.md Configuration for integrating the context7 MCP server with the Copilot Coding Agent. This setup uses an HTTP type with a specific URL and requires a CONTEXT7_API_KEY header. It also defines available tools. ```json { "mcpServers": { "context7": { "type": "http", "url": "https://mcp.context7.com/mcp", "headers": { "CONTEXT7_API_KEY": "YOUR_API_KEY" }, "tools": ["get-library-docs", "resolve-library-id"] } } } ``` -------------------------------- ### Build and Run context7 MCP Server with Docker Source: https://github.com/jiquanzhong/context7/blob/master/docs/README.zh-CN.md This section details how to build a Docker image for the context7 MCP server and run it within a container. The Dockerfile installs the package globally. The MCP client configuration then uses a 'docker run' command to start the server. ```dockerfile FROM node:18-alpine WORKDIR /app # 全局安装最新版本 RUN npm install -g @upstash/context7-mcp # 如果需要,暴露默认端口(可选,取决于 MCP 客户端交互) # EXPOSE 3000 # 运行服务器的默认命令 CMD ["context7-mcp"] ``` ```json { "mcpServers": { "Сontext7": { "autoApprove": [], "disabled": false, "timeout": 60, "command": "docker", "args": ["run", "-i", "--rm", "context7-mcp"], "transportType": "stdio" } } } ``` -------------------------------- ### Install Context7 MCP with Smithery CLI Source: https://github.com/jiquanzhong/context7/blob/master/docs/README.de.md Installs the Context7 MCP server for Claude Desktop using the Smithery CLI. This command-line interface simplifies the installation process for specific clients. ```bash npx -y @smithery/cli install @upstash/context7-mcp --client claude ``` -------------------------------- ### Example Prompt for Next.js Project Creation Source: https://github.com/jiquanzhong/context7/blob/master/docs/README.de.md An example prompt demonstrating how to instruct an LLM to create a Next.js project using the App Router, incorporating the 'use context7' command for up-to-date information. ```text Erstelle ein einfaches Next.js-Projekt mit dem App Router. use context7 ``` -------------------------------- ### Get Library Documentation using MCP Client Source: https://context7.com/jiquanzhong/context7/llms.txt This TypeScript example shows how to fetch library documentation using the `get-library-docs` MCP tool. It requires a Context7-compatible library ID and can optionally filter by topic and token limits. The response includes formatted documentation, code examples, and API references, or an error message if the documentation is not found. ```typescript // Example usage within an MCP client const docs = await mcpClient.callTool('get-library-docs', { context7CompatibleLibraryID: '/vercel/next.js', topic: 'routing', tokens: 5000 }); // Expected response format { content: [ { type: "text", text: `# Next.js Routing Documentation ## App Router The App Router uses a file-system based routing mechanism... ### Dynamic Routes // Example: app/blog/[slug]/page.tsx export default function Page({ params }: { params: { slug: string } }) { return
Post: {params.slug}
} ### Route Groups // Example: app/(marketing)/about/page.tsx ...` } ] } // Error case - invalid library ID { content: [ { type: "text", text: "Documentation not found or not finalized for this library..." } ] } ``` -------------------------------- ### Install Project Dependencies (Bash) Source: https://github.com/jiquanzhong/context7/blob/master/README.md This bash command installs the necessary dependencies for the Context7 MCP project. It should be run after cloning the repository and before building or running the project. ```bash bun i ``` -------------------------------- ### Prompt Example for Next.js Project (Text) Source: https://github.com/jiquanzhong/context7/blob/master/docs/README.zh-TW.md This example demonstrates how to prompt an LLM to create a basic Next.js project using the App Router, incorporating the 'use context7' command to fetch real-time information. ```text 建立一個使用 app router 的基本 Next.js 專案。use context7 ``` -------------------------------- ### Build Docker Image for Context7 MCP Server Source: https://github.com/jiquanzhong/context7/blob/master/docs/README.ko.md This Dockerfile defines the steps to build a Docker image for the Context7 MCP server, starting from a Node.js base image and globally installing the necessary npm package. ```dockerfile FROM node:18-alpine WORKDIR /app # 최신 버전 전역 설치 RUN npm install -g @upstash/context7-mcp # 필요한 경우 기본 포트 노출 (선택 사항, MCP 클라이언트 상호 작용에 따라 다름) # EXPOSE 3000 # 서버 실행 기본 명령어 CMD ["context7-mcp"] ``` -------------------------------- ### Install Context7 MCP in Perplexity Desktop Source: https://github.com/jiquanzhong/context7/blob/master/README.md This JSON configuration is used to install the Context7 MCP within the Perplexity Desktop application. It specifies the command to execute, necessary arguments including the package to install, and environment variables required for the installation process. ```json { "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"], "command": "npx", "env": {} } ``` -------------------------------- ### Configure Zed Local Server Source: https://github.com/jiquanzhong/context7/blob/master/docs/README.zh-CN.md JSON configuration for Zed to set up the Context7 MCP local server. It defines the command path and arguments for executing the MCP server. ```json { "context_servers": { "Context7": { "command": { "path": "npx", "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"] }, "settings": {} } } } ``` -------------------------------- ### Run Context7 MCP Server (Bash) Source: https://github.com/jiquanzhong/context7/blob/master/README.md This bash command executes the Context7 MCP server after it has been built. This is the command used to start the server and make its functionalities available. ```bash bun run dist/index.js ``` -------------------------------- ### Install context7 MCP Server in Warp Source: https://github.com/jiquanzhong/context7/blob/master/docs/README.zh-CN.md This configuration snippet is for adding the context7 MCP server within the Warp terminal. It specifies the command as 'npx' and includes arguments for running the package, along with optional environment variables and working directory settings. ```json { "Context7": { "command": "npx", "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"], "env": {}, "working_directory": null, "start_on_launch": true } } ``` -------------------------------- ### Context7 Configuration (`context7.json`) Example Source: https://github.com/jiquanzhong/context7/blob/master/docs/adding-projects.md This JSON snippet demonstrates the structure and available fields for configuring how Context7 parses and presents your project's documentation. It includes settings for project title, description, folder inclusions/exclusions, rules, and versioning. The `$schema` field enables editor features like autocomplete. ```json { "$schema": "https://context7.com/schema/context7.json", "projectTitle": "Upstash Ratelimit", "description": "Ratelimiting library based on Upstash Redis", "folders": [], "excludeFolders": ["src"], "excludeFiles": [], "rules": ["Use Upstash Redis as a database", "Use single region set up"], "previousVersions": [ { "tag": "v1.2.1" } ] } ``` -------------------------------- ### Connect to Context7 Remote Server Source: https://github.com/jiquanzhong/context7/blob/master/docs/README.zh-CN.md This configuration establishes a remote connection to the Context7 MCP server. It requires the HTTP URL of the server and an API key provided in the headers. This setup is applicable for Gemini CLI and Trae. ```json { "mcpServers": { "context7": { "httpUrl": "https://mcp.context7.com/mcp", "headers": { "CONTEXT7_API_KEY": "YOUR_API_KEY" } } } } ``` ```json { "mcpServers": { "context7": { "url": "https://mcp.context7.com/mcp" } } } ``` -------------------------------- ### Run Context7 Local MCP Server with Bun Source: https://github.com/jiquanzhong/context7/blob/master/docs/README.zh-CN.md This JSON configuration demonstrates how to set up a local Context7 MCP server using Bun. It specifies 'bunx' as the command and provides the necessary arguments, similar to the npx method. ```json { "mcpServers": { "context7": { "command": "bunx", "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"] } } } ``` -------------------------------- ### Claude Code CLI for Remote Context7 MCP Installation (HTTP) Source: https://github.com/jiquanzhong/context7/blob/master/docs/README.zh-CN.md Demonstrates the command-line instruction to add the Context7 MCP server to Claude Code using the HTTP transport protocol. This command specifies the server name, URL, and authentication header. ```sh claude mcp add --transport http context7 https://mcp.context7.com/mcp --header "CONTEXT7_API_KEY: YOUR_API_KEY" ``` -------------------------------- ### Cursor Local Server Configuration for Context7 MCP Source: https://github.com/jiquanzhong/context7/blob/master/docs/README.zh-CN.md Illustrates the JSON configuration for setting up a local Context7 MCP server within Cursor. This configuration specifies the command to run and arguments to pass, including the API key for authentication. ```json { "mcpServers": { "context7": { "command": "npx", "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"] } } } ``` -------------------------------- ### Cursor Remote Server Configuration for Context7 MCP Source: https://github.com/jiquanzhong/context7/blob/master/docs/README.zh-CN.md Shows the JSON configuration for connecting to a remote Context7 MCP server in Cursor. This setup involves providing the server URL and any necessary headers, such as the API key. ```json { "mcpServers": { "context7": { "url": "https://mcp.context7.com/mcp", "headers": { "CONTEXT7_API_KEY": "YOUR_API_KEY" } } } } ``` -------------------------------- ### Build Context7 MCP Project (Bash) Source: https://github.com/jiquanzhong/context7/blob/master/README.md This bash command builds the Context7 MCP project. It assumes the project dependencies have already been installed using 'bun i'. This step is crucial for preparing the project for execution. ```bash bun run build ``` -------------------------------- ### Testing Context7 MCP with Inspector (Bash) Source: https://github.com/jiquanzhong/context7/blob/master/README.md This bash command demonstrates how to test the Context7 MCP server using the MCP Inspector tool. It first installs and runs the inspector, then invokes the Context7 MCP package within it. ```bash npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp ``` -------------------------------- ### Claude Code CLI for Remote Context7 MCP Installation (SSE) Source: https://github.com/jiquanzhong/context7/blob/master/docs/README.zh-CN.md Provides the command-line syntax for integrating Context7 MCP with Claude Code using the Server-Sent Events (SSE) transport. Similar to the HTTP method, it requires the server name, URL, and API key. ```sh claude mcp add --transport sse context7 https://mcp.context7.com/sse --header "CONTEXT7_API_KEY: YOUR_API_KEY" ``` -------------------------------- ### Local Context7 MCP Configuration (JSON) Source: https://github.com/jiquanzhong/context7/blob/master/README.md This JSON configuration provides an example of setting up the Context7 MCP server for local development. It specifies the command to run, including the TypeScript execution ('tsx') and the path to the main script, along with an API key. ```json { "mcpServers": { "context7": { "command": "npx", "args": ["tsx", "/path/to/folder/context7/src/index.ts", "--api-key", "YOUR_API_KEY"] } } } ``` -------------------------------- ### Configure Context7 Local Server (JSON) Source: https://github.com/jiquanzhong/context7/blob/master/README.md This JSON configuration sets up a local Context7 MCP server connection. It specifies the command to execute using npx and includes a placeholder for your API key. This is a common setup for various IDEs and tools that support MCP. ```json { "mcp": { "context7": { "type": "local", "command": ["npx", "-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"], "enabled": true } } } ``` -------------------------------- ### Dockerfile for context7 MCP Server Source: https://github.com/jiquanzhong/context7/blob/master/README.md A Dockerfile to build a Docker image for the context7 MCP server. It uses a Node.js Alpine base image, installs the MCP server globally, and sets the default command to run the server. ```Dockerfile FROM node:18-alpine WORKDIR /app # Install the latest version globally RUN npm install -g @upstash/context7-mcp # Expose default port if needed (optional, depends on MCP client interaction) # EXPOSE 3000 # Default command to run the server CMD ["context7-mcp"] ``` -------------------------------- ### Configure Context7 MCP Server in OpenAI Codex Source: https://github.com/jiquanzhong/context7/blob/master/docs/README.zh-CN.md This TOML configuration is for setting up the Context7 MCP server in OpenAI Codex. It defines the command to be 'npx' and specifies the necessary arguments, including the API key. ```toml [mcp_servers.context7] args = ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"] command = "npx" ``` -------------------------------- ### Run context7 MCP Server with Deno Source: https://github.com/jiquanzhong/context7/blob/master/docs/README.zh-CN.md This snippet shows how to run the context7 MCP server using Deno. It requires specific environment variables and network access. The command executes the npm package '@upstash/context7-mcp'. ```json { "mcpServers": { "context7": { "command": "deno", "args": [ "run", "--allow-env=NO_DEPRECATION,TRACE_DEPRECATION", "--allow-net", "npm:@upstash/context7-mcp" ] } } } ``` -------------------------------- ### Configure VS Code Local Server Source: https://github.com/jiquanzhong/context7/blob/master/docs/README.zh-CN.md JSON configuration snippet for VS Code to connect to the Context7 MCP local server. It specifies the server type, command, and arguments for local execution. ```json "mcp": { "servers": { "context7": { "type": "stdio", "command": "npx", "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"] } } } ``` -------------------------------- ### Prompt Example for PostgreSQL Script (Text) Source: https://github.com/jiquanzhong/context7/blob/master/docs/README.zh-TW.md This example shows a prompt for generating a PostgreSQL script to delete rows where the 'city' column is empty, utilizing 'use context7' for up-to-date code generation. ```text 根據 PostgreSQL 資訊,建立一個刪除 city 為 "" 的資料列的腳本。use context7 ``` -------------------------------- ### Example Prompt for PostgreSQL Data Deletion Script Source: https://github.com/jiquanzhong/context7/blob/master/docs/README.de.md An example prompt for generating a script to delete rows based on a city criterion using PostgreSQL credentials, enhanced by the 'use context7' directive for current code. ```text Erstelle ein Skript zum Löschen der Zeilen, in denen die Stadt "" ist, mit PostgreSQL-Anmeldedaten. use context7 ``` -------------------------------- ### Configure Augment Code Local Server Source: https://github.com/jiquanzhong/context7/blob/master/docs/README.zh-CN.md JSON configuration for Augment Code's advanced settings to add the Context7 MCP local server. It specifies the command and arguments for execution. ```json "augment.advanced": { "mcpServers": [ { "name": "context7", "command": "npx", "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"] } ] } ``` -------------------------------- ### Configure Windsurf Remote Server Source: https://github.com/jiquanzhong/context7/blob/master/docs/README.zh-CN.md JSON configuration for connecting to the Context7 MCP remote server within Windsurf. This includes the server URL and API key for authentication. ```json { "mcpServers": { "context7": { "serverUrl": "https://mcp.context7.com/mcp", "headers": { "CONTEXT7_API_KEY": "YOUR_API_KEY" } } } } ``` -------------------------------- ### Configure MCP Server with stdio Transport using Bash Source: https://context7.com/jiquanzhong/context7/llms.txt Sets up the MCP server to use standard input/output for integration with editors and CLI tools. API key authentication can be managed via command-line arguments or environment variables. Examples show configuration for different environments like Claude Code and VS Code. ```bash # Start with stdio transport (default) npx @upstash/context7-mcp --transport stdio --api-key ctx7sk_your_key # Or use environment variable export CONTEXT7_API_KEY=ctx7sk_your_key npx @upstash/context7-mcp # Configuration in Claude Code claude mcp add context7 -- npx -y @upstash/context7-mcp --api-key YOUR_API_KEY # Configuration in VS Code # settings.json { "mcp": { "servers": { "context7": { "type": "stdio", "command": "npx", "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"] } } } } # Using environment variable in MCP client config { "mcpServers": { "context7": { "command": "npx", "args": ["-y", "@upstash/context7-mcp"], "env": { "CONTEXT7_API_KEY": "ctx7sk_your_key" } } } } ``` -------------------------------- ### VS Code Local Server Connection for Context7 MCP Source: https://github.com/jiquanzhong/context7/blob/master/docs/README.ko.md Configure VS Code to connect to a local Context7 MCP server using the stdio transport. This requires Node.js and npm to be installed as it utilizes npx to run the context7-mcp package. ```json { "mcp": { "servers": { "context7": { "type": "stdio", "command": "npx", "args": ["-y", "@upstash/context7-mcp"] } } } } ``` -------------------------------- ### Configure VS Code Remote Server Source: https://github.com/jiquanzhong/context7/blob/master/docs/README.zh-CN.md JSON configuration snippet for VS Code to connect to the Context7 MCP remote server. It includes the server type, URL, and authentication headers. ```json "mcp": { "servers": { "context7": { "type": "http", "url": "https://mcp.context7.com/mcp", "headers": { "CONTEXT7_API_KEY": "YOUR_API_KEY" } } } } ``` -------------------------------- ### Add Context7 MCP Server via Augment Code UI Source: https://github.com/jiquanzhong/context7/blob/master/docs/README.ko.md This is the command to input into the Augment Code UI when adding a new MCP server. It specifies the npm package to install and run for the Context7 MCP server. ```sh npx -y @upstash/context7-mcp@latest ``` -------------------------------- ### Prompting with Context7 MCP in Cursor Source: https://github.com/jiquanzhong/context7/blob/master/docs/README.zh-CN.md Demonstrates how to use Context7 MCP within the Cursor IDE by simply appending 'use context7' to your natural language prompts. This allows the LLM to fetch relevant, up-to-date information for the requested task. ```text Create a basic Next.js project using the app router. Use context7 ``` ```text Create a script to delete rows in a PostgreSQL database where the city field is "". Use context7 ``` -------------------------------- ### Configure Context7 MCP Server in Opencode Source: https://github.com/jiquanzhong/context7/blob/master/docs/README.zh-CN.md This snippet shows how to configure the Context7 MCP server within Opencode. It supports both remote connections via URL and local connections using a command-line execution. The configuration includes specifying the type, URL/command, headers (for remote), and an enabled flag. ```json { "mcp": { "context7": { "type": "remote", "url": "https://mcp.context7.com/mcp", "headers": { "CONTEXT7_API_KEY": "YOUR_API_KEY" }, "enabled": true } } } ``` ```json { "mcp": { "context7": { "type": "local", "command": ["npx", "-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"], "enabled": true } } } ``` -------------------------------- ### Configure Context7 MCP Server in Kiro Source: https://github.com/jiquanzhong/context7/blob/master/docs/README.zh-CN.md This JSON configuration is for adding the Context7 MCP server in Kiro. It includes the command for local execution, arguments, an empty environment object, and sets the server to be enabled and not disabled. ```json { "mcpServers": { "Context7": { "command": "npx", "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"], "env": {}, "disabled": false, "autoApprove": [] } } } ``` -------------------------------- ### Visual Studio 2022 Remote and Local Server Configuration for Context7 MCP Source: https://github.com/jiquanzhong/context7/blob/master/docs/README.ko.md Setup Visual Studio 2022 to connect to Context7 MCP servers. It supports both remote HTTP connections and local stdio connections, allowing flexibility in development workflows. ```json { "mcp": { "servers": { "context7": { "type": "http", "url": "https://mcp.context7.com/mcp" } } } } ``` ```json { "mcp": { "servers": { "context7": { "type": "stdio", "command": "npx", "args": ["-y", "@upstash/context7-mcp"] } } } } ``` -------------------------------- ### Run Context7 MCP with HTTP Transport (Bash) Source: https://github.com/jiquanzhong/context7/blob/master/README.md This bash command runs the Context7 MCP server using HTTP transport on a specified port (8080). It also includes an API key for authentication, demonstrating a typical production or testing setup. ```bash bun run dist/index.js --transport http --port 8080 ``` -------------------------------- ### Resolve Library ID using MCP Client Source: https://context7.com/jiquanzhong/context7/llms.txt This TypeScript example demonstrates how to use an MCP client to call the `resolve-library-id` tool. It takes a library name as input and returns a list of matching libraries with their metadata. This is typically the first step before retrieving detailed documentation. ```typescript const result = await mcpClient.callTool('resolve-library-id', { libraryName: 'next.js' }); // Expected response format { content: [ { type: "text", text: `Available Libraries (top matches): - Title: Next.js - Context7-compatible library ID: /vercel/next.js - Description: The React Framework for Production - Code Snippets: 1250 - Trust Score: 10 - Versions: v14.3.0-canary.87, v14.2.0, v13.5.0 ---------- - Title: Next.js Documentation - Context7-compatible library ID: /vercel/next.js-docs - Description: Official Next.js documentation - Code Snippets: 890 - Trust Score: 10` } ] } ``` -------------------------------- ### Configure Proxy Settings using Bash Source: https://context7.com/jiquanzhong/context7/llms.txt Enables automatic detection and use of HTTP/HTTPS proxy settings from environment variables for the MCP server. This configuration is compatible with standard proxy environment variable naming conventions, ensuring seamless integration with existing network setups. ```bash # Set proxy environment variables before starting server export HTTPS_PROXY=http://proxy.company.com:8080 export https_proxy=http://proxy.company.com:8080 export HTTP_PROXY=http://proxy.company.com:8080 export http_proxy=http://proxy.company.com:8080 # Start server (proxy will be automatically detected) npx @upstash/context7-mcp --transport http --port 3000 # Proxy is configured at startup using undici's ProxyAgent # All fetch() calls will automatically route through the proxy # MCP client configuration with proxy { "mcpServers": { "context7": { "command": "npx", "args": ["-y", "@upstash/context7-mcp"], "env": { "HTTPS_PROXY": "http://proxy.company.com:8080", "CONTEXT7_API_KEY": "ctx7sk_your_key" } } } } ``` -------------------------------- ### Claude Code Remote Server Connection for Context7 MCP Source: https://github.com/jiquanzhong/context7/blob/master/docs/README.ko.md Connect Claude Code to the Context7 MCP server using either HTTP or SSE transport. This command-line setup allows for quick integration of Context7's capabilities into the Claude development environment. ```sh claude mcp add --transport http context7 https://mcp.context7.com/mcp ``` ```sh claude mcp add --transport sse context7 https://mcp.context7.com/sse ``` -------------------------------- ### Utilisation de Context7 dans un prompt Source: https://github.com/jiquanzhong/context7/blob/master/docs/README.fr.md Exemples de prompts montrant comment intégrer Context7 pour obtenir des réponses de code à jour des LLMs. L'ajout de 'use context7' à votre prompt permet à l'outil de récupérer la documentation pertinente. ```txt Crée un projet Next.js basique avec app router. use context7 ``` ```txt Crée un script pour supprimer les lignes où la ville est "" avec des identifiants PostgreSQL. use context7 ``` -------------------------------- ### Configuration de Context7 MCP pour Zed (JSON) Source: https://github.com/jiquanzhong/context7/blob/master/docs/README.fr.md Configuration JSON à ajouter au fichier `settings.json` de Zed pour intégrer Context7 MCP en tant que serveur de contexte. Cela permet à Zed d'utiliser Context7 pour enrichir le contexte des requêtes. ```json { "context_servers": { "Context7": { "command": { "path": "npx", "args": ["-y", "@upstash/context7-mcp@latest"] }, "settings": {} } } } ``` -------------------------------- ### Configure Context7 Server for OpenAI Codex (TOML) Source: https://github.com/jiquanzhong/context7/blob/master/README.md This TOML configuration is for setting up the Context7 MCP server within OpenAI Codex. It defines the command to be executed ('npx'), its arguments including the API key, and a startup timeout. It also includes optional troubleshooting steps for Windows and macOS. ```toml [mcp_servers.context7] args = ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"] command = "npx" startup_timeout_ms = 20_000 ``` ```toml [mcp_servers.context7] command = "C:\\Users\\yourname\\AppData\\Roaming\\npm\\npx.cmd" args = [ "-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY" ] env = { SystemRoot="C:\\Windows", APPDATA="C:\\Users\\yourname\\AppData\\Roaming" } startup_timeout_ms = 40_000 ``` ```toml [mcp_servers.context7] command = "/Users/yourname/.nvm/versions/node/v22.14.0/bin/node" args = ["/Users/yourname/.nvm/versions/node/v22.14.0/lib/node_modules/@upstash/context7-mcp/dist/index.js", "--transport", "stdio", "--api-key", "YOUR_API_KEY" ] ``` -------------------------------- ### Configure Context7 MCP Server on Windows using NPX Source: https://github.com/jiquanzhong/context7/blob/master/docs/README.ko.md This JSON configuration is for setting up the Context7 MCP server on Windows, specifically for use with Cline. It uses 'cmd' to execute 'npx' with the necessary arguments. ```json { "mcpServers": { "github.com/upstash/context7-mcp": { "command": "cmd", "args": ["/c", "npx", "-y", "@upstash/context7-mcp@latest"], "disabled": false, "autoApprove": [] } } } ``` -------------------------------- ### Configure Context7 MCP in Cursor IDE with Bun Source: https://github.com/jiquanzhong/context7/blob/master/docs/README.de.md An alternative configuration for Cursor IDE using Bun as the package runtime. This JSON snippet specifies the command and arguments for running Context7 MCP with Bun. ```json { "mcpServers": { "context7": { "command": "bunx", "args": ["-y", "@upstash/context7-mcp@latest"] } } } ``` -------------------------------- ### Configure Amp for Context7 Server Connection (Basic) Source: https://github.com/jiquanzhong/context7/blob/master/README.md Adds the Context7 MCP server to Amp for basic usage without requiring an API key. This is suitable for general use cases where higher rate limits are not critical. ```sh amp mcp add context7 https://mcp.context7.com/mcp ``` -------------------------------- ### Add New Version to context7.json Source: https://github.com/jiquanzhong/context7/blob/master/docs/adding-projects.md Demonstrates how to update the `previousVersions` array in the `context7.json` file to include a new version of a library. The `tag` field must precisely match a Git tag. ```json { "previousVersions": [ { "tag": "v2.0.0", "title": "version 2.0.0" } ] } ``` -------------------------------- ### Configure Context7 MCP Server in Claude Desktop Source: https://github.com/jiquanzhong/context7/blob/master/docs/README.ko.md Add this JSON configuration to 'claude_desktop_config.json' in Claude Desktop to register the Context7 MCP server. It specifies the command and arguments needed to run the server. ```json { "mcpServers": { "Context7": { "command": "npx", "args": ["-y", "@upstash/context7-mcp"] } } } ``` -------------------------------- ### MCP Tool: get-library-docs Source: https://context7.com/jiquanzhong/context7/llms.txt Fetches up-to-date documentation for a specific library using its Context7-compatible library ID. Supports optional topic filtering and token limits. ```APIDOC ## MCP Tool: get-library-docs ### Description Fetches up-to-date documentation for a specific library using its Context7-compatible library ID. Supports optional topic filtering and token limits to control response size. Returns formatted documentation with code examples, API references, and integration patterns. ### Method POST (implied by `callTool`) ### Endpoint Not directly exposed as an HTTP endpoint; used via MCP client. ### Parameters #### Request Body - **context7CompatibleLibraryID** (string) - Required - The Context7-compatible ID of the library. - **topic** (string) - Optional - Filters documentation to a specific topic. - **tokens** (integer) - Optional - Limits the response size in tokens. ### Request Example ```typescript const docs = await mcpClient.callTool('get-library-docs', { context7CompatibleLibraryID: '/vercel/next.js', topic: 'routing', tokens: 5000 }); ``` ### Response #### Success Response - **content** (array) - Contains the documentation. - **type** (string) - 'text' - **text** (string) - Formatted documentation including code examples, API references, and integration patterns. #### Response Example ```json { "content": [ { "type": "text", "text": "# Next.js Routing Documentation\n\n## App Router\nThe App Router uses a file-system based routing mechanism...\n\n### Dynamic Routes\n// Example: app/blog/[slug]/page.tsx\nexport default function Page({ params }: { params: { slug: string } }) {\n return
Post: {params.slug}
\n}\n\n### Route Groups\n// Example: app/(marketing)/about/page.tsx\n..." } ] } ``` #### Error Response Example (Documentation not found) ```json { "content": [ { "type": "text", "text": "Documentation not found or not finalized for this library..." } ] } ``` ``` -------------------------------- ### Fetch Library Documentation API Source: https://context7.com/jiquanzhong/context7/llms.txt Retrieves the documentation content for a specified library using its ID. Supports optional parameters for token limits, topic filtering, client IP, and API key. ```APIDOC ## GET /jiquanzhong/context7/library/documentation ### Description Retrieves the actual documentation content for a library by its ID. Supports optional parameters for token limits and topic filtering. Returns plain text documentation or error messages. ### Method GET ### Endpoint /jiquanzhong/context7/library/documentation ### Parameters #### Query Parameters - **libraryId** (string) - Required - The unique identifier for the library. - **tokens** (integer) - Optional - The maximum number of tokens to return in the documentation. - **topic** (string) - Optional - Filters the documentation to a specific topic. #### Headers - **X-Client-IP** (string) - Optional - The IP address of the client making the request. - **Authorization** (string) - Optional - The API key for authentication (e.g., "Bearer ctx7sk_abc123..."). ### Request Example ``` GET /jiquanzhong/context7/library/documentation?libraryId=/mongodb/docs&tokens=3000&topic=aggregation \ -H "X-Client-IP: 203.0.113.42" \ -H "Authorization: Bearer ctx7sk_abc123..." ``` ### Response #### Success Response (200) - **documentation** (string) - The plain text documentation content. #### Response Example ```text # MongoDB Aggregation Framework The aggregation framework provides powerful data processing... ## Basic Pipeline Stages db.collection.aggregate([ { $match: { status: "active" } }, { $group: { _id: "$category", total: { $sum: "$amount" } } }, { $sort: { total: -1 } } ]) ## Common Operators - $match: Filters documents - $group: Groups documents by expression - $project: Reshapes documents... ``` #### Error Responses - **404 Not Found**: "The library you are trying to access does not exist. Please try with a different library ID." - **429 Too Many Requests**: "Rate limited due to too many requests. Please try again later." - **204 No Content**: null (if no content is available) ``` -------------------------------- ### Configure Amp for Context7 Server Connection (With API Key) Source: https://github.com/jiquanzhong/context7/blob/master/README.md Adds the Context7 MCP server to Amp, including the API key. This configuration enables higher rate limits and access to private repositories. ```sh amp mcp add context7 --header "CONTEXT7_API_KEY=YOUR_API_KEY" https://mcp.context7.com/mcp ``` -------------------------------- ### Stdio Server Configuration Source: https://context7.com/jiquanzhong/context7/llms.txt Configures the MCP server to run over standard input/output (stdio), suitable for direct integration with editors and CLI tools. Supports API key authentication via command-line arguments or environment variables. ```APIDOC ## MCP Server Configuration: stdio Transport ### Description Configures the MCP server to run over standard input/output, suitable for direct integration with editors and CLI tools. Supports API key authentication via command-line arguments or environment variables. ### Method (Server Start Command) ### Endpoint (N/A - communicates via stdin/stdout) ### Parameters #### Command Line Arguments - **--transport** (string) - Optional - Set to 'stdio' (default). - **--api-key** (string) - Optional - The API key for authentication. #### Environment Variables - **CONTEXT7_API_KEY** (string) - Optional - The API key for authentication. ### Request Example (Starting Server) ```bash # Start with stdio transport (default) npx @upstash/context7-mcp --transport stdio --api-key ctx7sk_your_key # Or use environment variable export CONTEXT7_API_KEY=ctx7sk_your_key npx @upstash/context7-mcp ``` ### Request Example (VS Code Configuration) ```json { "mcp": { "servers": { "context7": { "type": "stdio", "command": "npx", "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"] } } } } ``` ### Request Example (MCP Client Configuration with Environment Variable) ```json { "mcpServers": { "context7": { "command": "npx", "args": ["-y", "@upstash/context7-mcp"], "env": { "CONTEXT7_API_KEY": "ctx7sk_your_key" } } } } ``` ``` -------------------------------- ### Configure Context7 MCP in Program Source: https://github.com/jiquanzhong/context7/blob/master/README.md This JSON configuration enables the Context7 MCP server within the 'Program' environment. It specifies the command to run the Context7 MCP agent and requires a unique API key. ```json { "mcpServers": { "Context7": { "command": "npx", "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"] } } } ``` -------------------------------- ### Zed Editor Context Server Configuration for Context7 Source: https://github.com/jiquanzhong/context7/blob/master/docs/README.ko.md Integrate Context7 as a context server in the Zed editor. This configuration uses the command line to execute npx and the @upstash/context7-mcp package, enabling enhanced code assistance. ```json { "context_servers": { "Context7": { "command": { "path": "npx", "args": ["-y", "@upstash/context7-mcp"] }, "settings": {} } } } ``` -------------------------------- ### Add Context7 MCP Server via Command Line Source: https://github.com/jiquanzhong/context7/blob/master/docs/README.ko.md This command adds the Context7 MCP server using the 'claude' CLI tool, ensuring integration with the specified npm package. ```sh claude mcp add context7 -- npx -y @upstash/context7-mcp ``` -------------------------------- ### Configure Context7 MCP Server in BoltAI Source: https://github.com/jiquanzhong/context7/blob/master/docs/README.ko.md Input this JSON into the 'plugins' section of BoltAI's settings to configure the Context7 MCP server. This enables features like 'get-library-docs' and 'resolve-library-id'. ```json { "mcpServers": { "context7": { "command": "npx", "args": ["-y", "@upstash/context7-mcp"] } } } ``` -------------------------------- ### Gemini CLI Remote and Local Server Configuration for Context7 MCP Source: https://github.com/jiquanzhong/context7/blob/master/docs/README.ko.md Configure the Gemini CLI to connect to Context7 MCP servers. Supports both remote HTTP URLs and local server execution via npx, facilitating integration with Google's Gemini models. ```json { "mcpServers": { "context7": { "httpUrl": "https://mcp.context7.com/mcp" } } } ``` ```json { "mcpServers": { "context7": { "command": "npx", "args": ["-y", "@upstash/context7-mcp"] } } } ``` -------------------------------- ### Configure Zed Local MCP Server Source: https://github.com/jiquanzhong/context7/blob/master/README.md This JSON configuration sets up Context7 as a custom context server in Zed. It uses npx to run the Context7 MCP command and requires an API key. ```json { "context_servers": { "Context7": { "source": "custom", "command": "npx", "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"] } } } ``` -------------------------------- ### Configure Opencode Context7 Remote Server Source: https://github.com/jiquanzhong/context7/blob/master/README.md This configuration snippet is specifically for Opencode, detailing how to set up a remote connection to the Context7 MCP server. It includes the server URL, API key header, and an enablement flag. ```json { "mcp": { "context7": { "type": "remote", "url": "https://mcp.context7.com/mcp", "headers": { "CONTEXT7_API_KEY": "YOUR_API_KEY" }, "enabled": true } } } ``` -------------------------------- ### Configure Context7 MCP for Cursor (JSON) Source: https://github.com/jiquanzhong/context7/blob/master/docs/README.zh-TW.md These JSON configurations allow Cursor to connect to the Context7 MCP server, either remotely via a URL or locally via a command. This enables Cursor to fetch real-time documentation within its IDE. ```json { "mcpServers": { "context7": { "url": "https://mcp.context7.com/mcp" } } } ``` ```json { "mcpServers": { "context7": { "command": "npx", "args": ["-y", "@upstash/context7-mcp"] } } } ``` ```json { "mcpServers": { "context7": { "command": "bunx", "args": ["-y", "@upstash/context7-mcp"] } } } ``` ```json { "mcpServers": { "context7": { "command": "deno", "args": ["run", "--allow-env", "--allow-net", "npm:@upstash/context7-mcp"] } } } ``` -------------------------------- ### Configure Context7 MCP for Trae (JSON) Source: https://github.com/jiquanzhong/context7/blob/master/docs/README.zh-TW.md These JSON configurations are used to manually add the Context7 MCP server to Trae. They include options for both remote URL connections and local command execution. ```json { "mcpServers": { "context7": { "url": "https://mcp.context7.com/mcp" } } } ``` ```json { "mcpServers": { "context7": { "command": "npx", "args": ["-y", "@upstash/context7-mcp"] } } } ``` -------------------------------- ### Cline Remote Server Configuration with API Key Source: https://github.com/jiquanzhong/context7/blob/master/docs/README.zh-TW.md Configuration for Cline to connect to the Context7 MCP server using streamable HTTP. It includes a placeholder for an API key, essential for authentication. ```json { "mcpServers": { "context7": { "url": "https://mcp.context7.com/mcp", "type": "streamableHttp", "headers": { "Authorization": "Bearer YOUR_API_KEY" } } } } ``` -------------------------------- ### Configure Context7 MCP in Cursor IDE with Deno Source: https://github.com/jiquanzhong/context7/blob/master/docs/README.de.md An alternative configuration for Cursor IDE using Deno as the runtime. This JSON snippet outlines how to configure Context7 MCP to run with Deno, including necessary permissions. ```json { "mcpServers": { "context7": { "command": "deno", "args": ["run", "--allow-net", "npm:@upstash/context7-mcp"] } } } ``` -------------------------------- ### Configure MCP Client to Use Dockerized Context7 MCP Server Source: https://github.com/jiquanzhong/context7/blob/master/docs/README.ko.md This JSON configuration snippet shows how to set up an MCP client to use a Docker containerized Context7 MCP server. It specifies Docker as the command and provides arguments for running the image. ```json { "mcpServers": { "Сontext7": { "autoApprove": [], "disabled": false, "timeout": 60, "command": "docker", "args": ["run", "-i", "--rm", "context7-mcp"], "transportType": "stdio" } } } ``` -------------------------------- ### Configure Context7 Remote Server in Visual Studio 2022 Source: https://github.com/jiquanzhong/context7/blob/master/README.md This JSON configuration sets up a remote HTTP connection to the Context7 MCP server for Visual Studio 2022. It includes the server URL and requires an API key in the headers. ```json { "inputs": [], "servers": { "context7": { "type": "http", "url": "https://mcp.context7.com/mcp", "headers": { "CONTEXT7_API_KEY": "YOUR_API_KEY" } } } } ``` -------------------------------- ### Fetch Library Documentation using TypeScript Source: https://context7.com/jiquanzhong/context7/llms.txt This function retrieves documentation content for a library using its ID. It supports optional token limits, topic filtering, and client IP addresses. It returns plain text documentation or specific error messages for non-existent libraries or rate limiting. ```typescript import { fetchLibraryDocumentation } from './lib/api.js'; // Fetch documentation with options const docs = await fetchLibraryDocumentation( '/mongodb/docs', { tokens: 3000, topic: 'aggregation' }, '203.0.113.42', // Optional client IP 'ctx7sk_abc123...' // Optional API key ); // Successful response (string) `# MongoDB Aggregation Framework The aggregation framework provides powerful data processing... ## Basic Pipeline Stages db.collection.aggregate([ { $match: { status: "active" } }, { $group: { _id: "$category", total: { $sum: "$amount" } } }, { $sort: { total: -1 } } ]) ## Common Operators - $match: Filters documents - $group: Groups documents by expression - $project: Reshapes documents...` // 404 error "The library you are trying to access does not exist. Please try with a different library ID." // 429 rate limit error "Rate limited due to too many requests. Please try again later." // No content available null ``` -------------------------------- ### Default Excluded Folders for Context7 Parsing Source: https://github.com/jiquanzhong/context7/blob/master/docs/adding-projects.md This list outlines default folder exclusion patterns used by Context7 to prevent irrelevant content from being parsed as documentation. It targets archives, old versions, deprecated code, and internationalization folders to streamline the documentation context. ```text *archive*, *archived*, old, docs/old, *deprecated*, *legacy* *previous*, *outdated*, *superseded* i18n/zh*, i18n/es*, i18n/fr*, i18n/de*, i18n/ja*, i18n/ko* i18n/ru*, i18n/pt*, i18n/it*, i18n/ar*, i18n/hi*, i18n/tr* i18n/nl*, i18n/pl*, i18n/sv*, i18n/vi*, i18n/th* zh-cn, zh-tw, zh-hk, zh-mo, zh-sg ```