Belay.MCP (Belay v1.0.0)

Copy Markdown View Source

A Model Context Protocol server over stdio, so AI assistants (Claude Code, Cursor, or your own agents) can inspect and operate a Belay installation:

# .mcp.json / MCP client config
{"command": "mix", "args": ["belay.mcp", "--url", "postgres://.../my_app"]}

Read tools: stats, list_jobs, get_job (with steps, events, children), workflow_status. Write tools (clearly named as mutations): retry_job, cancel_job, signal, steer_job. Mutations are disabled by default; configure an :authorizer or explicitly set allow_mutations: true.

The server talks JSON-RPC 2.0 over newline-delimited stdio and needs only database access — no running Belay instance required.

Summary

Functions

Blocking stdio serve loop. storage is a {module, ref} pair.

Functions

serve(storage, opts \\ [])

@spec serve({module(), term()}, keyword()) :: :ok

Blocking stdio serve loop. storage is a {module, ref} pair.

Options:

  • :authorizer — a module exporting authorize(tool_name, args) (or a 2-arity fun) returning :ok or {:error, message}, consulted before every mutating tool call (retry_job, cancel_job, signal, steer_job). Introspection tools are never gated. This is the hook for capability systems such as Legant: verify the caller's grant offline and deny anything the token doesn't attenuate to.
  • :allow_mutations — explicitly enable every mutation without an authorizer (default false); intended only for a trusted local client.