Skip to main content

A2A vs MCP Agent Demo

This project demonstrates two different approaches to agent communication:

  1. Master Control Program (MCP) - A centralized server-based approach where agents communicate through a central server
  2. Agent-to-Agent (A2A) - A decentralized peer-to-peer approach where agents communicate directly with each other

Installation

  1. Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt

Usage

MCP Server and Agents

  1. Start the MCP server:
python cli.py run-mcp-server
  1. In separate terminals, start one or more MCP agents:
python cli.py run-mcp-agent --agent-id agent1
python cli.py run-mcp-agent --agent-id agent2

The MCP server will track all connected agents and their status. You can view the status by opening http://localhost:5000 in your browser.

A2A (Agent-to-Agent) Network

  1. Start the first A2A agent:
python cli.py run-a2a-agent --agent-id a2a1 --port 5001
  1. Start additional A2A agents, connecting them to existing agents:
python cli.py run-a2a-agent --agent-id a2a2 --port 5002 --peer localhost:5001
python cli.py run-a2a-agent --agent-id a2a3 --port 5003 --peer localhost:5001 --peer localhost:5002

A2A agents will automatically discover other agents through their initial peers. You can type messages in any agent's terminal to broadcast them to all connected agents.

Architecture

MCP (Master Control Program)

  • Centralized server that tracks all agents
  • Agents register with the server and maintain connection through heartbeats
  • Server provides a web interface to monitor agent status
  • Simple and reliable but has a single point of failure

A2A (Agent-to-Agent)

  • Decentralized peer-to-peer network
  • Agents connect directly to each other
  • Messages are flooded through the network
  • More resilient but requires more complex coordination
  • No single point of failure

Project Structure

a2a_mcp/
├── agents/              # Agent implementations
│   ├── mcp_agent.py    # MCP-based agent
│   └── a2a_agent.py    # Peer-to-peer agent
├── mcp/                # MCP server implementation
│   └── server.py       # Flask-based MCP server
├── cli.py             # Command-line interface
└── requirements.txt   # Python dependencies

Contributing

Feel free to submit issues and pull requests to improve the demonstration.

Metadata

Release files for a2a-mcp 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for a2a-mcp 0.1.0
File Size Uploaded Provenance
a2a_mcp-0.1.0.tar.gz 13.1 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for a2a-mcp 0.1.0
File Interpreter ABI Platform
a2a_mcp-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 15.6 kB

Release files / a2a_mcp-0.1.0.tar.gz

Download URL a2a_mcp-0.1.0.tar.gz
Size 13.1 kB
Tags Source
SHA-256 checksum
How to use checksums
610f4eaf5d4603977e1ca9870e0ae85761eec2ca5e1163c8824b9a4cfa346814
BLAKE2b-256 checksum
How to use checksums
eababeb1b5369349ea40809648c64debb92a462da76d3b142a621bc57a8b6620
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 30, 2025.

Transparency log

Release files / a2a_mcp-0.1.0-py3-none-any.whl

Download URL a2a_mcp-0.1.0-py3-none-any.whl
Size 2.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4783768774645462fb29823d8e6a9e18df312c331319f64c93bc3c69a6fa82b5
BLAKE2b-256 checksum
How to use checksums
31092843942c1fdd180c337c5478524da2fb01b567d943ad9c4293a2eacfe400
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 30, 2025.

Transparency log

Security for a2a-mcp 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for a2a_mcp-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 30, 2025.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page