5.4 KiB
Running MCP Gateway with Open-UI
You now have OpenAI-compatible endpoints for your MCP Gateway! This allows Open-UI to use all your MCP tools.
✅ What's Been Done
- ✅ Created
openai_routes.py- Handles OpenAI-compatible API requests - ✅ Updated
gateway_proxy.py- Added/v1/modelsand/v1/chat/completionsendpoints - ✅ Configuration ready - Just need to restart the gateway
🚀 Next Steps
Step 1: Restart Your Gateway
cd /sessions/beautiful-serene-gauss/mnt/MCP\ Servers/mcp-gateway/
docker compose restart mcp-gateway
Check the logs to verify the endpoints are registered:
docker compose logs mcp-gateway | grep -i "openai\|v1"
You should see: OpenAI-compatible endpoints registered at /v1/*
Step 2: Test the New Endpoints
Test /v1/models:
curl -H "Authorization: Bearer rIoRseJSR9rqwl5bp4CEOyOUKdymaoJnAsT-y752BDi2qD9jJYbgd8sWkiQIGMtz" \
https://mcp.wilddragon.net/v1/models
Expected response:
{
"object": "list",
"data": [
{
"id": "mcp-gateway",
"object": "model",
"owned_by": "mcp-gateway"
}
]
}
Step 3: Configure Open-UI
- Open Open-UI: http://10.0.0.25:3009/
- Go to: Admin → Settings → Connections
- Scroll to: "Direct Connections"
- Enable: Toggle "Direct Connections" ON
- Add Connection:
- API Base URL:
https://mcp.wilddragon.net/v1 - API Key:
rIoRseJSR9rqwl5bp4CEOyOUKdymaoJnAsT-y752BDi2qD9jJYbgd8sWkiQIGMtz
- API Base URL:
- Click: Save
Step 4: Use in Open-UI
- Create a new chat
- Model selection: Choose
mcp-gateway - Start chatting - The gateway will show available tools
🔑 Your Bearer Token
rIoRseJSR9rqwl5bp4CEOyOUKdymaoJnAsT-y752BDi2qD9jJYbgd8sWkiQIGMtz
Save this somewhere safe. It's what authenticates requests from Open-UI to your gateway.
🛠️ Running Both Systems
Your setup now runs:
┌─────────────────────────────────────────────┐
│ Your Workstation │
├─────────────────────────────────────────────┤
│ Claude.ai ──────────────┐ │
│ ▼ │
│ MCP Gateway │
│ (Port 4444) │
│ ▲ │
│ Open-UI ────────────────┘ │
│ (Port 3009) │
└─────────────────────────────────────────────┘
│
│ ERPNext, TrueNAS, Home Assistant, Wave
▼
(External services)
Both Claude and Open-UI can now:
- ✅ List all available MCP tools
- ✅ Call Wave Finance tools (invoices, customers, etc.)
- ✅ Execute TrueNAS commands (storage, snapshots, etc.)
- ✅ Control Home Assistant (lights, climate, etc.)
- ✅ Query ERPNext data
📝 API Endpoints Now Available
| Endpoint | Method | Purpose |
|---|---|---|
/v1/models |
GET | List available models (returns mcp-gateway) |
/v1/chat/completions |
POST | OpenAI-compatible chat endpoint |
/mcp |
POST | Raw MCP protocol (for Claude) |
/health |
GET | Health check |
/status |
GET | Gateway status |
🔧 Advanced Configuration
Using a Different Bearer Token
If you want to use a different token:
-
Update
.env(if you want to persist it):GATEWAY_API_TOKEN=your_new_token_here -
Restart gateway:
docker compose restart mcp-gateway
Enabling Tool Execution
Currently, the gateway shows available tools. To actually execute them:
- Edit
gateway-proxy/openai_routes.py - Uncomment the
_call_mcp_tool()function calls - Add logic to process tool calls in the response
Custom System Prompt
Edit openai_routes.py function _get_mcp_tools() to add a custom system prompt that guides the LLM on how to use tools.
⚠️ Troubleshooting
"Connection refused" error
- Check: Is the gateway running?
docker compose ps - Restart:
docker compose restart mcp-gateway - Check logs:
docker compose logs mcp-gateway
"Unauthorized" error
- Check: Bearer token is correct
- Check: Header format:
Authorization: Bearer YOUR_TOKEN
No tools showing
- Check: Are MCP backends initialized?
docker compose logs mcp-erpnext - Check: Is
/mcpendpoint working? Test with Claude.ai first
✨ Next: Production Hardening
When ready, consider:
- HTTPS certificates - Use proper SSL/TLS
- Rate limiting - Prevent API abuse
- Logging - Monitor all requests
- Metrics - Track usage patterns
- Tool execution - Actually execute MCP tools, not just list them
📚 Files Modified
gateway-proxy/gateway_proxy.py- Added OpenAI route imports and endpointsgateway-proxy/openai_routes.py- New file with OpenAI handlersopenai_adapter.py- Optional adapter class.- This setup guide
🎯 You Now Have
✅ MCP Gateway with OAuth 2.1 (for Claude) ✅ OpenAI-compatible API (for Open-UI) ✅ All your tools accessible from both clients ✅ Bearer token authentication ✅ Production-ready architecture
Enjoy! 🚀