ADK Integration¶
Litestar MCP can be consumed by Google's Agent Development Kit (ADK) as a remote Streamable HTTP MCP server. The integration allows your ADK-based agent applications to discover and invoke tools, as well as read resources exposed by your Litestar application.
Note
Google ADK is an optional client integration. The google-adk package is not installed as a runtime dependency of litestar-mcp.
Installation¶
For ADK application users, install google-adk in your client environment:
pip install google-adk
For contributors running the compatibility test harness:
uv sync --group test --group adk
uv run pytest -m adk tests/integration/test_google_adk_mcp_toolset.py
Connecting from an ADK Agent¶
Google ADK connects to remote MCP servers using McpToolset combined with StreamableHTTPConnectionParams.
Remote Connection Snippet¶
Here is how to set up the toolset connection in your ADK agent application:
docs/examples/snippets/adk_snippets.py¶def connect_simple() -> McpToolset:
"""Connect to the Litestar MCP server without authentication."""
toolset = McpToolset(
connection_params=StreamableHTTPConnectionParams(
url="https://api.example.com/mcp",
headers={"Accept": "application/json, text/event-stream"},
)
)
return toolset
Authentication Headers¶
If your Litestar MCP server uses bearer authentication (see Authentication), pass the authorization headers in StreamableHTTPConnectionParams:
docs/examples/snippets/adk_snippets.py¶def connect_with_auth() -> McpToolset:
"""Connect to the Litestar MCP server with bearer token authentication."""
toolset = McpToolset(
connection_params=StreamableHTTPConnectionParams(
url="https://api.example.com/mcp",
headers={
"Authorization": "Bearer <your_valid_token>",
"Accept": "application/json, text/event-stream",
},
)
)
return toolset
Cleanup¶
Because MCP is stateful and maintains active HTTP sessions, you must clean up connections when shutting down:
docs/examples/snippets/adk_snippets.py¶async def run_and_cleanup(toolset: McpToolset) -> None:
"""Clean up and close the toolset connection."""
await toolset.close()
Compatibility Matrix¶
The following matrix distinguishes features tested with Google ADK 1.x from native MCP protocol features:
Feature |
Supported in ADK |
Verification Path / Note |
|---|---|---|
Tool Discovery |
Yes |
Verified via |
Tool Execution |
Yes |
Verified via calling tool wrapper |
Auth Propagation |
Yes |
Verified via |
Resource Listing |
Yes |
Verified via |
Resource Reading |
Yes |
Verified via |
Resource Templates |
No (Direct MCP) |
Covered by direct MCP tests ( |
Completion |
No (Direct MCP) |
Covered by direct MCP tests ( |
SSE Replay Streams |
No (Direct MCP) |
Covered by direct MCP tests ( |
Task Augmentation |
No (Direct MCP) |
Covered by direct MCP tests ( |
MCP vs A2A Protocol Boundary¶
While the plugin publishes an agent metadata card (at /.well-known/agent-card.json) used by MCP discovery clients, it does not advertise or support the A2A protocol from this endpoint.
Full Agent-to-Agent (A2A) protocol compatibility requires: - A separate A2A routing tree. - A dedicated A2A agent card endpoint. - Skill execution pipelines aligned with the A2A spec.
Treating A2A as distinct from MCP prevents client-side handshake confusion.
Production Persistence Hardening¶
For high-availability or multi-replica production deployments of ADK and Litestar MCP: - State such as task lists, SSE replay events, and active sessions should be backed by a persistent storage tier. - This plugin supports a persistent storage layer to manage these needs across server instances. Refer to docs/usage/persistence.rst for detail on configuring persistence once available.