Cursor的代理模式可以自主编辑文件、运行shell命令、调用MCP服务器获取工具。如果没有搜索 MCP,智能体的知识会在训练时被冻结。本教程逐步介绍如何将 Scavio 的 MCP 服务器添加到 .cursor/mcp.json,以便每个 Cursor 代理会话都能获取实时 Google、YouTube、Amazon、Walmart 和 Reddit。
前置条件
- 已安装 Cursor IDE(2026 年最新版本)
- Cursor Pro 订阅(代理模式)
- Scavio API 密钥
- Node.js 20+(MCP 要求)
操作指南
步骤 1: 打开光标 MCP 配置
在 Cursor 中,打开项目根目录中的 .cursor/mcp.json 文件,如果不存在则创建它。
touch .cursor/mcp.json步骤 2: 添加 Scavio MCP 条目
将以下内容粘贴到 .cursor/mcp.json 中。将 YOUR_KEY 替换为您的 Scavio API 密钥。
{
"mcpServers": {
"scavio": {
"command": "npx",
"args": ["-y", "@scavio/mcp"],
"env": { "SCAVIO_API_KEY": "YOUR_KEY" }
}
}
}步骤 3: 重新加载光标
重新加载窗口(Cmd+Shift+P -> Developer:重新加载窗口),以便光标选择新的 MCP 服务器。
# In Cursor command palette
> Developer: Reload Window步骤 4: 启用 Scavio 工具
打开光标设置 -> MCP 并打开 Scavio 工具。
# Via Cursor UI: Settings > MCP > scavio > enable all tools步骤 5: 测试代理模式
将光标切换到代理模式并提出需要实时数据的问题。
> find the latest Stack Overflow answer about the 'ReferenceError' in Next.js 15 app routerPython 示例
# Validate Scavio works outside Cursor before debugging:
import os, requests
r = requests.post('https://api.scavio.dev/api/v1/search',
headers={'x-api-key': os.environ['SCAVIO_API_KEY']},
json={'query': 'stack overflow next.js 15 referenceerror app router'})
print(r.json())JavaScript 示例
const res = await fetch('https://api.scavio.dev/api/v1/search', {
method: 'POST',
headers: { 'x-api-key': process.env.SCAVIO_API_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({ query: 'stack overflow next.js 15 referenceerror app router' })
});
console.log(await res.json());预期输出
Cursor's agent panel shows scavio.search_google being called, then scavio.search_reddit for community discussion. The agent writes code with the fix, citing specific Stack Overflow and Reddit URLs.