MCP协议栈Docker集成

一个用于本地IDE集成的完整MCP(Model Context Protocol)服务器堆栈,包含Supabase数据库、Brave搜索、网页爬取和GitHub集成四大核心服务。

  • by arneldvdv-git
  • 本地部署
  • 更新于
在 GitHub 查看 arneldvdv-git/mcp-stack

使用说明

进行中

MCP堆栈-Docker编写设置

这个docker compose文件建立了一个完整的MCP(模型上下文协议)服务器栈,其中包含四个用于本地IDE集成的基本服务(VS Code、Windsurf等)。

服务包括

  1. Supabase MCP (端口3000、8000、54321)

    • PostgreSQL数据库后端
    • 认证与授权
    • 实时能力
    • 用于管理的Supabase Studio用户界面
  2. 勇敢搜索MCP (端口3001)

    • Web搜索集成
    • 基于人工智能的搜索结果
    • 需要勇敢的API密钥
  3. Crawl4AI MCP (端口3002)

    • 网络爬行和抓取
    • 内容提取
    • 人工智能驱动的数据处理
  4. GitHub MCP (端口3003)

    • GitHub存储库集成
    • 代码搜索和访问
    • 问题和公关管理
    • 需要GitHub令牌

先决条件

  • 已安装Docker和Docker Compose
  • API密钥用于:
    • 勇敢的搜索:https://api.search.brave.com/
    • github:https://github.com/settings/tokens(创建个人访问令牌)

安装说明

1.克隆/下载此堆栈

git clone https://github.com/arneldvdv-git/mcp-stack.git
cd mcp-stack

2.配置环境变量

# Copy the example file
copy .env.example .env

# Edit .env and add your API keys

3.启动服务

docker-compose up -d

这将在后台启动所有服务。通过以下方式检查状态:

docker-compose ps

4.验证服务是否正在运行

  • Supabase工作室:http://localhost:3000
  • 勇敢搜索MCP:http://localhost:3001
  • Crawl4AI MCP:http://localhost:3002/health
  • GitHub MCP:http://localhost:3003

配置VS代码

创建或更新 .vscode/settings.json:

{
  "[python]": {
    "defaultInterpreterPath": "${workspaceFolder}/venv/bin/python"
  },
  "mcp": {
    "servers": [
      {
        "name": "supabase-mcp",
        "command": "curl",
        "args": ["http://localhost:3000"],
        "type": "http"
      },
      {
        "name": "brave-search-mcp",
        "command": "curl",
        "args": ["http://localhost:3001"],
        "type": "http"
      },
      {
        "name": "crawl4ai-mcp",
        "command": "curl",
        "args": ["http://localhost:3002"],
        "type": "http"
      },
      {
        "name": "github-mcp",
        "command": "curl",
        "args": ["http://localhost:3003"],
        "type": "http"
      }
    ]
  }
}

配置Windsurf

创建 .windsurf/settings.json 或更新您的Windsurf配置:

{
  "mcp": {
    "servers": {
      "supabase": {
        "url": "http://localhost:3000"
      },
      "brave-search": {
        "url": "http://localhost:3001"
      },
      "crawl4ai": {
        "url": "http://localhost:3002"
      },
      "github": {
        "url": "http://localhost:3003"
      }
    }
  }
}

配置光标

Cursor通过其设置支持MCP服务器。通过以下方式进行配置:

选项1:使用光标设置UI

  1. 打开 光标设置 (Cmd/Ctrl+,)
  2. 搜索“MCP”
  3. 点击 “在settings.json中编辑” 在MCP服务器部分
  4. 添加服务器配置

选项2:手动配置

编辑 ~/.cursor/settings.json (或您的游标配置路径):

{
  "mcp": {
    "servers": [
      {
        "name": "supabase-mcp",
        "url": "http://localhost:3000",
        "enabled": true
      },
      {
        "name": "brave-search-mcp",
        "url": "http://localhost:3001",
        "enabled": true
      },
      {
        "name": "crawl4ai-mcp",
        "url": "http://localhost:3002",
        "enabled": true
      },
      {
        "name": "github-mcp",
        "url": "http://localhost:3003",
        "enabled": true
      }
    ]
  }
}

重新启动游标

添加配置后,重新启动Cursor,以便识别和连接MCP服务器。

验证连接

  • 打开Cursor的集成终端
  • MCP应出现在上下文菜单中或可用于提示
  • 检查Cursor的输出/调试控制台是否有任何连接错误

故障排除

服务未启动

# Check logs for specific service
docker-compose logs brave-search-mcp
docker-compose logs crawl4ai-mcp

# Restart all services
docker-compose restart

连接被拒绝

  • 确保Docker桌面正在运行
  • 检查防火墙设置是否允许本地主机连接
  • 验证端口3000-3003是否未使用

API关键错误

  • 复查 .env 文件具有正确的API密钥
  • 确保密钥未被引号括起来 .env
  • 如果需要,重新生成令牌

有用的命令

# Start services
docker-compose up -d

# Stop services
docker-compose down

# View logs
docker-compose logs -f

# Rebuild images
docker-compose build

# Remove volumes (WARNING: deletes data)
docker-compose down -v

# Access Supabase database
docker-compose exec supabase-mcp psql -U postgres

端口参考

服务 端口 用途
Supabase Studio 3000 Web用户界面
Suabase API 8000 REST API
PostgreSQL 54321 数据库
勇敢搜索MCP 3001 搜索API
爬网4AI MCP 3002 正在爬网API
GitHub MCP 3003 GitHub API

备注

  • 所有服务均通过以下方式连接 mcp-network 跨业务通信桥
  • 数据保存在Docker卷中(suppase_postgres_Data、crawl4ai_Data)
  • 服务已配置健康检查
  • 永远不应将环境(.env)提交给版本控制