Repository navigation
mcp-slim: Zero-dependency MCP stdio proxy to cut DSPy ReAct tool schema & output tokens by 50%-98% #10875
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 everyone,
When building multi-turn DSPy
ReActprograms backed by MCP servers (dspy.Tool.from_mcp_tool), large MCP tool catalogs and verbose JSON tool outputs can rapidly inflate prompt token usage across trajectory steps.We built mcp-slim, a zero-dependency Python 3.10+ stdio proxy that wraps any MCP server command (
mcp-slim run -- <server-cmd>):What it does for DSPy MCP Workflows
tools/listschema tokens by ~50% (or-98.7%with--lazyBM25 discovery): Inlines$defs/$refpointers, flattens rootanyOf/oneOf/allOf, and strips FastMCP voidoutputSchemabloat beforedspy.Tool.from_mcp_toolinspects the tool signature.tools/calloutputs (-43%+tokens): Strips null/empty fields and hypermedia links from JSON responses, flattens textEmbeddedResourceitems, and keeps truncated JSON 100% valid.SecretGuard: Fixes stringified scalar arguments ("10" -> 10,"true" -> True) and parameter name typos (filters -> filter), and scrubs leaked secrets/tokens from tool outputs.Repository: https://github.com/SalyyS1/mcp-slim
If
mcp-slimis useful for your DSPy agent pipelines, a star on SalyyS1/mcp-slim is much appreciated!All reactions