- 
                Notifications
    
You must be signed in to change notification settings  - Fork 136
 
Description
Describe the bug
When using the Wren MCP Server with a standalone Trino database, any attempt to run a SQL query from an MCP client fails with a generic connection error ('ConnectError' object has no attribute 'text').
The root cause is an internal API incompatibility between the ibis-server and java-engine containers. The ibis-server receives the request but then calls an API endpoint on the java-engine that does not exist, resulting in an HTTP 404 Not Found error within the backend, which breaks the query process. This is not a user configuration or networking issue, as all container networking has been verified to be working correctly.
To Reproduce
Steps to reproduce the behavior:
- Set up a standalone Trino container using 
docker-compose. - Set up the Wren Engine services (
ibis-server,java-engine) using the defaultdocker-compose.ymlfrom the repository. - Create a shared external Docker network and attach all three containers to it to ensure they can communicate.
 - Configure the 
wren-engine/mcp-serverwith the correct.env,mdl.json, andtrino_connection.jsonfiles, pointing to the Trino container via its service name (trino_parquet_server). - Launch the MCP server via 
uv run app/wren.py. - Connect an AI agent (e.g., Cline, Claude Desktop) and attempt to run a SQL query (e.g., "how many channels are there").
 - Observe that the query fails with a connection error.
 
Expected behavior
The query should be successfully proxied from the ibis-server to the java-engine, executed on the Trino database, and the results returned to the MCP client. The health_check tool should report that the Wren Engine is healthy.
Screenshots
The user-facing error in the MCP client:
The error from the java-engine logs, which shows the true root cause:
2025-07-16T13:37:58.279Z  WARN  http-worker-22  io.wren.main.web.WrenExceptionMapper    Exception, type: class jakarta.ws.rs.NotFoundException, message: HTTP 404 Not Found
jakarta.ws.rs.NotFoundException: HTTP 404 Not Found
        at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:271)
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:248)
        ... (stack trace continues)
Desktop:
- OS: Linux Ubuntu 24 LTS (Docker Desktop)
 
Wren AI Information
- Version: 
latesttags as of July 16, 2025, forghcr.io/canner/wren-engine-ibisandghcr.io/canner/wren-engine. 
Additional context
An exhaustive troubleshooting process was performed to isolate this bug. Here is the key evidence that proves all networking and configuration is correct:
- 
Host-to-Ibis-Server Connection Works: A
curl http://localhost:8000/v1/healthfrom the host machine successfully reaches theibis-serverand receives a{"detail":"Not Found"}response, proving the port mapping is correct. - 
Ibis-Server-to-Trino Connection Works: A
curlfrom inside theibis-servercontainer to the Trino container's service name and port (http://trino_parquet_server:8080) connects successfully and receives a validHTTP 303 See Otherresponse. This proves the Docker network bridge and DNS are working. - 
Ibis-Server-to-Java-Engine Connection Works: A
curlfrom inside theibis-serverto thejava-engine(http://java-engine:8080/v1/health) connects successfully and receives theHTTP 500 / 404 Not Founderror shown in the screenshot above. 
This combination of evidence definitively proves that all network links are functional. The failure occurs because the ibis-server makes a request to a URL path on the java-engine that does not exist, causing the java-engine to throw the NotFoundException and break the chain.