HTTP代理MCP服务器

一个提供Cursor工具作为HTTP API的MCP服务器,可与Open WebUI和n8n集成,适用于代码库搜索和文件操作等开发场景。

  • by bbajor
  • JavaScript
  • 本地部署
  • 更新于

使用说明

MCPO(MCP over HTTP Proxy for Cursor)

模型上下文协议 (MCP) 服务器,可将光标工具作为 HTTP API 提供,并与 Open WebUI 和 n8n 集成。

特性

  • 🚀 MCP服务器 mit光标工具(代码库搜索、文件操作等)
  • 🌐 HTTP-API公司 通过mcpo(MCP over HTTP代理)
  • 🐳 波德曼/Docker 支持轻松部署
  • 🔧 PowerShell安装脚本 适用于 Windows
  • 📡 打开WebUI集成 准备
  • 🔄 n8n兼容 工作流自动化

快速开始

Windows(PowerShell)

# Installations-Script ausführen
.\mcpo_install.ps1

Das脚本:

  1. 测试条件(Podman,Node.js)
  2. 安装依赖关系
  3. 以守护进程启动 Podman-Compose
  4. MCP服务器测试 http://localhost:8000 可用

曼努埃尔

# 1. Dependencies installieren
npm install

# 2. Environment konfigurieren
cp .env.example .env
# .env bearbeiten und API-Keys setzen

# 3. Mit Podman starten
podman-compose up -d

# 4. Status prüfen
podman-compose ps

配置

环境变量

复制 .env.example 之后 .env 并适应:

# MCPO Configuration
MCPO_PORT=8000
MCPO_API_KEY=dein-geheimer-api-key-hier

# Workspace (wird als Volume gemountet)
WORKSPACE_PATH=D:\workspace\pvs

# MCP Server
MCP_SERVER_NAME=cursor-mcp
MCP_SERVER_VERSION=1.0.0

生成API密钥

# PowerShell: Zufälligen API-Key generieren
-join ((48..57) + (65..90) + (97..122) | Get-Random -Count 32 | ForEach-Object {[char]$_})

使用

API 终端

启动后:

  • API基地: http://localhost:8000
  • OpenAPI文档: http://localhost:8000/docs
  • 健康检查: http://localhost:8000/health

打开WebUI集成

  1. 打开WebUI→ 管理员→ 设置→ 外部工具
  2. 添加 MCP 服务器:
    • 类型: MCP (Streamable HTTP)
    • 统一资源定位符: http://localhost:8000 (或 Docker 主机名)
    • API密钥价值: 从 MCPO_API_KEY 在 .env
  3. 激活和保存工具

n8n集成

n8n中的HTTP请求节点:

{
  "method": "POST",
  "url": "http://localhost:8000/api/tools/codebase_search",
  "headers": {
    "Authorization": "Bearer DEIN_API_KEY",
    "Content-Type": "application/json"
  },
  "body": {
    "query": "Wie funktioniert die Patient-Suche?",
    "target_directories": []
  }
}

可用工具

代码库搜索

代码库中的语义搜索。

输入:

{
  "query": "Wie wird die Patient-Suche implementiert?",
  "target_directories": ["src/main/java"]
}

file_read

从工作空间读取文件。

输入:

{
  "path": "src/main/java/de/bbajor/pvs/patient/service/PatientService.java"
}

file_list

列出目录内容。

输入:

{
  "directory": "src/main/java",
  "recursive": false
}

肺炎球菌

本地开发(无Docker)

# 1. Node.js Dependencies
npm install

# 2. MCP Server starten
node cursor-mcp-server.js

# 3. In anderem Terminal: mcpo starten
uvx mcpo --port 8000 --api-key "test-key" -- node cursor-mcp-server.js

查看日志

# Podman-Compose Logs
podman-compose logs -f mcp-cursor-proxy

# Nur MCP Server Logs
podman-compose logs -f mcp-server

新集装箱

podman-compose build --no-cache
podman-compose up -d

故障排除

端口已占用

# Prüfen, was Port 8000 nutzt
netstat -ano | findstr :8000

# In .env anderen Port setzen (z.B. 8001)

没有找到 Podman

# Prüfen, ob Podman installiert ist
podman --version

# Falls nicht: Podman Desktop installieren
# https://podman-desktop.io/

MCP 服务器无法启动

# Logs prüfen
podman-compose logs mcp-server

# Container-Shell öffnen
podman-compose exec mcp-server sh

# Manuell testen
node cursor-mcp-server.js

项目结构

mcpo/
├── cursor-mcp-server.js    # MCP Server (Node.js)
├── package.json            # Node.js Dependencies
├── Dockerfile              # MCP Server Container
├── podman-compose.yml      # Podman-Compose Config
├── mcpo_install.ps1        # Installations-Script
├── .env.example            # Environment Template
├── .gitignore
└── README.md

许可证

MIT License - 参见 LICENSE 文件(如果有)

贡献

PRs欢迎!请:

  1. 创建分叉
  2. 功能分支(cursor/feature/mein-feature)
  3. 承诺与推动
  4. PR 反对 main 创建