Skip to main content
This guide covers how to set up the Context7 MCP server locally for development and testing.

Getting Started

Clone the project and install dependencies:
Build:
Run the server:

CLI Arguments

context7-mcp accepts the following CLI flags:
Get your API key by creating an account at context7.com/dashboard.

Examples

HTTP transport on port 8080:
Stdio transport with API key:

Environment Variables

You can use the CONTEXT7_API_KEY environment variable instead of passing the --api-key flag. This is useful for:
  • Storing API keys securely in .env files
  • Integration with MCP server setups that use dotenv
  • Tools that prefer environment variable configuration
The --api-key CLI flag takes precedence over the environment variable when both are provided.

Using .env File

MCP Configuration with Environment Variable

Local Development Configuration

When developing locally, use this configuration to run from source:

Testing with MCP Inspector

Test your setup using the MCP Inspector:
This opens an interactive inspector to verify Context7 tools are working correctly.