Skip to content

MCP 配置管理

Vibe Kanban 提供集中化的 MCP (Model Context Protocol) 配置管理功能,让您可以统一管理所有代理的 MCP 服务配置。

MCP 简介

MCP (Model Context Protocol) 是一种标准化协议,允许 AI 编程代理与外部工具和服务进行交互。通过 MCP,代理可以:

  • 访问文件系统
  • 执行命令
  • 查询数据库
  • 调用 API
  • 使用自定义工具

集中配置的优势

在 Vibe Kanban 中集中管理 MCP 配置的好处:

优势说明
统一管理在一处配置所有代理的 MCP 服务
配置共享多个代理可以共享相同的 MCP 配置
版本控制轻松跟踪配置变更历史
安全管理集中管理敏感凭证

环境变量配置

MCP 服务的基础配置通过环境变量设置:

bash
# MCP 服务主机地址
export MCP_HOST="127.0.0.1"

# MCP 服务端口
export MCP_PORT="8080"

MCP 服务配置

配置文件位置

Vibe Kanban 的 MCP 配置通常位于项目根目录或用户配置目录。

配置示例

json
{
  "mcp": {
    "servers": {
      "filesystem": {
        "type": "local",
        "command": ["mcp-server-filesystem"],
        "args": ["--root", "/path/to/project"],
        "enabled": true
      },
      "database": {
        "type": "remote",
        "url": "https://mcp.example.com/db",
        "auth": {
          "type": "bearer",
          "token": "${DB_MCP_TOKEN}"
        },
        "enabled": true
      },
      "context7": {
        "type": "remote",
        "url": "https://mcp.context7.com/mcp",
        "enabled": true
      }
    }
  }
}

服务类型

类型说明配置方式
local本地 MCP 服务器指定 command 和 args
remote远程 MCP 服务指定 url 和 auth
stdio标准输入输出指定 command

代理 MCP 配置映射

为不同代理配置不同的 MCP 服务访问权限:

json
{
  "agents": {
    "claude-code": {
      "mcp_servers": ["filesystem", "database", "context7"]
    },
    "gemini-cli": {
      "mcp_servers": ["filesystem", "context7"]
    },
    "codex-cli": {
      "mcp_servers": ["filesystem"]
    }
  }
}

常用 MCP 服务

文件系统服务

提供文件读写、目录浏览等功能:

json
{
  "filesystem": {
    "type": "local",
    "command": ["mcp-server-filesystem"],
    "args": ["--root", "."],
    "capabilities": ["read", "write", "list"]
  }
}

数据库服务

提供数据库查询能力:

json
{
  "database": {
    "type": "local",
    "command": ["mcp-server-postgres"],
    "env": {
      "DATABASE_URL": "${DATABASE_URL}"
    }
  }
}

Context7 服务

提供智能上下文增强:

json
{
  "context7": {
    "type": "remote",
    "url": "https://mcp.context7.com/mcp",
    "description": "智能代码上下文服务"
  }
}

安全最佳实践

  1. 使用环境变量:敏感信息使用 ${VAR_NAME} 引用环境变量
  2. 最小权限原则:只授予代理必要的 MCP 服务访问权限
  3. 定期轮换凭证:定期更新 API Token 和密钥
  4. 审计日志:启用 MCP 调用日志以便追踪

故障排查

连接失败

bash
# 检查 MCP 服务是否运行
curl http://${MCP_HOST}:${MCP_PORT}/health

# 检查网络连通性
nc -zv ${MCP_HOST} ${MCP_PORT}

认证错误

  • 确认 Token 或 API Key 正确
  • 检查环境变量是否正确设置
  • 验证 Token 是否过期

下一步

aicodex 文档网站