Repository navigation
UI : fix SSE transport detection and routing through CORS proxy. Assi… - #24500
Conversation
…sted-by: Antigravity
|
@hrpnr please fix linting issues |
c4439a2 to
794af40
Compare
|
@allozaur could you re-review? just fixed linting issues. |
|
@ServeurpersoCom please check this when u have a moment 😄 |
|
Hello @hrpnr I have installed duckduckgo-mcp-server When I run it with transport sse. It does not work. Can you confirm how does fix apply or I am doing something wrong. llama.cpp server. |
|
Hi @engrtipusultan , i use DDGS from https://github.com/deedy5/ddgs 1. Install dependencies (one-time, ) pip install -U ddgs[mcp] mcp-proxy2. Start mcp-proxy wrapping ddgs & "path\to\mcp-proxy.exe" `
--port 8000 `
--allow-origin "http://localhost:8080" `
-- "path\to\ddgs.exe" mcp3. Start llama-server (pointing to the same 8080 or other preferred port) 4. In the UI:
|
ggml-org#24500) * UI : fix SSE transport detection and routing through CORS proxy. Assisted-by: Antigravity * ui : replace magic strings with constants in MCP transport handling
ggml-org#24500) * UI : fix SSE transport detection and routing through CORS proxy. Assisted-by: Antigravity * ui : replace magic strings with constants in MCP transport handling
ggml-org#24500) * UI : fix SSE transport detection and routing through CORS proxy. Assisted-by: Antigravity * ui : replace magic strings with constants in MCP transport handling


DuckDuckGo Search (DDGS) MCP Integration Walkthrough
This document summarizes the changes made to enable connecting the
ddgsMCP server to thellama.cppWeb UI using SSE transport over the CORS proxy.1. What was accomplished
We successfully configured the
ddgsMCP server to run over SSE transport and integrated it with thellama.cppWeb UI. The Web UI can now connect to the MCP server throughllama-server's built-in CORS proxy, discover tools, and execute queries.2. Why changes were required
Standard Stdio Transport vs. Browser Constraints
ddgs mcpruns onstdiotransport by default. However, the browser-based Web UI cannot communicate with local processes via stdio and requires HTTP-based transports (SSE / StreamableHTTP).ddgsas an SSE server exposed it athttp://127.0.0.1:8000/sse.Transport Selection Bug
StreamableHTTPClientTransport. The fallback block forSSEClientTransportwas never executed since theStreamableHTTPClientTransportconstructor does not throw synchronous network errors.Relative Endpoint Resolution Bug over CORS Proxy
http://localhost:8080/cors-proxy?url=...)./messages/), the SDK resolved this relative path against the proxy URL, mapping it to the local origin (http://localhost:8080/messages/) instead of wrapping the target through the CORS proxy. This resulted in404 Not Founderrors fromllama-server.3. How it was implemented
Step 1: SSE Transport Detection
We modified detectMcpTransportFromUrl to classify URLs ending with
/sse,/sse/, or containing/sse?asMCPTransportType.SSE:Step 2: Explicit SSE Client Transport Instantiation
We updated createTransport to explicitly check for
MCPTransportType.SSEand returnSSEClientTransportinstead of falling through:Step 3: Fetch Interceptor & CORS Proxy URL Rewrite
We added URL rewrite logic at the beginning of the custom
fetchhandler inside createDiagnosticFetch. If proxy routing is active and an outgoing request erroneously targets the local origin without/cors-proxy, the interceptor reconstructs the destination relative to the original MCP server and routes it through the CORS proxy:Step 4: UI Packaging
We compiled the changes with:
cd tools/ui npm run buildThis wrote the production static bundle to
tools/ui/dist, enablingllama-serverto serve it using the--path tools/ui/distflag.Requirements