Repository navigation
mcp-slim: Zero-dependency MCP stdio proxy for AnythingLLM Agent Skills (-50% to -98% tokens & local LLM schema fixes) #7131
Replies: 1 comment
|
the core issue here is real and annoying, local llms with small context windows get immediately overwhelmed by tools/list responses from servers like github mcp, which can easily dump 50k+ tokens of schema before any actual work happens. the --dynamic-toolsets approach (search_tools + call_tool) is a solid pattern, same idea as lazy tool loading. the $ref flattening is also genuinely necessary since most local models never saw jsonschema $ref in training and just ignore or hallucinate around it. one other option in this space: i work on 1claw, which approaches the token problem differently by keeping secrets and credentials out of context entirely via scoped vault tokens, but for the raw schema bloat problem you're describing, mcp-slim's approach of compacting at the proxy layer is more directly applicable. |
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 AnythingLLM community,
When running AnythingLLM with local models (Ollama, LM Studio, llama.cpp, vLLM) and MCP servers inside
anythingllm_mcp_servers.json, large MCP servers like GitHub or Playwright can overflow a 8k to 32k context window on the very first turn, and nested JSON Schema$refpointers or stringified numbers ("limit": "10") often break local tool calling.We built mcp-slim, a zero-dependency Python stdio proxy that drops directly into
anythingllm_mcp_servers.json:What it solves for AnythingLLM users
tools/listschemas, strips redundant prose, and supports BM25 on-demand tool discovery (--dynamic-toolsets) so 80+ tools collapse intosearch_tools+call_tool.--flatten-schemas&--coerce-args): Resolves$ref/$defspointers in-place, normalizes nullableanyOfunions, and coerces stringified integers/booleans/JSON arrays before forwardingtools/callto the MCP server.EmbeddedResourceUnwrapping (--unwrap-resources): Convertstype: "resource"blocks returned by servers likegithub-mcp-serverinto plaintype: "text"blocks so clients never see empty file contents.--redact-secrets): Scrubs API keys and prompt-injection tags from tool outputs.Drop-in
anythingllm_mcp_servers.jsonexample{ "mcpServers": { "github": { "command": "mcp-slim", "args": [ "--flatten-schemas", "--coerce-args", "--unwrap-resources", "--redact-secrets", "--", "npx", "-y", "@modelcontextprotocol/server-github" ] } } }Repository: https://github.com/SalyyS1/mcp-slim
All reactions