Repository navigation
mcp-slim: Zero-dependency MCP stdio proxy for smolagents ToolCollection.from_mcp (-50% to -98% tokens & SecretGuard) #3158
SalyyS1
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 smolagents community,
When loading external MCP servers into smolagents via
ToolCollection.from_mcp(...)orMCPClient, large MCP servers (like GitHub, Playwright, or Notion) expose dozens of tools with verbose descriptions, nested$ref/$defsschemas, and bulky JSON responses that inflate prompt tokens on every agent step.We built mcp-slim, a zero-dependency Python MCP stdio proxy and CLI profiler that wraps
StdioServerParametersinsmolagents:How it helps
smolagentsMCP workflows--toon), and supports on-demand BM25 tool discovery (--dynamic-toolsets).--flatten-schemas,--coerce-args): Resolves$ref/$defspointers and coerces stringified tool arguments for smaller open-weight models (Qwen2.5-Coder,Llama-3.1).SecretGuard(--allow-tools,--deny-tools,--redact-secrets): Enforces tool allowlists ontools/calland redacts leaked tokens (ghp_*,sk-*,AKIA*, JWTs, PEM keys) before they enter agent memory.Quick usage with
smolagentsRepository: https://github.com/SalyyS1/mcp-slim
All reactions