本项目实现了一个针对 RAG 网页浏览器 Actor 的 MCP 服务器。该 Actor 可作为大型语言模型 (LLMs) 和 RAG 管道的网页浏览器,其功能类似于 ChatGPT 中的网络搜索。
本 MCP 服务器能让相关应用像在 ChatGPT 中进行网络搜索一样,为大型语言模型和 RAG 管道提供网页浏览功能。只需按照后续的配置步骤操作,即可让 AI 助手使用该服务器进行网络搜索和内容抓取。
模型上下文协议(MCP)可使人工智能应用程序(和人工智能代理),如 Claude Desktop,连接到外部工具和数据源。它是一个开放协议,能让人工智能应用程序、人工智能代理与本地或远程资源之间实现安全且受控的交互。
RAG 网页浏览器 Actor 赋予了 AI 助手以下能力:
query
(字符串,必需):搜索词或 URL。max_results
(数字,可选):要抓取的最大搜索结果数量(默认:1)。query
(字符串,必需):搜索词或 URL。max_results
(数字,可选):要抓取的最大搜索结果数量(默认:1)。该服务器不提供任何资源和提示。
APIFY_API_TOKEN
)。需对 Claude Desktop 进行配置,使其能够识别 MCP 服务器。
~/Library/Application\ Support/Claude/claude_desktop_config.json
。%APPDATA%/Claude/claude_desktop_config.json
。"mcpServers": {
"mcp-server-rag-web-browser": {
"command": "npx",
"args": [
"/path/to/mcp-server-rag-web-browser/build/index.js"
],
"env": {
"APIFY-API-TOKEN": "your-apify-api-token"
}
}
}
What is an MCP server and how can it be used?
What is an LLM, and what are the recent news updates?
Find and analyze recent research papers about LLMs.
若您在未发布的服务器上工作,可通过以下命令访问本地服务器:
"mcpServers": {
"mcp-server-rag-web-browser": {
"command": "/path/to/mcp-server-rag-web-browser/build/index.js"
},
"env": {
"APIFY-API-TOKEN": "your-apify-api-token"
}
}
要对服务器进行测试,可使用 example_client
:
node build/example_client.js
该脚本会启动 MCP 服务器,获取可用工具,然后调用 search
工具以查询词。
调用 RAG 网页浏览器 Actor 进行测试:
APIFY_API_TOKEN=your-apify-api-token node build/example_call_web_browser.js
由于 MCP 服务器通过标准输入/输出(stdio)运行,调试可能具有一定挑战性。为获得最佳的调试体验,建议使用 MCP 调试器。