### Local Context7 MCP Configuration Example Source: https://github.com/nyepppp/context7/blob/master/README.md Example of local configuration for the Context7 MCP server, specifying the command and arguments for local execution. ```json { "mcpServers": { "context7": { "command": "npx", "args": ["tsx", "/path/to/folder/context7/src/index.ts", "--api-key", "YOUR_API_KEY"] } } } ``` -------------------------------- ### Context7 MCP Development Setup Source: https://github.com/nyepppp/context7/blob/master/README.md Bash commands for setting up and building the Context7 MCP project. Includes installing dependencies, building the project, and running the server. ```bash bun i bun run build bun run dist/index.js ``` -------------------------------- ### Context7 MCP CLI Arguments Example Source: https://github.com/nyepppp/context7/blob/master/README.md Examples of running the Context7 MCP server with different transport methods and ports using CLI arguments. ```bash bun run dist/index.js --transport http --port 8080 bun run dist/index.js --transport stdio --api-key YOUR_API_KEY ``` -------------------------------- ### Install Perplexity Desktop Connector Source: https://github.com/nyepppp/context7/blob/master/README.md JSON configuration for installing the Context7 MCP connector in Perplexity Desktop. It specifies the command to run and arguments including the package to install and an API key. ```json { "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"], "command": "npx", "env": {} } ``` -------------------------------- ### Install Context7 MCP Server in Amp (Basic) Source: https://github.com/nyepppp/context7/blob/master/README.md Adds the Context7 MCP server to Amp for basic usage without an API key. This command registers the server with its default URL. ```sh amp mcp add context7 https://mcp.context7.com/mcp ``` -------------------------------- ### Configure Context7 MCP for LM Studio (Local) Source: https://github.com/nyepppp/context7/blob/master/README.md This configuration allows you to set up the Context7 MCP server for local execution within LM Studio. It specifies the command to run (`npx`) and the necessary arguments to install and execute the `@upstash/context7-mcp` package. ```json { "mcpServers": { "Context7": { "command": "npx", "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"] } } } ``` -------------------------------- ### Install Context7 MCP Server in Amp (With API Key) Source: https://github.com/nyepppp/context7/blob/master/README.md Configures Amp to use the Context7 MCP server with an API key. This enables higher rate limits and access to private repositories by including the API key in the headers. ```sh amp mcp add context7 --header "CONTEXT7_API_KEY=YOUR_API_KEY" https://mcp.context7.com/mcp ``` -------------------------------- ### JSON: Configure Windows MCP Client for Context7 Source: https://github.com/nyepppp/context7/blob/master/README.md Configuration for Windows environments using 'cmd' to execute the Context7 MCP server via npx. This is an example for a Cline MCP client, demonstrating how to set the command and arguments. ```json { "mcpServers": { "github.com/upstash/context7-mcp": { "command": "cmd", "args": ["/c", "npx", "-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"], "disabled": false, "autoApprove": [] } } } ``` -------------------------------- ### CLI Usage: Local Server (Bash) Source: https://context7.com/nyepppp/context7/llms.txt Provides bash commands for installing and running the context7 MCP server locally using the stdio transport. It covers global installation, running with default settings, API key authentication, and execution with different package managers like npx, Bun, and Deno. Configuration examples for MCP clients like Cursor are also included. ```bash # Install globally npm install -g @upstash/context7-mcp # Run with default stdio transport context7-mcp # Run with API key for higher rate limits context7-mcp --api-key ctx7sk_your_api_key_here # Run with npx (no installation) npx -y @upstash/context7-mcp --api-key ctx7sk_your_key # Use with Bun bunx -y @upstash/context7-mcp --api-key ctx7sk_your_key # Use with Deno den o run --allow-env=NO_DEPRECATION,TRACE_DEPRECATION \ --allow-net npm:@upstash/context7-mcp --api-key ctx7sk_your_key # Configure in MCP client (Cursor example) { "mcpServers": { "context7": { "command": "npx", "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_KEY"] } } } ``` -------------------------------- ### Dockerfile for Context7 MCP Server Source: https://github.com/nyepppp/context7/blob/master/docs/README.pt-BR.md This Dockerfile is used to build a Docker image for running the Context7 MCP server. It installs the server globally using npm and sets the default command to start the server. ```Dockerfile FROM node:18-alpine WORKDIR /app # Instalar a versão mais recente globalmente RUN npm install -g @upstash/context7-mcp # Expor porta padrão se necessário (opcional, depende da interação do cliente MCP) # EXPOSE 3000 # Comando padrão para rodar o servidor CMD ["context7-mcp"] ``` -------------------------------- ### Dockerfile: Build Context7 MCP Server Image Source: https://github.com/nyepppp/context7/blob/master/README.md A Dockerfile to create a container image for the Context7 MCP server. This allows for consistent deployment across different environments by encapsulating the server and its dependencies. ```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 for Zencoder (Local) Source: https://github.com/nyepppp/context7/blob/master/README.md This JSON configuration is for setting up the Context7 MCP server locally within Zencoder. It specifies the `npx` command and arguments to run the Context7 MCP package and requires an API key. ```json { "command": "npx", "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"] } ``` -------------------------------- ### Development and Testing Setup (Bash) Source: https://context7.com/nyepppp/context7/llms.txt Details the steps for setting up a local development environment for context7, including cloning the repository, installing dependencies with Bun, building the TypeScript code, and running the server with hot reload and debugging capabilities. Commands for formatting, linting, and type checking are also included, along with MCP Inspector integration. ```bash # Clone repository git clone https://github.com/upstash/context7.git cd context7 # Install dependencies bun install # Build TypeScript bun run build # Run built server bun run dist/index.js --transport stdio --api-key ctx7sk_test # Run on custom port bun run dist/index.js --transport http --port 9000 # Test with MCP Inspector npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp # Configure local development in MCP client { "mcpServers": { "context7-dev": { "command": "npx", "args": ["tsx", "/path/to/context7/src/index.ts", "--api-key", "ctx7sk_dev"] } } } # Format code bun run format # Lint code bun run lint # Type check bun run typecheck ``` -------------------------------- ### Testing Context7 MCP with Inspector Source: https://github.com/nyepppp/context7/blob/master/README.md Bash command to test the Context7 MCP using the MCP Inspector tool. ```bash npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp ``` -------------------------------- ### Configure OpenAI Codex Local Server (Windows - CMD) Source: https://github.com/nyepppp/context7/blob/master/README.md This TOML configuration provides an alternative for Windows users experiencing timeouts, by using the command prompt (`cmd`) to execute the Context7 MCP server. It includes specific arguments, environment variables, and a startup timeout. Replace 'YOUR_API_KEY' with your actual API key. ```toml [mcp_servers.context7] command = "cmd" args = [ "/c", "npx", "-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY" ] env = { SystemRoot="C:\\Windows" } startup_timeout_ms = 20000 ``` -------------------------------- ### Smithery CLI Installation for Context7 MCP Source: https://github.com/nyepppp/context7/blob/master/docs/README.zh-CN.md Command to automatically install the Context7 MCP server using the Smithery CLI. This requires the client name and a Smithery key. ```bash npx -y @smithery/cli@latest install @upstash/context7-mcp --client --key ``` -------------------------------- ### Configure Context7 MCP for Crush (Local) Source: https://github.com/nyepppp/context7/blob/master/README.md This JSON configuration sets up a local Context7 MCP server connection within Crush. It utilizes `npx` to execute the Context7 MCP package locally. ```json { "$schema": "https://charm.land/crush.json", "mcp": { "context7": { "type": "stdio", "command": "npx", "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"] } } } ``` -------------------------------- ### Configure Zed Local Server Connection for Context7 Source: https://github.com/nyepppp/context7/blob/master/README.md This JSON configuration adds Context7 as a custom context server in Zed. It uses `npx` to run the local server and requires your API key. Replace 'YOUR_API_KEY' with your actual API key. ```json { "context_servers": { "Context7": { "source": "custom", "command": "npx", "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"] } } } ``` -------------------------------- ### Installing Context7 MCP with Smithery for Claude Desktop Source: https://github.com/nyepppp/context7/blob/master/docs/README.ru.md Installs the Context7 MCP server for Claude Desktop using the Smithery CLI. This command ensures that Claude Desktop can leverage Context7's real-time data. ```bash npx -y @smithery/cli install @upstash/context7-mcp --client claude ``` -------------------------------- ### Context7 MCP Configuration with Environment Variable Source: https://github.com/nyepppp/context7/blob/master/README.md JSON configuration for the Context7 MCP server using environment variables for the API key. This is useful for secure storage in .env files. ```json { "mcpServers": { "context7": { "command": "npx", "args": ["-y", "@upstash/context7-mcp"], "env": { "CONTEXT7_API_KEY": "YOUR_API_KEY" } } } } ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/nyepppp/context7/blob/master/docs/README.ko.md Command to install project dependencies using Bun. ```bash bun i ``` -------------------------------- ### JSON: Configure Copilot Coding Agent for Context7 Source: https://github.com/nyepppp/context7/blob/master/README.md Configuration for integrating the Context7 MCP server with Copilot Coding Agent. This specifies an HTTP type connection, the server URL, API key header, and 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"] } } } ``` -------------------------------- ### Example Prompt for Next.js Project Creation Source: https://github.com/nyepppp/context7/blob/master/docs/README.es.md An example prompt to be used with an MCP-enabled client (like Cursor) to generate a basic Next.js project with the app router. It includes the 'use context7' directive to leverage Context7 MCP. ```txt Crea un proyecto básico de Next.js con app router. use context7 ``` -------------------------------- ### Example Prompt for Next.js Project Generation Source: https://github.com/nyepppp/context7/blob/master/docs/README.de.md An example natural language prompt demonstrating how to instruct an LLM to create a Next.js project using the App Router, while also invoking Context7 MCP for up-to-date information. ```text Erstelle ein einfaches Next.js-Projekt mit dem App Router. use context7 ``` -------------------------------- ### Configure OpenAI Codex Local Server (Windows - Node.js Path) Source: https://github.com/nyepppp/context7/blob/master/README.md This TOML configuration addresses potential timeouts on Windows by explicitly specifying the full path to Node.js and the Context7 MCP package. Replace placeholders with your actual paths and API key. This ensures reliable operation on Windows. ```toml [mcp_servers.context7] command = "C:\\Program Files\\nodejs\\node.exe" args = [ "C:\\Users\\yourname\\AppData\\Roaming\\npm\\node_modules\\@upstash\\context7-mcp\\dist\\index.js", "--transport", "stdio", "--api-key", "YOUR_API_KEY" ] ``` -------------------------------- ### CLI Usage: HTTP Server (Bash) Source: https://context7.com/nyepppp/context7/llms.txt Shows bash commands for launching the context7 MCP server with an HTTP transport on a specified port. It details how to start the server, configure custom ports, and lists the available HTTP endpoints. Client configuration for remote connections and an example using curl are also provided. ```bash # Start HTTP server on default port 3000 context7-mcp --transport http # Start on custom port context7-mcp --transport http --port 8080 # Server provides multiple endpoints: # - POST /mcp (streamable HTTP) # - GET /sse (server-sent events) # - POST /messages (SSE message posting) # - GET /ping (health check) # Configure remote connection in MCP client { "mcpServers": { "context7": { "url": "http://localhost:8080/mcp", "headers": { "CONTEXT7_API_KEY": "YOUR_KEY" } } } } # Connect via curl curl -X POST http://localhost:8080/mcp \ -H "Content-Type: application/json" \ -H "CONTEXT7_API_KEY: ctx7sk_key" \ -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' ``` -------------------------------- ### Install Context7 MCP Server via Smithery (Bash) Source: https://github.com/nyepppp/context7/blob/master/docs/README.fr.md This command installs the Context7 MCP Server for Claude Desktop using Smithery CLI. It requires Node.js and the Smithery CLI to be installed. ```bash npx -y @smithery/cli install @upstash/context7-mcp --client claude ``` -------------------------------- ### Configure VS Code Local Server Connection for Context7 Source: https://github.com/nyepppp/context7/blob/master/README.md This configuration snippet enables a local connection to the Context7 MCP server within VS Code. It specifies the server type, command to execute, and arguments including the API key. Ensure you replace 'YOUR_API_KEY' with your actual API key. ```json { "mcp": { "servers": { "context7": { "type": "stdio", "command": "npx", "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"] } } } } ``` -------------------------------- ### Configure Gemini CLI Remote Server Connection for Context7 Source: https://github.com/nyepppp/context7/blob/master/README.md This configuration sets up a remote connection to the Context7 MCP server for Gemini CLI. It includes the HTTP URL and necessary headers, including the API key. Replace 'YOUR_API_KEY' with your actual API key. ```json { "mcpServers": { "context7": { "httpUrl": "https://mcp.context7.com/mcp", "headers": { "CONTEXT7_API_KEY": "YOUR_API_KEY", "Accept": "application/json, text/event-stream" } } } } ``` -------------------------------- ### Configure Context7 MCP in Crush (JSON) Source: https://github.com/nyepppp/context7/blob/master/docs/README.pt-BR.md Configuration examples for integrating Context7 MCP with Crush. This includes settings for remote HTTP, remote SSE, and local stdio connections. Refer to the Crush MCP docs for more details on setup. ```json { "$schema": "https://charm.land/crush.json", "mcp": { "context7": { "type": "http", "url": "https://mcp.context7.com/mcp" } } } ``` ```json { "$schema": "https://charm.land/crush.json", "mcp": { "context7": { "type": "sse", "url": "https://mcp.context7.com/sse" } } } ``` ```json { "$schema": "https://charm.land/crush.json", "mcp": { "context7": { "type": "stdio", "command": "npx", "args": ["-y", "@upstash/context7-mcp"] } } } ``` -------------------------------- ### Install Context7 MCP in Visual Studio 2022 (JSON) Source: https://github.com/nyepppp/context7/blob/master/docs/README.pt-BR.md Configuration for installing the Context7 MCP server in Visual Studio 2022. This snippet shows both the remote HTTP connection and the local stdio connection methods. Ensure to follow Visual Studio's MCP Servers documentation for detailed steps. ```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"] } } } } ``` -------------------------------- ### Install Context7 MCP using LM Studio Deeplink Source: https://github.com/nyepppp/context7/blob/master/docs/README.zh-TW.md This is a deeplink generated for LM Studio to automatically install the Context7 MCP server. Clicking the provided SVG link will initiate the installation process within LM Studio. This is the quickest method if available. ```html Install Context7 MCP Server into LM Studio ``` -------------------------------- ### Install Context7 MCP Server on Windows with npx Source: https://github.com/nyepppp/context7/blob/master/docs/README.pt-BR.md This JSON configuration is for installing and running the Context7 MCP server on Windows using npx. It uses the 'cmd' shell to execute the npx command with the specified package. ```json { "mcpServers": { "github.com/upstash/context7-mcp": { "command": "cmd", "args": ["/c", "npx", "-y", "@upstash/context7-mcp"], "disabled": false, "autoApprove": [] } } } ``` -------------------------------- ### Configure Kiro Local Server Source: https://github.com/nyepppp/context7/blob/master/README.md This JSON configuration is for adding a Context7 MCP server in Kiro. It defines the server details, including the command to run the local server, its arguments, and environment-specific settings like 'disabled' and 'autoApprove'. Replace 'YOUR_API_KEY' with your actual Context7 API key. ```json { "mcpServers": { "Context7": { "command": "npx", "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"], "env": {}, "disabled": false, "autoApprove": [] } } } ``` -------------------------------- ### Fetch Library Documentation with cURL Source: https://context7.com/nyepppp/context7/llms.txt This example shows how to fetch documentation for a specific library using cURL and the POST /mcp endpoint. It takes a Context7-compatible library ID, a topic, and a token limit as parameters. The response contains the documentation text, including code examples. ```bash # Example: Fetch documentation for specific library curl -X POST https://mcp.context7.com/mcp \ -H "Content-Type: application/json" \ -H "CONTEXT7_API_KEY: ctx7sk_your_api_key" \ -d '{ "jsonrpc": "2.0", "id": 2, "method": "tools/call", "params": { "name": "get-library-docs", "arguments": { "context7CompatibleLibraryID": "/vercel/next.js", "topic": "routing", "tokens": 3000 } } }' # Response contains documentation text with code examples { "jsonrpc": "2.0", "id": 2, "result": { "content": [{ "type": "text", "text": "Next.js Routing Documentation\n\n## App Router\n\n```typescript // app/page.tsx export default function Page() { return

