Expand description
§mcp-rtk
A token-optimizing MCP proxy that sits between Claude and any upstream MCP server, compressing tool responses to reduce token consumption by 60–90%.
§Architecture
Claude ←(stdio)→ mcp-rtk ←(stdio/subprocess)→ upstream MCP servermcp-rtk is both an MCP server (for Claude) and an MCP client (for
upstream). It forwards list_tools and call_tool requests, applying JSON
compression filters on responses before returning them.
§Modules
config— TOML configuration loading with per-tool filter rules and external preset auto-discovery from~/.local/share/mcp-rtk/presets/.filter— The 8-stage filter pipeline and generic JSON compression functions.hot_reload— File watcher that hot-reloads external presets and atomically rebuilds the filter engine viaarc_swap::ArcSwap.proxy—ProxyServerandProxyClientimplementing the MCP server/client handlers.tracking— SQLite-backed token savings metrics.
Modules§
- config
- Configuration loading with preset auto-detection.
- diff
- Side-by-side diff display for raw vs filtered tool responses.
- discover
- Analyze Claude Code session logs to find MCP servers that would benefit from mcp-rtk filtering.
- display
- Shared ANSI display utilities used by
trackinganddiscover. - filter
- The 8-stage filter pipeline and generic JSON compression functions.
- hot_
reload - Hot reload support for external presets.
- install
- Install and uninstall mcp-rtk wrapping in MCP JSON config files.
- preset_
ops - Preset operations: interactive init and remote pull.
- proxy
- MCP proxy server and client handlers.
- tracking
- SQLite-backed token savings metrics.