trustgraph icon indicating copy to clipboard operation
trustgraph copied to clipboard

v1.2 - tg-invoke-mcp-tool results in a timeout

Open keebeegee opened this issue 6 months ago • 3 comments

See below: When trying to invoke a MCP tool I get an timeout:

(trustgraph) kh@lt:~/docker-kg-is$ tg-show-mcp-tools

+-------------+---------------------------+
| id          | get_control               |
| remote-name | get_control               |
| url         | http://localhost:9880/mcp |
+-------------+---------------------------+

+-------------+---------------------------+
| id          | list_all_controls         |
| remote-name | list_all_controls         |
| url         | http://localhost:9880/mcp |
+-------------+---------------------------+

+-------------+---------------------------+
| id          | list_control_ids          |
| remote-name | list_control_ids          |
| url         | http://localhost:9880/mcp |
+-------------+---------------------------+

+-------------+---------------------------+
| id          | search_controls           |
| remote-name | search_controls           |
| url         | http://localhost:9880/mcp |
+-------------+---------------------------+

(trustgraph) kh@lt:~/docker-kg-is$ tg-invoke-mcp-tool -n get_control -P '{"control_id": "5.7"}'
Exception: HTTPConnectionPool(host='localhost', port=8088): Read timed out. (read timeout=60)
(trustgraph) kh@lt:~/docker-kg-is$ netstat -ltnup | grep 8088
tcp6       0      0 :::8088                 :::*                    LISTEN      -
(trustgraph) kh@lt:~/docker-kg-is$ curl localhost:8088
404: Not Found(trustgraph) kh@lt:~/docker-kg-is$

MCP Server is up-and-running, http request using browser to http://localhost:9880/mcp returns: {"jsonrpc":"2.0","id":"server-error","error":{"code":-32600,"message":"Not Acceptable: Client must accept text/event-stream"}}

As always - thanks for looking into this!

keebeegee avatar Sep 03 '25 13:09 keebeegee

@keebeegee I'm wondering if you're trying to use TrustGraph in a Docker Compose to access MCP services on the host?

You have the URL set to... http://localhost:9880/mcp. But this is being invoked inside a container, so localhost is the container itself. To access the host you need to use its address. In container engines this should be...

  • http://host.containers.internal:9880/mcp for Podman Compose
  • http://host.docker.internal:9880/mcp for Docker Compose

cybermaggedon avatar Sep 03 '25 17:09 cybermaggedon

Thanks for getting back to me in such a timely manner.

MCP Server runs local, so outside "docker-compose":

(trustgraph) kh@~/trustgraph/code/trustgraph-cust$ python3 mcp-server-regulatory-control-manager.py
INFO:     Started server process [59041]
INFO:     Waiting for application startup.
StreamableHTTP session manager started
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:9880 (Press CTRL+C to quit)

Forgot to mention that I tried http://host.docker.internal:9880/mcp
in the first place which also produced a timeout.

Afterwards I changed to: http://localhost:9880/mcp with the same results.

I´ll take a dive into the source when I get the chance, maybe you can point me to the file/function I should have a closer look at. This will save me some time.

keebeegee avatar Sep 03 '25 17:09 keebeegee

maybe you can point me to the file/function I should have a closer look at.

The code that's timing out is mcp-tool process here...

https://github.com/trustgraph-ai/trustgraph/blob/release/v1.3/trustgraph-flow/trustgraph/agent/mcp_tool/service.py

That's a process running in a container that implements the MCP calls.

If you're running in Windows, there's another combination which you would need to configure for. I can't remember off the top of my head, but maybe it's...

  • Docker Compose running directly on Windows. Container addresses are behind some virtual network fabric trying to talk to...
  • Services running under WSL. That's a virtual system so those services aren't on the Windows host either.

There was a discussion about such a setup on the Discord a while back and Claude knows how to find out the address of WSL-hosted services

cybermaggedon avatar Sep 03 '25 18:09 cybermaggedon