Hello, Next.js!

} ```\n\n## Dynamic Routes\n\n```typescript // app/blog/[slug]/page.tsx export default function BlogPost({ params }: { params: { slug: string } }) { return
Post: {params.slug}
} ```\n..." }] } } ``` -------------------------------- ### Install Context7 MCP via NPX (Common) Source: https://github.com/nyepppp/context7/blob/master/docs/README.zh-TW.md This configuration uses Node Package Manager (npx) to install and run the Context7 MCP server. It's a common method used across various platforms like Zencoder, Amazon Q Developer CLI, and JetBrains IDEs. Ensure Node.js and npm are installed on your system. ```json { "mcpServers": { "context7": { "command": "npx", "args": ["-y", "@upstash/context7-mcp"] } } } ``` ```json { "mcpServers": { "context7": { "command": "npx", "args": ["-y", "@upstash/context7-mcp@latest"] } } } ``` ```json { "mcpServers": { "context7": { "command": "npx", "args": ["-y", "@upstash/context7-mcp"] } } } ``` -------------------------------- ### Configure OpenAI Codex Local Server (MacOS - Node.js Path) Source: https://github.com/nyepppp/context7/blob/master/README.md This TOML configuration is tailored for MacOS users experiencing potential timeouts. It specifies the full path to Node.js and the Context7 MCP package to ensure reliable local server execution. Replace placeholders with your actual paths and API key. ```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 for Visual Studio 2022 (Remote) Source: https://github.com/nyepppp/context7/blob/master/README.md This JSON configuration is for setting up a remote Context7 MCP server connection within Visual Studio 2022. It specifies the HTTP URL for the server and includes a header for API key authentication. ```json { "inputs": [], "servers": { "context7": { "type": "http", "url": "https://mcp.context7.com/mcp", "headers": { "CONTEXT7_API_KEY": "YOUR_API_KEY" } } } } ``` -------------------------------- ### Configure VS Code for Context7 Remote MCP Server Source: https://github.com/nyepppp/context7/blob/master/README.md Adds the Context7 MCP server configuration to VS Code for remote connections. This JSON snippet specifies the server type as 'http', the URL, and the API key in the headers. ```json { "mcp": { "servers": { "context7": { "type": "http", "url": "https://mcp.context7.com/mcp", "headers": { "CONTEXT7_API_KEY": "YOUR_API_KEY" } } } } } ``` -------------------------------- ### Configure Context7 MCP for Crush (Remote) Source: https://github.com/nyepppp/context7/blob/master/README.md This JSON snippet configures a remote Context7 MCP server connection for the Crush tool. It follows the schema for Crush MCP configurations and specifies the HTTP endpoint and API key header. ```json { "$schema": "https://charm.land/crush.json", "mcp": { "context7": { "type": "http", "url": "https://mcp.context7.com/mcp", "headers": { "CONTEXT7_API_KEY": "YOUR_API_KEY" } } } } ``` -------------------------------- ### Create MCP Server Instance (TypeScript) Source: https://context7.com/nyepppp/context7/llms.txt Demonstrates how to create and configure a context7 MCP server instance using TypeScript. It shows examples of creating servers with default settings, API keys, client IP tracking, and both IP tracking and API keys. The server automatically registers tools for library resolution and documentation retrieval. ```typescript import { createServerInstance } from "./index.js"; import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; // Create server for stdio transport const server = createServerInstance(); const transport = new StdioServerTransport(); await server.connect(transport); console.error("Server running on stdio"); // Create server with API key for authentication const authenticatedServer = createServerInstance( undefined, "ctx7sk_your_api_key" ); // Create server with client IP tracking const trackedServer = createServerInstance("203.0.113.42"); // Create server with both IP and API key const fullServer = createServerInstance( "198.51.100.10", "ctx7sk_your_api_key" ); // Server includes two registered tools: // 1. resolve-library-id - searches for libraries // 2. get-library-docs - fetches documentation // Tools are automatically available to connected MCP clients // No additional configuration needed after server creation ``` -------------------------------- ### Example LLM Prompt with Context7 Source: https://github.com/nyepppp/context7/blob/master/docs/README.pt-BR.md These examples demonstrate how to incorporate 'use context7' into your LLM prompts. By including this directive, you instruct the LLM to leverage Context7 for up-to-date information relevant to the task, such as creating a Next.js project or a database script. ```text Create a basic Next.js project with app router. use context7 ``` ```text Create a script to delete the rows where the city is "" given PostgreSQL credentials. use context7 ``` -------------------------------- ### Configure Windsurf for Context7 Remote MCP Server Source: https://github.com/nyepppp/context7/blob/master/README.md Sets up Windsurf to connect to the Context7 MCP server remotely. This JSON configuration specifies the server URL and includes headers for API key authentication. ```json { "mcpServers": { "context7": { "serverUrl": "https://mcp.context7.com/mcp", "headers": { "CONTEXT7_API_KEY": "YOUR_API_KEY" } } } } ``` -------------------------------- ### JSON: Configure Warp for Context7 MCP Server Source: https://github.com/nyepppp/context7/blob/master/README.md Configuration for adding the Context7 MCP server in Warp. This JSON object defines the command, arguments, environment variables, and other settings for the server integration within Warp's AI settings. ```json { "Context7": { "command": "npx", "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"], "env": {}, "working_directory": null, "start_on_launch": true } } ``` -------------------------------- ### Configure Augment Code Local Server Connection for Context7 Source: https://github.com/nyepppp/context7/blob/master/README.md This JSON snippet configures a local Context7 MCP server connection within Augment Code's advanced settings. It specifies the command and arguments for running the server locally, including the API key. Replace 'YOUR_API_KEY' with your actual API key. ```json { "augment.advanced": { "mcpServers": [ { "name": "context7", "command": "npx", "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"] } ] } } ``` -------------------------------- ### Install Context7 MCP in Zencoder (JSON) Source: https://github.com/nyepppp/context7/blob/master/docs/README.pt-BR.md Instructions for adding Context7 MCP as a custom MCP in Zencoder. This involves providing the command and arguments necessary to run the MCP server locally. After installation, the server can be used within Zencoder. ```json { "command": "npx", "args": ["-y", "@upstash/context7-mcp"] } ``` -------------------------------- ### Configure Opencode Remote Server Source: https://github.com/nyepppp/context7/blob/master/README.md This JSON configuration enables a remote Context7 MCP server connection in Opencode. It specifies the server URL and authentication headers, including the API key. Replace 'YOUR_API_KEY' with your actual Context7 API key. Ensure the 'enabled' flag is set to true. ```json "mcp": { "context7": { "type": "remote", "url": "https://mcp.context7.com/mcp", "headers": { "CONTEXT7_API_KEY": "YOUR_API_KEY" }, "enabled": true } } ``` -------------------------------- ### Example Prompt Usage with Context7 (Text) Source: https://github.com/nyepppp/context7/blob/master/docs/README.fr.md Examples of prompts that utilize Context7 to leverage up-to-date information for generating code. The key phrase 'use context7' signals the LLM to engage Context7. ```text Crée un projet Next.js basique avec app router. use context7 ``` ```text Crée un script pour supprimer les lignes où la ville est "" avec des identifiants PostgreSQL. use context7 ``` -------------------------------- ### Install Context7 MCP on Zencoder Source: https://github.com/nyepppp/context7/blob/master/docs/README.ko.md Instructions for installing the Context7 MCP on Zencoder. This involves navigating the Zencoder menu, selecting agent tools, and adding a custom MCP with the provided server settings. ```json { "command": "npx", "args": ["-y", "@upstash/context7-mcp@latest"] } ``` -------------------------------- ### Configure Roo Code Remote Server Connection for Context7 Source: https://github.com/nyepppp/context7/blob/master/README.md This configuration enables a remote connection to the Context7 MCP server in Roo Code, specifying the server URL and API key in the headers. Replace 'YOUR_API_KEY' with your actual API key. ```json { "mcpServers": { "context7": { "type": "streamable-http", "url": "https://mcp.context7.com/mcp", "headers": { "CONTEXT7_API_KEY": "YOUR_API_KEY" } } } } ``` -------------------------------- ### Configure Context7 Local MCP Server with npx Source: https://github.com/nyepppp/context7/blob/master/docs/README.zh-CN.md This configuration is used to set up a local Context7 MCP server using npx. It specifies the command to execute and its arguments, including the API key. This is a common setup across multiple tools. ```json { "mcpServers": { "context7": { "command": "npx", "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"] } } } ``` ```json { "mcpServers": { "context7": { "command": "npx", "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"] } } } ``` ```json { "mcpServers": { "context7": { "command": "npx", "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"] } } } ``` ```json { "mcpServers": { "context7": { "command": "npx", "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"] } } } ``` ```json { "mcpServers": { "context7": { "command": "npx", "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"] } } } ``` ```json { "mcpServers": { "Context7": { "command": "npx", "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"], "env": {}, "disabled": false, "autoApprove": [] } } } ``` ```json { "mcpServers": { "context7": { "command": "npx", "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"] } } } ``` -------------------------------- ### Example Prompt for PostgreSQL Script Generation Source: https://github.com/nyepppp/context7/blob/master/docs/README.de.md An example natural language prompt showing how to ask an LLM to generate a PostgreSQL script for deleting specific rows, using Context7 MCP to ensure accurate and current code. ```text Erstelle ein Skript zum Löschen der Zeilen, in denen die Stadt "" ist, mit PostgreSQL-Anmeldedaten. use context7 ``` -------------------------------- ### Configure Context7 MCP Server in Claude Desktop Source: https://github.com/nyepppp/context7/blob/master/docs/README.ja.md Configures the Context7 MCP server for Claude Desktop by adding an entry to the 'claude_desktop_config.json' file. This setup uses npx to run the @upstash/context7-mcp package. ```json { "mcpServers": { "Context7": { "command": "npx", "args": ["-y", "@upstash/context7-mcp"] } } } ``` -------------------------------- ### Install Context7 MCP using Claude Code CLI Source: https://github.com/nyepppp/context7/blob/master/docs/README.es.md Adds the Context7 MCP server to Claude Code using its command-line interface. This command registers the specified npm package as an MCP server. ```sh claude mcp add context7 -- npx -y @upstash/context7-mcp@latest ``` -------------------------------- ### Configure Context7 Remote MCP Server Source: https://github.com/nyepppp/context7/blob/master/docs/README.zh-CN.md This configuration establishes a connection to a remote Context7 MCP server. It requires the server URL and an API key passed via headers. This setup is applicable for tools like Gemini CLI, Claude Desktop, and Opencode. ```json { "mcpServers": { "context7": { "httpUrl": "https://mcp.context7.com/mcp", "headers": { "CONTEXT7_API_KEY": "YOUR_API_KEY" } } } } ``` ```json "mcp": { "context7": { "type": "remote", "url": "https://mcp.context7.com/mcp", "headers": { "CONTEXT7_API_KEY": "YOUR_API_KEY" }, "enabled": true } } ``` ```json { "mcpServers": { "context7": { "url": "https://mcp.context7.com/mcp" } } } ``` -------------------------------- ### Environment Variable Configuration (Bash) Source: https://context7.com/nyepppp/context7/llms.txt Illustrates how to configure the context7 MCP server using environment variables for API key and proxy settings. It includes creating a `.env` file, loading variables, and running the server. MCP client configuration examples demonstrating environment variable usage are also presented, along with a note on CLI flag precedence. ```bash # Create .env file cat > .env << 'EOF' CONTEXT7_API_KEY=ctx7sk_your_api_key_here HTTPS_PROXY=http://proxy.company.com:8080 CLIENT_IP_ENCRYPTION_KEY=000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f EOF # Load and run export $(cat .env | xargs) context7-mcp # Configure in MCP client with env vars { "mcpServers": { "context7": { "command": "npx", "args": ["-y", "@upstash/context7-mcp"], "env": { "CONTEXT7_API_KEY": "ctx7sk_your_key", "HTTPS_PROXY": "http://proxy:8080" } } } } # Note: CLI --api-key flag takes precedence over CONTEXT7_API_KEY env var context7-mcp --api-key ctx7sk_cli_key # Uses CLI key, ignores env var ``` -------------------------------- ### Install Context7 MCP on OpenAI Codex Source: https://github.com/nyepppp/context7/blob/master/docs/README.ko.md Configuration for the Context7 MCP server within OpenAI Codex using TOML format. This specifies the command and arguments for running the MCP server. ```toml [mcp_servers.context7] args = ["-y", "@upstash/context7-mcp"] command = "npx" ``` -------------------------------- ### Dockerfile for Context7 MCP Server Source: https://github.com/nyepppp/context7/blob/master/docs/README.id-ID.md A Dockerfile to build a Docker image for the Context7 MCP server. It installs the latest version globally and sets the default command to run the server. ```Dockerfile FROM node:18-alpine WORKDIR /app # Instal versi terbaru secara global RUN npm install -g @upstash/context7-mcp # Ekspor port default jika diperlukan (opsional, tergantung pada interaksi klien MCP) # EXPOSE 3000 # Perintah default untuk menjalankan server CMD ["context7-mcp"] ``` -------------------------------- ### Prompting LLMs with Context7 MCP Source: https://github.com/nyepppp/context7/blob/master/docs/README.zh-CN.md Examples of how to instruct an LLM to use Context7 for generating code or performing tasks. This involves adding 'Use context7' to the prompt. ```text Create a basic Next.js project using the app router. Use context7 ``` ```text Create a script that deletes rows in a PostgreSQL database where the city field is "". Use context7 ``` -------------------------------- ### Example Prompt for PostgreSQL Data Deletion Script Source: https://github.com/nyepppp/context7/blob/master/docs/README.es.md An example prompt to generate a script for deleting rows from a PostgreSQL database where the city field is empty. This prompt also uses the 'use context7' directive for enhanced code generation. ```txt Crea un script para eliminar las filas donde la ciudad es "" dadas las credenciales de PostgreSQL. use context7 ``` -------------------------------- ### Build Docker Image for Context7 MCP Server Source: https://github.com/nyepppp/context7/blob/master/docs/README.ko.md To run the MCP server in a Docker container, first create a `Dockerfile` in your project root. This Dockerfile uses a Node.js base image, installs the Context7 MCP package globally, and sets the default command to run the server. After creating the Dockerfile, build the image using the `docker build` command. ```Dockerfile FROM node:18-alpine WORKDIR /app # 최신 버전 전역 설치 RUN npm install -g @upstash/context7-mcp # 필요한 경우 기본 포트 노출 (선택 사항, MCP 클라이언트 상호 작용에 따라 다름) # EXPOSE 3000 # 서버 실행 기본 명령어 CMD ["context7-mcp"] ``` -------------------------------- ### Configure Context7 MCP with a Remote URL (Qodo Gen, Opencode) Source: https://github.com/nyepppp/context7/blob/master/docs/README.zh-TW.md This configuration connects to a remote Context7 MCP server using a URL. It's used in environments like Qodo Gen and Opencode for remote server connections. No local installation of the MCP is required, only the remote URL. ```json { "mcpServers": { "context7": { "url": "https://mcp.context7.com/mcp" } } } ``` ```json "mcp": { "context7": { "type": "remote", "url": "https://mcp.context7.com/mcp", "enabled": true } } ``` -------------------------------- ### Claude Code Remote Server Installation (HTTP) Source: https://github.com/nyepppp/context7/blob/master/docs/README.zh-CN.md Command to add Context7 MCP as a remote server in Claude Code using HTTP transport. Requires the Context7 API key. ```sh claude mcp add --transport http context7 https://mcp.context7.com/mcp --header "CONTEXT7_API_KEY: YOUR_API_KEY" ``` -------------------------------- ### Configure Context7 MCP in Rovo Dev CLI (JSON) Source: https://github.com/nyepppp/context7/blob/master/docs/README.pt-BR.md Configuration for the Rovo Dev CLI to connect to the Context7 MCP server. This includes examples for both remote HTTP connection and local stdio connection. The command 'acli rovodev mcp' is used to edit the configuration. ```json { "mcpServers": { "context7": { "url": "https://mcp.context7.com/mcp" } } } ``` ```json { "mcpServers": { "context7": { "command": "npx", "args": ["-y", "@upstash/context7-mcp"] } } } ``` -------------------------------- ### Claude Code Remote Server Installation (SSE) Source: https://github.com/nyepppp/context7/blob/master/docs/README.zh-CN.md Command to add Context7 MCP as a remote server in Claude Code using SSE transport. Requires the Context7 API key. ```sh claude mcp add --transport sse context7 https://mcp.context7.com/sse --header "CONTEXT7_API_KEY: YOUR_API_KEY" ``` -------------------------------- ### GET /ping - Health Check Source: https://context7.com/nyepppp/context7/llms.txt A simple health check endpoint to verify the availability and responsiveness of the Context7 MCP server. ```APIDOC ## GET /ping (Health Check) ### Description Simple health check endpoint to verify server availability. ### Method GET ### Endpoint https://mcp.context7.com/ping ### Parameters None ### Request Example ```bash curl https://mcp.context7.com/ping ``` ### Response #### Success Response (200) - **status** (string) - Indicates server status, typically `"ok"`. - **message** (string) - A confirmation message, typically `"pong"`. #### Response Example ```json { "status": "ok", "message": "pong" } ``` ``` -------------------------------- ### Connect to SSE Endpoint with cURL Source: https://context7.com/nyepppp/context7/llms.txt This example demonstrates how to establish a Server-Sent Events (SSE) connection to the /sse endpoint using cURL. It requires a Context7 API key and initiates a stream for receiving server events. The initial response includes a connection established message with a session ID. ```bash # Connect to SSE endpoint curl -N https://mcp.context7.com/sse \ -H "CONTEXT7_API_KEY: ctx7sk_your_api_key" # Response stream data: {"type":"connection_established","sessionId":"abc123","timestamp":"2025-10-16T10:30:00.000Z"} # Client keeps connection open for server events ``` -------------------------------- ### GET /sse - Server-Sent Events Endpoint Source: https://context7.com/nyepppp/context7/llms.txt Establishes a Server-Sent Events (SSE) connection for real-time event streaming. Returns a session ID for subsequent message interactions. ```APIDOC ## GET /sse (Server-Sent Events Endpoint) ### Description Establishes SSE connection for event streaming. Returns session ID for subsequent message posts. ### Method GET ### Endpoint https://mcp.context7.com/sse ### Parameters #### Headers - **CONTEXT7_API_KEY** (string) - Required - Your API key ### Request Example ```bash curl -N https://mcp.context7.com/sse \ -H "CONTEXT7_API_KEY: ctx7sk_your_api_key" ``` ### Response #### Success Response (200) Stream of Server-Sent Events. - **data** (string) - Event data, typically JSON format. - **type** (string) - Type of event (e.g., `connection_established`) - **sessionId** (string) - Unique session ID for the connection - **timestamp** (string) - Timestamp of the event #### Response Example ``` data: {"type":"connection_established","sessionId":"abc123","timestamp":"2025-10-16T10:30:00.000Z"} ``` ``` -------------------------------- ### Add Remote MCP Server via Claude Code Source: https://github.com/nyepppp/context7/blob/master/docs/README.ja.md Adds a remote Context7 MCP server using the 'claude mcp add' command with SSE transport. Requires the claude CLI to be installed and configured. ```shell claude mcp add --transport sse context7 https://mcp.context7.com/sse ``` -------------------------------- ### Perform Health Check with cURL Source: https://context7.com/nyepppp/context7/llms.txt This example demonstrates a simple health check for the Context7 MCP server using cURL to access the /ping endpoint. It verifies the server's availability and returns a JSON response indicating its status. ```bash curl https://mcp.context7.com/ping # Response { "status": "ok", "message": "pong" } ``` -------------------------------- ### Resolve Library ID with cURL Source: https://context7.com/nyepppp/context7/llms.txt This example demonstrates how to use cURL to call the POST /mcp endpoint to resolve a library ID. It requires a Context7 API key and sends a JSON payload specifying the 'resolve-library-id' method with the library name as an argument. The response includes potential matches for the library. ```bash # Example: Resolve library ID for Next.js curl -X POST https://mcp.context7.com/mcp \ -H "Content-Type: application/json" \ -H "CONTEXT7_API_KEY: ctx7sk_your_api_key" \ -d '{ "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "resolve-library-id", "arguments": { "libraryName": "nextjs" } } }' # Response includes matching libraries { "jsonrpc": "2.0", "id": 1, "result": { "content": [{ "type": "text", "text": "Available Libraries (top matches):\n\n- Title: Next.js\n- Context7-compatible library ID: /vercel/next.js\n- Description: The React Framework for Production\n- Code Snippets: 1247\n- Trust Score: 10\n- Versions: v14.3.0-canary.87, v15.0.0, v15.1.0" }] } } ``` -------------------------------- ### Post Message to SSE Session with cURL Source: https://context7.com/nyepppp/context7/llms.txt This example shows how to send a message to an established SSE session using cURL and the POST /messages endpoint. It requires the session ID obtained from the SSE connection and a valid Context7 API key. The request payload follows the JSON-RPC 2.0 format for tool calls. ```bash # Post message to SSE session curl -X POST "https://mcp.context7.com/messages?sessionId=abc123" \ -H "Content-Type: application/json" \ -H "CONTEXT7_API_KEY: ctx7sk_your_api_key" \ -d '{ "jsonrpc": "2.0", "id": 3, "method": "tools/call", "params": { "name": "resolve-library-id", "arguments": { "libraryName": "supabase" } } }' # Response sent via SSE stream ``` -------------------------------- ### Prompt Esempio Next.js con Context7 Source: https://github.com/nyepppp/context7/blob/master/docs/README.it.md Questo snippet mostra un esempio di prompt da utilizzare con Context7 MCP per creare un progetto Next.js di base con l'app router. Indica all'LLM di utilizzare Context7 per ottenere informazioni aggiornate. ```text Crea un progetto Next.js di base con app router. Usa context7 ``` -------------------------------- ### Build Project with Bun Source: https://github.com/nyepppp/context7/blob/master/docs/README.ko.md Command to build the project using Bun. ```bash bun run build ```