contextd serve
Start contextd as an MCP (Model Context Protocol) server.
Usage
contextd serve [options]Options
| Flag | Description | Default |
|---|---|---|
--port <port> | Port to serve on | 3333 |
What it does
Running contextd serve starts an MCP server over stdio transport that exposes your project context as tools AI assistants can call:
| Tool | Description | Parameters |
|---|---|---|
get_project_overview | Get high-level project overview + architecture | None |
get_conventions | Get coding conventions and standards | None |
get_relevant_context | Get context relevant to specific files | files — array of file paths |
list_decisions | List all architecture decision records | None |
get_module_context | Get context for a specific module | module — module name or path |
Startup behavior
- Finds the project root
- Auto-refreshes stale remote sources (>24 hours old) non-blocking
- Warns on very stale sources (>7 days)
- Dynamically imports
@modelcontextprotocol/sdk - Creates MCP server with name
contextdand version0.1.0 - Connects via stdio transport
- Prints MCP configuration JSON to stderr
MCP configuration
The server prints this configuration to stderr when started:
{
"mcpServers": {
"contextd": {
"command": "npx",
"args": ["contextd", "serve"]
}
}
}Add it to .mcp.json in your project root, or to your MCP client’s settings.
Remote context inclusion
All tools automatically include remote contexts if configured. When get_relevant_context is called, the server matches files against both local and cached remote module scopes.