Use Google ADK with an MCP server to fetch prompts dynamically at runtime.
[User] ──► [Google ADK Agent (uvicorn)]
│
▼
[MCP Server (Docker)]
load_prompt tool
The ADK agent connects to the MCP server over stdio (via Docker), calls load_prompt to retrieve a persona-specific prompt, and uses it as its instruction.
- Docker installed and running
- Python 3.11+
- A Google AI Studio API key
# From the project root
docker build -t adk-mcp-server ./adk-mcp-serverThe ADK agent automatically spawns this container as a stdio subprocess when it starts — you do not need to run it manually.
Open mcp-client-agent/.env and replace the placeholder with your actual Google AI API key:
GOOGLE_GENAI_USE_VERTEXAI=FALSE
GOOGLE_API_KEY=your_actual_api_key_herecd mcp-client-agent
pip install -r requirements.txt# From the mcp-client-agent directory
adk webThis starts the ADK development UI at http://localhost:8000, where you can interact with the agent through a web interface.
Alternatively, run it headlessly via the ADK API server:
adk api_serverThe API is then available at http://localhost:8000.
Open the ADK web UI at http://localhost:8000 and select my_first_agetnt. Try the following prompts:
Load the Greeter prompt and introduce yourself.
Expected: The agent fetches the Greeter prompt and asks for your name, then replies with "Hello <Name>".
Load the Receptionist prompt and help me check in.
Expected: The agent fetches the Receptionist prompt and warmly greets you, asking for your name.
Load the Barista prompt and take my order.
Expected: The MCP server returns a message that the Barista persona is not recognised, and the agent responds accordingly.
adk-mcp-example/
├── adk-mcp-server/ # MCP server (Dockerised)
│ ├── my_adk_mcp_server.py # MCP server entry point
│ ├── load_prompt.py # load_prompt tool implementation
│ └── requirements.txt
└── mcp-client-agent/ # Google ADK agent
├── agent.py # Agent definition
├── .env # API key configuration
└── requirements.txt