A2A-MCP-ADK-Integration
Health Warn
- No license — Repository has no license file
- Description — Repository has a description
- Active repo — Last push 0 days ago
- Low visibility — Only 9 GitHub stars
Code Pass
- Code scan — Scanned 7 files during light audit, no dangerous patterns found
Permissions Pass
- Permissions — No dangerous permissions requested
No AI report is available for this listing yet.
Convert a Google ADK agent with Firecrawl MCP tools into an A2A service, plus an orchestrator that discovers and calls it
A2A × MCP × ADK Integration
Turn a Google ADK agent that uses MCP tools into an A2A-compatible service that other agents can discover and call.
[!NOTE]
Companion code for the Google Cloud Blog post Unlock AI agent collaboration: Convert ADK agents for A2A.
📖 Overview
Agents built with the Agent Development Kit (ADK) usually live inside a single process. The
Agent2Agent (A2A) protocol lets independent agents advertise their skills and talk to each other over HTTP.
This repo bridges the two:
- Search agent (
MultiURLBrowser) – an ADKLlmAgentpowered by Gemini that scrapes web pages through the
Firecrawl MCP server (Model Context Protocol), wrapped in an A2A server with an Agent Card. - Orchestrator agent (
root_orchestrator) – a second ADK agent that has no scraping ability of its own. It
discovers remote agents via their A2A Agent Card and delegates tasks to them with two function tools,list_agents()andcall_agent(). - Test client – a minimal A2A client that fetches the Agent Card and sends a scrape request directly.
A step-by-step explanation of the conversion pattern is in ADK_TO_A2A_CONVERSION_GUIDE.md.
🏗️ Architecture

