- Node.js 22.12 or later and npm. Node.js 20.19+ on the 20.x line is also supported.
- A Context.dev API key only if you want to make live API calls.
npm ci
npm run devThe server listens at http://localhost:3000/mcp. Without a key or OAuth configuration, tool calls require a caller-supplied API key. For a private local development server, set CONTEXT_API_KEY in your environment before starting it. Do not expose a server with a fallback key to untrusted callers.
You can copy .env.example as a configuration reference. Export the variables in your shell or configure them in your deployment platform; do not assume a .env file is loaded by every start command.
npm run build
npm testnpm test builds the server and runs the test suite. Integration tests start fake Context and OAuth services on loopback addresses; they do not need production credentials or call the production API or database.
To run the built server:
npm startTo test against your own fake API, set CONTEXT_API_BASE to its base URL, for example http://127.0.0.1:4000.
Download the public OpenAPI specification, inspect it, and pass its path to the generator:
curl -fsSL https://docs.context.dev/openapi.json -o /tmp/context-openapi.json
npm run generate:endpoints -- /tmp/context-openapi.json context-endpoints.ts
npm testReview the generated diff before committing. The checked-in snapshot may differ from the latest public API specification. The generator's no-argument default targets a sibling checkout used by Context maintainers; contributors should pass an explicit path as above.
| Path | Purpose |
|---|---|
index.ts |
MCP server, transport, OAuth routes, and tool registration |
src/auth.ts, src/dcr.ts |
Authentication and dynamic client registration |
src/context-client.ts |
Context API calls and response handling |
src/toolset.ts |
Published tool catalog and profiles |
context-endpoints.ts |
Generated API request schemas |
scripts/generate-context-endpoints.ts |
OpenAPI schema generator |
resources/ |
Interactive brand card and styles |
src/*.test.ts |
Unit and integration tests |
See deployment for OAuth configuration and tool behavior for response formats, limits, and error handling.