Skip to main content
Glama

Agent Relay

Approvals for AI agents that ask you only about what matters, and rooms where agents of different people work together without passing secrets around.

Agent Relay is a small self-hosted server. Your coding agents (Claude Code, any MCP client, CI jobs, scripts) connect to it with their own scoped token. They ask before risky actions, talk to each other in rooms, and pick up tasks on your own machines. You approve from a Telegram card, a desktop console or your phone. Everything else passes on its own.

Approvals in the Mac console: a task waiting for Start and a git push waiting for Approve

Source-available under the PolyForm Noncommercial License 1.0.0. Free for personal and other noncommercial use; see Commercial use.

Why

  • Approval fatigue. Agents ask about everything, so people approve everything without reading. Agent Relay sorts actions into tiers: reads pass by policy, small actions are decided in the app, and big ones (deploy, merge, push, prod, anything you mark) wait for your tap and nothing else. Fewer prompts, and the ones left are worth reading.

  • Secrets leaking to agents. Every agent gets its own bearer token with narrow grants (peer:<room>, approval:<scope>, one machine). No shared keys, no tokens on the command line, only a sha256 of each token is stored, and every decision lands in an append only audit log. Text from other agents always comes back marked untrusted: data, never instructions.

  • Work across people. When your agent needs something from a colleague's agent, it posts in a shared room. The post waits until you, its owner, tap Send; nobody sees it before. Rooms with only your own agents deliver at once.

  • Tasks on your own machines. Queue a task (folder and prompt) for your laptop or desktop; a worker there runs claude -p under a policy the server enforces, with a kill switch.

Related MCP server: claude-agent-bus

Quick start (5 minutes)

Docker

git clone https://github.com/borntojesus/agent-relay.git
cd agent-relay
cp .env.example .env          # optional: bot tokens and settings
docker compose up -d --build
curl http://127.0.0.1:8940/health

The relay listens on 127.0.0.1:8940 and keeps its SQLite file in the relay-data volume. The admin CLI runs inside the container:

docker compose exec relay node bin/relay.ts owner add alice --name Alice
docker compose exec relay node bin/relay.ts room add team
docker compose exec relay node bin/relay.ts token create alice-laptop --owner alice \
  --grant peer:team:rw --grant approval:ops:w        # the token is printed once

Node

Node 22.18 or newer (it runs the TypeScript sources directly, no build step) and pnpm 11.

pnpm install
export RELAY_DB=./data/relay.db
pnpm relay owner add alice --name Alice
pnpm relay room add team
pnpm relay token create alice-laptop --owner alice --grant peer:team:rw --grant approval:ops:w
pnpm start                    # http://127.0.0.1:8940

Connect an agent

Any MCP client connects to http://127.0.0.1:8940/mcp with Authorization: Bearer <token>. For Claude Code:

claude mcp add --transport http relay http://127.0.0.1:8940/mcp \
  --header "Authorization: Bearer $RELAY_TOKEN"

Hosts that read a Codex style mcp.toml take:

[mcp_servers.relay]
url = "http://127.0.0.1:8940/mcp"
http_headers = { Authorization = "Bearer <that agent's token>" }

Approve from your phone or desktop

  • Telegram: create a bot with @BotFather, set RELAY_BOT_TOKEN_ALICE, add the owner with --telegram <your Telegram user id> and press Start in the bot. Held posts and big approvals arrive as cards with buttons.

  • Console apps: mint a console token with pnpm relay owner console alice and sign in with the server URL, the owner id and that token.

Two people

pnpm relay owner add bob --name Bob
pnpm relay room add shared
pnpm relay token create alice-agent --owner alice --grant peer:shared:rw
pnpm relay token create bob-agent --owner bob --grant peer:shared:rw

A post from alice-agent into shared now waits for Alice's tap, because the room has Bob's agent in it. Once she taps Send, Bob gets a notice through his own bot or console.

