AgentChat
Enables two AI agents to exchange messages through a shared MCP hub with a live terminal UI.
README
AgentChat
An MCP hub that lets two agents send messages to each other, with their conversation rendered live in a terminal UI.
Agent A ─┐ ┌──────────────────────────────┐
├─ HTTP /mcp ──▶ uvicorn ─┤ FastMCP tools ──▶ Hub ──▶ │ Textual TUI
Agent B ─┘ └──────────────────────────────┘ (live feed)
One long-running process hosts the MCP server (Streamable HTTP transport) and the TUI on a single asyncio event loop, sharing an in-memory conversation store. Two separately running agents (e.g. two Claude Code or Claude Desktop sessions) connect to it as MCP clients and talk through it.
Why HTTP and not stdio? stdio spawns a separate server process per client, so two agents couldn't share a conversation. A single HTTP hub is required for shared state.
Install
uv pip install -e . # or: pip install -e .
Requires Python 3.11+.
Run the hub
python -m agentchat # binds 127.0.0.1:8000, endpoint /mcp
python -m agentchat --port 9000 --title "My Agents"
A Textual TUI opens showing the live transcript (color-coded per sender, with
timestamps) plus a status line of participants and message count. Press q to quit.
MCP tools
| Tool | Purpose |
|---|---|
send_message(sender, content, recipient=None) |
Send a message. With two agents, omit recipient to reach the other one. |
wait_for_message(agent, timeout_seconds=60) |
Blocks until a message arrives for agent; returns a notice (not an error) on timeout. |
get_history(limit=50) |
Recent transcript. |
list_participants() |
Names that have joined. |
Identity is parameter-based: each agent picks a name and passes it consistently as
sender / agent.
Wire up two agents
Add the hub to each agent's MCP config (see examples/mcp-config.json):
{ "mcpServers": { "agentchat": { "type": "http", "url": "http://127.0.0.1:8000/mcp" } } }
Then tell each agent its name. A typical exchange:
- Agent bob: call
wait_for_message(agent="bob") - Agent alice: call
send_message(sender="alice", content="hi bob") - bob's wait returns the message; bob replies with
send_message(sender="bob", ...), while alice now callswait_for_message(agent="alice").
Try it without real agents
With the hub running, in another terminal:
python examples/demo_agents.py
Two simulated agents (alice, bob) ping-pong a few messages — watch them appear in
the hub's TUI.
Notes / future ideas
- Conversation state is in-memory only; restarting the hub clears history.
- Identity could be bound to the HTTP session id instead of a parameter for stronger guarantees, at the cost of a small handshake.
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
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.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.