mcp-slim: Zero-dependency MCP stdio proxy for RAGFlow Agents (-50% to -98% tool schema tokens & SecretGuard) #22288
Replies: 2 comments
|
the schema minification approach is smart, stripping verbosity before it hits context rather than trying to summarize after. for the SecretGuard side, one complementary angle worth knowing: redacting secrets from outputs is reactive, so if a tool response contains a raw key it's already been in the wire. a proactive pattern is to never inject the raw secret at all, give the agent a short-lived reference path instead, and have the tool resolve it server-side. disclosure: i work on 1Claw which does exactly that via an HSM-backed vault, so it's not a neutral take, but the pattern itself is useful regardless of implementation. |
|
@redbotster Appreciate the thoughtful breakdown and transparent disclosure. You are completely right that static Inspired by your point on reference-based isolation, |
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 RAGFlow community,
When pairing RAGFlow agent workflows with external MCP servers (such as GitHub, filesystem, database, or browser tools), verbose
tools/listschemas and massive JSON tool outputs can quickly consume the context budget meant for retrieved chunks.We built mcp-slim, a zero-dependency Python MCP stdio proxy and CLI token profiler that sits transparently in front of any stdio MCP server:
Key capabilities for RAGFlow + MCP workflows
tools/listJSON schemas and converts repetitive JSON list payloads intools/callresponses into compact TOON tables (--toon), freeing up context window space for RAG chunks.$refFlattening (--flatten-schemas) & Stringified Argument Coercion (--coerce-args): Helps local and open-weight LLMs call complex MCP tools reliably without schema validation errors.--dynamic-toolsets): Exposessearch_toolsandcall_toolwhen connecting multi-server MCP setups with dozens of tools.--redact-secrets): Redacts API tokens, bearer headers, and<system>/[INST]prompt-injection markers from untrusted tool results before they enter the agent prompt.Drop-in command wrapper
Source code and reproducible benchmarks: https://github.com/SalyyS1/mcp-slim
All reactions