RecoSearch
A deterministic MCP server that governs read-only queries across multiple data sources, returning answers with full provenance (every row cited) or a typed refusal, ensuring LLM answers are traceable and contract-enforced.
README
RecoSearch
Let an LLM answer questions over your real data — and prove every number it returns.
RecoSearch is a deterministic, governed MCP server. An MCP client (Claude, Claude Code, any MCP-compatible app) plans a question; RecoSearch decides whether and how to run it, executes only contract-allowed, read-only queries, and returns either an answer carrying full provenance — every row cited back to its source and the exact contract version that produced it — or a typed refusal.
It is not an agent. There is no model-driven decision loop in the server. All reasoning lives in the external MCP client; RecoSearch only governs execution.
<p align="center"> <img src="docs/assets/hero.svg" alt="RecoSearch architecture — an MCP client LLM sends tool calls to RecoSearch, which governs execution (semantic contract, RBAC, masking, read-only SQL guard) and returns validated rows each carrying a citation." width="920"> </p>
Two governed paths, one server
RecoSearch exposes two coherent capabilities under one MCP server, one package, and one cite-or-refuse philosophy:
- Governed multi-source query (breadth). Read-only, contract-governed access across six source types — structured (DuckDB, Postgres, Snowflake), text (OpenSearch), vector (Qdrant), and document (MongoDB) — with RBAC, field masking, a read-only SQL guard, in-process federation across sources, and a per-row citation on every result.
- Certified semantic layers (depth, DuckDB). A certified metric kernel (definition-hash, fan-out guard against double-counting, freshness SLA), an L2 context/trust layer, and L3 ontology claim validation. An experimental L4/L5 decision + calibration loop is available behind a flag (off by default).
Honest scope. The depth semantic layers run on a local DuckDB source. The breadth path is the one that spans all six source types. Both share the same contract, envelope, and citation model.
Every row is citable — and the client enforces it
Every row a data tool returns carries a _citation (source, contract version, fields, query hash,
and whether it may back a final answer). RecoSearch also ships validate_cited_evidence_packet, a
closure-graph validator that refuses a packet whose claims don't resolve to evidence actually returned
this session from the source that defines the metric, pinned to the current contract.
The validator is a tool the client calls — the server provides the validator and the provenance; the MCP client invokes the gate before presenting an answer. The server does not silently auto-validate behind your back. See the worked example for the full question → tool calls → cited answer flow.
How you author it
Three files you author are the source of truth for the breadth path — no business logic in Python:
| File | Role |
|---|---|
source_config.yaml |
Connection authority — where each source lives and how to reach it |
semantic.md |
Business meaning — metrics, rules, dimensions, measures, relations in plain language |
scenario_config.yaml |
Scenario identity and optional governance (RBAC, field masking, vocabulary) |
The depth semantic layers are authored as their own kernel YAML (see
docs/design and the bundled recosearch/semantic_layers/semantic/).
Quickstart — zero infrastructure, 2 minutes
The bundled NovaShop example is a single DuckDB file (products, customers, orders). No server, no credentials:
pip install -e ".[duckdb]"
# Build the sample database (deterministic), point the server at the example, compile + check.
python examples/novashop-duckdb/seed.py
export RECOSEARCH_SEMANTIC_DIR=examples/novashop-duckdb
recosearch --write-semantic-json
recosearch --validate
recosearch --health-check # → status "ok" with nothing else running
# Start the MCP server (connect it from Claude Desktop / Claude Code)
recosearch
Then ask your MCP client "Which product category drove the most delivered order revenue?" and watch it call the governed tools and return a cited answer.
Install
pip install -e ".[duckdb]" # minimal: the zero-infra quickstart
pip install -e ".[all,dev]" # all adapters + ontology + tests
Extras: duckdb, postgres, opensearch, qdrant, snowflake, mongodb, ontology,
observability. The depth ontology layer needs the ontology extra (rdflib, pyshacl).
CLI
| Command | Description |
|---|---|
recosearch |
Start the MCP server |
recosearch --write-semantic-json |
Compile semantic.json from the source files |
recosearch --validate |
Validate declared inputs; non-zero exit on errors |
recosearch --health-check |
Probe all declared sources |
recosearch --check-semantic-json |
Verify semantic.json is not stale |
Environment variables
| Variable | Default | Description |
|---|---|---|
RECOSEARCH_SEMANTIC_DIR |
./semantic |
Directory holding the active scenario's input files |
RECOSEARCH_CONTRACT_ENFORCEMENT |
warn |
strict aborts startup on invalid/stale contract |
RECOSEARCH_ROLE |
— | RBAC role applied to all requests (admin, analyst, viewer). Opt-in: governance is off when unset. |
RECOSEARCH_EXPERIMENTAL |
off |
Enables the experimental L4/L5 decision/calibration tools |
RECOSEARCH_TRACING_ENABLED |
false |
Export MCP tool spans to Phoenix (needs the observability extra) |
Limitations (what v0.1 does and does not do)
- The depth semantic layers run on DuckDB; the multi-source breadth path is the one spanning all six source types.
- Federation is an in-process slice-join over pre-fetched rows, not atomic cross-source SQL.
- RBAC/masking are opt-in and default to off (no
RECOSEARCH_ROLE→ no role gating). The read-only SQL guard and contract gating are always on. - The experimental decision/calibration tools keep their ledger per-process (the audit trail is
not persisted across restart). They are off by default behind
RECOSEARCH_EXPERIMENTAL. - The read-only guard blocks mutating SQL, undeclared tables/columns, no-FROM/constant selects, and a denylist of server-side functions (file read/write, sleep, dblink). Run the DB connection under a least-privilege, read-only role as the backstop.
See docs/usage/limitations.md for the full list.
Documentation
Running tests
pip install -e ".[duckdb,postgres,mongodb,ontology,dev]"
recosearch --write-semantic-json # compile first
pytest -q tests/unit tests/smoke tests/integration -m "not live" # breadth gateway
pytest -q tests/semantic_layers -m "not live" # depth semantic layers
License
Apache-2.0 — see LICENSE. Built by Recohut. Found a security issue? See SECURITY.md.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。