Google ADK with MCP #4289
-
|
Can anyone please share me example for MCP integration with ADK. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
Response from ADK Answering Agent (experimental, answer may be inaccurate) TLDR: ADK integrates with external tools and services using the Model Context Protocol (MCP), an open standard for communication between LLMs and tools. You can connect ADK to MCP servers for databases, third-party APIs like Postman, and Google Cloud services. The App-Distro for Kubernetes (ADK) uses the Model Context Protocol (MCP) to interact with external tools and services. MCP is an open standard that defines how Large Language Models (LLMs) can communicate with other tools in a structured way. [1] ADK can act as both a consumer of tools from an MCP server and an exporter of its own tools to an MCP server. [2] Here are a few examples of how you can integrate ADK with MCP: 1. MCP Toolbox for DatabasesYou can use the open-source MCP Toolbox for Databases to create an MCP server for your database, which ADK can then connect to. Here is an example of how to load tools from a database toolbox server in Python: [3] from adk.mcp import McpTool
# Load tools from a remote MCP server
tools = McpTool.from_mcp_server(
'https://<your-mcp-server-url>'
)
# Initialize your agent with the tools
agent = adk.Agent(
model='gemini-1.5-pro-latest',
tools=tools
)2. Third-Party Tools (e.g., Postman)ADK can integrate with third-party tools like Postman through MCP. You can import a Postman collection and expose it via an MCP server, which your ADK agent can then use. Here’s how you can connect to a local Postman MCP server: [4] from adk.mcp import McpTool
# Load tools from a local MCP server for Postman
tools = McpTool.from_mcp_server('http://localhost:8080')
# Initialize your agent with the tools
agent = adk.Agent(
model='gemini-1.5-pro-latest',
tools=tools
)3. Google Cloud Services via API RegistryYou can use the Google Cloud API Registry to discover and connect to MCP servers for various Google Cloud services. For example, to connect to a BigQuery MCP server: [5] from adk.mcp import McpTool
# Load tools from the BigQuery MCP server
tools = McpTool.from_mcp_server(
'https://google.bigquery.mcp.adk.dev',
service_account_impersonation_url='<your-service-account-email>'
)
# Initialize your agent with the tools
agent = adk.Agent(
model='gemini-1.5-pro-latest',
tools=tools
)These examples demonstrate how ADK's MCP integration allows you to extend your agent's capabilities by connecting to a wide range of tools and services. Citations: |
Beta Was this translation helpful? Give feedback.
-
|
Refer this : https://github.com/Ashfaqbs/google-adk-playground/tree/main/python/project-3-mcp-client |
Beta Was this translation helpful? Give feedback.
Refer this : https://github.com/Ashfaqbs/google-adk-playground/tree/main/python/project-3-mcp-client