Using an MCP Server as toolset for Agent which run in docker container over MCP Gateway #3074
Replies: 2 comments
-
Response from ADK Answering Agent (experimental, answer may be inaccurate) TLDR: To use an MCP Server as a toolset across different Docker containers, you need to switch from a Hello! Based on the information in the ADK documentation, I can provide some guidance. The When you run your MCP Server and agent in separate Docker containers, they are in isolated environments and cannot communicate directly via Here is the recommended solution:
Example Agent Configuration:Here is how you would configure the from google.adk.tools.mcp_tool.mcp_toolset import MCPToolset
from google.adk.tools.mcp_tool.mcp_session_manager import SseConnectionParams
# URL of your MCP Server container.
# If you are using docker-compose, this might be 'http://<service_name>:<port>'
# For example: 'http://mcp-server:8081'
mcp_server_url = "http://your-mcp-server-address:8081" # Replace with your server's actual network address and port
mcp_toolset = MCPToolset(
connection_params=SseConnectionParams(url=mcp_server_url),
)
# You can then add this toolset to your agent, for example:
# agent = LlmAgent(..., tools=[mcp_toolset]) The documentation on "MCP Tools" provides more details on connection management for different environments, including containerized setups which are conceptually similar to what you are building with docker-compose. [1] By making these changes, your agent will be able to correctly connect to your MCP Server over the network and use it as a toolset. |
Beta Was this translation helpful? Give feedback.
-
connection_params = TCPConnectionParams(host='localhost', port=9000) does it work then? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I am running an MCP Server in a container and an MCP Gateway using docker-compose
As my MCP Server is runnnig in a container with --transport=stdio
I want to use this server as toolset for my agent to use
help on how can I implement
Thanks in advance!!
Beta Was this translation helpful? Give feedback.
All reactions