Repository navigation
mcp-slim: Cross-provider MCP schema normalizer, token optimizer (-50% to -98%), and secret firewall #51333
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 routing MCP tools across multiple LLM providers through LiteLLM (OpenAI, Anthropic, Gemini / Vertex AI, Bedrock, DeepSeek, and local vLLM/Ollama), a single MCP server's
tools/listschema often breaks on one provider while working on another:$defs/$ref,discriminator, and["string", "null"]nullable type arrays (GenerateContentRequest.tools[0].function_declarations: properties: should be non-empty for OBJECT type).anyOf/oneOf/allOf.?token=,X-Amz-Signature=) in tool outputs.We built mcp-slim, a zero-dependency Python 3.10+ MCP JSON-RPC 2.0 proxy that normalizes, compacts, and guards MCP traffic at the stdio boundary.
Highlights
-50%Token Reduction: Inlines$defs/$ref, flattens rootanyOf/oneOf/allOfobject branches into standardproperties/required, normalizes Zod/Pydantic nullable type arrays (["integer", "null"] -> "integer"), and strips unsupported vendor keywords.--lazyBM25 Dynamic Tool Discovery (-98.7%tokens): Replaces 60+ static tools (12,512tokens) with 2 on-demand discovery tools (168tokens).snake_case/camelCaseparameter typos ontools/call.SecretGuard: Scrubs API keys (sk-ant-,ghp_,AKIA), URL query secrets, and prompt injections in< 5 microsecondswhen clean.Repo & CLI docs: https://github.com/SalyyS1/mcp-slim
If this helps your LiteLLM + MCP pipelines, a star on SalyyS1/mcp-slim is much appreciated!
All reactions