Skip to content

Instantly share code, notes, and snippets.

@eonist
Created August 18, 2025 20:24
Show Gist options
  • Save eonist/0e30c84f50f50ed1c8a7f5e8a26a044c to your computer and use it in GitHub Desktop.
Save eonist/0e30c84f50f50ed1c8a7f5e8a26a044c to your computer and use it in GitHub Desktop.
# Using MCP to run two coder agents in a turn-by-turn collaboration
Short answer: Yes—this is possible with systems built on the Model Context Protocol (MCP). Several community and vendor implementations demonstrate multi-agent setups where two (or more) specialized coder agents collaborate either turn-by-turn (sequential) or in parallel, with a coordinator/hub mediating messages and shared context for handoffs and arbitration. MCP’s recent evolution supports richer interaction patterns that make agent-to-agent coordination feasible, including multi-turn task flows and indirect or direct agent messaging via a shared hub/context store.[1][6][9]
## What “turn-by-turn” looks like with MCP
- A shared MCP hub (or server) acts as the message bus and single source of truth; agents read/write tasks, status, and artifacts there.[1]
- Agents coordinate indirectly through the shared context (default), or occasionally directly, while still logging outcomes back to the hub for traceability.[1]
- A planner/coordinator can assign tasks and resolve conflicts; two coder agents can alternate turns on subtasks (e.g., Agent A implements a function, Agent B writes tests/fixes, then Agent A refactors), with explicit in-progress/complete markers to avoid overlap.[1]
- MCP’s newer capabilities (e.g., elicitation and resumable streams) enable multi-turn interactions and richer back-and-forth patterns that are useful for agent-to-agent workflows.[6][9]
## Concrete options to try
- Use an MCP-based multi-agent “hub” that turns a standard MCP client into a multi-agent system; community projects advertise plug-and-play setups that simulate multiple experts collaborating within one client, suitable for two coder agents alternating turns.[4]
- Frameworks and sample repos built around MCP for agent composition let you define multiple agents, their roles, and shared tools, then orchestrate them via an MCP server or orchestrator.[3][7][8][10]
- Practical A2A (agent-to-agent) guides show task lifecycles (pending → running → updates → completed) and how MCP reduces tool mismatch/context loss, which is essential for reliable turn-by-turn handoffs.[5]
## Recommended setup pattern
1. Stand up or adopt an MCP hub/server that supports shared context and tool discovery/calls.[7][8]
2. Define two coder agents with clear roles (e.g., Implementer vs. Reviewer/Tester) to enable clean turn-taking and reduce conflicts.[1]
3. Add a lightweight planner/coordinator agent to assign turns, mark “in progress,” and arbitrate merges or conflicts.[1]
4. Ensure artifacts (diffs, tests, logs) are posted to shared context each turn so the next agent has full state continuity.[1]
5. Leverage MCP’s multi-turn interaction features to allow each agent to request clarifications or sub-results mid-turn without breaking the handoff flow.[9][6]
If helpful, a starter template and example orchestration script can be provided to spin up two coder agents with a coordinator and a shared MCP context, mirroring the turn-by-turn pattern described above.
[1] https://www.jeeva.ai/blog/multi-agent-coordination-playbook-(mcp-ai-teamwork)-implementation-plan
[2] https://tutorials.botsfloor.com/mcp-explained-the-new-standard-connecting-ai-to-everything-79c5a1c98288
[3] https://github.com/lastmile-ai/mcp-agent
[4] https://www.reddit.com/r/mcp/comments/1ljkt9t/built_an_mcp_server_that_turns_any_mcp_client/
[5] https://dev.to/composiodev/a-practical-guide-to-agent-to-agent-a2a-protocol-31fd
[6] https://www.youtube.com/watch?v=ovB8FZ7LAAk
[7] https://codelabs.developers.google.com/instavibe-adk-multi-agents/instructions
[8] https://aws.amazon.com/blogs/opensource/open-protocols-for-agent-interoperability-part-3-strands-agents-mcp/
[9] https://devblogs.microsoft.com/blog/can-you-build-agent2agent-communication-on-mcp-yes
[10] https://dev.to/codanyks/agent-to-agent-communication-via-mcp-1imj
# MCP services to run two coder agents turn-by-turn
Yes—there are several MCP-compatible services, servers, and frameworks that can host multi-agent workflows and support a turn-by-turn collaboration pattern between two coder agents.
## Ready-to-use MCP servers/hubs and frameworks
- lastmile-ai/mcp-agent (GitHub): Wraps an agent app inside an MCP server and exposes agents and workflows to MCP hosts (e.g., Claude Desktop), useful for composing multiple specialized agents and orchestrating turn-taking via defined workflows.[1]
- Agent-MCP (GitHub): A multi-agent framework that can run as an MCP server; it exposes tools like create_agent, assign_task, manage_agent_communication, and shared resources (agent_status, project_memory), making it straightforward to stand up a two-coder, coordinator-mediated, turn-by-turn flow.[2]
- mcp-use: An open-source client/runner that connects a model to multiple MCP servers simultaneously; helpful when each coder agent needs different tool servers and a shared coordinator orchestrates turns across them.[3]
- Camunda Agentic Orchestration: Provides orchestrated multi-agent processes with protocol-ready connectors for MCP and A2A; suitable when enterprise-grade process control, auditability, and long-running turn-by-turn exchanges are desired.[4]
- MCP Servers Multi-Agent AI Infrastructure: A community project for multi-agent collaboration over MCP with monitoring (Inspector), Qdrant-backed semantic memory, and modular components; can be adapted to two-coder alternation with shared context.[5]
## Cloud platform with multi-agent support (can integrate MCP)
- Azure AI Foundry Agent Service: Offers multi-agent capabilities for building coordinated agent systems; while it’s not an MCP server by default, it’s positioned to integrate with MCP-based tools and connectors for orchestrated turn-taking between agents.[6]
## Helpful explainers and positioning
- Overviews clarify that MCP is an integration layer rather than an orchestration brain; pairing MCP servers with an orchestrator (e.g., workflow engine or a planner agent) is the typical way to achieve reliable turn-by-turn collaboration.[7][8]
- Implementation guides describe using a shared MCP hub/server to route messages, persist shared context, and coordinate sequential or parallel work among coder/tester/QA agents, which directly maps to a two-coder alternating pattern.[9]
## Practical starting points
- If a streamlined, local-first setup is preferred: start with Agent-MCP running as an MCP server and define two coder agents plus a lightweight planner; expose project_memory and agent_status so each turn leaves artifacts for the next agent.[2]
- If integrating with an existing MCP host (e.g., Claude Desktop): try lastmile-ai/mcp-agent to expose multiple agents/workflows as MCP tools the host can call, enabling explicit turn assignment and handoffs.[1]
- If mixing multiple external tools: use mcp-use to connect to several MCP servers (file system, repo tools, browser automation) and let the coordinator agent decide which server to invoke each turn.[3]
- For enterprise governance and observability: model the collaboration as a process in Camunda and connect agents via the MCP connector so each “turn” is a process task with auditable state transitions.[4]
If preferred, a minimal reference architecture and config snippets can be provided to stand up two coder agents with a coordinator on top of one of the options above, including suggested tool servers (filesystem, Git, tests) and the turn-taking loop.
[1] https://github.com/lastmile-ai/mcp-agent
[2] https://github.com/rinadelph/Agent-MCP
[3] https://github.com/mcp-use/mcp-use
[4] https://camunda.com/agentic-orchestration/
[5] https://mcp.so/server/mcp-servers/FrankGenGo
[6] https://techcommunity.microsoft.com/blog/azure-ai-foundry-blog/building-a-digital-workforce-with-multi-agents-in-azure-ai-foundry-agent-service/4414671
[7] https://tutorials.botsfloor.com/mcp-explained-the-new-standard-connecting-ai-to-everything-79c5a1c98288
[8] https://huggingface.co/blog/Kseniase/mcp
[9] https://www.jeeva.ai/blog/multi-agent-coordination-playbook-(mcp-ai-teamwork)-implementation-plan
[10] https://www.camel-ai.org/blogs/camel-mcp-servers-model-context-protocol-ai-agents
[11] https://streamnative.io/blog/open-standards-real-time-ai-mcp
[12] https://orkes.io/blog/what-is-model-context-protocol-mcp/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment