search-mcp
Provides an MCP server with a search tool for agents, backed by Cloudflare AI Search and a synced corpus of git repositories.
README
search-mcp
Open-source toolkit for Cloudflare AI Search:
- MCP Worker (
src/mcp.ts) -- bearer-gated Streamable-HTTP MCP with asearchtool for agents. - Query Worker (
src/index.ts) -- CORS + Turnstile + rate-limitedPOST /askthat streams answers for a browser widget. - Corpus sync (
scripts/sync.mjs,scripts/sync-runner.mjs) -- git-tracked sources to R2, with extension remapping so TypeScript, Dockerfiles, and other text AI Search would otherwise skip get indexed.
git repos -> sync.mjs -> R2 bucket -> AI Search instance -> /ask + /mcp
Quick start
npm install
cp wrangler.toml.example wrangler.toml
cp wrangler.mcp.toml.example wrangler.mcp.toml
cp scripts/targets.json.example scripts/targets.json
# edit the three files for your account, instance, bucket, and repos
npm run typecheck
npm test
Provision R2 + AI Search, sync your corpus, deploy both Workers. Step-by-step: docs/DEPLOY.md.
Workers
| Worker | Entry | Endpoint | Auth |
|---|---|---|---|
| Query | wrangler.toml |
POST /ask, GET /health |
Turnstile (optional) + CORS allowlist |
| MCP | wrangler.mcp.toml |
POST /mcp, GET /health |
Authorization: Bearer (fail closed) |
Deploy separately so browser traffic and agent traffic can bind different AI Search instances if you want.
npm run deploy # query Worker
npm run deploy:mcp # MCP Worker
wrangler secret put MCP_TOKEN -c wrangler.mcp.toml
wrangler secret put TURNSTILE_SECRET # optional; skips verification when unset
MCP client wiring
{
"mcpServers": {
"search-mcp": {
"type": "http",
"url": "https://YOUR_MCP_HOST/mcp",
"headers": { "Authorization": "Bearer YOUR_TOKEN" }
}
}
}
MCP_TOKEN accepts a single token or comma-separated name=token pairs for per-consumer attribution in logs.
Corpus sync
export R2_ACCESS_KEY_ID=... R2_SECRET_ACCESS_KEY=... CLOUDFLARE_ACCOUNT_ID=...
export CORPUS_GIT_ORG=your-org GITHUB_TOKEN=... # for sync-runner clone auth
npm run sync:dry # plan upload for the default `corpus` target
npm run sync # upload + prune
npm run sync:run # isolated clone root, sync all targets, optional reindex
The sync remaps non-native extensions (.ts, .tsx, extensionless Dockerfile, .service, etc.) to .txt keys so AI Search indexes them. See scripts/sync-ingest.mjs.
If you name a target public, optional boundary checks refuse overlap with restrictedRepos and can verify GitHub repo visibility before upload.
Ask widget
Copy public/ask-widget.js and public/ask-widget.css to your docs site:
<div id="docs-ask"></div>
<script defer src="/ask-widget.js"
data-endpoint="https://search.example.com/ask"
data-target="#docs-ask"
data-label="Ask the docs"
data-sitekey="YOUR_TURNSTILE_SITEKEY"></script>
License
AGPL-3.0-only. See LICENSE.
Community
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。
mcp-server-qdrant
这个仓库展示了如何为向量搜索引擎 Qdrant 创建一个 MCP (Managed Control Plane) 服务器的示例。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。