MCP Agent Hub
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
MCP Agent Hub
A network MCP server for coordinating multiple AI agents through a shared SQLite database. It runs as a Docker daemon, and all agents connect over HTTP.
Quick Start
test -f deploy/hub.local.env || cp deploy/hub.local.env.example deploy/hub.local.env
grep -q '^MCP_HUB_REGISTER_TOKEN=' deploy/hub.local.env || \
printf 'MCP_HUB_REGISTER_TOKEN=%s\n' "$(openssl rand -hex 32)" >> deploy/hub.local.env
chmod 600 deploy/hub.local.env
./hub.sh build # Build Docker image
./hub.sh start # Start daemon on port 3000
./hub.sh status # Check that it is running
./hub.sh smoke # Verify handshake + registration + authenticated tool callRelated MCP server: Durebak
Management
./hub.sh build # Build Docker image
./hub.sh test # Run tests
./hub.sh start # Start server daemon
./hub.sh stop # Stop
./hub.sh restart # Restart
./hub.sh status # Status + health check
./hub.sh smoke # MCP handshake + registration/auth smoke test
./hub.sh logs # Logs (use logs -f to follow)
./hub.sh db # SQLite shell for DB inspection
./hub.sh clean # Remove everythingKPI Round (8-12 workers)
For a comparative baseline vs hash/blob mode run:
set -a; . deploy/hub.local.env; set +a # expose the same registration secret to helpers
./scripts/kpi-round.sh # default: 10 workers
WORKERS=12 ./scripts/kpi-round.sh # upper load boundary
USE_AUTH_TOKEN=true WORKERS=12 ./scripts/kpi-round.sh # for auth_mode=enforceReport is saved to /tmp/exp5/exp5-kpi.json (or $OUT_DIR/exp5-kpi.json).
The report also includes transport fields (transport_wait_*, transport_polling_calls) and their baseline vs optimized deltas.
The script registers orchestrator/workers with onboarding_mode=none to avoid unnecessary onboarding token overhead during benchmarks.
Smart Swarm Round (real Claude/Codex workers)
To run real CLI workers instead of synthetic calls:
set -a; . deploy/hub.local.env; set +a
./scripts/smart-swarm-round.sh
WORKERS=12 WORKER_BACKEND=mixed ./scripts/smart-swarm-round.sh
WORKERS=10 WORKER_BACKEND=claude ./scripts/smart-swarm-round.sh
USE_AUTH_TOKEN=true WORKERS=12 WORKER_BACKEND=mixed ./scripts/smart-swarm-round.shThe worker contract in this round uses register_agent(onboarding_mode=none) without get_onboarding to reduce service token overhead and keep useful traffic in the experiment.
Key variables:
ENDPOINT=http://127.0.0.1:3000/mcp
WORKERS=8
WORKER_BACKEND=mixed # claude | codex | mixed
USE_AUTH_TOKEN=auto # auto | true | false
ENABLE_NAMESPACE=auto # auto | true | false
WORKER_TIMEOUT_SEC=900
OUT_DIR=/tmp/smart-swarm
SNAPSHOT_RESPONSE_MODE=auto # auto | tiny | nano (auto => nano when server supports it)
ALLOW_BACKEND_FALLBACK=1 # 1 = fallback to another backend on worker runtime failure
SKIP_CLI_PREFLIGHT=0 # 1 = skip CLI availability/auth preflight checksThe script:
registers orchestrator;
creates one task per worker;
starts real workers in parallel via
claude/codex;captures snapshot (
list_tasks/read_messages/get_context) innanowhen supported (ortinyfallback);can automatically restart a failed
claudeworker oncodexwhenALLOW_BACKEND_FALLBACK=1(exit!=0or empty output);collects KPI (done-rate, latency, message/context chars, token proxy);
writes report to
$OUT_DIR/smart-swarm-<experiment>.json(includingbackend_health,backend_runtime_health,fallback_used,snapshots.*_bytes, andsnapshots.total_tokens_est).
Wait Mode A/B (tiny vs micro vs nano)
To measure transport payload savings in wait_for_updates:
ENDPOINT=http://127.0.0.1:3300/mcp ROUNDS=12 WAIT_MODES=default,tiny,micro,nano ./scripts/wait-mode-ab.shOutput:
JSON report with
avg_bytesandavg_msfor selected modes (WAIT_MODES, defaulttiny,micro,nano);supports
defaultmode (withoutresponse_mode) to validate server defaults;deltas
default_vs_tiny,default_vs_nano,micro_vs_tiny,nano_vs_tiny,nano_vs_microfor direct transport comparison;scenario listens only to
messagesstream (wait_for_updates.streams=["messages"]);default file:
/tmp/wait-mode-ab-<ts>.json(or$OUT_FILE).
Repo-isolated Workflow (workers without repository access)
If workers must not change project files:
workers send only structured handoff via MCP (
intent,evidence,patch_plan,verification_plan,risk_notes);use
send_blob_message/share_blob_contextwithcompression_mode=lossless_autofor large payloads;only orchestrator/reviewer applies code changes to the repository;
workers do not create local project files (except temporary files in
/tmp).
Prerequisites:
claudeand/orcodexCLI are installed and authenticated;hub is reachable via
ENDPOINT.bridge workers do not need direct MCP configuration; the runner deliberately disables backend MCP servers and mediates all authenticated hub calls.
Ready-to-use template for an empty isolated directory:
templates/CLAUDE.isolated-swarm.md
Quick usage:
mkdir -p /tmp/isolated-swarm-worker && cd /tmp/isolated-swarm-worker
cp /path/to/mcp-local/templates/CLAUDE.isolated-swarm.md ./CLAUDE.md
claudeObserver Mode (live metrics)
For continuous read-only monitoring of a live hub:
./scripts/observe-hub.sh
INTERVAL_SEC=10 SAMPLES=12 TAG=peak-window ./scripts/observe-hub.shThe script reads metrics from the mcp-hub container SQLite DB and stores:
raw JSONL:
/tmp/hub-observer/<tag>.jsonlsummary JSON:
/tmp/hub-observer/<tag>.summary.json
Main summary fields: online agents, task backlog, active claims, activity/message intensity, top actions over 5 minutes, namespace distribution, and trend over the observation window.
Summary Report for N Hours
For a retrospective pool report (read-only from SQLite, JSON + Markdown):
./scripts/pool-report.sh --hours 12
./scripts/pool-report.sh --hours 24 --out-dir /tmp/hub-reports --tag day-1
./scripts/pool-report.sh --hours 6 --db "$HOME/.mcp-hub/hub.db"Output:
JSON:
/tmp/hub-reports/<tag>.jsonMD:
/tmp/hub-reports/<tag>.md
The report includes: task/claim throughput, auth coverage (valid/missing/invalid), top actions/agents, failure reasons, hourly trends, and namespace throughput for the selected window.
Override port or DB path:
MCP_HUB_PORT=8080 MCP_HUB_DATA=/path/to/dir ./hub.sh startKey protocol modes:
MCP_HUB_AUTH_MODE=observe|warn|enforce
MCP_HUB_REGISTER_TOKEN=<bootstrap-secret>
MCP_HUB_ALLOW_LEGACY_AGENT_CLAIM=false
MCP_HUB_REGISTER_RATE_LIMIT_RPS=5
MCP_HUB_REGISTER_RATE_LIMIT_BURST=20
MCP_HUB_NAMESPACE_GOVERNANCE=off|warn|require
MCP_HUB_EXTRA_BIND_HOSTS=100.107.1.68[,192.168.1.50]
MCP_HUB_SESSION_IDLE_TIMEOUT_MS=21600000 # <=0 disables idle session eviction (sessions live until DELETE /mcp or server restart)
MCP_HUB_SESSION_PROVISIONAL_TTL_MS=60000 # absolute deadline to present valid agent auth after initialize
MCP_HUB_SESSION_GC_INTERVAL_MS=60000
MCP_HUB_MAX_SESSIONS=500
MCP_HUB_MAX_SESSIONS_PER_SOURCE=100
MCP_HUB_SESSION_INITIALIZE_RPS=10
MCP_HUB_SESSION_INITIALIZE_BURST=20
MCP_HUB_UNKNOWN_SESSION_POLICY=error
MCP_HUB_AGENT_OFFLINE_AFTER_MS=1800000
MCP_HUB_AGENT_RETENTION_MS=604800000
MCP_HUB_AUTO_PACK_MIN_PAYLOAD_CHARS=2048
MCP_HUB_AUTO_PACK_MIN_GAIN_PCT=3
MCP_HUB_LOSSLESS_AUTO_MIN_PAYLOAD_CHARS=1024
MCP_HUB_LOSSLESS_AUTO_MIN_GAIN_PCT=3
MCP_HUB_WAIT_MAX_MS=25000
MCP_HUB_WAIT_DEFAULT_MS=10000
MCP_HUB_WAIT_RETRY_FACTOR=1.5
MCP_HUB_WAIT_RETRY_CAP_MS=10000
MCP_HUB_WAIT_RETRY_JITTER_PCT=0.2
MCP_HUB_MAX_CONSENSUS_VOTES=1000
MCP_HUB_CONSENSUS_QUALITY_WEIGHTING=on|off
MCP_HUB_DONE_EVIDENCE_MIN_REFS=1
MCP_HUB_MAX_EVIDENCE_REFS_PER_CALL=16
MCP_HUB_MAX_EVIDENCE_REF_CHARS=256
MCP_HUB_ARTIFACT_MAX_BYTES=52428800
MCP_HUB_ARTIFACT_TICKET_TTL_SEC=300
MCP_HUB_ARTIFACT_UPLOAD_TICKET_MAX_ACTIVE=10000
MCP_HUB_ARTIFACT_UPLOAD_TICKET_MAX_PER_AGENT=100
MCP_HUB_ARTIFACT_UPLOAD_RESERVATION_TTL_MS=300000
MCP_HUB_ARTIFACT_DOWNLOAD_TICKET_MAX_ACTIVE=20000
MCP_HUB_ARTIFACT_DOWNLOAD_TICKET_MAX_PER_AGENT=200
MCP_HUB_ARTIFACT_UPLOAD_TTL_SEC=300
MCP_HUB_ARTIFACT_DOWNLOAD_TTL_SEC=180
MCP_HUB_ARTIFACT_RETENTION_SEC=86400
MCP_HUB_WAIT_DEFAULT_RESPONSE_MODE=compact|tiny|micro|nano|full
MCP_HUB_WAIT_DEFAULT_TIMEOUT_RESPONSE=default|minimal
MCP_HUB_WAIT_LOG_HITS=true|false
MCP_HUB_WAIT_LOG_TIMEOUTS=true|false
MCP_HUB_DEFAULT_ONBOARDING_MODE=full|compact|none
MCP_HUB_EPHEMERAL_DEFAULT_ONBOARDING_MODE=compact|full|none
MCP_HUB_REREGISTER_ONBOARDING_MODE=none|compact|full
MCP_HUB_PUBLIC_BASE_URL=http://localhost:3000The persistent production profile is stored in the repository:
deploy/hub.production.env(with comments and optimized defaults)deploy/hub.local.env(optional local overlay, gitignored)
Port 127.0.0.1 is always published. To add external interfaces, define MCP_HUB_EXTRA_BIND_HOSTS in deploy/hub.local.env.
hub.sh refuses to start the production auth_mode=enforce profile until
MCP_HUB_REGISTER_TOKEN is set in that protected overlay.
Example local overlay:
cp deploy/hub.local.env.example deploy/hub.local.env
# then edit deploy/hub.local.env and set:
# MCP_HUB_EXTRA_BIND_HOSTS=100.107.1.68
# MCP_HUB_PUBLIC_BASE_URL=http://100.107.1.68:3000./hub.sh picks it up automatically (if the file exists). Priority:
environment variables passed in command (
MCP_HUB_* ./hub.sh start)MCP_HUB_LOCAL_ENV_FILE=/path/to/local.env(or defaultdeploy/hub.local.env)MCP_HUB_ENV_FILE=/path/to/file.envdeploy/hub.production.env(auto-default)
Apply profile changes:
./hub.sh restart
./hub.sh statusCanary flow without stopping the working container:
MCP_HUB_CONTAINER=mcp-hub-canary \
MCP_HUB_PORT=3300 \
MCP_HUB_DATA="$HOME/.mcp-hub-canary" \
MCP_HUB_AUTH_MODE=warn \
MCP_HUB_NAMESPACE_GOVERNANCE=require \
./hub.sh startClaude Code Connection
Global config (works from any directory) in ~/.claude/.mcp.json:
{
"mcpServers": {
"agent-hub": {
"url": "http://localhost:3000/mcp"
}
}
}For one project, place the same format in .mcp.json at project root.
This repository provides a starter template in .mcp.example.json.
Claude Desktop Connection
File: ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"agent-hub": {
"url": "http://localhost:3000/mcp"
}
}
}Codex Connection
Add the running Streamable HTTP server to Codex:
codex mcp add agent-hub --url http://127.0.0.1:3000/mcp
codex mcp get agent-hub --jsonNetwork Connection (other machines)
If an extra bind is configured (for example MCP_HUB_EXTRA_BIND_HOSTS=100.107.1.68), remote clients can use that IP/hostname instead of localhost:
{
"mcpServers": {
"agent-hub": {
"url": "http://192.168.1.100:3000/mcp"
}
}
}Set MCP_HUB_PUBLIC_BASE_URL to the externally reachable origin as well; artifact upload/download
URLs otherwise default to localhost and will not work from remote clients. Bearer and registration
tokens require an encrypted trusted network (for example a VPN) or a TLS reverse proxy; do not
publish the plain HTTP endpoint on an untrusted network. Browser clients also need their exact
origin in MCP_HUB_ALLOWED_ORIGINS.
Architecture
One Docker daemon server, all agents connect via HTTP (Streamable HTTP transport).
┌─────────────┐ ┌────────────────────────┐
│ Claude Code ├─── HTTP ────►│ │
└─────────────┘ │ │
│ MCP Agent Hub │
┌─────────────┐ │ :3000 │ ┌──────────┐
│ Claude Desk ├─── HTTP ────►│ ├─►│ SQLite │
└─────────────┘ │ Docker container │ │ hub.db │
│ │ └──────────┘
┌─────────────┐ │ │
│ Codex/Other ├─── HTTP ────►│ │
└─────────────┘ └────────────────────────┘Available Tools (65)
Tool | Description |
| Register an agent (call first; use |
| Update registered agent |
| List all agents and statuses ( |
| Rank agents for a capability/model/runtime request |
| Get onboarding with protocol capabilities and rules |
| Send a message to one agent or broadcast, supports |
| Send message as hash-reference to deduplicated blob (single call, default |
| Read inbox messages ( |
| Start a topic thread backed by trace-scoped messages |
| Reply to an existing discussion thread |
| Read a visible discussion thread with cursor pagination |
| Search messages, tasks, context, activity, artifacts, and consensus |
| Hydrate selected search/event references without broad list reads |
| Save a reusable signal-feed filter |
| List filters owned by the current agent |
| Read and optionally advance a saved filter cursor |
| Delete an owned saved filter |
| Read a low-token actionable inbox across hub sources |
| Acknowledge handled signal-feed items |
| Read a bounded multi-source coordination digest |
| Store durable, namespace-scoped shared memory |
| Search shared memory by text/tags/importance |
| Read compact high-value memory at startup |
| Read a cross-source trace timeline |
| Create task on shared board ( |
| Update task (status, assignment, |
| View task board ( |
| Rank compatible agents for a specific task |
| Atomically claim next available task by priority ( |
| Claim a specific task in lease mode (anti-duplicate; |
| Renew task lease |
| Release lease and set final status ( |
| List active leased tasks and expiration times |
| Attach artifact to task and auto-share to current assignee (for repo-isolated handoff) |
| List artifacts attached to a task ( |
| Get consolidated task handoff packet (deps + evidence refs + artifact hints), optionally with download tickets ( |
| Archive/delete an unclaimed task safely |
| Share context (key-value), supports |
| Share context as hash-reference to deduplicated blob (single call, default |
| Get context from other agents ( |
| Resolve multi-agent disagreement: inline votes or |
| Resolve consensus directly from |
| Resolve consensus directly from |
| View persisted consensus decisions ( |
| Pack payload into CAEP-v1 packet with adaptive lossless policy ( |
| Unpack CAEP-v1 packet and validate hash |
| Compute deterministic payload hash for references/dedup |
| Store a deduplicated blob; private by default, with explicit public/agent grants |
| Fetch a blob visible to the authenticated agent |
| List only visible blobs and access counters |
| Create upload ticket + URL for binary side-channel transfer (without MCP payload tokens) |
| Create download ticket + URL for shared artifact download |
| Create batch download tickets for task-bound artifacts (single call, supports |
| Grant artifact access to specific agent, optionally bind to task ( |
| List artifacts visible to agent ( |
| Agent activity log ( |
| Built-in KPI aggregates over 1m/5m/30m ( |
| Lightweight wait/poll transport efficiency snapshot for a window ( |
| Long-poll for updates ( |
| Batch read for polling loops: one call returns |
| Read replayable stream-event deltas from a cursor |
| Recalculate SLO alerts (pending age / claim churn / stale in_progress) |
| List open/closed SLO alerts |
| Auth-token usage coverage by time window and tools |
| Run retention, claim cleanup, archival, and SLO housekeeping |
Artifact upload/download ticket tools require a client/runtime that actually has MCP tool access and
has negotiated artifact_tickets: true. Bridge-launched CLIs are mediated by the bridge runner and
must not call create_artifact_upload, create_artifact_download, or share_artifact directly
when the bridge advertises artifact_tickets: false; they should return structured handoffs and
/tmp paths for a hub-connected bridge/operator instead.
nano mode for read tools (lossless, short keys only):
read_messages:{ m, h, n }+m[]items with keysi/f/t/u/r/c/d(+x/yfor trace/span,b/zfor blob-ref)list_tasks:{ t, h, n }+t[]items with keysi/s/a/p/n/e/cm/u/tc/t/dc(+x/yfor trace/span)get_context:{ c }+c[]items with keysi/a/k/u/c/d(+x/yfor trace/span,b/rfor blob-ref)read_snapshot:{ s, h, ch, n, u }, wheres={m,t,c}is batch data anduis the unified cursor
For polling loops, pass polling:true to read_messages/list_tasks/get_context; when polling:true, the server forbids response_mode:"full" and returns FULL_MODE_FORBIDDEN_IN_POLLING.
Best practice for repo-isolated workers: workers send only structured proposals/votes via blob/hash-reference, reviewer calls resolve_consensus, and repository changes are applied by orchestrator/reviewer.
Running Agents from Different Directories
With global config (~/.claude/.mcp.json), each agent can work in a separate project:
# Terminal 1 - frontend agent
cd ~/projects/frontend
claude -p "$(cat ~/mcp-local/AGENT_PROMPT.md)
You are claude-frontend. Your responsibility area: React UI.
Register and check the task board."
# Terminal 2 - backend agent
cd ~/projects/backend
claude -p "$(cat ~/mcp-local/AGENT_PROMPT.md)
You are claude-backend. Your responsibility area: API and database.
Register and check the task board."Role Launcher /hub
Unified role launcher for codex and claude with runtime-profile auto-detection (repo/isolated):
./hub --role orchestrator --backend codex --endpoint http://localhost:3000/mcp
./hub --role reviewer --backend claude --endpoint http://localhost:3000/mcp
./hub --role assistant --backend codex --namespace EXP-123
./hub --role orchestrator --backend codex --runtime-mode repo
./hub --role assistant --backend claude --runtime-mode isolated
./hub --role assistant --backend codex --lifecycle ephemeralWhat launcher does:
detects
runtime_profile(mode,cwd,has_git,file_count,empty_dir);supports forced mode via
--runtime-mode repo|isolated|unknown(or shortcuts--repo-runtime/--isolated-runtime);registers
orchestrator/reviewer/assistantroles aslifecycle: "persistent"by default (set--lifecycle ephemeralfor short-lived workers);injects profile into
register_agentcontract;loads system onboarding + role prompt;
starts the selected CLI behind the bridge runner. The backend CLI receives read-only preflight context and returns a structured result; the bridge handles hub registration, evidence publication, and any artifact side-channel work only when its negotiated capabilities include
artifact_tickets: true.sends composed prompts to model backends over stdin instead of process arguments and strips hub credentials from their environment;
keeps private-thread results inside that thread: no shared memory/context/broadcast publication, and any full result blob is private with access granted only to the other participant.
Role skill cheatsheets:
skills/codex-hub.mdskills/claude-hub.md
Endpoints
Endpoint | Method | Description |
| POST | MCP Streamable HTTP (primary) |
| GET | SSE stream for notifications |
| DELETE | Close session |
| GET | SSE-only push channel for high-load polling replacement ( |
| POST | Side-channel upload binary artifact (ticket/token required) |
| GET | Side-channel download binary artifact (ticket/token required) |
| GET | Health check ( |
Handshake Diagnostics
If you see an error in Codex/Claude like:
error decoding response body, when send initialize request
check server status:
./hub.sh status
./hub.sh smokeIf smoke fails, in most cases an outdated container is running. Fix:
./hub.sh build
./hub.sh restart
./hub.sh smokeClient Auto-Recovery for -32000
After container restart, previous mcp-session-id values become invalid.
Server returns JSON-RPC error code: -32000 with error.data.reinitialize_required=true.
Recommended client algorithm:
Catch
error.code == -32000.Re-run handshake:
initialize->notifications/initialized.Retry the original request exactly once.
For tools that advertise
idempotency_key, preserve the exact same key and arguments.
An explicit -32000 unknown-session response means the rejected call was not executed by that
session. A timeout, disconnect, or lost HTTP response is different: execution may already have
committed. In that case, automatically retry a mutation only when its tool schema advertises
idempotency_key. Side-effecting reads also need argument-aware handling: retry
read_messages only with mark_read=false, read_filter_feed only without
advance_cursor=true, fetch_hub_refs only without mark_messages_read=true, and
get_task_handoff only without include_downloads=true.
Idempotency keys are limited to 256 characters. A key may only be reused with the same semantic
arguments (authentication and registration secrets are excluded from the payload fingerprint).
Reusing a key with different arguments fails with IDEMPOTENCY_KEY_CONFLICT; pre-fingerprint
legacy records fail closed and require a new key.
Artifact upload/download ticket responses are encrypted at rest with a process-ephemeral key.
They replay within the same server process, but after restart return
IDEMPOTENCY_VOLATILE_RESPONSE_EXPIRED; request a new ticket with a new idempotency key.
Discussion thread roots are server-owned records. Databases upgraded from releases that stored only message metadata do not auto-import those legacy roots, because forged metadata is indistinguishable from a legitimate old root. Recreate or export important legacy threads before upgrading.
Server also adds:
error.data.reason(unknown_or_expired_session/server_not_initialized)error.data.recovery_sequenceHTTP header
x-mcp-reinit-required: 1
For long-lived pools, keep a long but finite idle timeout and bound session admission:
MCP_HUB_SESSION_IDLE_TIMEOUT_MS=21600000
MCP_HUB_SESSION_PROVISIONAL_TTL_MS=60000
MCP_HUB_MAX_SESSIONS=500
MCP_HUB_MAX_SESSIONS_PER_SOURCE=100New sessions are provisional until a non-registration tools/call supplies a valid agent subject
and auth_token in enforce mode. In observe/warn, a known caller subject is enough to preserve
legacy rollout behavior. The provisional deadline is measured from initialize and is not extended
by notifications, tools/list, unknown tools, or anonymous traffic. After promotion, the normal
idle timeout applies. /health reports provisional/authenticated counts and both TTLs.
Why not Redis for "live" MCP sessions:
In the SDK, transport session keeps in-memory connection state and is not serializable.
Redis is useful for metrics/queues/event-store, but transport itself does not resume from Redis after process restart.
Practical reliability path: finite idle timeout + bounded admission + client auto-reinit on unknown session.
Onboarding at Agent Startup
Minimal bootstrap contract:
register_agentSave
auth.tokenfrom responseCall all subsequent tools with
auth_tokenCall
get_onboarding { mode: "compact" }once
Set MCP_HUB_REGISTER_TOKEN whenever auth enforcement is enabled. hub.sh refuses to start its
production enforce profile without it. A server started directly without the secret has open
registration: a client can create a new agent identity and receive its token even when
MCP_HUB_AUTH_MODE=enforce. Keep the secret in the gitignored
deploy/hub.local.env (or another protected env file), then pass the same value as
register_token only during registration. Existing IDs additionally require their current
auth_token; registration never recovers a lost agent token. Tokens are stored in SQLite only as
SHA-256 digests. A client may provide a strong initial auth_token (32..512 characters) and persist
it before registration; the bridge runner uses this to recover when the first response is lost.
When upgrading a database created by a plaintext-token release, logical rows are migrated to
digests, but the hub does not run an expensive VACUUM during startup. Old token bytes can remain
in WAL, free pages, or backups until an operator compacts the database. During a maintenance window,
stop the hub, back up the database, then run this with a local sqlite3 as the hub's OS user:
./hub.sh stop
DB="${MCP_HUB_DATA:-$HOME/.mcp-hub}/hub.db"
sqlite3 "$DB" 'PRAGMA wal_checkpoint(TRUNCATE); PRAGMA secure_delete=ON; VACUUM; PRAGMA wal_checkpoint(TRUNCATE);'
chmod 600 "$DB"
./hub.sh startTreat pre-compaction backups as containing plaintext credentials and rotate or securely retire them.
Legacy database rows that predate agent tokens are not claimable by default. For a supervised
migration window, configure MCP_HUB_REGISTER_TOKEN, temporarily set
MCP_HUB_ALLOW_LEGACY_AGENT_CLAIM=true, migrate the intended agents, then disable the flag. Never
enable this mode with open enrollment.
Agent tokens authenticate the caller identity; they are not a full project/task RBAC system. Run separate hub instances for mutually untrusted teams until namespace/task authorization policies are configured at the deployment boundary.
Token optimization for mass re-registrations:
on an authenticated repeated
register_agent(sameidplus currentauth_token) server defaults toonboarding_mode=none;first
register_agentremains detailed (fullfor persistent,compactfor ephemeral);behavior is configurable via
MCP_HUB_DEFAULT_ONBOARDING_MODE,MCP_HUB_EPHEMERAL_DEFAULT_ONBOARDING_MODE,MCP_HUB_REREGISTER_ONBOARDING_MODE.
For swarm workers use register_agent { ..., lifecycle: "ephemeral" }:
faster offline marking,
faster stale-agent cleanup,
automatic task requeue from missing ephemeral workers during maintenance.
Example Scenario
Claude agent registers:
register_agent { id: "claude-1", name: "Claude", type: "claude", runtime_profile: { mode: "repo", has_git: true, file_count: 120 } }Codex agent registers:
register_agent { id: "codex-1", name: "Codex", type: "codex", runtime_profile: { mode: "isolated", has_git: false, file_count: 0, empty_dir: true } }Claude creates task:
create_task { title: "Refactor auth", created_by: "claude-1", execution_mode: "repo" }Codex claims atomically:
poll_and_claim { agent_id: "codex-1", lease_seconds: 300 }During execution Codex renews lease:
renew_task_claim { task_id: 42, agent_id: "codex-1", lease_seconds: 300, claim_id: "<from claim response>" }Codex shares progress:
share_context { agent_id: "codex-1", key: "status", value: "refactoring auth.ts" }On completion Codex records result:
release_task_claim { task_id: 42, agent_id: "codex-1", next_status: "done", claim_id: "<from claim response>", confidence: 0.95, verification_passed: true, evidence_refs: ["context_id:123", "message_id:456"] }
For a strict task, an independent reviewer must first attach evidence with update_task; the claimant then includes that reviewer's ID as verified_by in release_task_claim. The server rejects self-verification, unknown reviewers, and reviewer IDs that have not authored evidence for the task.
Recommendations for Swarm Polling
If
poll_and_claimreturnstask: null, waitretry_after_msbefore the next poll.Under burst load, this reduces empty polls and collisions between agents.
In routing loop, replace three calls (
list_tasks+read_messages+get_context) with oneread_snapshotusing a singlecursor.For high-load modes, enable
/eventspush channel (SSE) and process onlyupdateevents instead of cyclic long-poll.For safe renew/release, pass
claim_idfrom the claim response.retry_after_msis adaptive to the number of active agents (profiles for ~5/10/20+ agents) and includes jitter.For large handoff payloads, use
send_blob_message/share_blob_context; when reading, enableresolve_blob_refs.In production swarm rounds, set
namespaceon task-flow and enable namespace quotas (MCP_HUB_NAMESPACE_QUOTA_MODE=warn|enforce).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Durable agent-to-agent handoffs and shared scratchpad for multi-agent workflows.
Coordination hub for AI coding agents: message teammates, ask humans, audit every event.
Durable background job execution, async task scheduling, and state persistence for AI agents.
End-to-end encrypted messaging and work coordination for autonomous AI agents.
Related MCP Servers
- FlicenseNot gradedqualityNot gradedmaintenanceA production-grade coordination hub that enables AI agents and human teams to work as a single organism by sharing tasks, context, decisions, and persistent memory across projects. It features two-tier agentic memory with per-agent hot caches, inter-agent messaging, and multi-agent authorship tracking for seamless collaboration.2-
- AlicenseNot gradedqualityBmaintenanceEnables coding-agent sessions on the same machine to collaborate locally and durably by exchanging requests, replies, and task results through an authenticated loopback server with SQLite-backed storage, joined via CLI or an MCP stdio bridge. It also handles message delivery by priority and wait time, deduplicates idempotent sends, enforces task versioning, and preserves artifacts by content hash.12 npmApache 2.0
- AlicenseBqualityBmaintenanceLets multiple AI agents and parallel coding sessions share one memory and task ledger, so they can claim work instead of duplicating it, resume each other's handoffs and reasoning, and use credentials without ever seeing the keys. Connects assistants such as Claude Code, Codex, Cursor, Gemini, ChatGPT and custom agents over MCP, backed by a single local SQLite file or a self-hosted Postgres hub.412MIT
- AlicenseAqualityCmaintenanceEnables heterogeneous AI agent CLIs to coordinate via a shared SQLite-backed state bus with inter-agent messaging, shared knowledge, swarm/activity discovery, and file-level mutex locks, all without an external daemon.10MIT