MCPInstall
mcp-a2a logo

mcp-a2a

by aitho-corso-DMI-agenti-ai 1 stars aitho-corso-DMI-agenti-ai/mcp-a2a

Example code for the 2025 course Agenti Intelligenti e Machine Learning, focusing on MCP and A2A

READMEmaster

Model Context Protocol (MCP) & Agent-to-Agent Protocol (A2A)

This repository contains example notebooks for the 2025 course Agenti Intelligenti e Machine Learning (AiTHO), focusing on MCP and A2A.

Tech Stack

  • Python
  • LangChain – A framework for building AI-based conversational chains
  • LangGraph – A framework for building AI agent workflows
  • Streamlit - A fast and intuitive framework for building interactive web apps directly in Python, commonly used for AI and data science applications
  • Model Context Protocol (MCP) – A standardized interface for defining, sharing, and exchanging model context across different systems and agents
  • Agent-to-Agent Protocol (A2A) - A communication protocol enabling direct, structured interactions between autonomous AI agents, supporting task coordination and collaboration

Project Structure

All the slides are located in the slide/ directory.

The code is located in the examples/ directory.

More infos about the examples is to be found in the MCP example README and the A2A example README.

AI Models

The examples use OpenAI models by default (by importing the langchain_openai module for LangChain). You're welcome to switch to any model provider of your choice.

Setup Instructions

1. Install Poetry

Poetry is the dependency manager used in this project. Follow the official installation guide to set it up on your system.

2. Install Project Dependencies

poetry install

3. Setup API keys

Copy the file .env.example as .env and put your own keys.

4. Launch the applications

4.1 Streamlit MCP application

poetry run streamlit run examples/mcp_example/app.py --server.address 0.0.0.0

4.2 A2A Application

  • Start the agent with the following command:

    poetry run python examples/a2a_example/agent/main.py --host 0.0.0.0 --port 8080
    
  • Then start the CLI client:

    poetry run python examples/a2a_example/client/main.py --agent http://localhost:8080