mcp_rtk/lib.rs
1//! # mcp-rtk
2//!
3//! A token-optimizing MCP proxy that sits between Claude and any upstream MCP
4//! server, compressing tool responses to reduce token consumption by 60–90%.
5//!
6//! # Architecture
7//!
8//! ```text
9//! Claude ←(stdio)→ mcp-rtk ←(stdio/subprocess)→ upstream MCP server
10//! ```
11//!
12//! mcp-rtk is both an MCP **server** (for Claude) and an MCP **client** (for
13//! upstream). It forwards `list_tools` and `call_tool` requests, applying JSON
14//! compression filters on responses before returning them.
15//!
16//! # Modules
17//!
18//! * [`config`] — TOML configuration loading with per-tool filter rules and
19//! external preset auto-discovery from `~/.local/share/mcp-rtk/presets/`.
20//! * [`filter`] — The 8-stage filter pipeline and generic JSON compression
21//! functions.
22//! * [`hot_reload`] — File watcher that hot-reloads external presets and
23//! atomically rebuilds the filter engine via [`arc_swap::ArcSwap`].
24//! * [`proxy`] — [`ProxyServer`](proxy::ProxyServer) and
25//! [`ProxyClient`](proxy::ProxyClient) implementing the MCP server/client
26//! handlers.
27//! * [`tracking`] — SQLite-backed token savings metrics.
28
29pub mod config;
30pub mod diff;
31pub mod discover;
32pub mod display;
33pub mod filter;
34pub mod hot_reload;
35pub mod install;
36pub mod preset_ops;
37pub mod proxy;
38pub mod tracking;