Skip to main content
Glama

mcp-sieve

CI License: MIT Node.js >= 20 Zero Dependencies

Local STDIO MCP multiplexing proxy that cuts agent tool-schema context bloat by 94.8% via in-memory BM25 search and lazy schema loading.

Connecting 5–10 MCP servers (GitHub, PostgreSQL, Docker, Filesystem, Slack, Jira, AWS, Browser) injects 100+ full JSON schemas into every prompt, burning tens of thousands of tokens and degrading tool-selection accuracy. mcp-sieve sits between your AI client and upstream MCP servers, indexing all tools in memory and exposing only 3 lightweight meta-tools.


Architecture

+--------------------+         STDIO (JSON-RPC 2.0)          +-----------------------+
|                    |  <--------------------------------->  |       mcp-sieve       |
|   AI Coding Agent  |   Exposes ONLY 3 meta-tools (~368t):  |  - BM25 Tool Indexer  |
|  (Cursor / Claude  |     1. search_tools(query, limit)     |  - Lazy Schema Store  |
|   / Antigravity)   |     2. get_tool_schema(tool_names)    |  - Upstream Router    |
|                    |     3. call_tool(tool_name, args)     |  - Token Telemetry    |
+--------------------+                                       +-----------+-----------+
                                                                         |
                   +---------------------+---------------------+---------+-----------+
                   | STDIO               | STDIO               | STDIO               | STDIO
                   v                     v                     v                     v
           +---------------+     +---------------+     +---------------+     +---------------+
           |  GitHub MCP   |     | Postgres MCP  |     |  Docker MCP   | ... |  N-th Server  |
           +---------------+     +---------------+     +---------------+     +---------------+

Meta-Tools Exposed

  1. search_tools(query, limit?) — Searches tool names, server names, parameter keys, and descriptions using a local multi-field Okapi BM25 engine with camelCase / snake_case / acronym splitting. Returns compact { name, server, summary, score } matches in sub-millisecond time.

  2. get_tool_schema(tool_names) — Lazy-loads full JSON inputSchema definitions only for the exact tools the agent selects.

  3. call_tool(tool_name, arguments) — Routes execution transparently to the owning upstream STDIO server (with automatic ${server}__${tool} collision namespacing) and returns the upstream result.


Related MCP server: mcp-search-proxy

Benchmark

Measured with npm run benchmark across 120 simulated tools spanning 8 MCP servers (github, postgres, docker, filesystem, slack, jira, aws, browser) and 20 realistic developer intent queries:

Total Tools

Baseline Prompt Tokens

mcp-sieve Prompt Tokens

Token Reduction %

Top-5 Recall %

Avg Search Latency (ms)

120

13,798

718

94.8%

100% (20/20)

0.102 ms

  • Upfront footprint: 368 tokens for the 3 meta-tools (97.33% upfront reduction vs. 13,798 baseline schema tokens).

  • Active turn footprint: 718 tokens (368 upfront meta-tools + ~214 top-5 search_tools results + ~136 lazy-loaded get_tool_schema payload).

  • Zero external APIs: Pure local BM25 indexing and tokenization in Node.js with zero runtime dependencies.


Quick Start

1. Create an upstream mcp.servers.json

Use the standard mcpServers format (compatible with Claude Desktop, Cursor, and Antigravity):

{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_..."
      }
    },
    "postgres": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-postgres", "postgresql://localhost:5432/app"]
    },
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/workspace"]
    }
  }
}

2. Point your AI client to mcp-sieve

Drop this into your Cursor (.cursor/mcp.json), Claude Desktop (claude_desktop_config.json), or Antigravity MCP config:

{
  "mcpServers": {
    "mcp-sieve": {
      "command": "npx",
      "args": ["-y", "mcp-sieve", "--config", "/absolute/path/to/mcp.servers.json"]
    }
  }
}

3. CLI Usage

# Start the STDIO MCP proxy
npx mcp-sieve --config mcp.servers.json

# Inspect connected upstream servers and baseline vs. mcp-sieve token counts
npx mcp-sieve --config mcp.servers.json --stats

# Run the reproducible 120-tool / 20-query BM25 benchmark
npx mcp-sieve --benchmark

Project Layout

  • src/index.ts — CLI entry point (--config, --stats, --benchmark)

  • src/config.ts — mcpServers JSON loader and schema validator

  • src/indexer.ts — Multi-field Okapi BM25 engine with identifier tokenizer

  • src/upstream.ts — Upstream STDIO MCP process manager with pagination, collision namespacing, and error isolation

  • src/proxy.ts — Downstream STDIO MCP server exposing the 3 meta-tools

  • src/telemetry.ts — Token estimator (chars / 4 + JSON framing overhead) and session savings tracker

  • src/jsonrpc.ts — Shared newline-delimited JSON-RPC 2.0 STDIO framing

  • benchmarks/run.ts — 120-tool / 8-server / 20-query benchmark suite

  • tests/ — Unit and end-to-end STDIO tests built on node:test


Development

npm install
npm run build         # Compile TypeScript to dist/
npm test              # Build and run offline hermetic unit + STDIO tests
npm run test:e2e-real # Run live E2E test against @modelcontextprotocol/server-filesystem
npm run benchmark     # Build and run the 120-tool BM25 benchmark

Real-World Verification: mcp-sieve is verified end-to-end (npm run test:e2e-real) over STDIO against the official @modelcontextprotocol/server-filesystem server (search_tools discovery, get_tool_schema lazy-loading, and live call_tool file reads).


License

MIT — Copyright (c) 2026 Mehmet Ruşen Ayvaz.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      B
      maintenance
      A single MCP endpoint for AI agents to browse, inspect, and call tools from multiple upstream MCP servers without loading all schemas upfront, reducing context overhead.
      -
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables clients of tool-heavy MCP aggregators to find and use upstream tools on demand through four fixed bridge tools (search, describe, call, refresh), cutting per-turn tool context from ~180k tokens to ~2–3k. It merges multiple upstream servers behind sticky sessions and a local lexical BM25 index, so only the schemas actually needed are retrieved.
      9
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to connect to multiple upstream MCP servers while dynamically returning only semantically relevant tools, with lazy schema loading, session-aware boosting, and rule-based gating to reduce token bloat and improve performance.
      MIT