mcp-server-agent-comm
Enables multi-agent communication between AI agents via MCP tools with real-time message routing, admin control, and dual-language support.
README
Agent Communication System
A sophisticated multi-agent communication framework that enables seamless collaboration between AI agents through MCP (Model Context Protocol) tools, with support for real-time message routing, admin control, and dual-language operation.
š Features
- Multi-Agent Communication: Enable Agent 1 and Agent 2 to communicate efficiently
- Admin Control System: Absolute priority commands with SOURCE tag authority
- Real-time Message Routing: Smart delivery and manual routing options
- Dual Language Support: Vietnamese and English rule sets
- Advanced UI Controller: Comprehensive interface for message management
- File & Image Attachments: Support for mixed content communication
- Workspace-Aware: Intelligent path processing for different workspaces
š Prerequisites
- Python
- MCP-compatible AI environment (e.g., Claude, Cursor)
- Git for repository cloning
āļø Installation
1. Clone Repository
git clone https://github.com/your-repo/mcp-server-agent-comm.git
cd mcp-server-agent-comm
2. Install Dependencies
pip install -r requirements.txt
3. MCP Server Configuration
Add the following configuration to your MCP settings:
{
"agent_chat_1": {
"command": "python",
"args": ["E:/MCP-servers-github/Utils/mcp_server_agent1.py"],
"stdio": true,
"enabled": true
},
"agent_chat_2": {
"command": "python",
"args": ["E:/MCP-servers-github/Utils/mcp_server_agent2.py"],
"stdio": true,
"enabled": true
}
}
Note: Update the path E:/MCP-servers-github/Utils/ to match your actual installation directory.
š Rule Configuration
Language Options
Choose one of the rule files based on your preferred language:
- Vietnamese:
rule_for_AI_VI.txt - English:
rule_for_AI_EN.txt
Setup in Cursor
- Open Cursor settings
- Navigate to "Rules for AI" section
- Copy and paste the content of your chosen rule file
- Save the configuration
š Usage
Step 1: Start Controller UI
Open your terminal/command prompt and run:
python E:\MCP-servers-github\Utils\main_controller.py
Note: Replace E:\MCP-servers-github\Utils\ with your actual installation path.
The Controller UI will open, allowing you to monitor and control agent communication.
Feature "AI Chat" -> user can chat with all waiting agent.
Step 2: Setup Agents in Cursor
- Open Two Tabs: Create two separate chat tabs in Cursor
- Tab 1 - Agent 1: Type activation command to start Agent 1
- Tab 2 - Agent 2: Type activation command to start Agent 2
- Execute Tools: Allow AI to call the MCP server agent chat tools
- Monitor Controller: Check Controller UI for registered agents
- Route Messages: Use Controller UI to manage message delivery
Activation Commands
For AI Interaction Mode:
- Vietnamese:
start ai_interaction - English:
start ai_interaction
For Agent Communication Mode:
- Vietnamese:
start agent chat 1orstart agent chat 2 - English:
start agent chat 1orstart agent chat 2
Communication Flow
- Agent Registration: Agents register with their respective tools
- Message Routing: Controller UI manages message delivery
- Priority System: Admin commands (SOURCE=admin) have absolute priority
- Collaboration: Agents discuss and confirm execution plans for admin tasks
Detailed Workflow
Initial Setup:
- Start Controller UI with
python main_controller.py - Open Cursor with two chat tabs
- Activate Agent 1 in Tab 1:
start agent chat 1 - Activate Agent 2 in Tab 2:
start agent chat 2 - Verify both agents appear in Controller UI "Waiting Agents" section
Message Communication:
- Send message from Agent 1 (will appear in message queue)
- Use Controller UI to route message to Agent 2
- Agent 2 receives and can respond
- Continue conversation through Controller UI routing
Admin Controls:
- Send admin messages with absolute priority
- Use "Smart Delivery" for automatic routing
- Monitor real-time agent status
- Clear data when needed
Admin Controls
- Absolute Authority: Admin messages override all agent activities
- Smart Delivery: Automatic routing to available agents
- Manual Routing: Precise control over message delivery
- Real-time Monitoring: Live status of waiting agents and message queue
šļø Project Structure
Utils/
āāā agent_comm/
ā āāā core/ # Core system components
ā ā āāā config_manager.py # Configuration management
ā ā āāā flow_manager.py # Message flow control
ā ā āāā message_handler.py # Message processing
ā ā āāā state_manager.py # System state management
ā āāā ui/ # User interface components
ā ā āāā controller_ui.py # Main controller interface
ā ā āāā styles.py # UI styling
ā āāā chat_ui/ # Chat interface system
ā āāā shared_data/ # Persistent data storage
āāā mcp_server_agent1.py # Agent 1 MCP server
āāā mcp_server_agent2.py # Agent 2 MCP server
āāā rule_for_AI_VI.txt # Vietnamese rules
āāā rule_for_AI_EN.txt # English rules
āāā README.md # This file
šÆ Key Components
Agent Chat Tools
- mcp_agent_chat_1_agent_chat_1_tool: Communication tool for Agent 1
- mcp_agent_chat_2_agent_chat_2_tool: Communication tool for Agent 2
Controller Features
- Message queue management
- Agent status monitoring
- Smart delivery system
- File and image attachment support
- Real-time refresh capability
Rule System
- SOURCE Tag Authority: admin = absolute priority, agent = standard
- Initialization Rules: Keyword-based activation system
- Workflow Compliance: Mandatory tool recall and thinking blocks
- Language Consistency: Vietnamese or English throughout communication
š§ Advanced Features
Message Types
- Text Messages: Standard communication
- File Attachments: Document and code sharing
- Image Support: Visual content communication
- Mixed Content: Combined text, files, and images
Priority System
- Admin Commands: Immediate execution, override all activities
- Agent Messages: Standard peer-to-peer communication
- Collaboration Required: Agents must discuss admin task execution
UI Controller
- Real-time Updates: 1.5-second refresh intervals
- Multi-selection: Batch operations on messages
- Smart Routing: Automatic agent selection
- Status Tracking: Comprehensive system monitoring
š Troubleshooting
Common Issues
-
MCP Server Not Starting
- Verify Python path in configuration
- Check file permissions
- Ensure all dependencies are installed
-
Agents Not Communicating
- Confirm both agents are registered
- Check controller UI for waiting agents
- Verify rule file is properly configured
-
Message Queue Issues
- Use "Clear All Data" in controller UI
- Restart MCP servers
- Check shared_data directory permissions
š” Related Projects:
https://github.com/KhaiHuynhVN/MCP-Server_AI-interaction
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.