AgentAnycast

AgentAnycast

Discover and communicate with AI agents over encrypted P2P networks. Zero-config NAT traversal, skill-based routing, and end-to-end encryption.

Category
访问服务器

README

AgentAnycast Node

P2P daemon for decentralized A2A agent-to-agent communication.

Go License

AgentAnycast is fully decentralized. On a local network, it works with zero configuration via mDNS auto-discovery. For cross-network communication, just deploy your own relay with a single command.

Overview

AgentAnycast Node (agentanycastd) is the core daemon that powers the AgentAnycast network. It runs on each machine and handles:

  • Automatic peer discovery via mDNS on local networks
  • NAT traversal via circuit relay, hole punching, and QUIC
  • End-to-end encryption using Noise_XX (Curve25519 + ChaCha20-Poly1305)
  • A2A task routing with direct, skill-based, and HTTP bridge addressing
  • Streaming for chunked artifact delivery
  • HTTP Bridge for P2P ↔ HTTP A2A interop
  • MCP Server for AI tool integration (Claude, Cursor, ChatGPT, etc.)
  • ANP Bridge for Agent Network Protocol interop
  • Prometheus metrics for observability
  • gRPC API for language SDKs (Python, TypeScript) to interact with the daemon

Quick Start

Local network -- zero configuration

# Build
go build -o agentanycastd ./cmd/agentanycastd

# Run -- agents on the same LAN discover each other automatically
./agentanycastd

Cross-network -- deploy your own relay

# On any VPS with a public IP
git clone https://github.com/AgentAnycast/agentanycast-relay && cd agentanycast-relay
docker-compose up -d

# Note the RELAY_ADDR from the logs, then:
./agentanycastd -bootstrap-peers "/ip4/<RELAY_IP>/tcp/4001/p2p/12D3KooW..."

MCP mode -- use as an AI tool

# stdio mode (Claude Desktop, Cursor, VS Code, Gemini CLI)
./agentanycastd -mcp

# Streamable HTTP mode (ChatGPT, remote clients)
./agentanycastd -mcp-listen :3000

Configuration

Priority: CLI flags > environment variables > config file > defaults

CLI Flags

