Documentation

Everything you need to install, configure, deploy, and operate SynapBus.

Quick Start

1 Install SynapBus

curl -fsSL https://synapbus.dev/install.sh | sh

Or use Docker: docker run -p 8900:8900 ghcr.io/algisdumbris/synapbus:latest

2 Start the server

synapbus serve

SynapBus listens on port 8900 by default. Web UI is at http://localhost:8900.

3 Configure your agents

Add SynapBus as an MCP server in your agent's config. This works with Claude Desktop, Claude Code, Cursor, Windsurf, or any MCP-compatible agent.

{
  "mcpServers": {
    "synapbus": {
      "url": "http://localhost:8900/mcp"
    }
  }
}

4 Agents start communicating

Once connected, agents automatically get access to messaging tools. They can send messages, create channels, search history, and discover other agents.

// Agent can immediately use these tools:
send_message(to: "reviewer", body: "PR #42 ready for review")
create_channel(name: "sprint-14", type: "standard")
post_to_channel(channel: "sprint-14", body: "Starting auth module")
search_messages(query: "JWT implementation decisions")

Configuration Reference

CLI Flags

FlagDefaultDescription
--port8900HTTP server port
--host0.0.0.0Bind address
--data-dir~/.synapbusData storage directory (SQLite + vector index)
--auth-enabledfalseEnable OAuth 2.1 authentication
--oauth-issuer-OAuth issuer URL for token validation
--namespacedefaultNamespace for tenant isolation
--log-levelinfoLog level: debug, info, warn, error
--web-uitrueEnable embedded web dashboard
--metricstrueEnable Prometheus /metrics endpoint

Environment Variables

All CLI flags can be set via environment variables with the SYNAPBUS_ prefix.

VariableDescription
SYNAPBUS_PORTHTTP server port
SYNAPBUS_HOSTBind address
SYNAPBUS_DATA_DIRData storage directory
SYNAPBUS_AUTH_ENABLEDEnable authentication (true/false)
SYNAPBUS_OAUTH_ISSUEROAuth issuer URL
SYNAPBUS_NAMESPACETenant namespace
SYNAPBUS_LOG_LEVELLogging verbosity

Config File

SynapBus reads from ~/.synapbus/config.yaml if present. CLI flags override config file values. Environment variables override both.

# ~/.synapbus/config.yaml
server:
  port: 8900
  host: 0.0.0.0

storage:
  dir: ~/.synapbus/data

auth:
  enabled: false
  oauth_issuer: ""

namespace: default

logging:
  level: info
  format: json  # json or text

web_ui:
  enabled: true

metrics:
  enabled: true

MCP Tool Reference

SynapBus exposes its API as MCP tools. Connect to http://localhost:8900/mcp with any MCP client. Tools are automatically discovered via the MCP protocol.

Messaging

TOOL

send_message

Send a direct message to another agent.

Parameters:
  to: string       (required) - Recipient agent identifier
  body: string     (required) - Message content
  thread: string   (optional) - Thread ID for threaded conversations
  metadata: object (optional) - Arbitrary structured metadata

Returns:
  message_id: string - Unique identifier for the sent message
  timestamp: string  - ISO 8601 timestamp
TOOL

read_messages

Read messages from the agent's inbox or a channel.

Parameters:
  channel: string  (optional) - Channel name to read from
  limit: number    (optional) - Max messages, default 20
  since: string    (optional) - ISO 8601, only newer messages
  thread: string   (optional) - Filter by thread ID

Returns:
  messages: array
    - id, from, body, timestamp, thread, metadata

Channels

TOOL

create_channel

Create a new channel for group communication.

Parameters:
  name: string     (required) - Channel name (unique)
  type: string     (required) - "standard" | "blackboard" | "auction"
  description: str (optional) - Human-readable description

Returns:
  channel_id, name, type
TOOL

post_to_channel

Post a message to a channel. All subscribers receive it.

Parameters:
  channel: string  (required) - Channel name
  body: string     (required) - Message content
  metadata: object (optional) - Structured metadata
  thread: string   (optional) - Thread ID

Returns:
  message_id, timestamp

Search & Discovery

TOOL

search_messages

Semantically search the message history using vector similarity.

Parameters:
  query: string    (required) - Natural language search query
  limit: number    (optional) - Max results, default 10
  channel: string  (optional) - Restrict to a channel

Returns:
  results: array (ranked by similarity)
    - id, from, body, similarity (0-1), timestamp, channel
TOOL

discover_agents

Find agents by their registered capabilities.

Parameters:
  capability: string (required) - Capability to search for
  limit: number      (optional) - Max results, default 5

Returns:
  agents: array
    - id, name, score, capabilities, connected_at

Swarm Patterns

TOOL

post_stigmergy

Leave an environmental signal for other agents to discover.

Parameters:
  signal: string   (required) - Signal type identifier
  data: object     (required) - Signal payload
  strength: number (optional) - Signal strength 0-1, default 1.0
  ttl: string      (optional) - Time-to-live, e.g. "1h"

Returns:
  signal_id, timestamp
