MCP server

MCP server

codemap can run as a Model Context Protocol (MCP) server. MCP clients start it as a child process and talk to it over stdio.

codemap mcp

The transport is newline-delimited JSON-RPC 2.0 on stdin and stdout.

Tool

The server exposes one tool, pack_codebase.

ArgumentTypeDescription
directorystringRepository root to pack. Required, and must exist.
includestringComma-separated include patterns.
excludestringComma-separated exclude patterns.
formatstringmarkdown, xml, json, or plain.
removeCommentsbooleanRemove comments.
removeEmptyLinesbooleanRemove empty lines.
truncateBase64booleanTruncate base64 runs.
instructionPathstringInstruction file to prepend.
headerTextstringHeader text to add.

The tool returns the packed content as text. It does not write files. If the call fails, the result has isError set to true.

Client configuration

Add the server to your MCP client’s configuration. For example:

{
  "mcpServers": {
    "codemap": {
      "command": "codemap",
      "args": ["mcp"]
    }
  }
}

Protocol notes

  • initialize, tools/list, and tools/call are supported.
  • Notifications receive no response.
  • Unknown methods return error code -32601.