MCP 服务配置
配置 AgileBuilder MCP 服务
概述
本篇介绍如何启动 AgileBuilder MCP 服务并配置到各种 AI 工具中。
启动 MCP 服务
基本启动
agilebuilder mcp start
服务默认监听 http://localhost:3457。
自定义端口
agilebuilder mcp start --port 8080
后台运行
agilebuilder mcp start --daemon
查看状态
agilebuilder mcp status
配置 AI 工具
Cursor
- 打开 Cursor 设置
- 进入「MCP Servers」配置
- 添加新服务器:
{
"mcp": {
"servers": {
"agilebuilder": {
"url": "http://localhost:3457"
}
}
}
}
Claude Code
在命令行中配置:
# 方式一:命令行参数
claude code --mcp agilebuilder=http://localhost:3457
# 方式二:配置文件
# 在 ~/.claude_desktop_config.json 中添加
{
"mcpServers": {
"agilebuilder": {
"url": "http://localhost:3457"
}
}
}
Windsurf
- 打开 Windsurf 设置
- 进入「Extensions」或「MCP」配置
- 添加 AgileBuilder MCP 服务器地址
VS Code Copilot
注意:VS Code Copilot 的 MCP 支持取决于官方更新,请关注最新动态。
验证配置
配置完成后,你可以通过以下方式验证:
"列出所有可用的 AgileBuilder 模板"
AI 应该能够返回模板列表。
连接问题排查
服务未启动
# 检查服务状态
agilebuilder mcp status
# 如果未启动,重新启动
agilebuilder mcp start
端口被占用
# 使用其他端口
agilebuilder mcp start --port 8080
# 更新 AI 工具中的配置
网络问题
- 确保 MCP 服务和 AI 工具可以访问同一网络
- 检查防火墙设置
- 本地服务建议使用 localhost
安全考虑
本地服务
MCP 服务默认只允许本地访问,不要将服务端口暴露到公共网络。
认证配置
如果需要远程访问,可以配置认证:
agilebuilder mcp start --auth-token YOUR_TOKEN
然后在 AI 工具中配置:
{
"mcp": {
"servers": {
"agilebuilder": {
"url": "http://localhost:3457",
"headers": {
"Authorization": "Bearer YOUR_TOKEN"
}
}
}
}
}