综合Web搜索MCP服务器
一个模型上下文协议(MCP)服务器,公开合成网络搜索API作为一个工具,用于Claude和其他兼容MCP的应用程序。
](https://www.npmjs.com/package/synthetic-web-search-mcp)
概述
此服务器提供 search_web 允许MCP客户端使用 合成API。搜索结果以JSON格式返回,其中包含URL、标题、文本和发布日期字段。
Claude Code快速入门
使用一个命令将MCP服务器添加到Claude Code中:
claude mcp add synthetic-web-search -e SYNTHETIC_API_KEY=your_api_key_here -- npx -y synthetic-web-search-mcp@latest替换 your_api_key_here 与你的实际 合成API键.
使用Claude Desktop
要将此MCP服务器与Claude Desktop一起使用,请将以下内容添加到您的Claude Desktop配置文件中:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json 视窗: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"synthetic-web-search": {
"command": "npx",
"args": ["-y", "synthetic-web-search-mcp@latest"],
"env": {
"SYNTHETIC_API_KEY": "your_actual_api_key_here"
}
}
}
}添加配置后,重新启动Claude Desktop。然后,您可以在对话中使用网络搜索工具。
使用opencode
要将此MCP服务器与opencode一起使用,请将以下内容添加到您的opencode配置中:
{
"mcp": {
"synthetic-web-search": {
"type": "local",
"command": ["npx", "-y", "synthetic-web-search-mcp@latest"],
"environment": {
"SYNTHETIC_API_KEY": "your_actual_api_key_here"
},
"enabled": true
}
}
}替换 your_actual_api_key_here 与你的实际 合成API键。添加配置后重新启动opencode。
本地开发和测试
1.先决条件
- Node.js 18+
- A. 合成API键
2.安装和构建
npm install
npm run build3.使用MCP检验员进行测试
无需任何客户端配置即可交互式验证服务器的最快方法:
SYNTHETIC_API_KEY=your_key_here \
npx @modelcontextprotocol/inspector node dist/index.js这将打开一个浏览器UI,您可以在其中调用 search_web 直接。尝试:
queryonly →text默认限制为1000个字符。query+max_text_length: 200→ 更严格的截断以快速扫描结果。query+max_text_length: 5000→ 当你需要完整的细节时,请提供更多内容。
4.使用Claude代码进行测试(本地构建)
claude mcp add synthetic-web-search \
-e SYNTHETIC_API_KEY=your_key_here \
-- node /absolute/path/to/synthetic-web-search-mcp/dist/index.js5.使用Claude Desktop进行测试(本地构建)
编辑 ~/Library/Application Support/Claude/claude_desktop_config.json (macOS)或 %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"synthetic-web-search": {
"command": "node",
"args": ["/absolute/path/to/synthetic-web-search-mcp/dist/index.js"],
"env": {
"SYNTHETIC_API_KEY": "your_key_here"
}
}
}
}保存文件后重新启动Claude Desktop。
可用工具
搜索web
使用合成API搜索网页。
论据:
query(string,必填):搜索查询字符串max_text_length(数字,可选,默认值:1000):中包含的最大字符数text每个结果的字段。有助于防止大片段充斥上下文窗口。超过此长度的结果将被截断...。当您需要结果的全部内容时,传递一个更大的值。
例子:
Search for " TypeScript documentation"退货: 搜索结果的JSON数组,每个数组包含:
url:搜索结果的链接title:页面标题text:页面中的片段或内容published:出版日期(如有)
API详细信息
- 端点:
https://api.synthetic.new/v2/search - 方法:POST
- 认证:持票人代币通过
Authorization头球 - 请求正文:JSON格式
query领域
项目结构
synthetic-web-search-mcp/
├── package.json
├── tsconfig.json
├── .env.example
├── README.md
├── src/
│ └── index.ts
└── dist/ (generated after build)
├── index.js
└── index.d.ts