在 Cursor 中使用
将 Crawlbase 作为 Cursor 的 MCP 服务器。无需离开编辑器即可拉取实时文档、抓取竞品代码并获取参考内容。
设置
Cursor 从 JSON 文件中读取 MCP 服务器配置。打开 Cursor Settings → Tools and Integrations → Add Custom MCP,或直接编辑文件:
| 范围 | 路径 |
|---|---|
| 全局(所有项目) | ~/.cursor/mcp.json |
| 按项目 | .cursor/mcp.json
位于项目根目录 |
配置
{
"mcpServers": {
"crawlbase": {
"type": "stdio",
"command": "npx",
"args": ["@crawlbase/mcp@latest"],
"env": {
"CRAWLBASE_TOKEN": "YOUR_TOKEN",
"CRAWLBASE_JS_TOKEN": "YOUR_JS_TOKEN"
}
}
}
}保存并重新加载 Cursor(Cmd/Ctrl+Shift+P → "Reload Window")。Crawlbase 工具现在应该会在 MCP 设置面板中显示为绿点。
在聊天中使用
打开 Cursor 聊天面板(Cmd/Ctrl+L)。AI 现在可以在需要时调用 Crawlbase 工具。
Fetch the latest changelog from https://nextjs.org/blog and tell me
what's new in the most recent release. Then update our package.json
to match if our version is older.效果良好的使用模式
- 实时文档查询:「拉取最新的 library 文档并解释如何实现 X」,比模型训练数据中的内容更准确。
- 竞品分析:「查看 competitor 在其公开站点上如何实现 feature」,可与代码编辑配合使用。
- 构建时抓取:在工具 prompt 中加入 Crawlbase 调用,用于一次性数据获取,无需把它们放进代码库。
按项目配置可让不同的代码仓库使用不同的 Crawlbase token,如果您为生产和开发工作负载使用独立账号,这将非常实用。