Skip to content

Open-source project showcasing how single or multiple AI Agents interact with MCP in real-world tasks. Includes both frontend and backend implementations.

License

Notifications You must be signed in to change notification settings

johnson7788/A2AServer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

A2A-MCP Server Framework

๐Ÿ“˜ ไธญๆ–‡Readme ็”ฑไบŽa2aๅ่ฎฎๅ‡็บง๏ผŒไปฅๅ‰็š„taskๅ˜ๆˆไบ†message๏ผŒconversation็š„idไปŽmetadataไนŸๆ”นๆˆไบ†contextId๏ผŒๆ‰€ไปฅ่ฟ›่กŒไบ†ๅ‡็บงใ€‚ ๆŽจ่ๆœ€ๆ–ฐA2A็ป“ๅˆADKๅ’ŒMCPๅฎž็Žฐๆ›ดๅคๆ‚ไปปๅŠก็š„ๆ–นๆณ•: https://github.com/johnson7788/MultiAgentPPT/tree/main/backend

License: MIT Code style: black Imports: isort

A Fully Compatible Implementation of Google's Agent-to-Agent (A2A) Protocol with Model Context Protocol (MCP) Integration

๐ŸŒŸ Overview

A2A-MCP Serer Framework is a robust, production-ready solution that leverages Google's Agent-to-Agent (A2A) protocol and integrates seamlessly with the Model Context Protocol (MCP). This project is designed for building interoperable single and multi-agent systems with full compatibility with Google's official A2A code. It offers a clear structure, rich examples, and a full-stack, ready-to-use implementation for developers.

Key highlights:

  • 100% A2A Compatibility: Built using Google's official A2A code for maximum interoperability.
  • MCP Integration: First-class support for MCP, enabling agents to access external tools and data sources.
  • Clear Structure: Well-organized project with comprehensive examples for single and multi-agent setups.
  • Full-Stack Solution: Includes both backend (Python) and frontend (Node.js) components for immediate deployment.
  • Rich Examples: Demonstrates practical use cases for both single-agent and multi-agent collaboration.
  • Multi-LLM Model Support: Seamlessly integrates and supports various leading language models, including OpenAI, DeepSeek, Anthropic, Ollama, VLLM, Bytedance offering users flexibility and choice.

โœจ Why Choose A2A-MCP Server Framework?

  • Complete A2A Implementation: Adheres strictly to the official A2A specification.
  • Flexible Agent Systems: Supports both single-agent and multi-agent workflows.
  • MCP Tooling: Easily integrate external tools via MCP for enhanced agent capabilities.
  • Production-Ready: Robust error handling and clear documentation for enterprise use.
  • Developer-Friendly: Rich examples, intuitive setup, and minimal dependencies.

๐Ÿ“ฆ Installation

Prerequisites

  • Python 3.10+
  • Node.js 16+
  • pip for Python dependencies
  • npm for frontend dependencies

Backend Setup

  1. Clone the repository:
git clone https://github.com/johnson7788/A2AServer.git
  1. Install backend dependencies:
cd backend/A2AServer
pip install .

๐Ÿš€ Quick Start

Single-Agent Example

1. Start the A2A Agent

  • Agent RAG:
cd backend/AgentRAG
python main.py --port 10005

2. Start the Frontend

cd frontend/single_agent
npm install
npm run dev

Open the frontend in your browser, add the agent, and start interacting through the Q&A interface.

3. UI Example

SingleAgentHome

More UI: UI

Single Agent Call Flow

graph TD
    A[Frontend] --> B[Agent1]
    B --> E[MCP Tool1]
    B --> F[MCP Tool2]
Loading

Reasoning Flow for a Single Agent

Question โ†’ Reasoning โ†’ MCP Tool 1 โ†’ Reasoning โ†’ MCP Tool 2 โ†’ Reasoning โ†’ Answer

graph TD
    A[ๅ‰็ซฏ] --> B[Agent1]
    B --> C[Reasoning Text]
    C --> D[MCP Tool1]
    D --> F[Reasoning Text]
    F --> E[MCP Tool2]
    E --> G[Reasoning Text]
    G --> H[Answer]
Loading

Multi-Agent Setup

This section demonstrates how to set up a multi-agent system with collaboration between A2A agents.

1. Start Agent 1

  • Agent RAG:
cd backend/AgentRAG
python main.py --port 10005

2. Start Agent 2

cd backend/DeepSearch
python main.py --port 10004

3. Start Host Agent

The host agent coordinates multiple A2A agents, manages their states, and decides which agent to use.

cd frontend/hostAgentAPI
pip install -r requirements.txt
python api.py

4. Start Frontend

