You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
mcp-slim: Zero-dependency MCP stdio proxy & token optimizer for AI agent workflows (-50% to -98% schema tokens)
#3988
We built mcp-slim, an open-source, zero-dependency Python stdio proxy and CLI token profiler for Model Context Protocol (MCP) servers that cuts tools/list schema tokens and tools/call output tokens by 50% to 98.7% while scrubbing leaked secrets in real time:
Key features
Schema & Output Compaction (--toon, --dynamic-toolsets): Minifies verbose MCP tool schemas, exposes lazy BM25 tool discovery (search_tools + call_tool), and converts repetitive JSON arrays into tabular TOON format so RAG context stays focused on retrieved documents.
Local & Open-Weight LLM Fixes (--flatten-schemas, --coerce-args): Inlines recursive JSON Schema $ref / $defs pointers and coerces stringified tool arguments.
Bidirectional SecretGuard (--redact-secrets): Redacts leaked API keys (ghp_*, sk-*, AKIA*, JWTs, PEM keys, and basic-auth URLs) and strips <system> / [INST] prompt-injection markers from tool outputs.
the --redact-secrets approach is useful but it's reactive, secrets already hit the wire before they get scrubbed. for the token reduction side, the TOON format and BM25 lazy discovery are genuinely clever and the benchmarks look solid. one thing worth noting: if secrets are showing up in tool outputs at all, that's a sign they're being passed as raw values through the agent, which redaction can miss (novel patterns, encoded variants, etc). a different angle is keeping secrets out of the context entirely by having the agent reference a vault path and get a short-lived token at call time. i work on something that does exactly that (1claw, docs.1claw.co?utm_source=github&utm_medium=comment&utm_campaign=growth) so take that with appropriate salt, but the pattern itself is worth considering alongside proxy-side redaction.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi Quivr community,
We built mcp-slim, an open-source, zero-dependency Python stdio proxy and CLI token profiler for Model Context Protocol (MCP) servers that cuts
tools/listschema tokens andtools/calloutput tokens by 50% to 98.7% while scrubbing leaked secrets in real time:Key features
--toon,--dynamic-toolsets): Minifies verbose MCP tool schemas, exposes lazy BM25 tool discovery (search_tools+call_tool), and converts repetitive JSON arrays into tabular TOON format so RAG context stays focused on retrieved documents.--flatten-schemas,--coerce-args): Inlines recursive JSON Schema$ref/$defspointers and coerces stringified tool arguments.SecretGuard(--redact-secrets): Redacts leaked API keys (ghp_*,sk-*,AKIA*, JWTs, PEM keys, and basic-auth URLs) and strips<system>/[INST]prompt-injection markers from tool outputs.Repository and benchmarks: https://github.com/SalyyS1/mcp-slim
All reactions