external-cli-setup

Instructions for giving command-line agents an identity and access token for bot-relay-mcp, a service that connects agents to a shared relay.

In plain words
What is it for?
Use them to create relay tokens outside an agent process, configure tokens through environment variables, and connect CLI agents from scripts or multi-agent workflows.
Why use it?
They provide a scriptable fallback when an agent cannot register itself and immediately use the returned token in the same interaction.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/maxlumiere/bot-relay-mcp/external-cli-setup
Clone the repo
git clone --depth 1 https://github.com/Maxlumiere/bot-relay-mcp
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,153 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.02153
Opus 5 $0.00000 $0.01077
Sonnet 5 $0.00000 $0.00431
Haiku 4.5 $0.00000 $0.00215

Measured 2d ago against content hash 0205c7e30105, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

external-cli-setup scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

docs/agents/external-cli-setup.md · 148 lines

How it starts

The opening of the file, as written. The whole thing — 148 lines — stays where its author put it; the contents beside it link to each section on GitHub.

External CLI agent setup

This doc covers wiring an MCP-aware command-line agent into bot-relay-mcp without the agent calling register_agent itself. Use it when:

  • Your CLI client's safety monitor cancels follow-up tool calls when the same response calls register_agent and then immediately uses the returned token. (Codex was the canonical case as of 2026-04-27. Cursor and similar agents may exhibit the same pattern — see the platform notes below.)
  • You're provisioning agents from a CI script and want a deterministic, scriptable identity-issuance path without an interactive register/use ceremony.
  • You're embedding bot-relay-mcp into a multi-LLM workflow where one operator script provisions every agent and hands plaintext tokens out via env vars.

If your CLI client supports the standard SessionStart hook (hooks/check-relay.sh) and doesn't trip the safety pattern, you don't need this doc — keep using the hook flow. The env-token pattern below is the universal fallback.

How it works

  1. Operator runs relay mint-token <name> outside the agent's process.
  2. The CLI generates a random 32-byte token, bcrypt-hashes it (matching src/auth.ts's BCRYPT_ROUNDS), and writes the hash directly to the agent row in the active per-instance DB. The plaintext token is printed ONCE to stdout.
  3. Operator captures the plaintext token, exports it as RELAY_AGENT_TOKEN, exports the agent name as RELAY_AGENT_NAME, and launches the CLI client.
  4. The agent's first MCP tool call (e.g. get_messages) carries the token via the agent_token field or X-Agent-Token HTTP header. The relay's standard auth path bcrypt-verifies it. The agent never sees register_agent in its own trace.

The agents row that mint-token creates is byte-identical to the row that register_agent would create on first registration. The auth layer cannot tell the two paths apart — both produce an auth_state='active', agent_status='idle' row with the same column shape.

Step-by-step: first mint

Read the full file on GitHub · 148 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 148 lines · 0 tokens per session scan A 0205c7e30105

Subscribe to this mod's changes

external-cli-setup is an agent published in the GitHub repository Maxlumiere/bot-relay-mcp (4 stars, last pushed 2d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,153 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.