使用说明
公民部署MCP服务器
用于部署应用程序的模型上下文协议(MCP)服务器 公民平台.从git或本地文件部署,具有智能错误处理和自动修复功能。
适用于:
- ✅ 克劳德桌面版
- ✅ 克劳德代码(VS代码扩展)
- ✅ 光标
- ✅ 带有MCP扩展的VS代码
安装
npm install -g @citizenteam/mcp
# or
bun install -g @citizenteam/mcp
快速设置
克劳德桌面版
添加到您的 claude_desktop_config.json:
{
"mcpServers": {
"citizen": {
"command": "npx",
"args": ["-y", "@citizenteam/mcp"]
}
}
}
配置文件位置:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - 视窗:
%APPDATA%\Claude\claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json
克劳德代码(VS代码扩展)
- 打开VS代码设置(Cmd/Ctrl+,)
- 搜索“MCP服务器”
- 点击“在settings.json中编辑”
- 添加:
{
"claude.mcpServers": {
"citizen": {
"command": "npx",
"args": ["-y", "@citizenteam/mcp"]
}
}
}
光标
- 打开光标设置→ 特性→ MCP
- 点击“添加MCP服务器”
- 输入配置:
{
"citizen": {
"command": "npx",
"args": ["-y", "@citizenteam/mcp"]
}
}
或手动编辑 ~/.cursor/mcp.json:
{
"mcpServers": {
"citizen": {
"command": "npx",
"args": ["-y", "@citizenteam/mcp"]
}
}
}
VS代码(带MCP扩展名)
- 安装 VS代码的MCP扩展
- 打开settings.json(Cmd/Ctrl+Shift+P→ “首选项:打开设置(JSON)”)
- 添加:
{
"mcp.servers": {
"citizen": {
"command": "npx",
"args": ["-y", "@citizenteam/mcp"]
}
}
}
首次设置
- 添加配置后重新启动IDE/Claude Desktop
- 使用
authenticate使用设备流登录的工具 - 按照浏览器中的设备授权链接进行操作
- 一旦获得授权,您就可以部署应用程序!
可用工具
认证
authenticate-使用设备流登录check_auth_status-检查身份验证状态
应用管理
list_apps-列出您的应用程序(RBAC筛选)get_app_info-获取应用程序详细信息
部署
deploy_from_git-从git仓库部署deploy_from_local-从本地目录部署get_deployment_status-检查部署状态和日志list_deployment_runs-列出最近的部署
可用资源
部署说明(citizen://instructions)
一份全面的指南,帮助法学硕士了解:
- 完整的部署工作流程(git和本地)
- 错误处理和调试策略
- 如何修复常见的构建错误(Python版本、节点版本、端口绑定等)
- 监控部署的最佳实践
- RBAC权限模型
- 常见的nixbacks配置
- 示例对话和用例
您的AI助手将自动阅读此资源,以了解如何正确使用部署工具、监控构建并在出现错误时进行修复。
示例用法
基本部署
You: Deploy my app from github.com/user/repo.git
AI will:
1. Read the deployment instructions to understand the workflow
2. Check if you're authenticated
3. List your apps to see what's available
4. Deploy using deploy_from_git tool
5. Monitor the deployment with get_deployment_status
6. If errors occur, analyze logs and suggest fixes
带错误处理的部署
You: Deploy my Flask app from the current directory
AI will:
1. Deploy using deploy_from_local (creates tar.gz automatically)
2. Monitor build progress
3. If build fails (e.g., "Python 3.11 not found"):
- Read the error from logs
- Create/update nixpacks.toml with correct Python version
- Redeploy automatically
4. Continue monitoring until successful
交互式调试
You: My last deployment failed, can you help?
AI will:
1. List recent deployment runs
2. Get detailed logs for the failed run
3. Analyze the error (missing dependency, version mismatch, etc.)
4. Suggest and apply fixes
5. Redeploy with corrections
特性
- 🔐 安全设备身份验证 -类似OAuth的设备流,无需密码
- 🚀 Git和本地部署 -从GitHub或本地文件部署
- 🤖 智能错误修复 -AI自动分析日志并修复构建错误
- 📊 实时监控 -实时部署日志和状态更新
- 🔒 RBAC支持 -基于角色的访问控制(查看者、成员、管理员、所有者)
- 🏗️ 自动检测建筑商 -支持nixpacks和Dockerfile
- 🔄 快速迭代 -本地部署,无需git提交即可快速修复
需求
- Node.js 18+或Bun
- 公民平台账号(注册)
- 其中之一:克劳德桌面、克劳德代码、光标或带有MCP扩展的VS代码
故障排除
身份验证问题
- 确保你已经运行了
authenticate工具 - 检查您的令牌是否已过期
check_auth_status - 验证您使用的组织是否正确
部署失败
- AI将自动分析日志并提出修复建议
- 常见问题:Python/Node版本不匹配、缺少依赖项、端口绑定
- 使用
deploy_from_local在修复错误时进行更快的迭代
权限不足
- 检查你的角色
list_apps-您可能无法访问该应用程序 - 联系您的组织管理员以授予您成员+角色
链接
许可证
麻省理工学院©公民团队