README.md•4.56 kB
# MCPO - MCP over HTTP Proxy für Cursor
Ein MCP (Model Context Protocol) Server, der Cursor-Tools als HTTP-API bereitstellt und mit Open WebUI und n8n integriert werden kann.
## Features
- 🚀 **MCP Server** mit Cursor-Tools (codebase_search, file operations, etc.)
- 🌐 **HTTP-API** via mcpo (MCP over HTTP Proxy)
- 🐳 **Podman/Docker** Support für einfaches Deployment
- 🔧 **PowerShell Install-Script** für Windows
- 📡 **Open WebUI Integration** ready
- 🔄 **n8n kompatibel** für Workflow-Automation
## Quick Start
### Windows (PowerShell)
```powershell
# Installations-Script ausführen
.\mcpo_install.ps1
```
Das Script:
1. Prüft Voraussetzungen (Podman, Node.js)
2. Installiert Dependencies
3. Startet Podman-Compose als Daemon
4. MCP Server ist unter `http://localhost:8000` verfügbar
### Manuell
```bash
# 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
```
## Konfiguration
### Environment Variables
Kopiere `.env.example` nach `.env` und passe an:
```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-Key generieren
```powershell
# PowerShell: Zufälligen API-Key generieren
-join ((48..57) + (65..90) + (97..122) | Get-Random -Count 32 | ForEach-Object {[char]$_})
```
## Verwendung
### API-Endpunkte
Nach dem Start:
- **API Base**: `http://localhost:8000`
- **OpenAPI Docs**: `http://localhost:8000/docs`
- **Health Check**: `http://localhost:8000/health`
### Open WebUI Integration
1. Open WebUI → Admin → Settings → External Tools
2. MCP Server hinzufügen:
- **Type**: `MCP (Streamable HTTP)`
- **URL**: `http://localhost:8000` (oder Docker-Hostname)
- **API Key**: Wert aus `MCPO_API_KEY` in `.env`
3. Tools aktivieren und speichern
### n8n Integration
HTTP Request Node in n8n:
```json
{
"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": []
}
}
```
## Verfügbare Tools
### codebase_search
Semantische Suche im Codebase.
**Input:**
```json
{
"query": "Wie wird die Patient-Suche implementiert?",
"target_directories": ["src/main/java"]
}
```
### file_read
Liest Dateien aus dem Workspace.
**Input:**
```json
{
"path": "src/main/java/de/bbajor/pvs/patient/service/PatientService.java"
}
```
### file_list
Listet Verzeichnisinhalte.
**Input:**
```json
{
"directory": "src/main/java",
"recursive": false
}
```
## Entwicklung
### Lokale Entwicklung (ohne Docker)
```bash
# 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
```
### Logs ansehen
```bash
# Podman-Compose Logs
podman-compose logs -f mcp-cursor-proxy
# Nur MCP Server Logs
podman-compose logs -f mcp-server
```
### Container neu bauen
```bash
podman-compose build --no-cache
podman-compose up -d
```
## Troubleshooting
### Port bereits belegt
```powershell
# Prüfen, was Port 8000 nutzt
netstat -ano | findstr :8000
# In .env anderen Port setzen (z.B. 8001)
```
### Podman nicht gefunden
```powershell
# Prüfen, ob Podman installiert ist
podman --version
# Falls nicht: Podman Desktop installieren
# https://podman-desktop.io/
```
### MCP Server startet nicht
```bash
# Logs prüfen
podman-compose logs mcp-server
# Container-Shell öffnen
podman-compose exec mcp-server sh
# Manuell testen
node cursor-mcp-server.js
```
## Projekt-Struktur
```
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
```
## Lizenz
MIT License - siehe LICENSE Datei (falls vorhanden)
## Beitragen
PRs sind willkommen! Bitte:
1. Fork erstellen
2. Feature-Branch (`cursor/feature/mein-feature`)
3. Commit & Push
4. PR gegen `main` erstellen