cd frontend/multiagent_front
npm install
npm run dev
  • Open the frontend in your browser, add agents, and start interacting via the Q&A interface.

5. UI Example

MultiAgentHomePage RAG_reference1 RAG_reference2

Multi-Agent Call Flow

graph TD
    A[Frontend] --> B[HostAgent]
    B --> C[Agent1]
    B --> D[Agent2]
    D --> E[MCP Tool1]
    D --> F[MCP Tool2]
    C --> M[MCP Tool3]
Loading

๐Ÿ“‚ Project Structure

A2AServer
โ”œโ”€โ”€ backend
โ”‚   โ”œโ”€โ”€ A2AServer           # A2A server dependencies
โ”‚   โ”œโ”€โ”€ AgentRAG            # RAG-based A2A agent
โ”‚   โ”œโ”€โ”€ DeepSearch          # DeepSearch A2A agent example
โ”‚   โ”œโ”€โ”€ client.py           # A2A client for testing
โ”‚   โ””โ”€โ”€ hostAgentAPI        # Host agent for multi-agent coordination
โ”œโ”€โ”€ multiagent_front        # Frontend for multi-agent collaboration
โ”œโ”€โ”€ single_agent            # Frontend for single-agent interaction
โ””โ”€โ”€ README.md               # Project documentation

๐Ÿ› ๏ธ Developing Your Own A2A Server

To create a custom A2A server, follow these steps:

  1. Copy the DeepSearch Example:
cp -r backend/DeepSearch backend/MyCustomAgent
  1. Directory Structure:
MyCustomAgent
โ”œโ”€โ”€ .env                # Environment file for model keys
โ”œโ”€โ”€ main.py             # A2A server startup script
โ”œโ”€โ”€ mcp_config.json     # MCP server configuration
โ”œโ”€โ”€ mcpserver           # MCP server code (optional)
โ”‚   โ””โ”€โ”€ my_tool.py      # Custom MCP tool
โ””โ”€โ”€ prompt.txt          # Agent prompt file
  1. Configure MCP Tools:
  • Ensure tool names in mcp_config.json use camelCase (e.g., MyCustomTool) instead of underscores (e.g., My_Custom_Tool) to avoid lookup issues.
  • Example mcp_config.json:
{
  "tools": [
    {
      "name": "MyCustomTool",
      "description": "A custom tool for processing data",
      "script": "mcpserver/my_tool.py"
    }
  ]
}
  1. Run Your Server:
cd backend/MyCustomAgent
python main.py --port 10006

Best Practices

  • Prompts: Please carefully experiment with your different prompts to achieve the best experience.
  • MCP Tools: The naming and description of MCP tools, as well as the docstrings for MCP tool functions, must precisely align with the business logic to make them easy for the LLM to understand.

โš ๏ธ Notes

  • Tool Naming: Use camelCase for tool names in mcp_config.json (e.g., SearchTool, RAGTool) to ensure compatibility.
  • Environment Variables: Store API keys and sensitive data in the .env file.
  • Port Conflicts: Ensure unique ports for each agent to avoid conflicts.

๐Ÿงฉ Core Features

  • Single-Agent Interface: Simple, intuitive UI for interacting with a single A2A agent.
  • Multi-Agent Collaboration: Host agent coordinates multiple A2A agents for complex tasks.
  • MCP Integration: Seamless access to external tools and data via MCP.
  • Rich Examples: Comprehensive examples for both single and multi-agent setups.
  • Full-Stack: Backend and frontend components for immediate deployment.

๐Ÿ—บ๏ธ Use Cases

  • AI-Powered Assistants: Build intelligent assistants with single or multi-agent setups.
  • Research Tools: Create collaborative agent systems for data analysis or search.
  • Enterprise Workflows: Coordinate multiple agents for complex business processes.
  • Educational Platforms: Demonstrate agent collaboration for learning purposes.

๐Ÿ“– Contributing

We welcome contributions! To get started:

  1. Fork the repository.
  2. Create a feature branch (git checkout -b feature/my-feature).
  3. Commit your changes (git commit -m 'Add my feature').
  4. Push to the branch (git push origin feature/my-feature).
  5. Open a pull request.

See our contributing guide for more details.

Acknowledgements

This project draws inspiration from and gratefully acknowledges the contributions of the following open-source project:

๐Ÿค Community & Support

๐Ÿ“„ License

This project is licensed under the MIT License - Free for all.


Made with โค๏ธ by Johnson Guo

WeiChat ๅพฎไฟก

johnsongzc

About

Open-source project showcasing how single or multiple AI Agents interact with MCP in real-world tasks. Includes both frontend and backend implementations.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published