MCP ExplorerExplorer

Mcp A2a

1 MIT
FreeCommunity
AI Systems
Example code for the 2025 course Agenti Intelligenti e Machine Learning, focusing on MCP and A2A

Overview

What is Mcp A2a

mcp-a2a is an example code repository for the 2025 course ‘Agenti Intelligenti e Machine Learning’, focusing on the Model Context Protocol (MCP) and Agent-to-Agent Protocol (A2A). It serves as a practical guide for implementing AI-based interactions and workflows.

Use cases

Use cases for mcp-a2a include developing AI agents that can communicate and collaborate on tasks, creating interactive data science applications, and implementing AI workflows that leverage multiple models and protocols.

How to use

To use mcp-a2a, first install Poetry as the dependency manager. Then, install project dependencies using ‘poetry install’. Set up your API keys by copying ‘.env.example’ to ‘.env’ and adding your keys. Finally, launch the application as instructed in the README files.

Key features

Key features of mcp-a2a include the use of Python, integration with frameworks like LangChain and LangGraph for building AI workflows, and Streamlit for creating interactive web applications. It also utilizes standardized protocols for model context sharing and agent communication.

Where to use

mcp-a2a can be used in various fields such as artificial intelligence, machine learning, and data science, particularly in applications requiring agent-based interactions and collaborative tasks.

Content

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
    

Tools

No tools

Comments