costaffective-mcp
Coding agents that explore less, remember more, and carry less context.
MCP:
github.com/okyashgajjar/costaffective-mcp
CostAffective is a local MCP server that makes AI coding agents behave like experienced engineers. Instead of re-reading whole files every turn, dumping build logs into context, and re-discovering symbols they already found, agents get fast, token-budgeted access to your repository — so they stop carrying everything around forever.
Why
In long sessions the dominant cost is not the model's output — it's the prompt cache re-reading and re-writing everything resident in the context window every turn. A real measured example: a single API call billed at $2.95, of which $2.84 was a 5-minute cache write of ~455k tokens of resident context. The answer was under 4,000 tokens.
CostAffective fixes this by keeping tokens out of the window in the first place.
Tools (11 MCP tools)
Retrieval
- search_code — semantic repository search by natural language question
- find_symbol — locate where a symbol is defined
- read_symbol — return a symbol's full implementation body by name
- find_references — every usage of a symbol, precomputed
- find_callers — which functions call a given function
Context control
- remember — persist a durable fact once instead of repeating it inline
- stash_context — park a large blob (file, log, output) out of context behind a tiny handle
- recall — pull back only the slice matching a query, within a token budget
Maintenance
- get_repository_summary — token-budgeted repo overview, drillable by module
- index_repository — manual re-index trigger
Session awareness
- costaffective-session skill — 275-token guidance auto-delivered via MCP instructions field, teaching agents to stash, remember, and retrieve instead of pasting inline
Architecture
AI Client (MCP Host) → stdio transport → costaffective serve
├── Tree-sitter parser → Symbol / Reference / Call Graph indexes
├── Per-repo stash (large blobs out of context)
├── Per-repo durable facts (remember/recall)
└── Token-budgeted compression on every tool output
All per-repo state lives under .mycli-fts/ in the repo root. Index is local SQLite. No cloud, no API keys.
Benchmarks
Small repo: tokens consumed dropped 81.7% (299K → 55K), 2.2x faster, 70% fewer tool calls. Large repo (Continue OSS): tokens down 45.9% (8.7M → 4.7M), API calls down 33.6%.
Install
curl -fsSL https://raw.githubusercontent.com/okyashgajjar/costaffective-mcp/main/install.sh | bash
Or manual: CGO_ENABLED=1 go build -o costaffective ./cmd/costaffective/
Server config for any MCP client:
{
"mcpServers": {
"costaffective": {
"command": "costaffective",
"args": ["serve"]
}
}
}
Supports Claude Code, Cursor, OpenCode, Cline, Codex CLI, Antigravity, and any stdio MCP client.
Requirements
Go 1.25+, C compiler (CGO required for go-sqlite3 and tree-sitter). Linux amd64/arm64, macOS amd64/arm64, Windows amd64.