Install
$ agentstack add mcp-dimarch0x-mcp-sieve ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ● Network access Used
- ✓ Filesystem access No
- ● Shell / process execution Used
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.
How agent discovery & health will work →About
MCP Sieve
A semantic proxy for MCP servers. Solves tool selection degradation — when an LLM has too many tools, it picks the wrong ones.
The sieve sits between the client (Claude Code, Hermes, any MCP client) and downstream MCP servers. The client sees 2 tools instead of dozens: mcp_router_select + mcp_router_call. The first finds relevant tools via embeddings, the second proxies the call.
How it works
Client (Claude Code / Hermes)
↓ sees only 2 tools
mcp_router_select(task="...") → embeddings → top-N relevant tools
mcp_router_call(tool_name, arguments) → proxies to downstream
↓
downstream MCP servers (time, fetch, git, arxiv, playwright, ...)
Two call paths:
| Client | Path | Notes | |--------|------|-------| | Hermes | Path 2 (proxy) | Hermes loads a frozen toolset at startup — use mcp_router_select + mcp_router_call. | | Claude Code | Path 1 or 2 | Without prompt caching: supports tools/list_changed (Path 1). With caching: behaves like Path 2. | | Custom MCP client | Path 1 | If your client handles notifications/tools/list_changed, the relevant tools appear in tools/list after select. |
- Path 1 (notifications/tools/list_changed):
selectfinds tools → sieve updatestools/list→ client calls tools directly. - Path 2 (mcproutercall proxy): for clients with a frozen toolset.
selectreturns tools withinputSchema→callproxies execution. No/resetneeded when new downstream tools are discovered.
Install
pip install mcp-sieve
# or
uvx mcp-sieve # run without installing
Ollama setup
Sieve needs a running Ollama instance at startup. Model download alone is not enough.
ollama pull nomic-embed-text
ollama serve # start the daemon (or enable the systemd service)
If Ollama is unreachable when sieve starts, it does not crash — it falls back to returning all downstream tools unordered (see [Fallback](#fallback)). For the semantic router to actually rank tools, Ollama must be alive before the first mcp_router_select call.
Quick start
Copy the example config and edit it:
cp config.example.yaml config.yaml
# edit config.yaml — add your downstream servers and paths
Run standalone:
python -m mcp_router.server
Server listens on stdio (JSON-RPC).
Connect to Claude Code
In ~/.claude.json → projects[""].mcpServers:
"sieve": {
"type": "stdio",
"command": "uvx",
"args": ["mcp-sieve"],
"env": {
"MCP_ROUTER_CONFIG": "/path/to/config.yaml"
}
}
Or via CLI:
claude mcp add sieve -- uvx mcp-sieve
Connect to Hermes
hermes mcp add sieve --command uvx --args "mcp-sieve"
hermes mcp test sieve
# /reset in chat
> Always set MCP_ROUTER_CONFIG when running via uvx. Because uvx installs the package into an isolated cache, sieve cannot find your config.yaml next to the source without this variable. This applies to all OSes, not just Windows.
Config
config.yaml (see config.example.yaml for a full template):
downstream:
- name: time
command: uvx
args: ["mcp-server-time"]
- name: fetch
command: uvx
args: ["mcp-server-fetch"]
- name: git
command: uvx
args: ["mcp-server-git", "--repository", "/path/to/your/repo"]
# Windows: npx is a .cmd file — needs cmd /c
- name: context7
command: cmd
args: ["/c", "npx", "-y", "@upstash/context7-mcp@latest"]
- name: filesystem
command: cmd
args: ["/c", "npx", "-y", "@modelcontextprotocol/server-filesystem", "/path/to/dir"]
# Remote MCP over HTTP (streamable) or SSE — no local process.
# transport defaults to stdio; a bare url implies http.
- name: gitmcp
transport: http
url: "https://gitmcp.io/docs"
embeddings:
ollama_url: "http://127.0.0.1:11434/api/embeddings"
model: "nomic-embed-text"
top_n: 10
Env variables:
MCP_ROUTER_CONFIG— path toconfig.yaml(otherwise looks in CWD or next to source)MCP_SIEVE_DOWNSTREAM__NAME/_COMMAND/_ARGS/_URL/_TRANSPORT— define downstream servers without a file (Docker/k8s).Nstarts at 1, stops at the first gap._ARGSis a JSON array or whitespace-split. A same-named entry overrides the yaml one.MCP_SIEVE_OLLAMA_URL/MCP_SIEVE_EMBED_MODEL/MCP_SIEVE_TOP_N— embeddings overrides
Crashed downstream servers (Ollama, npx) auto-reconnect with exponential backoff — no restart needed.
Security: avoid committing tokens. config.yaml is gitignored by default. For secrets (GitHub tokens, API keys), pass them as environment variables to the sieve process itself — your MCP client (claude_desktop_config.json, ~/.claude.json, or hermes mcp add ... --env) propagates them to downstream servers.
Using sieve
- Call
mcp_router_selectwith a natural language task:
``json {"task": "list open issues in facebook/react"} ` It returns up to top_n relevant tools with their inputSchema`.
- Pick the tool you need and call
mcp_router_call:
``json { "tool_name": "github_list_issues", "arguments": { "owner": "facebook", "repo": "react", "state": "open", "per_page": 5 } } ``
Important:
tool_namemust be exactly the name fromselected_tools(e.g.github_list_issues, notmcp_router_github_list_issues).argumentsmust match theinputSchemaof that tool. If validation fails, the downstream server's error is forwarded unchanged.
Troubleshooting
| Symptom | Cause | Fix | |---------|-------|-----| | mcp_router_select returns empty list or all tools unordered | Ollama is down or unreachable | Start ollama serve and restart sieve/gateway | | unknown tool: | Wrong tool_name in mcp_router_call | Copy the exact name from selected_tools | | downstream call failed: Invalid input... | Arguments don't match inputSchema | Check required fields in the schema returned by select | | Client sees only mcp_router_select / mcp_router_call | Client needs a tool-list refresh | In Hermes: /reset or restart gateway; in Claude Code: restart | | Some downstream tools are missing | That downstream failed to connect | Check mcp-stderr.log for npm/uvx errors; sieve keeps retrying |
Windows notes
- npx →
cmd /c npx:npxis a.cmdfile, Python subprocess (MCP SDK) can't find it without a shell.uvxis a real binary, works directly.
- uvx isolated venv:
uvx mcp-sieveinstalls into an isolated uv-cache venv. All imports must be inpyproject.toml[project.dependencies]— implicit deps from the dev env won't be picked up.
- uv cache clean: if the cache is locked (
os error 32), kill MCP server processes first:
``bash powershell -Command "Get-Process | Where-Object { $_.ProcessName -match 'mcp|uv' } | Stop-Process -Force" uv cache clean --force ``
- Debug connection failures:
claude --debugwrites to~/.claude/debug/.txt. GrepServer stderr:for real server tracebacks.
Stack
- MCP Python SDK (
mcp) — stdio + HTTP/SSE transports,notifications/tools/list_changed - Ollama — local embeddings (
nomic-embed-text), free - numpy — cosine similarity
- httpx — HTTP client for Ollama API
Fallback
If Ollama is unreachable when sieve builds embeddings at startup, mcp_router_select returns all downstream tools without ranking, plus a warning field. If Ollama becomes reachable later, restart sieve to build embeddings; the in-memory cache is not backfilled on the fly.
Performance
Tested with 10 downstream servers (79 tools):
mcp_router_select: 83–166msmcp_router_call: 15–774ms (longest: playwright browser navigation)- Startup: ~16–18s (all 10 downstream connect + 79 embeddings built)
Status
Working end-to-end in Claude Code and Hermes. See TASKS.md for the roadmap and benchmark results.
Source & license
This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: dimarch0x
- Source: dimarch0x/mcp-sieve
- License: MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.