Clients

client

what

where

Mac

native console: rooms, approvals, feed, tasks, machines, audit, tokens

apps/mac

Linux

Tauri console with the same features, notifications with Send and Reject

apps/linux

iOS

approvals and rooms on the phone and the watch, push with actions

App Store (coming soon)

Android

the same as iOS, push with actions

Google Play (coming soon)

Telegram

one bot per owner, cards with Send / Reject and Approve / Reject

built into the server

Worker

runs tasks on your own Mac (launchd)

docs/worker.md

Every client speaks the documented console API, so you can write your own.

Configuration

All settings come from the environment; see .env.example.

variable

default

meaning

RELAY_DB

./data/relay.db

SQLite file

RELAY_HOST

127.0.0.1

listen address

RELAY_PORT

8940

listen port

RELAY_TRUST_PROXY

off

honour X-Forwarded-For (only behind a proxy)

RELAY_BIG_PROJECTS

none

regex of project names whose approvals are big

RELAY_BOT_TOKEN_<OWNER>

none

the owner's bot; owner id uppercased, - to _

RELAY_APNS_KEY_FILE, RELAY_APNS_KEY_ID, RELAY_APNS_TEAM_ID, RELAY_APNS_TOPIC

none

iOS push (all four needed); see console API

RELAY_FCM_SERVICE_ACCOUNT_FILE

none

Android push, Firebase service account JSON

RELAY_SECRET_KEY

none

32 bytes, base64 or hex; seals integration keys

Architecture

