mcp-agent-collaboration
Click on "Deploy 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-agent-collaboration Coordinate a code review: create topic 'pr-42', add reviewer agent"
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 Agent Collaboration
In-memory MCP server for cooperative collaboration between separate agents.
The intended workflow is:
A coordinator/main agent starts this MCP server as a dedicated Streamable HTTP process.
The coordinator creates a topic and joins it.
Secondary agents join the same topic with friendly names such as
builderorreviewer.Agents exchange direct and broadcast messages through MCP tools.
Idle agents long-poll with
read_messages.Working agents use
check_into report progress and read messages in one call.
Messages are held only in memory. Restarting the server clears all topics, members, and messages.
After a restart, old join_token values are invalid and agents must re-join.
Install
python3 -m venv .venv
. .venv/bin/activate
pip install -e .Related MCP server: agent-comm
Run
mcp-agent-collaboration --host 127.0.0.1 --port 8000The MCP endpoint is:
http://127.0.0.1:8000/mcpFor Codex, add a Streamable HTTP MCP server in config.toml:
[mcp_servers.agent_collaboration]
url = "http://127.0.0.1:8000/mcp"
tool_timeout_sec = 600Set tool_timeout_sec high enough for your preferred long-poll duration. The server itself does not impose a maximum wait; the MCP client/tool runtime may still have its own timeout.
Codex Autostart
For Codex, the preferred setup is the stdio autostart proxy. Codex launches the proxy as a normal stdio MCP server; the proxy starts the shared Streamable HTTP server on localhost if it is not already running, then forwards tool calls to it.
From this source checkout:
codex mcp add agent_collaboration \
--env PYTHONPATH=/home/vkolotoff/projects/mcp-agent-collaboration/src \
-- python3 -m mcp_agent_collaboration.autostart_stdioAfter installing the package, this shorter form is enough:
codex mcp add agent_collaboration -- mcp-agent-collaboration-stdioDefaults:
MCP_AGENT_COLLAB_HOST=127.0.0.1MCP_AGENT_COLLAB_PORT=8000MCP_AGENT_COLLAB_PATH=/mcpMCP_AGENT_COLLAB_LOG=/tmp/mcp-agent-collaboration.log
Override them with --env only when needed.
To install the package into your user-level Python environment:
python3 -m pip install --user /home/vkolotoff/projects/mcp-agent-collaboration
codex mcp add agent_collaboration -- mcp-agent-collaboration-stdiocodex mcp add writes to the global Codex MCP config by default, so the server
is available to future Codex sessions after restart.
Tools
create_topic
Create a topic by string name.
{
"topic": "build-123"
}join_topic
Join a topic with a friendly agent name. The returned join_token is required for message operations.
{
"topic": "build-123",
"agent_name": "reviewer",
"role": "secondary",
"create_if_missing": true
}Agent names are unique within a topic. The literal name all is reserved for broadcast messages.
send_message
Send a direct message to one agent or a broadcast to all agents currently joined.
{
"join_token": "opaque-token",
"recipient": "reviewer",
"body": {
"type": "review_request",
"task_id": "task-001",
"summary": "Implementation is ready for review."
}
}Use "recipient": "all" for broadcast. Broadcast recipients are snapshotted at send time, so agents who join later do not receive older broadcasts. The sender receives its own broadcast by default because it is also a joined agent; set include_self to false to opt out.
Compact output is the default:
{
"id": "msg_123",
"stored": true
}Pass "verbosity": "full" only when you need topic, sender, and recipient metadata.
read_messages
Read and consume pending messages for the joined agent.
{
"join_token": "opaque-token",
"timeout_ms": 600000,
"max_messages": 20
}Compact output is the default:
{
"timed_out": false,
"messages": [
{
"id": "msg_123",
"from": "reviewer",
"body": {
"type": "review_result",
"status": "approved"
}
}
]
}Pass "verbosity": "full" only when you need topic, recipient, timestamp, or broadcast snapshot metadata.
Long-poll behavior:
If messages are already pending, return immediately.
If no messages are pending and
timeout_ms > 0, hold the request open until a relevant message arrives or the requested timeout elapses.If
timeout_msis0, return immediately with pending messages or an empty timeout response.The server does not impose its own maximum timeout.
Returned messages are consumed.
Deletion behavior:
Direct messages are deleted after the recipient reads them.
Broadcast messages are deleted after every send-time recipient has read them.
If an agent leaves a topic, it is removed from unread recipient sets so old broadcasts can be cleaned up.
check_in
Optionally send a message and read pending messages in one tool call. This is
the preferred work-loop tool for secondary agents because it avoids a separate
send_message call followed by read_messages.
{
"join_token": "opaque-token",
"timeout_ms": 0,
"recipient": "coordinator",
"body": {
"type": "progress",
"task_id": "task-001",
"done": "Added compact read tests.",
"next": "Update docs.",
"blockers": []
}
}Compact output:
{
"sent": {
"id": "msg_123",
"stored": true
},
"timed_out": true,
"messages": []
}Omit body to use check_in as a compact read. Use a long timeout_ms when
idle, and timeout_ms: 0 or a short timeout between work chunks.
body: null is treated the same as omitting body, so it cannot be used as a
sent message payload. If body is provided with a large timeout_ms, the send
confirmation is returned only when the read side wakes or times out; use
timeout_ms: 0 for fire-and-return progress updates.
leave_topic
Leave a topic and stop receiving future messages.
{
"join_token": "opaque-token"
}list_topics
List topics with member and pending-message counts.
list_topic_members
List members in a topic.
Collaboration Contract
This MCP does not forcibly interrupt running agents. Messages wake agents that are currently blocked in read_messages; agents that are actively working see messages at their next check-in.
Secondary agents must:
Join with a clear role name.
Send a readiness message to the coordinator.
Work in bounded chunks.
Use
check_into send progress to the coordinator and read messages at reasonable intervals.Always poll after completing a work chunk, after sending a review result, and after reporting task completion.
Treat urgent or cancellation messages as priority instructions when seen.
Send
task_completewhen done.Ask the coordinator for more work, then enter idle long-poll mode.
The coordinator must:
Start the server.
Create the topic.
Join as
coordinatoror another clear main-agent name.Assign tasks to secondary agents.
Watch progress, blockers, completion messages, and requests for more work.
Poll after sending assignments, clarifications, cancellations, or follow-up work so queued replies are not missed.
Recommended message body types:
presencetask_assignmentprogresstask_completerequest_more_workreview_requestreview_resultcancel_taskinterrupt
interrupt is cooperative. It is not forced preemption.
Test
python3 -m unittest discover -s testsAvailable Tools
8 toolscheck_inC
Optionally send a message, then read pending messages in one tool call.
Inputs: join_token (required), timeout_ms (required), body, recipient, +3 more. Returns: object
create_topicB
Create a collaboration topic by name.
Inputs: topic (required). Returns: object
join_topicC
Join a topic with a friendly agent name and receive a join_token.
Inputs: topic (required), agent_name (required), role, replace_existing, +1 more. Returns: object
leave_topicC
Leave the joined topic.
Inputs: join_token (required). Returns: object
list_topic_membersB
List active members in a topic.
Inputs: topic (required). Returns: object
list_topicsA
List topics with member counts and pending in-memory message counts.
Inputs: no named parameters. Returns: object
read_messagesA
Long-poll, read, and consume pending messages for the joined agent.
Inputs: join_token (required), timeout_ms (required), verbosity, max_messages. Returns: object
send_messageB
Send a direct or broadcast message in the joined topic.
Inputs: body (required), join_token (required), recipient, verbosity, +1 more. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
Each tool has a clearly distinct purpose: topic lifecycle (create, join, leave), messaging (send, read, check_in), and listing (topics, members). check_in is a convenience combination but its description clarifies its dual role.
All tool names follow a consistent verb_noun pattern (create_topic, join_topic, send_message, read_messages, list_topics, list_topic_members). Minor phrasal verb 'check_in' still fits the style.
Eight tools cover the domain of topic-based collaboration without redundancy or bloat. Each tool serves a distinct function and the count is well within the ideal range.
The surface covers topic creation, joining/leaving, messaging, and listing topics/members. A delete_topic operation is missing but might be intentionally omitted for ephemeral in-memory topics, so minor gap only.
Related MCP Connectors
Shared memory and mail for your AI agents. Verified with Claude Code; other MCP clients in testing.
Shared memory for your AI tools: tasks, notes and context every tool can read and write over MCP.
Remote MCP server for The Colony — a social network for AI agents (posts, DMs, search, marketplace).
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceA production-ready MCP server that enables multiple AI agents to collaborate through a shared, concurrency-safe memory space. It supports advanced search, full CRUD operations, and automatic backups to facilitate asynchronous communication between agents.MIT
- AlicenseNot gradedqualityCmaintenanceMCP server that enables AI coding agents to communicate, share state, and coordinate work in real time via MCP tools or REST API.79 npm10MIT
- AlicenseNot gradedqualityDmaintenanceA local MCP server that provides shared, real-time context across multiple AI agents via WebSocket and MCP resource notifications, enabling collaborative workspaces, memory, tasks, and messaging.2MIT
- AlicenseAqualityDmaintenanceMCP server for inter-agent communication. Gives multiple Claude Code sessions a shared message board, agent registry, and orchestration layer — backed by a cloud relay so agents can coordinate across machines, repos, and teams.851 npm1MIT