MCP Two AI Models Communicating Server
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP Two AI Models Communicating ServerAsk the other AI for a second opinion on my travel plan."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP: Two AI Models Communicating
A Python-based AI chatbot that demonstrates how two independent open-source Large Language Models (LLMs) can communicate using the Model Context Protocol (MCP).
The first AI model (Qwen) interacts directly with the user and can consult a second AI model (Llama) whenever it determines that a second opinion or additional reasoning may be useful. Both models run locally using Ollama without requiring any paid APIs or cloud services.
Features
Two independent AI models communicating through MCP.
Runs completely on your local machine.
No paid APIs or cloud services required.
Uses Ollama to run both LLMs locally.
Supports terminal-based interaction.
Includes an optional Streamlit web interface.
Demonstrates tool calling and multi-model collaboration.
Related MCP server: HydraMCP
Technologies Used
Python
Ollama
MCP (Model Context Protocol)
Streamlit
Qwen 2.5 (1.5B)
Llama 3.2 (1B)
Project Structure
project-folder/
│
├── app.py
├── client.py
├── server.py
├── requirements.txt
├── .gitignore
└── README.mdSystem Requirements
Ubuntu (Recommended)
Python 3.10 or above
Ollama
Internet connection (only required for downloading Ollama and the LLM models)
Python Virtual Environment (Recommended)
Clone the Repository
git clone https://github.com/mamidi-joseph/MCP-Two-AI-Models-Communicating.git
cd MCP-Two-AI-Models-CommunicatingCreate a Virtual Environment
Create a virtual environment:
python3 -m venv venvActivate the virtual environment:
source venv/bin/activateVerify that it is activated:
which pythonInstall Python Dependencies
Install all required Python packages:
pip install -r requirements.txt(Optional) Upgrade pip:
pip install --upgrade pipInstall Ollama
Run the following command:
curl -fsSL https://ollama.com/install.sh | shVerify the installation:
ollama --versionDownload the Required LLM Models
This project uses two local LLM models.
Download Qwen 2.5 (1.5B)
ollama pull qwen2.5:1.5bDownload Llama 3.2 (1B)
ollama pull llama3.2:1bVerify the Installed Models
Run:
ollama listYou should see both models installed:
qwen2.5:1.5b
llama3.2:1bIf both models are listed, you are ready to run the project.
Running the Project
Recommended Method - Ubuntu Terminal
The recommended way to use this project is through the Ubuntu terminal using client.py.
Run:
python client.pyYou should see something similar to:
============================================================
Two AI models are now connected.
You are talking to Model 1 (Qwen2.5).
It can privately consult Model 2 (Llama 3.2) when useful.
Type 'quit' to exit.
============================================================You can now start asking questions directly from the terminal.
To exit the application:
quitor
exitNote:
client.pyis the recommended way to use this project and best demonstrates how the two AI models communicate using MCP.
Optional Web Interface
This project also includes a simple Streamlit-based web interface.
Run:
streamlit run app.pyAfter running the command, Streamlit will provide a local URL similar to:
http://localhost:8501Open the URL in your browser to interact with the chatbot.
Note:
app.pyis completely optional. The terminal-based version (client.py) is recommended for demonstrating MCP-based communication between the two AI models.
Example Prompts
The first AI model decides whether it needs to consult the second AI model. Because of this, some prompts may be answered directly without invoking MCP.
If you want to clearly demonstrate communication between both AI models, try prompts that explicitly request a second opinion or ask the first model to consult the second AI model.
Examples:
Ask the second AI what it thinks, then tell me if you agree.
Get a second opinion on whether cats or dogs make better pets.
Check with the other AI whether my plan makes sense: [describe your plan]
Consult the second AI and explain how MCP works.
Ask the other AI for its opinion on learning Python.Note: The use of MCP depends on the first AI model's decision. Prompts that explicitly request a second opinion are more likely to demonstrate the interaction between the two AI models.
How It Works
User
|
v
client.py
|
v
Qwen 2.5 (1.5B)
|
v
MCP Tool Call
|
v
server.py
|
v
Llama 3.2 (1B)
|
v
Response Returned
|
v
Qwen Generates Final Answer
|
v
UserWorkflow
The user asks a question.
Qwen receives the question.
If required, Qwen consults the second AI model through MCP.
The MCP server forwards the question to Llama.
Llama generates its response.
The response is returned to Qwen.
Qwen combines the information and generates the final answer.
The final response is displayed to the user.
Important Notes
This project was developed and tested on Ubuntu.
Using a Python virtual environment is recommended.
Both LLM models must be downloaded before running the project.
client.pyis the recommended way to use the project.app.pyis optional and provides a simple Streamlit web interface.No paid APIs or cloud services are required.
Internet access is only required when downloading Ollama and the LLM models.
All AI models run locally on your machine using Ollama.
The first AI model decides when it should consult the second AI model.
Not every prompt will result in communication between both models.
Troubleshooting
Ollama Command Not Found
Verify that Ollama is installed:
ollama --versionIf the command is not recognized, reinstall Ollama:
curl -fsSL https://ollama.com/install.sh | shModel Not Found
Check the installed models:
ollama listIf a model is missing, download it again:
ollama pull qwen2.5:1.5bor
ollama pull llama3.2:1bPython Packages Not Found
Ensure that your virtual environment is activated:
source venv/bin/activateThen reinstall the dependencies:
pip install -r requirements.txtAuthor
Mamidi Joseph
GitHub: https://github.com/mamidi-joseph
Feel free to connect with me or reach out if you have any questions, suggestions, or feedback regarding this project.
License
This project is intended for educational and learning purposes.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityDmaintenanceConnects local LLMs to external tools (calculator, knowledge base) via MCP protocol, enabling automatic tool detection and execution to enhance query responses.MIT
- AlicenseAqualityCmaintenanceAn MCP server that enables users to query, compare, and synthesize responses from multiple local and cloud LLMs simultaneously using existing subscriptions. It provides tools for parallel model evaluation, consensus polling with an LLM-as-judge, and response synthesis across different model providers.81215MIT
- Flicense-qualityAmaintenanceMCP server that bridges coding agents (Claude Code, Codex, Gemini CLI) via ACP for pair programming, enabling agents to consult each other as tools.
- Flicense-qualityCmaintenanceEnables interaction with Claude and Gemini command-line tools through the MCP protocol, allowing users to send prompts to either or both LLMs and receive responses.
Related MCP Connectors
MCP server for AI dialogue using various LLM models via AceDataCloud
AI Reasoning Cache & Consensus Layer with 11 MCP tools via Streamable HTTP.
Agent-to-agent reasoning-as-a-service: chain-of-thought, analysis, and decision support.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/mamidi-joseph/MCP-Two-AI-Models-Communicating'
If you have feedback or need assistance with the MCP directory API, please join our Discord server