Give Gemini access to an MCP server's tools.
The worker launches the echo_mcp_server.py stdio server and registers it with
the plugin under the name echo. Inside the workflow, a
TemporalMcpClientSession("echo") is passed as a tool — Gemini's AFC loop
discovers and calls its tools, and list_tools / call_tool run as Temporal
activities against a pooled worker-side connection.
- Registering an MCP server with
GoogleGenAIPlugin(mcp_servers={...}) - Passing
TemporalMcpClientSession(name)as agenerate_contenttool cache_tools=Trueto discover the tool list once and reuse it (replay-safe)- MCP tool calls dispatched through per-server Temporal activities
Prerequisites: install dependencies, set GOOGLE_API_KEY, and start a Temporal
dev server. See the suite README.
# Terminal 1
uv run google_genai/mcp/run_worker.py
# Terminal 2
uv run google_genai/mcp/run_workflow.py| File | Description |
|---|---|
echo_mcp_server.py |
A minimal FastMCP stdio server exposing an echo tool |
workflow.py |
McpWorkflow — passes TemporalMcpClientSession("echo") as a tool |
run_worker.py |
Registers the echo MCP server with the plugin, starts the worker |
run_workflow.py |
Executes the workflow and prints the result |