contextd serve

Start contextd as an MCP (Model Context Protocol) server.

Usage

contextd serve [options]

Options

FlagDescriptionDefault
--port <port>Port to serve on3333

What it does

Running contextd serve starts an MCP server over stdio transport that exposes your project context as tools AI assistants can call:

ToolDescriptionParameters
get_project_overviewGet high-level project overview + architectureNone
get_conventionsGet coding conventions and standardsNone
get_relevant_contextGet context relevant to specific filesfiles — array of file paths
list_decisionsList all architecture decision recordsNone
get_module_contextGet context for a specific modulemodule — module name or path

Startup behavior

  1. Finds the project root
  2. Auto-refreshes stale remote sources (>24 hours old) non-blocking
  3. Warns on very stale sources (>7 days)
  4. Dynamically imports @modelcontextprotocol/sdk
  5. Creates MCP server with name contextd and version 0.1.0
  6. Connects via stdio transport
  7. 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.