Skip to main content

Crate mcp_rtk

Crate mcp_rtk 

Source
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 server

mcp-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 via arc_swap::ArcSwap.
  • proxyProxyServer and ProxyClient implementing 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 tracking and discover.
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.