Getting Started
Clone the project and install dependencies: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:Environment Variables
You can use theCONTEXT7_API_KEY environment variable instead of passing the --api-key flag. This is useful for:
- Storing API keys securely in
.envfiles - Integration with MCP server setups that use dotenv
- Tools that prefer environment variable configuration
Using .env File
CONTEXT7_API_URL sets the base URL for Context7 API calls and defaults to https://context7.com/api.
Override it for self-hosted deployments or proxies that sit in front of the API.
MCP Configuration with Environment Variable
MCP Tools
The server registers two tools. Both are read-only, idempotent, and open-world (annotations:readOnlyHint, idempotentHint, and openWorldHint are true; destructiveHint is false).
resolve-library-id
Resolves a package/product name to a Context7-compatible library ID and returns matching libraries. Call this beforequery-docs unless the user already provides a library ID in /org/project or /org/project/version format.
query-docs
Retrieves and queries up-to-date documentation and code examples for a library. Requires a valid library ID fromresolve-library-id (or one provided directly by the user).
The server declares the
prompts and resources capabilities but registers no prompts and no resources — prompts/list and resources/list answer with empty collections.