Target architecture on Google Cloud. Run locally today (adk web + Uvicorn on localhost:10000); this is the production target.
- Cloud Run (two services):
root_orchestratorand theMultiURLBrowserA2A server each run as their own container. The search agent serves its Agent Card at/.well-known/agent.json, and the Firecrawl MCP server runs inside the same container as a stdio subprocess (npx firecrawl-mcp). - Vertex AI (Gemini): both ADK agents call Gemini for reasoning. Locally this uses
GOOGLE_API_KEY. On Cloud Run, setGOOGLE_GENAI_USE_VERTEXAI=trueand authenticate with the service account instead. - Identity-Aware Proxy + service accounts: IAP authenticates people calling the orchestrator. The orchestrator calls the search agent with a Google-signed ID token (Cloud Run IAM
roles/run.invoker), and each service has its own least-privilege service account. - Secret Manager: holds
FIRECRAWL_API_KEYand mounts it into the search-agent service as an environment variable. - Cloud Build + Artifact Registry: build the container images and deploy them to Cloud Run.
- Cloud Logging / Monitoring: collect agent and A2A task logs, latency, and error metrics.
Diagram source: docs/architecture/gcp_architecture.py (rendered with the diagrams library).
Request flow
sequenceDiagram
actor U as User
participant O as root_orchestrator (ADK)
participant S as Search Agent A2A Server
participant E as AgentTaskManager
participant B as MultiURLBrowser (ADK + Gemini)
participant F as Firecrawl MCP
U->>O: "Scrape https://... and summarise"
O->>S: list_agents() → GET Agent Card
S-->>O: AgentCard (name, skills, url)
O->>S: call_agent("MultiURLBrowser", msg) → message/send
S->>E: execute(RequestContext, EventQueue)
E->>B: invoke(query, session_id)
B->>F: MCP tool call (scrape)
F-->>B: page content
B-->>E: progress updates + final result
E-->>S: TaskState.working → TaskState.completed
S-->>O: Task result (text part)
O-->>U: Final answer
🧭 What I built — step by step
- Built an MCP-powered ADK agent.
agents/search_agent/agent.pydefinesMultiURLBrowser, an ADKLlmAgenton Gemini whose tools come fromMCPToolset. The toolset launches the Firecrawl MCP server over stdio and passes itFIRECRAWL_API_KEY. - Wrapped the agent for A2A. The class owns an ADK
Runnerwith in-memory session, memory, and artifact services, plus an asyncinvoke()generator that streams progress and returns the final answer. - Bridged it to the A2A task model.
task_manager.pyaddsAgentTaskManager, an A2AAgentExecutorthat turns ADK events intoTaskUpdaterstates (working→completed/failed). - Published an Agent Card and server.
__main__.pydeclares anAgentSkilland anAgentCard, then serves them withA2AStarletteApplication+DefaultRequestHandler+InMemoryTaskStoreon Uvicorn. - Wrote a direct A2A client.
client.pyresolves the card withA2ACardResolverand sends amessage/sendrequest withA2AClient. - Built an orchestrator that delegates over A2A.
scrap_translate/agent.pygives a second ADK agent twoFunctionTools,list_agents()andcall_agent(), so it can find and call remote agents fromadk web. - Documented the pattern. I wrote it up in
ADK_TO_A2A_CONVERSION_GUIDE.mdand the companion Google Cloud Blog post.
✨ Key Features
- ADK → A2A conversion pattern – wrap an existing ADK
LlmAgentin a class exposing an asyncinvoke()generator, then plug it into the A2A server through anAgentExecutor. - MCP tool integration – the search agent uses ADK's
MCPToolsetto launch the Firecrawl MCP server over stdio (npx -y firecrawl-mcp). - Agent Card & skills – the server publishes an
AgentCardwith anAgentSkill(MultiURLBrowser), streaming capability, and example prompts for discovery. - Task lifecycle –
AgentTaskManagerreportsworking→completed/failedstates throughTaskUpdater. - Agent-to-agent orchestration – an ADK orchestrator discovers and calls remote A2A agents as tools, runnable from
adk web. - Configurable – model name and agent registry URL come from environment variables.
🧰 Tech Stack
| Layer | Technology |
|---|---|
| Agent framework | Google ADK (google-adk) |
| LLM | Gemini via google-genai (default gemini-2.5-pro-preview-03-25) |
| Agent interoperability | A2A Python SDK (a2a-sdk) |
| Tools | Model Context Protocol (mcp) + Firecrawl MCP server (Node.js / npx) |
| Server | Starlette + Uvicorn, CLI via click |
| HTTP client | httpx |
| Config | python-dotenv |
📁 Repository Structure
.
├── agents/
│ └── search_agent/
│ ├── __main__.py # A2A server: AgentCard, AgentSkill, Starlette app, Uvicorn
│ ├── agent.py # MultiURLBrowser: ADK LlmAgent + Firecrawl MCPToolset
│ ├── task_manager.py # AgentTaskManager: A2A AgentExecutor bridging to the ADK agent
│ └── client.py # Standalone A2A client that sends a scrape request
├── scrap_translate/
│ ├── __init__.py
│ └── agent.py # root_orchestrator: discovers/calls A2A agents (loaded by `adk web`)
├── docs/architecture/ # GCP diagram (PNG) and its `diagrams` source
├── ADK_TO_A2A_CONVERSION_GUIDE.md # Walkthrough of the conversion pattern
├── env.example # Environment variable template
└── requirements.txt # Pinned Python dependencies
🚀 Getting Started
Prerequisites
- Python 3.10+ (required by
google-adk) - Node.js /
npx(to launch the Firecrawl MCP server) - A Gemini API key
- A Firecrawl API key
Setup
git clone https://github.com/Ashwinikumar1/A2A-MCP-ADK-Integration.git
cd A2A-MCP-ADK-Integration
python3 -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txt
cp env.example .env # then fill in your keys
Environment variables
| Variable | Required | Default | Purpose |
|---|---|---|---|
GOOGLE_API_KEY |
✅ | – | Gemini API access for both agents |
FIRECRAWL_API_KEY |
✅ | – | Passed to the Firecrawl MCP server |
GOOGLE_MODEL_NAME |
gemini-2.5-pro-preview-03-25 |
Gemini model used by both agents | |
AGENT_REGISTRY_BASE_URL |
http://localhost:10000 |
Where the orchestrator looks for the A2A agent |
[!WARNING]
Never commit your.envfile. It is listed in.gitignore.
🎬 Usage
1. Start the search agent A2A server (from the repo root):
python3 -m agents.search_agent --host localhost --port 10000
2. Call it directly with the test client (new terminal):
python3 agents/search_agent/client.py
The client fetches the Agent Card, sends"Scrape the title and first paragraph from this URL: https://medium.com/p/86a1735368e1", and prints the agent's reply.
3. Agent-to-agent via the ADK web UI (new terminal, from the repo root):
adk web
Select the scrap_translate agent and try prompts such as:
List the available agents.Use the MultiURLBrowser agent to scrape https://example.com and summarise it.
The orchestrator calls list_agents() to read the search agent's Agent Card, then call_agent() to delegate the scrape over A2A.
🔐 Security
- Secrets: API keys are read only from environment variables.
env.exampleholds placeholders, and.envis git-ignored. In production, putFIRECRAWL_API_KEYin Secret Manager and use Vertex AI with a service account instead ofGOOGLE_API_KEY. - IAM least privilege: give each Cloud Run service its own service account. The orchestrator needs
roles/aiplatform.userandroles/run.invokeron the search agent. The search agent needsroles/aiplatform.userandroles/secretmanager.secretAccessoron its one secret. - Endpoint auth: as written, the A2A server is unauthenticated, which is fine for
localhostonly. On Cloud Run, deploy with--no-allow-unauthenticated, have the orchestrator send Google ID tokens, put IAP in front of user-facing entry points, and declare the auth scheme in the Agent Card. - Prompt injection and tool guardrails: scraped web content is untrusted input. Treat it as data, not instructions. Restrict the MCP toolset to the scrape tools you need (
tool_filter), consider a URL allow-list, cap response size, and screen inputs and outputs with ADK callbacks or Model Armor. - Input validation: check the incoming A2A message (non-empty text, length limits, URL scheme
http/httpsonly) before invoking the agent, and returnInvalidParamsErrorfor bad requests. - PII and data handling: tasks, sessions, and memory are stored in memory and dropped on restart. Do not scrape or log personal data without a lawful basis, and redact prompts and responses before long-term log retention.
- Audit logging: turn on Cloud Audit Logs for Vertex AI and Secret Manager access, and log A2A task IDs and caller identity to Cloud Logging.
🚀 Path to Production
- Deploy target: containerise each agent and deploy to Cloud Run (the A2A server needs Node.js in the image for
npx firecrawl-mcp). Alternatively, host the orchestrator on Vertex AI Agent Engine. PointAGENT_REGISTRY_BASE_URLat the search agent's Cloud Run URL. - State: replace
InMemoryTaskStoreand the in-memory ADK services with persistent stores (for example, a database-backed task store andVertexAiSessionService), so tasks survive restarts and work across multiple instances. - CI/CD: Cloud Build builds and tests the images, pushes them to Artifact Registry, and deploys to Cloud Run. Keep dependencies pinned (as in
requirements.txt) and scan images. - Observability: use structured logs in Cloud Logging, OpenTelemetry traces in Cloud Trace (ADK supports tracing), and Cloud Monitoring alerts on error rate, latency, and failed tasks.
- Evaluation: build an ADK eval set of scrape and summarise prompts, plus A2A contract tests for the Agent Card and task states, and run both in CI before every deploy.
- Scaling and cost: set Cloud Run concurrency and max instances, add timeouts and retries on A2A and Firecrawl calls, and use a Flash model for routing when Pro is not needed. Track Gemini and Firecrawl usage with budgets and alerts.
- Governance: register agents and Agent Cards in a central catalogue, version the skills, and review the tools each agent is allowed to use.
📚 Learn More
- Google Cloud Blog: Unlock AI agent collaboration: Convert ADK agents for A2A
- A2A protocol
- Google ADK (Python)
- Model Context Protocol
- Firecrawl MCP server
👤 Author
Ashwini Kumar — github.com/Ashwinikumar1
Reviews (0)
Sign in to leave a review.
Leave a reviewNo results found