High-performance Cap'n Proto RPC for AI agent communication.
ZAP provides a unified protocol for connecting to and aggregating MCP (Model Context Protocol) servers, enabling efficient tool calling, resource access, and prompt management for AI agents.
"Infinity Times Faster" - When decode time is zero, the speedup is mathematically infinite.
- Zero-copy Serialization: Cap'n Proto wire format = memory format
- Promise Pipelining: N dependent calls in 1 round trip
- Capability Security: Possession = permission, no ambient authority
- Multi-transport: Unix sockets, TCP, TLS, QUIC, WebSocket, shared memory
- MCP Gateway: Aggregate multiple MCP servers behind a single endpoint
- Agent Consensus: Built-in metastable voting for multi-agent coordination
- Post-Quantum Ready: ML-KEM-768, ML-DSA-65, Ringtail signatures
- Cross-language: 17 language bindings
| Package | Language | Install |
|---|---|---|
zap-protocol |
Rust | cargo add zap-protocol |
zap-protocol |
Python | pip install zap-protocol |
@zap-protocol/zap |
TypeScript | npm install @zap-protocol/zap |
zap-protocol/zap-go |
Go | go get github.com/zap-protocol/zap-go |
All language bindings are maintained in the zap-protocol GitHub organization:
| Language | Repository | Status |
|---|---|---|
| Rust | zap-protocol/zap | Production |
| Go | zap-protocol/zap-go | Production |
| Python | zap-protocol/zap-py | Production |
| JavaScript/TypeScript | zap-protocol/zap-js | Production |
| C++ | zap-protocol/zap-cpp | Stable |
| C | zap-protocol/zap-c | Stable |
| C# | zap-protocol/zap-cs | Development |
| Java | zap-protocol/zap-java | Development |
| Haskell | zap-protocol/zap-haskell | Development |
| OCaml | zap-protocol/zap-ocaml | Development |
| Erlang | zap-protocol/zap-erlang | Development |
| D | zap-protocol/zap-d | Development |
| Lua | zap-protocol/zap-lua | Development |
| Nim | zap-protocol/zap-nim | Development |
| Ruby | zap-protocol/zap-ruby | Development |
| Scala | zap-protocol/zap-scala | Development |
use zap_protocol::{Client, Gateway};
// Connect to a ZAP gateway
let client = Client::connect("zap://localhost:9999").await?;
// List available tools
let tools = client.list_tools().await?;
// Call a tool
let result = client.call_tool("search", json!({"query": "hello"})).await?;import "github.com/zap-protocol/zap-go"
// Connect to a ZAP gateway
client, err := zap.Connect("zap://localhost:9999")
// List available tools
tools, err := client.ListTools(ctx)
// Call a tool
result, err := client.CallTool(ctx, "search", map[string]any{"query": "hello"})from zap import ZAP
# FastMCP-style decorator API
zap = ZAP("my-agent")
@zap.tool
def search(query: str) -> str:
"""Search for information."""
return f"Results for: {query}"
# Or connect as client
from zap import Client
client = await Client.connect("zap://localhost:9999")
tools = await client.list_tools()import { Client, Gateway } from '@zap-protocol/zap';
// Connect to a ZAP gateway
const client = await Client.connect('zap://localhost:9999');
// List available tools
const tools = await client.listTools();
// Call a tool
const result = await client.callTool('search', { query: 'hello' });# List tools from a gateway
zap tools list
# Call a tool
zap call search --query "hello world"
# List resources
zap resources list
# Read a resource
zap read file:///path/to/file# Start gateway with config file
zapd --config /etc/zap/config.toml
# Start with inline servers
zapd --server "stdio://npx @modelcontextprotocol/server-filesystem"Create a zap.toml configuration file:
[gateway]
listen = "0.0.0.0"
port = 9999
log_level = "info"
[[servers]]
name = "filesystem"
transport = "stdio"
command = "npx"
args = ["@modelcontextprotocol/server-filesystem", "/path/to/files"]
[[servers]]
name = "database"
transport = "http"
url = "http://localhost:8080/mcp"
[[servers]]
name = "search"
transport = "websocket"
url = "ws://localhost:9000/ws"┌─────────────────────────────────────────────────────────────┐
│ AI Client │
│ (Claude, GPT, etc.) │
└──────────────────────────┬──────────────────────────────────┘
│
│ ZAP Protocol (Cap'n Proto RPC)
│
▼
┌─────────────────────────────────────────────────────────────┐
│ ZAP Gateway │
│ │
│ ┌──────────────────────────────────────────────────────┐ │
│ │ Server Registry │ │
│ │ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ │ │
│ │ │Server A │ │Server B │ │Server C │ │Server D │ │ │
│ │ └────┬────┘ └────┬────┘ └────┬────┘ └────┬────┘ │ │
│ └───────┼────────────┼────────────┼────────────┼───────┘ │
│ │ │ │ │ │
└──────────┼────────────┼────────────┼────────────┼──────────┘
│ │ │ │
▼ ▼ ▼ ▼
┌────────┐ ┌────────┐ ┌────────┐ ┌────────┐
│ stdio │ │ HTTP │ │ WS │ │ Unix │
│ MCP │ │ MCP │ │ MCP │ │ Socket │
│ Server │ │ Server │ │ Server │ │ Server │
└────────┘ └────────┘ └────────┘ └────────┘
ZAP uses Cap'n Proto for efficient serialization and RPC:
interface Zap {
# Server discovery
initialize @0 (info :ServerInfo) -> (info :ServerInfo);
# Tools
listTools @1 () -> (tools :List(Tool));
callTool @2 (name :Text, arguments :Text) -> (result :ToolResult);
# Resources
listResources @3 () -> (resources :List(Resource));
readResource @4 (uri :Text) -> (content :ResourceContent);
# Prompts
listPrompts @5 () -> (prompts :List(Prompt));
getPrompt @6 (name :Text, arguments :Text) -> (messages :List(PromptMessage));
}cd /path/to/hanzo-zap
cargo build
cargo testcd /path/to/hanzo-zap/python
uv sync
uv run pytestcd /path/to/hanzo-zap/typescript
npm install
npm run build
npm test| Tool | Repository | Description |
|---|---|---|
| VS Code | zap-protocol/zap-vscode | VS Code extension |
| Vim | zap-protocol/zap-vim | Vim plugin |
| IntelliJ | zap-protocol/zap-intellij | JetBrains plugin |
| LSP | zap-protocol/zap-lsp | Language server |
| Wireshark | zap-protocol/zap-wireshark | Protocol dissector |
Full documentation available at: https://zap.hanzo.ai
MIT OR Apache-2.0