V Vant Docs

RPC

Vant talks over three HTTP wires. Each has a different job, and all three default to loopback so nothing is exposed to the network by accident.

Wire Lives in Default port Job
MCP tool door lib/mcp.js 3457 Agents and clients execute tools: brain reads and writes, search, agent spawn, config, and the rest of the catalog
REST layer lib/api.js on lib/server.js 3456 Embedders call brain, stream, trust, and market endpoints
Crew bus lib/crew-bus.js per node Node-to-node signed envelopes for federation and agora

The MCP tool door

The primary door. One endpoint executes every registered tool, so clients never need a new route per feature.

Endpoints

Method Path What
GET /mcp/tools List registered tools with input schemas
POST /mcp/exec Execute one tool
GET /mcp/events SSE tap of the pod’s event bus - the dashboard feed (authed when mcp.requireKey is on; dashboard-ui event families only, sanitized + throttled)

Two legacy aliases are kept on the same server for older clients: GET /tools (tool list) and GET /health (liveness). Anything else gets a 404 that echoes the real endpoints: GET /mcp/tools, POST /mcp/exec, GET /mcp/events, GET /health.

Executing a tool

The exec body accepts both the flat shape and a JSON-RPC-style shape:

# Flat shape: { tool, args }
curl -X POST http://localhost:3457/mcp/exec \
  -H "Content-Type: application/json" \
  -d '{"tool": "brain_load", "args": {"name": "identity"}}'

# Same call, JSON-RPC style: { method, params }
curl -X POST http://localhost:3457/mcp/exec \
  -H "Content-Type: application/json" \
  -d '{"method": "brain_load", "params": {"name": "identity"}}'

Responses are plain JSON: {"result": ...} on success, {"error": "..."} on failure. There is no JSON-RPC envelope and no tools/call method.

Authentication and guards

By default the door is open on loopback (local companion posture). Four boundaries tighten it:

  1. vant config set mcp.requireKey true (or env VANT_MCP_REQUIRE_KEY=true) requires x-api-key or Authorization: Bearer on POSTs.
  2. Habitat tokens (a vant_ bearer token or the x-habitat-token header) are accepted wherever a shared key is, and anchor the request to its registry-verified RLS subject. Guest tokens (vguest_<id>_<secret>, the H1 #185 layer) satisfy the same boundary with their OWN identity: each carries a role on the sandbox capability vocabulary (observer/human/agent), the door gates verbs by class, and revocation is denylist-backed. Issue with vant guest issue - see Multi-Guest Auth.
  3. The Host header must be loopback (DNS-rebinding guard), cross-origin POSTs are refused, and bodies must be application/json.
  4. The bind is loopback by default: VANT_MCP_BIND widens it deliberately, VANT_MCP_PORT (default 3457) moves it.

Operations and catalog

Running the server, stdio mode, ports, TLS, and the security chain are covered in the MCP Server guide. The full tool catalog lives in MCP Tools.


The REST layer

lib/server.js is the HTTP server class: a router with static serving, a per-minute rate limiter that sets X-RateLimit headers, and a TLS posture of loopback-or-TLS. TLS is automatic when VANT_SERVER_CERT and VANT_SERVER_KEY are set; the vant server CLI refuses a non-loopback plaintext bind unless --insecure is passed.

On top of it, lib/api.js registers the REST surface for embedders:

const api = require('vant/lib/api');

await api.startREST({ port: 3456 });  // REST routes only
await api.startAll();                 // REST + MCP together

Every REST route is a thin proxy to an MCP tool, so responses are the tool’s result JSON:

Method Path Backs onto
GET /streams stream_list
POST /streams stream_create
GET /streams/:id stream_info
POST /streams/:id/enqueue stream_enqueue
POST /streams/:id/poll stream_poll
GET /brain brain_state
GET /brain/ls brain_list
GET /brain/:name brain_load
POST /brain/:name brain_save
GET /trust/score/:entity trust_getScore
POST /trust/record trust_record
GET /trust/leaderboard trust_leaderboard
GET /market/listings market_search
POST /market/list market_list
POST /market/bid market_bid
POST /market/trade market_trade
GET /market/stats market_stats
GET /market/listing/:id market_get

Three built-ins sit on every lib/server.js instance before any route: GET /health (liveness), POST /call (executes any tool, honors both the JSON-RPC 2.0 tools/call envelope and flat { tool, args } bodies), and GET /tools, which answers 410 Gone since the #187 retire (the MCP door is the tool surface, and its own GET /tools alias stays 200).

The full request and response reference is the REST API Reference. The vant api utility CLI (status, routes, call, docs) introspects the same surface.


The crew bus

Cross-node transport for the multi-agent crew and agora (lib/crew-bus.js). Crew messages travel as HMAC-signed webhook envelopes between node processes. There is no shared process and no shared protocol state, only signed post between peers that registered each other.

Envelope shape (JSON body):

{
  "event": "crew.vote",
  "from": "node-a",
  "type": "vote",
  "payload": { "topic": "use-gold-theme", "choice": "aye" },
  "ts": 1730000000000,
  "nonce": "9f2c1b"
}

Contract:

Setup sketch:

const crewBus = require('./lib/crew-bus');

crewBus.configure({ name: 'node-a', port: 4001, secret });
crewBus.registerNode({ name: 'node-b', url: 'http://127.0.0.1:4002', secret });
crewBus.onDispatch('vote', (env) => tally(env.payload));
await crewBus.listen(4001);

await crewBus.send('node-b', 'vote', { topic: 'use-gold-theme' });

Bootstrap between fresh nodes is the genesis.hello / genesis.ack handshake (lib/genesis.js). Operating verbs that ride this wire (remote votes, ledger sync, settlement) are in Agora operations and Federation playbooks; the webhook transport underneath is in Webhooks.


Agent chains

Delegation is shipped and real, but it is tool calls and work items, not a wire protocol:

The guide for the whole crew surface is Multi-Agent Crew.


The _theme extension

Status: helpers shipped, server adoption pending. The honest one-liner: lib/theme.js ships the spec’d helpers and CLI output uses them today (health, help, lock, config), but the MCP server returns plain JSON and does not decorate responses with _theme yet.

The design, so a client can be ready early:

Clients MUST ignore unknown _theme fields (forward compatibility), and servers can adopt incrementally. The design RFC is labs/rfc-mcp-theme.md in the repo; lib/theme.js exports STATUS_ICONS, applyToMCP, and the mcp.success, mcp.error, mcp.warn, mcp.loading, and mcp.info response builders.