Skip to content

NashTech-Labs/adk-mcp-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

adk-mcp-example

Use Google ADK with an MCP server to fetch prompts dynamically at runtime.


Architecture

[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.


Prerequisites


Step 1 — Build the MCP Server Docker Image

# From the project root
docker build -t adk-mcp-server ./adk-mcp-server

The ADK agent automatically spawns this container as a stdio subprocess when it starts — you do not need to run it manually.


Step 2 — Configure the API Key

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_here

Step 3 — Install Agent Dependencies

cd mcp-client-agent
pip install -r requirements.txt

Step 4 — Run the ADK Agent with uvicorn

# From the mcp-client-agent directory
adk web

This 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_server

The API is then available at http://localhost:8000.


Step 5 — Test End-to-End with Prompt Examples

Open the ADK web UI at http://localhost:8000 and select my_first_agetnt. Try the following prompts:

Greeter persona (default)

Load the Greeter prompt and introduce yourself.

Expected: The agent fetches the Greeter prompt and asks for your name, then replies with "Hello <Name>".

Receptionist persona

Load the Receptionist prompt and help me check in.

Expected: The agent fetches the Receptionist prompt and warmly greets you, asking for your name.

Unknown persona

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.


Project Layout

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

About

Using Google ADK with MCP Server to laod prompts dynamically

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages