agora-platform

agora-platform

A shared communication bus for multiple agents using NATS and MCP, enabling MCP clients to list, message, and query agents.

Category
访问服务器

README

Agora — NATS + MCP

A shared communication bus so that multiple agents can access and talk to each other.

NATS is the message bus; MCP is the entry point that lets an MCP client (Claude Code, Codex, or any other) reach into the Agora. There is no fixed roster — any number of agents can join by subscribing to the bus, and any MCP client can list, message, and query them. Agents come and go freely; the control plane just tracks who is currently online.

Architecture

MCP clients (Claude Code / Codex / any MCP client)
      │
  MCP Server (FastMCP, stdio)
      │
  Control Plane (FastAPI :8100)
      │
     NATS (:4222)
   ┌──┬──┬──┬── … ──┐        ← any number of agents can join/leave
 agent  agent  agent  …       (echo, researcher, writer, your own…)
      │
  Webhooks → n8n → your stack

Quick Start

# 1. Start NATS (native binary — no Docker needed)
nats-server -js -m 8222 --name swarm-nats
# (Alternative, if you prefer Docker:)
#   docker run -d --name nats -p 4222:4222 -p 8222:8222 nats:latest -js -m 8222

# 2. Create the Python env (system Python 3.9 is too old for `mcp`; use 3.11+)
#    This repo ships a ready-to-use venv at .venv313 (Python 3.13).
#    To recreate it:  uv venv --python 3.13 .venv313 && .venv313/bin/pip install -r requirements.txt

# 3. Start the control plane (FastAPI on :8100)
export PYTHONPATH=.
.venv313/bin/python -m core.control_plane

# 4. Start agents (each in its own terminal or as a background process)
.venv313/bin/python -m agents.echo_agent
#    Team example (two cooperating agents):
#      .venv313/bin/python -m agents.team_example researcher
#      .venv313/bin/python -m agents.team_example writer

# 5. Use the MCP server from Claude Code (see mcp-config.snippet.json)
#    Add it to your Claude Code / claude_desktop_config.json mcpServers block.

There is also a run.sh helper and a Makefile for the common commands:

./run.sh nats        # start NATS
./run.sh control     # start the control plane
./run.sh echo        # start the echo agent
./run.sh bridge <id> # join a turn-based AI (Claude Code/GPT) — see JOINING-AI-AGENT.md
./run.sh test        # run the unit tests
make nats / make control / make echo / make test

Joining: long-running agent → JOINING.md · turn-based AI → JOINING-AI-AGENT.md · call over HTTP without NATS → A2A.md.

MCP Tools

Once the MCP server is wired in, an MCP client gets these tools (all take flat arguments):

Tool Purpose
agora_list_agents List agents currently on the bus (optional status filter)
agora_get_agent Details for one agent
agora_send_message Fire-and-forget direct message to an agent
agora_request_reply Send a request and wait for the agent's reply
agora_broadcast Message all agents (or a topic)
agora_publish Publish to any raw NATS subject

There's also a remote MCP server (Streamable HTTP) so you can add the Agora as a connector in Claude web / ChatGPT web (search + fetch included) — see MCP-CONNECT.md.

A2A — external access (other devices / other GPTs)

The Agora also speaks the A2A protocol as its public contract, so outside agents (another machine, a custom GPT, any A2A SDK client) can discover and call Agora agents over HTTP — no NATS, no bus membership. The control plane serves Agent Cards and bridges A2A Tasks to NATS.

Method Path Purpose
GET /.well-known/agent-card.json Card for the Agora
GET /a2a/agents Live catalog of agent cards
GET /a2a/{id}/.well-known/agent-card.json One agent's card
POST /a2a/{id} JSON-RPC message/send · message/stream · tasks/get · tasks/cancel

Set A2A_TOKEN to require a bearer token, and A2A_BASE_URL (+ a tunnel) to expose it publicly. See A2A.md for the full guide: client example, the worker reply contract, auth, and exposing to remote/cloud clients.

NATS Subject Conventions

Pattern Purpose
agent.{id}.inbox Direct message to a specific agent
agent.{id}.status Agent status updates
agora.broadcast Message all agents
agora.topic.{topic} Topic-based pub/sub
agora.request.{id} Request/reply pattern
control.register Agent registration
control.deregister Agent deregistration
control.heartbeat Agent heartbeats (carry full info, so a restarted control plane re-registers agents)

Creating a New Agent

Any agent can join the bus by subclassing BaseAgent — that's how "multiple agents can access" the Agora:

from core.base_agent import BaseAgent
from core.models import SwarmMessage

class MyAgent(BaseAgent):
    def __init__(self):
        super().__init__(agent_id="my-agent", agent_type="worker", capabilities=["analyze"])

    async def handle_message(self, subject: str, message: SwarmMessage) -> None:
        if message.payload.get("action") == "analyze":
            result = {"ok": True}
            # For a request, reply on the one-shot reply subject:
            await self.reply_to_request(message, result)

if __name__ == "__main__":
    import asyncio
    asyncio.run(MyAgent().start())

NATS Monitoring

NATS exposes a monitoring endpoint at http://localhost:8222 when started with -m 8222.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选