Files
agent-fox/docs/clients/cursor.md
2026-04-12 20:15:41 +08:00

57 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Cursor
Cursor 是一款 AI 代码编辑器,支持通过 MCP 协议连接外部工具。
## 配置步骤
### 方式一:通过配置文件
在项目根目录创建 `.cursor/mcp.json`
```json
{
"mcpServers": {
"my-api": {
"type": "http",
"url": "https://www.agentfoxapp.com/mcp/{projectId}",
"headers": {
"Authorization": "Bearer {your-api-key}"
}
}
}
}
```
### 方式二:通过设置界面
1. 打开 Cursor 设置(`Cmd/Ctrl + ,`
2. 搜索 "MCP"
3. 在 MCP Servers 配置区域添加服务器信息
## 使用方法
配置完成后,在 Cursor 的 AI 对话中Agent 模式)即可使用 AgentFox 的 MCP 工具:
```
你:帮我调用用户注册接口,参考 API 文档
Cursor[调用 search_endpoints keyword="register"]
[调用 get_endpoint_detail endpointId="..."]
根据 API 文档,注册接口是 POST /api/users/register...
```
> **提示**:确保使用 Cursor 的 Agent 模式(而非 Ask 模式Agent 模式才能调用 MCP 工具。
## 验证连接
1. 打开 Cursor 设置 → MCP 区域
2. 检查 AgentFox 服务器状态是否显示为已连接(绿色指示灯)
3. 在对话中要求调用 `get_project_overview` 测试
## 安全提示
建议将 `.cursor/mcp.json` 添加到 `.gitignore`
```bash
echo ".cursor/mcp.json" >> .gitignore
```