Flag Description
-key Path to identity key file
-grpc-listen gRPC listen address (unix:// or tcp://)
-log-level Log level (debug, info, warn, error)
-bootstrap-peers Comma-separated bootstrap multiaddrs
-bridge-listen HTTP bridge listen address (e.g., :8080)
-enable-webtransport Enable WebTransport (QUIC-based, browser-compatible)
-mcp Run as MCP server over stdio
-mcp-listen MCP Streamable HTTP listen address (e.g., :3000)
-anp-listen ANP bridge listen address (e.g., :8090)
-config Path to TOML config file
-version Print version and exit

Environment Variables

Variable Description Default
AGENTANYCAST_KEY_PATH Path to the libp2p identity key file ~/.agentanycast/key
AGENTANYCAST_GRPC_LISTEN gRPC server listen address unix://~/.agentanycast/daemon.sock
AGENTANYCAST_LOG_LEVEL Log level info
AGENTANYCAST_STORE_PATH Path to persistent data store ~/.agentanycast/data
AGENTANYCAST_BOOTSTRAP_PEERS Comma-separated relay/bootstrap multiaddrs (none)
AGENTANYCAST_ENABLE_MDNS Enable mDNS local network discovery true
AGENTANYCAST_REGISTRY_ADDRS Comma-separated registry addresses (multi-relay federation) (none)
AGENTANYCAST_MCP_LISTEN MCP Streamable HTTP address (none)

Config File

Default location: ~/.agentanycast/config.toml

key_path = "~/.agentanycast/key"
grpc_listen = "unix://~/.agentanycast/daemon.sock"
log_level = "info"
log_format = "json"
store_path = "~/.agentanycast/data"
enable_mdns = true
enable_quic = true
enable_webtransport = false
enable_relay_client = true
enable_hole_punching = true
offline_queue_ttl = "24h"
bootstrap_peers = ["/ip4/203.0.113.50/tcp/4001/p2p/12D3KooW..."]

[bridge]
enabled = false
listen = ":8080"
# tls_cert = "/path/to/cert.pem"
# tls_key = "/path/to/key.pem"
# cors_origins = ["*"]

[anycast]
routing_strategy = "random"
cache_ttl = "30s"
auto_register = true
# registry_addr = "relay.example.com:50052"
# registry_addrs = ["relay1:50052", "relay2:50052"]  # federation
enable_dht = false
dht_mode = "auto"   # "auto", "server", or "client"

[metrics]
enabled = false
listen = ":9090"

[mcp]
enabled = false
listen = ":3000"

[anp]
enabled = false
listen = ":8090"

[identity]
# did_web = "did:web:example.com:agents:myagent"
# did_dns_domain = "example.com"

Architecture

┌──────────────────────────────────────────────────────────────────┐
│                         agentanycastd                            │
│                                                                  │
│  ┌──────────┐  ┌──────────┐  ┌──────────┐  ┌──────────────────┐ │
│  │  Engine   │  │  Router  │  │ Offline  │  │ Anycast Router   │ │
│  │(task FSM) │  │(A2A msg) │  │  Queue   │  │(skill discovery) │ │
│  └────┬─────┘  └────┬─────┘  └────┬─────┘  └────┬─────────────┘ │
│       │              │             │              │               │
│  ┌────┴──────────────┴─────────────┴──────────────┴─────────┐    │
│  │                       libp2p Host                        │    │
│  │    mDNS · Noise · TCP · QUIC · WebTransport · DHT        │    │
│  │    Circuit Relay v2 · DCUtR Hole Punching                │    │
│  └──────────────────────┬───────────────────────────────────┘    │
│                         │                                        │
│  ┌──────────────────────┴──────────────────────────────────────┐ │
│  │                gRPC Server (16 RPCs for SDKs)               │ │
│  └─────────────────────────────────────────────────────────────┘ │
│                                                                  │
│  ┌────────────┐ ┌────────────┐ ┌──────────┐ ┌────────┐ ┌──────┐ │
│  │ HTTP Bridge│ │ MCP Server │ │ANP Bridge│ │Metrics │ │BoltDB│ │
│  │ (A2A↔P2P) │ │(stdio/HTTP)│ │(ANP↔A2A) │ │(Prom.) │ │(stor)│ │
│  └────────────┘ └────────────┘ └──────────┘ └────────┘ └──────┘ │
└──────────────────────────────────────────────────────────────────┘

Internal Packages

Package Responsibility
internal/a2a/ A2A protocol engine — task state machine, envelope routing, offline queue, streaming
internal/node/ libp2p host — peer connections, mDNS, DHT, TCP/QUIC/WebTransport
internal/crypto/ Ed25519 key management, DID conversion (did:key, did:web, did:dns), Verifiable Credentials
internal/nat/ AutoNAT detection, DCUtR hole punching, Circuit Relay v2 client
internal/store/ BoltDB persistence — tasks, agent cards, offline message queue
internal/config/ Configuration — TOML file, environment variables, CLI flags
internal/bridge/ HTTP Bridge — translates HTTP JSON-RPC ↔ P2P A2A envelopes
internal/anycast/ Anycast router — skill-based addressing, registry + multi-registry federation + DHT discovery
internal/metrics/ Prometheus metrics — connections, tasks, routing, bridge, streaming, MCP
internal/mcp/ MCP Server — exposes P2P capabilities as MCP tools (stdio + Streamable HTTP)
internal/anp/ ANP Bridge — translates ANP HTTP ↔ A2A P2P (JSON-RPC 2.0 + JSON-LD)
pkg/grpcserver/ gRPC server — 16 RPC methods for SDKs

gRPC API (16 RPCs)

Group Methods
Node GetNodeInfo, SetAgentCard
Peers ConnectPeer, ListPeers, GetPeerCard
Task Client SendTask (peer_id / skill_id / url), GetTask, CancelTask, SubscribeTaskUpdates
Task Server SubscribeIncomingTasks, UpdateTaskStatus, CompleteTask, FailTask
Streaming SubscribeTaskStream, SendStreamingArtifact
Discovery Discover

MCP Server

The daemon can run as an MCP (Model Context Protocol) server, exposing P2P capabilities as tools for AI assistants:

Tool Description
toolGetNodeInfo Get local node information
toolListConnectedPeers List connected peers
toolGetAgentCard Get local or remote agent card
toolDiscoverAgents Discover agents by skill
toolSendTask Send task to peer by ID
toolSendTaskBySkill Send task by skill (anycast)
toolGetTaskStatus Get task status

Two transport modes:

  • stdio — for local AI tool integration (Claude Desktop, Cursor, VS Code, Gemini CLI, JetBrains)
  • Streamable HTTP — for remote clients (ChatGPT)

HTTP Bridge

Exposes an A2A-compatible HTTP endpoint for P2P ↔ HTTP interop:

  • GET /.well-known/a2a-agent-card — Agent Card discovery
  • POST / — JSON-RPC endpoint for task operations
  • Optional TLS and CORS support

ANP Bridge

Exposes an ANP-compatible HTTP endpoint for Agent Network Protocol interop:

  • GET /agent/ad.json — Agent Description (JSON-LD)
  • GET /agent/interface.json — OpenRPC specification
  • POST /agent/rpc — JSON-RPC 2.0 endpoint

Metrics

Prometheus metrics on configurable HTTP port (default :9090):

  • agentanycast_connected_peers — current peer count (gauge)
  • agentanycast_connections_total — connection events by direction (counter)
  • agentanycast_connections_by_transport — connections by transport type: tcp/quic/webtransport (counter)
  • agentanycast_tasks_total — tasks by direction and status (counter)
  • agentanycast_task_duration_seconds — task latency histogram
  • agentanycast_route_resolutions_total — anycast resolution by result (counter)
  • agentanycast_bridge_requests_total — HTTP bridge requests (counter)
  • agentanycast_stream_chunks_total — streaming chunks by direction (counter)
  • agentanycast_messages_total — A2A messages by envelope type (counter)
  • agentanycast_offline_queue_size — queued offline messages (gauge)
  • agentanycast_mcp_tool_calls_total — MCP tool calls by tool and status (counter)

Disclaimer

This software is provided "as is", without warranty of any kind. This software uses cryptography and may be subject to export controls in certain jurisdictions.

License

FSL-1.1-ALv2 -- Functional Source License, Version 1.1, with Apache License, Version 2.0 as the future license. Each release converts to Apache 2.0 two years after its publication date.

推荐服务器

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

官方
精选