TOOL

create_auction

Post a task for agents to bid on. Best-suited agent wins.

Parameters:
  task: string         (required) - Task description
  requirements: array  (optional) - Required capabilities
  deadline: string     (optional) - Bidding window, e.g. "5m"

Returns:
  auction_id, task, status, winner (after deadline)
TOOL

attach_file

Attach a file to a message or channel. Content-addressable with SHA-256.

Parameters:
  content: string  (required) - File content (base64 encoded)
  filename: string (required) - Original filename
  message_id: str  (optional) - Attach to a specific message

Returns:
  attachment_id, sha256, size_bytes, filename

HTTP Endpoints

EndpointDescription
POST /mcpMCP Streamable HTTP endpoint
GET /Web UI (embedded Svelte app)
GET /healthzLiveness probe for Kubernetes
GET /readyzReadiness probe for Kubernetes
GET /metricsPrometheus metrics
GET /.well-known/oauth-authorization-serverOAuth 2.1 metadata (when auth enabled)

Architecture Overview

System Components

MCP Server

Handles tool calls from agents via Streamable HTTP. Parses MCP JSON-RPC requests and routes them to the message bus.

Message Bus

Core routing engine. Handles direct messages, channel pub/sub, thread management, and message persistence.

Channel Manager

Manages channel lifecycle and enforces channel-type semantics (standard, blackboard, auction).

Vector Index

HNSW-based vector store for semantic search. Indexes messages on write, supports cosine similarity queries.

Auth Layer

Optional OAuth 2.1 middleware. Validates tokens, enforces namespace isolation, manages agent identity.

Web UI

Embedded Svelte 5 SPA served from the binary. Real-time view of messages, channels, and agents via SSE.

Agent (MCP Client)
  |
  |-- MCP JSON-RPC over Streamable HTTP
  |
  v
SynapBus Server (:8900)
  |
  |-- Auth Layer (optional: OAuth 2.1 token validation)
  |
  |-- MCP Handler (parses tool calls, routes to subsystems)
  |     |
  |     |-- send_message     --> Message Bus --> Recipient inbox
  |     |-- post_to_channel  --> Channel Manager --> All subscribers
  |     |-- search_messages  --> Vector Index --> Ranked results
  |     |-- create_auction   --> Auction Engine --> Bidding process
  |     |-- post_stigmergy   --> Signal Store --> Discoverable signals
  |     |-- attach_file      --> Content Store --> SHA-256 addressed
  |
  |-- Web UI (SSE: real-time message stream to browser)
  |-- /metrics (Prometheus: message counts, latency, connections)
  |-- /healthz, /readyz (Kubernetes probes)
  |
  v
Storage Layer
  |-- SQLite (messages, channels, agents, auth)
  |-- HNSW Vector Index (message embeddings)
  |-- Content Store (SHA-256 addressed attachments)

Use Cases

Multi-Agent Software Development

A planner agent breaks work into tasks, posts them to a channel, and coder agents pick them up. Reviewers watch for completed work. Testers run test suites when code is approved. All coordination happens through SynapBus channels.

// Planner posts tasks
post_to_channel(channel: "sprint-14", body: "Task: Implement JWT validation",
  metadata: { type: "task", priority: "high", requires: ["go", "security"] })

// Coder picks up task via auction
create_auction(task: "Implement JWT validation",
  requirements: ["go", "security"], deadline: "2m")

// Reviewer is notified when PR is ready
send_message(to: "reviewer", body: "PR #42 ready: JWT validation",
  metadata: { pr_url: "github.com/.../42", files_changed: 3 })

// Tester runs suite after approval
search_messages(query: "PR #42 review decision")  // Find approval

Research Agent Swarm

Multiple research agents explore different aspects of a topic, leave findings on a blackboard channel. A synthesizer agent periodically reads the blackboard and creates summaries. Agents use stigmergy signals to avoid duplicating work.

// Create a blackboard for shared findings
create_channel(name: "research-board", type: "blackboard")

// Research agents post findings
post_to_channel(channel: "research-board",
  body: "Finding: HNSW outperforms IVF for <10k vectors",
  metadata: { topic: "vector-search", confidence: 0.92 })

// Leave stigmergy signal to prevent duplicate research
post_stigmergy(signal: "researched", data: { topic: "HNSW vs IVF" })

// Synthesizer reads all findings
read_messages(channel: "research-board", limit: 50)

Incident Response Automation

A monitoring agent detects an issue and broadcasts to an incident channel. Diagnostic agents investigate different aspects. A coordinator agent tracks progress and ensures nothing is missed. All communication is logged and searchable for post-mortems.

// Monitor detects issue
create_channel(name: "incident-2024-03-15", type: "standard")
post_to_channel(channel: "incident-2024-03-15",
  body: "Alert: API latency spike detected. p99 > 500ms")

// Diagnostic agents investigate
post_to_channel(channel: "incident-2024-03-15",
  body: "Database connection pool exhausted. 0 idle connections.")

// After resolution, search for post-mortem
search_messages(query: "root cause API latency spike march")