From 2a5b3a07cd7cb2e9b6346987cdbb9f494c07a88a Mon Sep 17 00:00:00 2001 From: zgaetano Date: Tue, 31 Mar 2026 15:32:59 -0400 Subject: [PATCH] Remove mcp-gateway/QUICK_OPENUI_FIX.txt --- mcp-gateway/QUICK_OPENUI_FIX.txt | 113 ------------------------------- 1 file changed, 113 deletions(-) delete mode 100644 mcp-gateway/QUICK_OPENUI_FIX.txt diff --git a/mcp-gateway/QUICK_OPENUI_FIX.txt b/mcp-gateway/QUICK_OPENUI_FIX.txt deleted file mode 100644 index 6139dc5..0000000 --- a/mcp-gateway/QUICK_OPENUI_FIX.txt +++ /dev/null @@ -1,113 +0,0 @@ -QUICK IMPLEMENTATION GUIDE -============================ - -ISSUE: OpenUI cannot discover any tools from MCP Gateway - -ROOT CAUSE: -1. Missing /v1/tools endpoint -2. Tool schemas have complex JSON that OpenUI doesn't support -3. Need schema normalization layer - - -STEP 1: Add the Fixed Routes Handler -==================================== -The file openai_routes_fixed.py is ready to use. -It's already in: gateway-proxy/openai_routes_fixed.py - - -STEP 2: Update gateway_proxy.py -================================ - -Find line ~27 (near other imports) and add: - - from .openai_routes_fixed import convert_mcp_tool_to_openai, list_models, tools, chat_completions - - -Then find the routes list (around line 795) and add these routes BEFORE the closing bracket: - - # OpenAI-compatible API endpoints (for Open-UI) - Route("/v1/models", list_models, methods=["GET"]), - Route("/v1/tools", lambda r: tools(r, TOOL_DEFINITIONS), methods=["GET"]), - Route("/v1/chat/completions", lambda r: chat_completions(r, TOOL_DEFINITIONS), methods=["POST"]), - - -STEP 3: Restart Gateway -======================== - -docker-compose restart gateway-proxy - - -STEP 4: Verify -============== - -Check that tools load: -curl http://localhost:8000/v1/tools | jq '.data | length' - -Should return a number like 45 (total number of tools) - - -STEP 5: Test in OpenUI -======================= - -1. Open OpenUI -2. Add new model endpoint: http://mcp.wilddragon.net:8000 -3. Select model "mcp-gateway" -4. Search for tools - they should now appear! - - -KEY CHANGES EXPLAINED: -======================= - -_simplify_schema(): - - Converts type arrays ["string", "null"] → "string" - - Flattens anyOf/oneOf to single schema - - Removes unsupported JSON schema keywords - - Makes schemas OpenAI-compatible - -convert_mcp_tool_to_openai(): - - Takes MCP tool definition - - Converts inputSchema to OpenAI parameters format - - Wraps in function schema structure - -/v1/tools endpoint: - - Returns all tools in OpenAI format - - Called by OpenUI for tool discovery - - Lists all backends' tools (ERPNext, Wave, TrueNAS, Home Assistant) - - -TESTING RESPONSES: -=================== - -Good /v1/tools response looks like: -{ - "object": "list", - "data": [ - { - "type": "function", - "function": { - "name": "erpnext_get_document", - "description": "Retrieve a single document", - "parameters": { - "type": "object", - "properties": { - "doctype": {"type": "string", "description": "..."}, - "name": {"type": "string", "description": "..."} - }, - "required": ["doctype", "name"] - } - } - }, - ...more tools... - ] -} - -If you see truncated tool names or "string not found" errors, -the schema conversion isn't working - check imports and routes. - - -FILES READY TO USE: -==================== - -✅ gateway-proxy/openai_routes_fixed.py (ready - no changes needed) -✅ OPENUI_SCHEMA_FIX.md (detailed explanation) -⏳ gateway-proxy/gateway_proxy.py (needs 2 edits: import + routes)