What is MCP (Model Context Protocol) and how does Google ADK integrate with it?
#google-adk#mcp#tools#protocol#integration
Answer
MCP (Model Context Protocol)
Model Context Protocol (MCP) is an open standard that provides a unified way for AI agents to connect to external tools, data sources, and services. Google ADK has native MCP support allowing agents to use any MCP-compatible server.
What MCP Provides
| Feature | Description |
|---|---|
| Standard Interface | One protocol for all tool integrations |
| Tool Discovery | Servers advertise available tools automatically |
| Two Transports | Stdio (local) and SSE/HTTP (remote) |
| Ecosystem | Growing library of pre-built MCP servers |
MCP in Google ADK
Using MCP Filesystem Server

pythonfrom google.adk.agents import Agent from google.adk.tools.mcp_tool import McpToolset, StdioServerParameters # Connect to the filesystem MCP server mcp_tools = McpToolset( connection_params=StdioServerParameters( command="npx", args=["-y", "@modelcontextprotocol/server-filesystem", "/path/to/dir"], ) ) file_agent = Agent( name="file_manager", model="gemini-2.5-flash", instruction="Help users manage files. List, read, and write files.", tools=[mcp_tools], )
Using MCP Google Maps Server

pythonfrom google.adk.tools.mcp_tool import McpToolset, StdioServerParameters maps_tools = McpToolset( connection_params=StdioServerParameters( command="npx", args=["-y", "@modelcontextprotocol/server-google-maps"], env={"GOOGLE_MAPS_API_KEY": "your-api-key"} ) ) maps_agent = Agent( name="maps_agent", model="gemini-2.5-flash", instruction="Help users with directions and location queries.", tools=[maps_tools], )
Using Remote MCP Server (SSE)
pythonfrom google.adk.tools.mcp_tool import McpToolset, SseServerParams remote_tools = McpToolset( connection_params=SseServerParams( url="https://mcp-server.example.com/sse", headers={"Authorization": "Bearer your-token"} ) )
ADK as MCP Server
Google ADK agents can also expose their tools as MCP servers:
pythonfrom google.adk.mcp import serve_as_mcp # Expose agent's tools via MCP protocol serve_as_mcp(agent=my_agent, port=3000)
MCP vs A2A
| Feature | MCP | A2A |
|---|---|---|
| Purpose | Agent-to-Tool | Agent-to-Agent |
| Scope | Tools, data sources | Remote agent collaboration |
| Transport | Stdio / SSE | HTTP / SSE |
| Standard by | Anthropic |
They are complementary: An agent uses MCP to access tools, and uses A2A to communicate with other agents.
Learn more at MCP Tools in ADK and MCP Protocol.