MCP Node DuckDuckGo 服务器是一个基于 Node.js 的应用程序,作为 MCP(模块化控制平台)服务器运行。它主要提供两个实用工具,一是可查询 DuckDuckGo 并获取格式化搜索结果的搜索工具,二是能从指定网页 URL 抓取并解析文本内容的获取内容工具。
MCP Node DuckDuckGo 服务器通过 HTTP 端口提供对 DuckDuckGo 搜索和网页内容抓取的功能。以下是启动服务器的步骤:
node mcp-node-duckduckgo-server.js
MCP 服务器 "ddg-search" 在端口3000上运行
git clone <仓库地址>
cd mcp-node-duckduckgo-server
npm install express axios cheerio
要列出所有可用工具,请打开新的终端窗口并运行:
curl http://localhost:3000/tools
这将输出一个 JSON 列表,显示注册的工具(例如,“search”和“fetchContent”)。
使用搜索工具执行搜索查询:
curl -X POST http://localhost:3000/run-tool -H "Content-Type: application/json" -d "{\"toolName\":\"search\",\"params\":{\"query\":\"测试查询\",\"maxResults\":5}}"
响应将包含来自 DuckDuckGo 的格式化搜索结果。
从指定网页获取内容:
curl -X POST http://localhost:3000/run-tool -H "Content-Type: application/json" -d "{\"toolName\":\"fetchContent\",\"params\":{\"url\":\"https://www.channelnewsasia.com/singapore/ge2025-general-election-may-3-parliament-dissolved-5064316\"}}"
服务器将返回从抓取网页中提取的文本片段。
欢迎贡献!如果希望参与:
git checkout -b feature/YourFeature
)。git commit -m '添加某个功能'
)。git push origin feature/YourFeature
)。本项目遵循 MIT 许可证,具体内容请参阅LICENSE文件。