cag-mcp
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| CAG_MCP_URL | No | API base URL. | https://api.openai.com/v1 |
| CAG_MCP_MODEL | No | Answering model. | gpt-6-luna |
| OPENAI_API_KEY | No | Fallback OpenAI API key, used when CAG_MCP_API_KEY and the user file's api_key are not set. | |
| XDG_CACHE_HOME | No | Base for the default `state_dir` (`$XDG_CACHE_HOME/cag-mcp`). | |
| CAG_MCP_API_KEY | No | OpenAI API key. Order: CAG_MCP_API_KEY, then the user file, then OPENAI_API_KEY. | |
| XDG_CONFIG_HOME | No | Location of the user config file (`$XDG_CONFIG_HOME/cag-mcp/config.toml`). | |
| CAG_MCP_PROVIDER | No | Provider to use. Only `openai` is implemented; `fake` is an offline test double. | openai |
| CAG_MCP_CACHE_TTL | No | `30m` or `12h`, sent as `prompt_cache_options.ttl`. | 12h |
| CAG_MCP_STATE_DIR | No | Where snapshots and ledgers live. | $XDG_CACHE_HOME/cag-mcp (default ~/.cache/cag-mcp) |
| CLAUDE_PROJECT_DIR | No | The project directory (exported by Claude Code to the plugin's stdio MCP servers). | |
| CAG_MCP_OVERLAY_ENABLED | No | `false`: any change rebuilds the snapshot. | true |
| CAG_MCP_MAX_INPUT_TOKENS | No | A larger corpus (or request) is an error. | 900000 |
| CAG_MCP_REASONING_EFFORT | No | Reasoning effort. Unset: `none` for `gpt-6-luna` and `gpt-6.1-terra`; for other models no effort is sent. | |
| CAG_MCP_RESPECT_GITIGNORE | No | Inside git, select tracked files only. | true |
| CAG_MCP_LONG_PROMPT_TOKENS | No | A larger corpus is a warning in `status`. | 272000 |
| CAG_MCP_OVERLAY_MAX_TOKENS | No | Absolute overlay limit in tokens; `0` disables this limit. | 0 |
| CAG_MCP_OVERLAY_MAX_PERCENT | No | Overlay size as % of the snapshot; `0` disables this limit. | 10 |
| CAG_MCP_CACHE_READ_EXTENDS_TTL | No | How the ledger predicts expiry: from the last write only, or from the later of the last write and the last read. | false |
| CAG_MCP_OVERLAY_WHOLE_FILE_PERCENT | No | A changed file whose diff exceeds this % of the new file is sent whole. | 50 |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
cag-mcp answers questions about this project's documentation from a cached copy of the whole doc set. Call ask before searching the docs yourself; it replies briefly with file:line citations that the server has verified on disk; read those lines. Citations marked unverified need checking before you rely on them.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": false
} |
| prompts | {
"listChanged": false
} |
| resources | {
"subscribe": false,
"listChanged": false
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| askB | Ask a question about the project's documentation. Returns a brief answer and citations as |
| statusC | Show files, tokens, the snapshot in use, its predicted cache state, overlay size, usage and cost. |
| rebuildC | Build a new snapshot of the corpus from this checkout now. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
| skill-ask | |
| skill-init |
TDQS
Scored across 3 tools
ask queries the corpus, status reports state, and rebuild regenerates the snapshot — three clearly distinct operations with no overlap. An agent can pick the right tool without inference from descriptions.
All names are single lowercase words with no separators, which is internally consistent and readable. Minor deviation: 'ask' and 'rebuild' are verbs while 'status' is a noun, breaking a strict verb pattern.
Three tools map cleanly onto the query / inspect / maintain lifecycle of a snapshot-backed doc server, with each earning its place. The surface is minimal but not artificially thin given the narrow domain.
The query-and-cite loop has a notable dead end: ask returns `path:start-end` citations telling the agent to read the lines itself, but no tool exposes file reads, so unverified citations cannot be resolved. No tool exists to refresh or clear a stale overlay/cache beyond a full rebuild.