stream://model-context-stream

v0.6.3 · MIT · self-hosted · “a living, breathing MCP server”

An event-driven MCP server for AI agent fleets

model-context-stream keeps fleets of AI agents mutually context-aware: durable, replayable context streams, a task queue with exactly-once claims, and versioned protocols — served over MCP Streamable HTTP, backed by Redis Streams. When any agent publishes, every subscribed agent knows.

# no clone needed — prebuilt images on GHCR
curl -sO \
  https://raw.githubusercontent.com/thejavapirate/model-context-stream/main/docker-compose.yml
MCS_TOKENS="tok_ops:ops:admin" docker compose up -d --no-build
# connect any MCP client to http://localhost:3000/mcp
stream://team 4 agents following

    Four primitives, one shared log

    Everything an agent fleet needs to stay coordinated is an event on a stream — including the coordination itself. Each card is headed by the real event type it emits.

    event.published → resources/updated

    Context streams

    Append-only event logs over Redis Streams. Subscribers get MCP resources/updated pushes (debounced 200 ms); a fresh agent replays history and is caught up — the entry id is the cursor. Durable per-agent cursors survive reconnects.

    task.claimed — exactly one winner

    Task queue

    Atomic claims via Redis Lua with crash-safe leases (~5 min, heartbeat to keep). Proven by a 25-way concurrent claim race in the test suite: one winner, every time. A crashed agent's task returns to the queue automatically.

    protocol.updated → v4

    Versioned protocols

    Living playbooks. Update a protocol once; every subscribed agent is notified and follows the new version. Pin protocol://name/v3 when you need immutability.

    agent.connected · agents://online

    Presence & senses

    A live fleet roster with claimed tasks. HTTP ingest brings CI events in; HMAC-signed webhooks push events out; federated upstreams give every agent their tools. Idle agents register wakes — a stream event starts them back up.

    How it compares

    Multi-agent coordination has a few common answers. This is where each one stands as of July 2026.

    model-context-stream Claude Code Agent Teams DIY Redis pub/sub MCP tasks extension
    Durable, replayable history Yes — streams + cursors No — local files, cleared at session end No — pub/sub is fire-and-forget No — call-scoped handles
    Exactly-once task claims Yes — atomic Lua + leases File locks, single machine Build it yourself Not specified
    Cross-machine fleet Yes No — one machine Yes Single client–server call
    Works with any MCP client Yes — any harness, any vendor Claude Code only No — custom client code Yes
    External ingest (CI, webhooks) Yes — HTTP in, signed webhooks out No Build it yourself No

    Agent Teams facts per its official docs (experimental, v2.1.x, July 2026); the MCP tasks extension is io.modelcontextprotocol/tasks from the 2026-07-28 spec. Corrections welcome — open an issue.

    Questions agents and humans ask

    The short answers, in plain text on purpose.

    What is model-context-stream?

    An MIT-licensed, self-hostable MCP server that coordinates fleets of AI agents through shared, durable context streams — plus a task queue with exactly-once claims and versioned protocols. It runs on Node.js and Redis; agents connect over MCP Streamable HTTP.

    How do agents share context?

    Any agent (or CI system) publishes an event to a named stream. Every subscribed agent receives an MCP resources/updated notification and re-reads the stream. Agents that were offline replay from their durable cursor — nothing is missed.

    How do agents avoid doing the same work twice?

    Tasks are claimed through an atomic Redis Lua script — exactly one claimant, verified by a 25-way race test. Claims carry leases: if an agent crashes, its task returns to the queue within about five minutes.

    Does the server call an LLM?

    No. There is no LLM key in the server. Even stream compaction is agent-driven: the server posts a digest task on its own queue and a connected agent summarizes, then the server verifies and trims.

    Do publishers need to speak MCP?

    No. POST /ingest/:stream accepts events from CI, monitoring, or any webhook, and GET /streams/:stream reads with durable cursors — plain HTTP with a bearer token, no MCP session.

    Can it wake agents that aren't running?

    Yes. Any agent registers a wake for itself (register_wake — capped, owner-scoped, audited); when a matching event lands, the server POSTs a signed wake envelope, debounced so a burst of 50 events is one wake. The reference wake-runner starts a headless session that catches up from its durable cursor and acts. Idle-but-open Claude Code sessions self-resume too: fleet-kit's standby hook re-wakes them the moment a teammate publishes.

    What does it take to run?

    Node.js ≥ 20 and Redis, or neither: prebuilt multi-arch images ship on GHCR with a two-command docker compose quickstart, and a production Helm chart installs from an OCI registry with Prometheus metrics built in.

    Built to operate

    Image ghcr.io/thejavapirate/model-context-stream Chart oci://ghcr.io/thejavapirate/charts Metrics Prometheus at /metrics Replicas Redis-backed coordination state License MIT