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 for LobeChat plugins (-50% to -98% schema tokens, $ref flattening & SecretGuard)
#22885
If you use stdio MCP servers in LobeChat (especially with local Ollama/vLLM models or high-tool-count servers like GitHub, Playwright, or Notion), you may have noticed two common friction points:
Enabling 2 to 3 MCP servers injects 15,000 to 40,000+ tokens of tools/list JSON schemas on every turn.
FastMCP / Pydantic servers emit nested $defs and $ref pointers or strict integer/boolean types that cause smaller models to fail tool validation.
We built mcp-slim, a zero-dependency Python MCP stdio proxy and CLI token profiler that wraps any MCP command in LobeChat:
What mcp-slim does on the stdio pipe
Cuts tools/list and tools/call tokens by 50% to 98.7%: Strips verbose descriptions, compacts JSON schemas, and optionally turns JSON object arrays into TOON tables (--toon).
BM25 Lazy Tool Discovery (--dynamic-toolsets): Collapses 50+ tools into 2 meta-tools (search_tools and call_tool) so LobeChat only loads schemas relevant to the user's prompt.
Inlines $ref / $defs (--flatten-schemas) & Coerces Arguments (--coerce-args): Automatically converts "10" -> 10 and "true" -> true based on the upstream tool schema.
Bidirectional SecretGuard (--redact-secrets): Scrubs leaked credentials (ghp_*, sk-*, AKIA*, JWTs, private keys, and basic-auth URLs) from tool arguments and responses in real time.
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 LobeChat community,
If you use stdio MCP servers in LobeChat (especially with local Ollama/vLLM models or high-tool-count servers like GitHub, Playwright, or Notion), you may have noticed two common friction points:
tools/listJSON schemas on every turn.$defsand$refpointers or strict integer/boolean types that cause smaller models to fail tool validation.We built mcp-slim, a zero-dependency Python MCP stdio proxy and CLI token profiler that wraps any MCP command in LobeChat:
What
mcp-slimdoes on the stdio pipetools/listandtools/calltokens by 50% to 98.7%: Strips verbose descriptions, compacts JSON schemas, and optionally turns JSON object arrays into TOON tables (--toon).--dynamic-toolsets): Collapses 50+ tools into 2 meta-tools (search_toolsandcall_tool) so LobeChat only loads schemas relevant to the user's prompt.$ref/$defs(--flatten-schemas) & Coerces Arguments (--coerce-args): Automatically converts"10"->10and"true"->truebased on the upstream tool schema.SecretGuard(--redact-secrets): Scrubs leaked credentials (ghp_*,sk-*,AKIA*, JWTs, private keys, and basic-auth URLs) from tool arguments and responses in real time.Usage in LobeChat MCP configuration
Simply wrap your existing command with
mcp-slim:GitHub repository: https://github.com/SalyyS1/mcp-slim
All reactions