Sieve
БесплатноНе проверенSemantic tool selection proxy for MCP servers — LLM sees 2 tools instead of dozens
Описание
Semantic tool selection proxy for MCP servers — LLM sees 2 tools instead of dozens
README
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 (mcp_router_call 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). 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["<path>"].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_CONFIGwhen running viauvx. Becauseuvxinstalls the package into an isolated cache, sieve cannot find yourconfig.yamlnext 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_<N>_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:{"task": "list open issues in facebook/react"}It returns up to
top_nrelevant tools with theirinputSchema.Pick the tool you need and call
mcp_router_call:{ "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: <name> |
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:powershell -Command "Get-Process | Where-Object { $_.ProcessName -match 'mcp|uv' } | Stop-Process -Force" uv cache clean --forceDebug connection failures:
claude --debugwrites to~/.claude/debug/<session>.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.
Установка Sieve
У этого сервера нет опубликованного пакета — он собирается из исходников. Открой репозиторий и следуй инструкции в README.
▸ github.com/dimarch0x/mcp-sieveFAQ
Sieve MCP бесплатный?
Да, Sieve MCP бесплатный — установка в пару кликов через Unyly без оплаты.
Нужен ли API-ключ для Sieve?
Нет, Sieve работает без API-ключей и переменных окружения.
Sieve — hosted или self-hosted?
Self-hosted: сервер запускается локально на твоей машине командой из раздела установки.
Как установить Sieve в Claude Desktop, Claude Code или Cursor?
Открой Sieve на unyly.org, выбери вкладку своего клиента (Claude Desktop, Claude Code, Cursor) и нажми Install — конфиг сгенерируется автоматически, без правки JSON.
Похожие MCP
Fetch
Web content fetching and conversion for efficient LLM usage.
AWS KB Retrieval
Retrieval from AWS Knowledge Base using Bedrock Agent Runtime.
автор: modelcontextprotocolSpring AI MCP Server
Provides auto-configuration for setting up an MCP server in Spring Boot applications.
llm-analysis-assistant
A very streamlined mcp client that supports calling and monitoring stdio/sse/streamableHttp, and can also view request responses through the /logs page. It also
автор: xuzexin-hzMCP-Agent
A simple, composable framework to build agents using Model Context Protocol by [LastMile AI](https://www.lastmileai.dev)
автор: lastmile-aiSpring AI MCP Client
Provides auto-configuration for MCP client functionality in Spring Boot applications.
mcp.natoma.ai
A Hosted MCP Platform to discover, install, manage and deploy MCP servers by [Natoma Labs](https://www.natoma.ai)
MCPHub
Website to list high quality MCP servers and reviews by real users. Also provide online chatbot for popular LLM models with MCP server support.
MCP Servers Rating and User Reviews
Website to rate MCP servers, write authentic user reviews, and [search engine for agent & mcp](http://www.deepnlp.org/search/agent)
mkinf
An Open Source registry of hosted MCP Servers to accelerate AI agent workflows.
Compare Sieve with
Не уверен что выбрать?
Найди свой стек за 60 секунд
Автор?
Embed-бейдж для README
Похожее
Все в категории ai
