agent-mesh-core

agent-mesh-core

An MCP server for coordinating trusted local AI agents across machines on a private Tailscale network, enabling message passing and state management between agents like Claude Code, Codex, and Ollama.

Category
访问服务器

README

agent-mesh-core

agent-mesh-core is a personal AgentMesh reference implementation for coordinating trusted local AI agents across machines. A Mac mini owns the live mesh directory on local disk; Claude Code, Codex, and Ollama-side tooling talk to it over a private Tailscale network through MCP and HTTP services.

This is experimental personal infrastructure, not a general-purpose multi-tenant coordination service. The trust boundary is your private tailnet. Callers are trusted; the app layer does not authenticate users, authorize agents, or prevent one trusted caller from passing another agent_id.

What It Does

  • Maintains per-agent inboxes, state files, and directory-based locks under a local mesh root.
  • Writes JSON atomically with local-disk os.replace semantics.
  • Uses claim-then-acknowledge inbox processing so dropped network clients do not silently lose claimed messages.
  • Exposes the same dispatch layer through agent-mesh-mcp-server for Claude Code/Codex and agent-mesh-http-server for tools that cannot speak MCP.

Background and design rationale:

Trust Model

This project assumes one human operator, trusted machines on a private Tailscale network, and trusted local tools that are allowed to call the MCP/HTTP services.

This project does not provide multi-user authorization, per-client authentication, agent ID anti-spoofing, or a security boundary between tools already allowed to reach the service. If you need those properties, treat this repo as a design reference rather than deployable software.

Architecture

The live mesh root is local to the Mac mini:

AgentMesh/
├── config/
│   └── local_rules.json
├── agents/
│   ├── agent_mac_mini/
│   │   ├── inbox/
│   │   └── state.json
│   ├── agent_mbp/
│   │   ├── inbox/
│   │   └── state.json
│   └── agent_ollama_local/
│       ├── inbox/
│       └── state.json
└── locks/

Other machines never mount or write this directory. They call services running on the Mac mini:

  • MCP: http://<mac-mini-tailscale-host>:8000/mcp
  • HTTP wrapper: http://<mac-mini-tailscale-host>:8001

New Client Setup

Use this when the Mac mini services are already deployed and you want a new Mac, Linux, or Windows machine to talk to the mesh.

  1. Install and log into Tailscale on the new machine.

  2. Confirm the machine can reach the Mac mini Tailscale IP or MagicDNS name:

    tailscale status
    
  3. Register the MCP server with Claude Code:

    claude mcp add --transport http agent-mesh http://<mac-mini-tailscale-host>:8000/mcp
    claude mcp list
    
  4. Register the MCP server with Codex:

    codex mcp add agent-mesh --url http://<mac-mini-tailscale-host>:8000/mcp
    

Use the Mac mini's Tailscale IP if startup-time DNS resolution is a concern. MagicDNS is easier to read, but a raw tailnet IP avoids depending on DNS during launchd startup.

Per-OS Notes

The MCP registration commands are the same across operating systems. The platform-specific part is getting Tailscale installed and authenticated.

  • macOS: install Tailscale from the App Store, direct download, or package manager; log into the same tailnet as the Mac mini.
  • Linux: install Tailscale using the distribution instructions from Tailscale, start the service, and run tailscale up.
  • Windows: install Tailscale for Windows, log into the same tailnet, and run the Codex/Claude commands from a shell that has those CLIs on PATH.

No SMB mount is needed on any client OS.

Mac Mini Setup

Use this when setting up the host role from scratch or doing local development.

  1. Clone the repo and install dependencies:

    git clone <repo-url>
    cd agent-mesh-core
    uv sync
    
  2. Run tests and lint:

    UV_CACHE_DIR=.uv-cache uv run pytest -q
    UV_CACHE_DIR=.uv-cache uv run ruff check .
    
  3. Bootstrap a mesh root:

    MESH_ROOT=/Users/Shared/AgentMesh \
    AGENT_IDS=agent_mac_mini,agent_mbp,agent_ollama_local \
    ./deploy.sh
    
  4. Render and load the MCP and HTTP launchd services.

    See docs/OPERATIONS.md for the exact commands, logging paths, and validation steps.

Ollama Integration

Ollama does not speak MCP and does not provide a built-in hook that makes arbitrary coordination calls before or after inference. The deployed HTTP wrapper exists for Ollama-side glue code to call explicitly.

Expected integration shape:

  1. Keep agent-mesh-http-server running on the Mac mini.
  2. Write or use an Ollama-side script/proxy that calls HTTP routes such as POST /send_message, POST /claim_inbox_messages, POST /acknowledge_claims, POST /read_local_rules, and POST /health_check.
  3. Have that script identify itself with the provisioned agent ID agent_ollama_local.

Example health check:

curl -sS -X POST \
  http://<mac-mini-tailscale-host>:8001/health_check \
  -H "Content-Type: application/json" \
  -d '{}'

Example send:

curl -sS -X POST \
  http://<mac-mini-tailscale-host>:8001/send_message \
  -H "Content-Type: application/json" \
  -d '{
    "agent_id": "agent_ollama_local",
    "target_agent_id": "agent_mbp",
    "message_type": "task.note",
    "body": {"text": "hello from ollama-side tooling"}
  }'

A reference poller that closes this loop end-to-end — claiming inbox messages, routing them to a local Ollama model, and replying to the sender — lives at examples/ollama/mesh_poller.py, with the task-routing rationale (what's a good fit for Ollama vs. what should stay on Claude Code/Codex) in examples/ollama/README.md. It's example code, not a deployed service — copy it into your own always-on process (launchd/systemd) if you want it running continuously.

Development

Useful commands:

UV_CACHE_DIR=.uv-cache uv run pytest -q
UV_CACHE_DIR=.uv-cache uv run ruff check .
UV_CACHE_DIR=.uv-cache uv run agent-mesh-bootstrap --mesh-root /tmp/AgentMesh --agent-ids agent_mac_mini,agent_mbp,agent_ollama_local
UV_CACHE_DIR=.uv-cache uv run agent-mesh-recover-processing --mesh-root /tmp/AgentMesh --agent-id agent_mbp --dry-run

Runtime paths such as agents/, locks/, and live config/*.json files are ignored by git. Keep the live mesh as data-only; source code and templates belong in this repository.

Status & Support

This is experimental personal infrastructure, maintained in spare time for a single operator's own machines — not a supported product with an SLA. Issues and PRs are welcome, but there's no commitment on response time, and feature requests outside the single-operator/private-tailnet scope described in Trust Model are likely to be declined rather than accepted. See SECURITY.md for the trust boundary and how to report a real security concern.

License

MIT

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选