增强型游标MCP服务器
一个全面的MCP服务器,用于协调 端到端GitHub问题工作流 使用Cursor的后台代理API。启动自动实施解决方案、创建PR和管理整个问题生命周期的代理。
🚀 特性
完成PR工作流的问题
- 🎯 一键解决问题:
work_issue(issueUrl)处理一切 - 🤖 智能代理提示: 自动根据问题详细信息生成全面提示
- 🔗 自动PR链接: 使用“关闭#N”将PR链接到问题
- 🏷️ 状态跟踪: 管理标签(正在进行中→ 完成/错误)
- 💬 进度更新: 发布关于状态更新问题的评论
- 🪝 Webhook集成: 代理完成时的实时通知
🛠️ 设置
1.安装依赖项
cd ~/brocksoftware/mcps/custom-cursor-mcp
bun install2.获取API密钥
- 光标API键: 光标仪表板
- GitHub令牌: 随着
repo,issues,pull_requests范围
3.配置环境
export CURSOR_API_KEY=your_cursor_api_key_here
export GITHUB_TOKEN=your_github_personal_access_token_here
export WEBHOOK_SECRET=your_webhook_secret # optional4.构建和启动
bun run build
bun start🎯 核心工具
work_issue - 完成工作流程
在一个命令中处理PR工作流的整个问题。
work_issue({
issueUrl: "https://github.com/owner/repo/issues/123",
customPrompt: "Use TypeScript and include tests",
webhookUrl: "https://your-webhook.com/cursor"
})流程:
- ✅ 从GitHub获取问题详细信息
- ✅ 添加“进行中”标签
- ✅ 帖子“工作开始”评论
- ✅ 启动具有全面提示的Cursor代理
- ✅ 代理使用“Closes#123”创建PR
- ✅ 完成时出现Webhook更新问题
launch_agent_for_issue - 手动启动
launch_agent_for_issue({
owner: "myorg",
repo: "myproject",
issueNumber: 42,
customPrompt: "Focus on performance"
})followup_agent - 导游代理
followup_agent({
agentId: "bc_123456789",
prompt: "Also add unit tests"
})🔧 GitHub工具
问题管理
comment_on_issue-为问题添加评论update_issue_labels-管理问题标签get_issue_details-获取问题信息link_pr_to_issue-将PR与问题联系起来
📱 克劳德集成
添加到克劳德代码桌面MCP配置:
{
"mcpServers": {
"cursor-agents": {
"command": "bun",
"args": ["run", "~/brocksoftware/mcps/custom-cursor-mcp/dist/index.js"],
"env": {
"CURSOR_API_KEY": "your_cursor_api_key_here",
"GITHUB_TOKEN": "your_github_personal_access_token_here",
"WEBHOOK_SECRET": "your_webhook_secret"
}
}
}
}🎬 使用示例
克劳德指挥部:
*“关于问题的工作https://github.com/myorg/api/issues/42"*
结果:
- 分析问题#42
- 启动后台代理
- 代理实现解决方案
- 使用“关闭#42”创建PR
- 随进度更新问题
多代理工作流:
// Launch multiple agents
const issues = [23, 24, 25];
issues.forEach(num => {
work_issue({
issueUrl: `https://github.com/myorg/backend/issues/${num}`,
customPrompt: "Ensure backward compatibility"
})
})代理商指导:
// Launch agent
const result = launch_agent_for_issue({
owner: "myorg", repo: "frontend", issueNumber: 15
})
// Guide mid-work
followup_agent({
agentId: result.agentId,
prompt: "Add error handling and loading states"
})🪝 Webhook事件
完成:代理已完成
- 删除“进行中”标签
- 添加“代理已完成”标签
- 通过PR链接发布成功评论
错误:代理失败
- 删除“进行中”标签
- 添加“代理错误”标签
- 发布错误详细信息
🔒 安全
GitHub代币范围:
repo-存储库访问issues-问题管理pull_requests-公关管理
分行安全:
- 代理商使用
cursor/issue-N分支模式 - 避免命名冲突
cursor/*分支
⚡ 限制
- 256种活性剂 每个游标API键
- 5000个GitHub API请求/小时
- API测试版-可能会更改
🔄 发展
# Development mode
bun run dev
# Build for production
bun run build
# Type checking
bun run type-check🐛 故障排除
代理失败:
- 验证CURSOR_API_KEY
- 检查存储库访问权限
- 确保分支/ref存在
GitHub错误:
- 验证GITHUB_TOKEN示波器
- 检查存储库权限
- 确认问题/PR编号
Webhook问题:
- 使用HTTPS端点
- 验证WEBHOOK_SECRET
- 检查公共可访问性
📄 许可证
麻省理工学院
______________________________________________________________________
开始自动化: 说 *“处理问题URL”* 在克劳德和看魔术发生! 🚀