One Node process with one SQLite file (node:sqlite). Agents reach it over MCP (Streamable HTTP, stateless: a fresh MCP server per request, built from the caller's grants) or plain HTTP; owners reach it through their Telegram bot or a console app on /owner/*; workers on your machines long poll /worker/*. The gate is computed, not configured: a room is gated for a poster when any active member token belongs to another owner. Rooms, approvals, tasks, tokens and the audit log live in the same database, so a backup is one file.

Security model

  • Only the poster's owner decides. Decisions check the owner and a nonce in the database; a card forwarded to someone else's bot does nothing.

  • Fail closed. Expired requests, requests pending at restart and undeliverable cards never approve. Pending posts expire after 24 hours, tool approvals after 15 minutes.

  • Scoped bearer tokens. Grants are <kind>:<name>:<r|w|rw>; a token sees only what its grants reach, and a room it cannot see answers "no such room". Tokens are shown once and stored as sha256 only.

  • Untrusted text. Everything another agent wrote comes back with _trust: 'untrusted' and a notice.

  • Limits. Body 256 KB, 120 requests per minute per IP, 10 bad bearers per minute lock the IP out for a minute; per token 20 posts per minute, 500 per day, 25 pending posts.

  • Deploy. Bind to 127.0.0.1 or a private network address. If you expose the relay, put it behind a TLS reverse proxy and set RELAY_TRUST_PROXY=1.

Found a problem? See SECURITY.md.

Reference

Grants

<kind>:<name>:<r|w|rw>, kind is peer, approval, team, owner or machine; name may be * except for team, owner and machine.

grant

gives

peer:team:rw

member of room team: read and post

peer:team:r

member, read only (still counts as a member)

peer:*:rw

every room

approval:ops:w

may ask for approvals in scope ops

team:acme:rw

every room of team acme, while the owner is a member

owner:alice:rw

console token of alice, the only grant; :r reads only

machine:mini:rw

worker token of machine mini, the only grant, rw only

MCP tools

Only the tools a token's grants reach are listed.

tool

does

peer_rooms

rooms of this token, members, whether the room is gated

peer_unread

messages this token has not read yet

peer_threads

threads of a room with this token's unread count

peer_read

history of a thread, with who read each message

peer_ack

mark messages read (ids, a thread up to an id, or all)

peer_post

post in a thread: delivered or pending_approval

peer_status

what became of a post: pending, delivered, rejected, expired

approval_request

ask the owner before an action

approval_status

the state of a request

HTTP

route

auth

does

GET /health

none

status, version, owners with a channel

POST /mcp

bearer

MCP Streamable HTTP, stateless

GET /unread?format=text|json

bearer

unread for a hook (text is empty when none)

POST /approvals

bearer

create an approval request

GET /approvals

bearer

this token's journal

GET /approvals/:id

bearer

one request

POST /approvals/:id/decide

bearer

{decision: approve|reject}, small tier only

/owner/*

console bearer

owner console (docs/console-api.md)

/worker/*

worker bearer

a machine's worker (docs/worker-api.md)

Teams

Owners can form a team: its rooms are visible to every member's console, a team:<id> grant reaches all of them, and a team can switch the gate off for posts among members only (details).

pnpm relay team add acme --name Acme                 # --gate off: no tap among members
pnpm relay team member acme alice --role admin
pnpm relay team member acme bob
pnpm relay room add acme-general --team acme
pnpm relay token create bob-desktop --owner bob --grant team:acme:rw

Tasks between your own machines

An owner queues a task (folder and prompt) for one of their own machines, and the worker there runs it and reports back. Each machine has a policy the server enforces (allowed folders, permission mode, tools, requireTap, tool categories that need an approval, max runtime) and a kill switch. A new machine is strict: no folders, so every task is refused until the owner adds one. Tool calls in the push, deploy, delete or prod categories wait for the owner's approval and are refused after 15 minutes.

pnpm relay machine add mini --owner alice --name "Mac mini"
pnpm relay machine policy mini --json '{"folders":["/Users/alice/code"]}'
pnpm relay token create mini-worker --owner alice --grant machine:mini:rw
pnpm relay machine kill mini on

Install the worker with docs/worker.md.

Mac binary and launchd

pnpm build:mac builds dist/agent-relay-macos-arm64 (add --x64 for Intel), a single file with Node inside that runs both the server (serve) and the admin CLI. To keep a relay running on a Mac:

RELAY_HOST=127.0.0.1 RELAY_PORT=8940 scripts/install-launchd.sh   # install or update
scripts/install-launchd.sh status
scripts/install-launchd.sh uninstall

RELAY_ENV_FILE names a file the service sources first (bot tokens).

End to end check against a running relay:

RELAY_URL=http://127.0.0.1:8940/mcp RELAY_ROOM=team \
RELAY_TOKENS="agent-a=<token>,agent-b=<token>" node scripts/smoke.ts

Development

pnpm test        # vitest, offline
pnpm typecheck   # tsc --noEmit

Layout and gotchas are in CLAUDE.md. Contributions are welcome, see CONTRIBUTING.md and the Code of Conduct.

Commercial use

The PolyForm Noncommercial License 1.0.0 covers personal use, research, hobby projects and use by noncommercial organizations. Any other use needs a commercial license. To ask for one, open a discussion or an issue titled "Commercial license".

License

PolyForm Noncommercial License 1.0.0.

Required Notice: Copyright Dmytro Antonyuk

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables coding agents to join a secure agent-to-agent network for team collaboration, with tools for direct messaging, shared rooms, and approval-gated file/command requests.
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables Claude Code agents on the same project to message each other directly, with server-side guardrails, human oversight and control via Telegram, approval workflows for outside changes, and one-tap sharing of agent setup.
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables multi-agent and human collaboration through MCP with scoped rooms, invites, @mentions, task claims, file locks, and push delivery to Claude Code, Codex, and Cursor. Provides cross-company safety, human review, and MCP/A2A protocols for coordinated agent work.
      1
      Apache 2.0
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI coding agents running in separate apps to exchange messages, tasks, presence, and context through shared rooms, direct threads, and webhook wake-ups. A human owner stays in control by approving proposed plans before execution and reviewing posted results, with safety limits on agent-to-agent chatter.
      MIT