Optimizing MCP Tools for VS Code Agents: Compact Go Proxy
VS Code agent extensions like Cline, Roo Code, or Kilo quickly rack up MCP servers: file access, search, databases, GitHub, Jira, OpenAPI. The mcp.json config balloons to 25+ servers. The model wastes context parsing the mess: name conflicts (search duplicates), verbose descriptions, argument hallucinations. Result? Higher token costs with no real gains.
The toolc Go proxy aggregates servers into a single MCP interface. It filters duplicates, compresses descriptions, and controls tool visibility. For VS Code, that's one server instead of a zoo.
Installation and Setup
Grab the binary from Releases or build from source:
go install github.com/aak204/Tool-Catalog-Compiler/cmd/[email protected]
Optimize your config:
./toolc optimize-mcp \
-input .vscode/mcp.json \
-emit vscode \
-out-dir dist/mcp-optimized
Launch the gateway:
./toolc mcp-serve -catalog dist/mcp-optimized/toolc.compiled.json
Hook the new config into VS Code like any MCP server. Your agent gets a streamlined catalog without extra queries.
Internal Architecture
toolc converts MCP and OpenAPI specs into an intermediate representation (IR). It applies three compilation modes:
- direct: Full schema unchanged — for debugging.
- flat: Flat list with deduplication and description compression — the go-to mode.
- staged: Name-based discovery, on-demand schemas — for complex APIs.
The OpenAPI parser handles massive specs (like Stripe API) with depth limits and shallow ref reuse. Memory usage: ~48 MB. Processing time: milliseconds.
Token Savings Benchmarks
Tested on GitHub API (1,100 endpoints) and Stripe. Models: Qwen-3.6-plus, GLM-5.1, GPT-5.4, Claude Sonnet 4.6. Cost per million calls (flat vs direct):
| Model | Without Proxy ($) | With toolc ($) | Savings (%) |
|----------------------------|-------------------|----------------|-------------|
| qwen/qwen3.6-plus | 1807.26 | 1199.13 | 33.65 |
| z-ai/glm-5.1 | 3102.53 | 1593.14 | 48.65 |
| openai/gpt-5.4 | 8819.46 | 4291.96 | 51.34 |
| anthropic/claude-sonnet-4.6 | 10736.57 | 4290.21 | 60.04 |
Success rates stay high. Flat mode cuts token proxy overhead.
GLM-5.1 Case Study: Hallucinations and Fixes
GLM-5.1 choked on truncated JSON and forgot contracts. Culprits:
- One-size-fits-all system prompt for orchestration.
- Insufficient completion budget.
Fix: Isolated prompts and bumped limits. Success rate jumped from 0.78 to 0.92 in flat mode.
Finicky models need request shaping on top of compilation.
Limitations and Roadmap
Supported:
- Local MCP stdio.
- OpenAPI.
- VS Code agent contexts.
Not yet:
- Remote MCP.
- Generic functions.
- OpenAI-compatible runtime (in progress).
Architecture scales for a full control plane.
Key Takeaways
toolcslashes costs 33–60% by compressing MCP/OpenAPI catalogs.- Three modes: flat wins on price/performance.
- Parser tackles recursive APIs (Stripe) without crashing.
- Cleaner context boosts model success rates.
- VS Code-ready, no config rewrites needed.
— Editorial Team
No comments yet.