Harness Console MCP layer¶
The Harness Console's HTTP API as a Model Context Protocol server, so Claude Code, Cursor, Grok Bots or any other MCP client can read the fleet's control plane — and, only when the operator turns it on, act on it. Feature HUB-031, PRD FR26 / NFR9.
It lives in tools/console/mcp_layer/ (server.py, client.py), is built on the official MCP Python SDK (mcp v2, MCPServer), and is started by tools/console/mcp.sh or tools/dash mcp.
How it fits¶
MCP client ──stdio──▶ mcp_layer.server ──HTTP + Bearer DASH_CONSOLE_TOKEN──▶ console :4001 (fleet-console-1)
remote agent ──streamable HTTP :4002/mcp + Bearer HARNESS_MCP_TOKEN──┘
The layer is a thin client of the console: every tool is one or two GET calls to existing /api/* routes, so the console's Host allowlist, token guard, operation allowlist and confirm-before-GitHub-write gate stay the only enforcement. It runs on the host next to the console rather than inside it: the console container is untouched, the layer can be restarted on its own, and stdio clients need a local process anyway.
It absorbed the older fleet server (tools/fleetcore/mcp_server.py, stdlib, stdio only). Its read tools (fleet_overview, fleet_apps, fleet_inbox, fleet_work, fleet_workflows, workflow_lint, fleet_graph, fleet_learning, and fleet_nodes, which asks the console first) are now tools of this layer and still read the committed signals and the checkout directly, so they work without a console. The old server's TOOLS table is the list: test_mcp_layer.py fails when a tool in it is not served here (the workflow atlas's two were missing from the merge until 2026-11-10). Its action tools survive as aliases (console_ops, console_jobs, console_job_log, and console_run / console_cancel with --fleet-compat or writes on). .mcp.json keeps the server name fleet, now launching tools/console/mcp.sh --fleet-compat, so existing mcp__fleet__* permissions keep working. python3 tools/fleetcore/mcp_server.py delegates to this layer; FLEET_MCP_STDLIB=1 runs the old stdlib loop.
Run it¶
tools/dash mcp # stdio (what an MCP host launches)
tools/dash mcp --http # streamable HTTP on http://127.0.0.1:4002/mcp, bearer auth
tools/dash mcp --http --port 4010 --allow-host my-tunnel.example
tools/dash mcp --tunnel-url # current URL of the persistent compose mcp-tunnel service
tools/dash mcp --tunnel # TEMPORARY public URL via a cloudflared quick tunnel (Ctrl-C stops it)
tools/dash mcp --fleet-compat # also register the legacy fleet action tools (what .mcp.json uses)
tools/dash mcp --list-tools # print the catalog (read / WRITE) and exit
mcp.sh creates .venv-mcp at the repo root (gitignored) on first run, installs requirements-mcp.txt at latest when it changes, unsets PYTHONPATH so the shell's site-packages cannot shadow the venv, and keeps stdout clean for the stdio channel.
| Variable | Default | Meaning |
|---|---|---|
DASH_CONSOLE_URL |
http://127.0.0.1:4001 |
the console to wrap |
DASH_CONSOLE_TOKEN |
.env line |
the console's bearer token; parsed from .env, never sourced or printed |
HARNESS_MCP_TOKEN |
.env line |
bearer token HTTP clients must send; --http refuses to start without one and never falls back to DASH_CONSOLE_TOKEN |
HARNESS_MCP_DOTENV |
<repo>/.env |
which .env to parse for the tokens |
DASH_CONSOLE_HOST_HEADER |
unset | Host header sent to the console (the sidecar uses 127.0.0.1:4001 to pass its loopback allowlist) |
HARNESS_MCP_FLEET_COMPAT |
off | 1 = --fleet-compat |
HARNESS_MCP_HOST / HARNESS_MCP_PORT |
127.0.0.1 / 4002 |
HTTP bind; a non-loopback host prints a warning |
HARNESS_MCP_ALLOW_WRITES |
off | 1 registers the broad write tools (and every scope) |
HARNESS_MCP_SCOPES |
empty | comma list of narrow write scopes: jobs (job_dispatch, job_cancel), work (work_apply), page (page_navigate, page_click, page_fill, page_press on a paired console page; stdio only); unknown names grant nothing (Scoped write access) |
HARNESS_MCP_PAGE_SESSION |
unset | set by the console for the one server process it starts for a docked-assistant message: the page-bridge session that process may reach. Never set by hand; a paired session uses page_attach |
HARNESS_MCP_AUDIT |
<repo>/.fleet/mcp/audit.jsonl |
the scoped-write audit file (gitignored); the sidecar writes /audit/audit.jsonl, which is .fleet/mcp/ on the host |
HARNESS_MCP_MAX_CHARS |
60000 |
larger results come back as {truncated, total_chars, json_prefix} |
QDRANT_URL / OLLAMA_URL |
the _data/fleet.yml URLs |
where the code index is reached from THIS process (the contract's are the browser's) |
QDRANT_COLLECTION |
the fullest ws- collection |
the code index's collection name, when the store's listing should not decide |
HTTP security: bearer token compared in constant time on every request (401 otherwise), DNS-rebinding protection with a loopback Host/Origin allowlist (421 otherwise), loopback bind by default. HARNESS_MCP_TOKEN is separate from the console token, so the console token never leaves the machine; the console token is rejected by the MCP endpoint.
Client setup¶
Claude Code — the repo's .mcp.json already registers it as fleet; or add it by hand:
claude mcp add harness-console -- /Users/bamr87/bamr87/tools/console/mcp.sh
# remote / HTTP:
claude mcp add --transport http harness-console http://127.0.0.1:4002/mcp --header "Authorization: Bearer $HARNESS_MCP_TOKEN"
Cursor — .cursor/mcp.json (project) or ~/.cursor/mcp.json (global):
{
"mcpServers": {
"harness-console": { "command": "/Users/bamr87/bamr87/tools/console/mcp.sh", "args": [] },
"harness-console-http": {
"url": "http://127.0.0.1:4002/mcp",
"headers": { "Authorization": "Bearer ${env:HARNESS_MCP_TOKEN}" }
}
}
}
Generic HTTP clients (Grok Bots, other remote agents): MCP streamable HTTP at POST /mcp with Authorization: Bearer <HARNESS_MCP_TOKEN> and Accept: application/json, text/event-stream. A remote agent off this machine needs a tunnel to the HTTP server; pass the tunnel's hostname with --allow-host.
A remote client that says "connected" but lists zero tools¶
A remote agent such as Grok Bot runs off this machine, so it cannot launch mcp.sh over stdio here. Its supported connector is streamable HTTP: the tunnel's https://<host>/mcp URL (from tools/dash mcp --tunnel-url) with the header Authorization: Bearer <HARNESS_MCP_TOKEN>. A connector registered as stdio that runs a helper script to forward to the tunnel is not this interface, and it fails in a way that looks healthy: the client sees the helper process start and reports "connected", while the helper's own requests never get a tool list through. The server answers each of a bridge's usual mistakes with an error the helper may swallow:
| What the helper does | What the server answers |
|---|---|
| no or wrong bearer token | 401 unauthorized (never logged by the server) |
Accept: application/json only |
406 Not Acceptable — it must also accept text/event-stream |
tools/list without the Mcp-Session-Id header from initialize |
400 Bad Request: Missing session ID |
| an old session after 30 idle minutes | 404 — the client must send initialize again |
the legacy HTTP+SSE transport (GET /sse) |
404 — only streamable HTTP is served |
| a tunnel hostname from before the tunnel restarted | Cloudflare 530, or no answer |
Check the server side with the handshake a connector must complete. It reads the token in-process, prints tool names only, and exits non-zero on zero tools:
.venv-mcp/bin/python tools/console/smoke_mcp_layer.py --url "$(tools/dash mcp --tunnel-url)" console_overview
If that lists the tools and the remote client still shows none, the fault is in the client's connector configuration: replace the stdio helper with a streamable-HTTP connector to the current URL and header, then reconnect it. A successful console_overview call made by the remote client itself is the proof; an HTTP 200 on initialize, or a tool list fetched from this Mac, is not. Each successful initialize logs Created new transport with session ID in docker logs fleet-mcp-1, so a connector that never logs one never reached the server with a valid token.
Always-on sidecar (compose profile mcp)¶
docker compose --profile mcp up -d mcp # 127.0.0.1:4002/mcp, healthy when /mcp answers 401
docker compose --profile mcp stop mcp
Opt-in, never started by a plain docker compose up. python:3.14-slim, repo mounted read-only, venv in the venv-mcp volume, token read from the mounted .env, talks to http://console:4001 with Host: 127.0.0.1:4001. It does not restart or depend on console. Writes stay off unless HARNESS_MCP_ALLOW_WRITES=1; HARNESS_MCP_SCOPES=jobs,work in the environment or .env grants only the scoped tools. Its one writable mount is .fleet/mcp/ → /audit, where the scoped-write audit lands. It runs the main checkout's code, so a change to mcp_layer/ reaches it only after the checkout has it and the sidecar is recreated (docker compose --profile mcp up -d --no-deps mcp); that does not restart the tunnel, so the tunnel's URL stays the same.
Remote access (persistent quick tunnel — compose mcp-tunnel)¶
docker compose --profile mcp --profile mcp-tunnel up -d mcp mcp-tunnel
tools/dash mcp --tunnel-url # prints https://<random>.trycloudflare.com/mcp, writes .dash-live/mcp-tunnel-url
An opt-in cloudflared quick tunnel to the mcp service, restart: unless-stopped. It rewrites Host to 127.0.0.1:4002 so the server's loopback Host check passes; the bearer HARNESS_MCP_TOKEN is the gate and writes stay off. Its metrics port (127.0.0.1:${HARNESS_MCP_TUNNEL_METRICS_PORT:-4003}) serves /quicktunnel, which --tunnel-url reads. The hostname is not stable: it changes whenever the container restarts, so a connector pointing at it must be updated.
Stable hostname (needs a one-time interactive sign-in)¶
Named Cloudflare Tunnel (requires a domain on Cloudflare):
docker run -it --rm -v ~/.cloudflared:/home/nonroot/.cloudflared cloudflare/cloudflared:latest tunnel login
docker run --rm -v ~/.cloudflared:/home/nonroot/.cloudflared cloudflare/cloudflared:latest tunnel create harness-mcp
docker run --rm -v ~/.cloudflared:/home/nonroot/.cloudflared cloudflare/cloudflared:latest tunnel route dns harness-mcp mcp.<your-domain>
Then run tunnel run harness-mcp with an ingress to http://mcp:4002 and set HARNESS_MCP_ALLOW_HOSTS=mcp.<your-domain> on the mcp service (comma-separated; added to --allow-host). Alternatives: Tailscale Funnel or an ngrok static domain.
Remote access (temporary tunnel)¶
Starts a cloudflared quick tunnel (native cloudflared, else the cloudflare/cloudflared image via host.docker.internal), waits for its *.trycloudflare.com hostname, prints the TEMPORARY public endpoint, and runs the HTTP server in the foreground with --allow-host <that host>. Ctrl-C (or any exit) stops the tunnel container. The URL changes every run and is public, so the bearer token is the only gate: use it for a session, not as a standing service. For a permanent endpoint use a named Cloudflare Tunnel or Tailscale to 127.0.0.1:4002 and --allow-host <hostname>.
curl -s -X POST http://127.0.0.1:4002/mcp \
-H "Authorization: Bearer $HARNESS_MCP_TOKEN" -H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"curl","version":"0"}}}'
import httpx2, anyio # mcp v2's HTTP client package
from mcp import Client
from mcp.client.streamable_http import streamable_http_client
async def main():
http = httpx2.AsyncClient(headers={"Authorization": "Bearer <HARNESS_MCP_TOKEN>"})
async with Client(streamable_http_client("http://127.0.0.1:4002/mcp", http_client=http)) as c:
print([t.name for t in (await c.list_tools()).tools])
print(await c.call_tool("console_overview", {}))
anyio.run(main)
Tool catalog¶
Read tools are annotated readOnlyHint: true. Lists come back as {count, items}.
| Tool | Console route | What it answers |
|---|---|---|
console_overview |
/api/health, /api/state |
Is the console up, git head, signal freshness, tripped wires, harness totals, whether writes are on (mcp_writes_enabled) and which scopes are granted (mcp_scopes) |
fleet_status |
/api/fleet |
Every registry project: health, triage, CI, docker (q, sort, limit) |
fleet_docker |
/api/fleet/docker |
Containers on every Docker host, with a reason per unreachable host; errors when none answers (the console's container holds no Docker socket by design) |
fleet_nodes |
/api/nodes |
Where hub workloads run (fleetcore.nodes.status_doc, docs/PLATFORM.md): each node's role, on/off state, reachability (up · unknown · off), capacity and hub services, the placement rows and the drift (null when no node's containers could be read, which is not the same as no drift; drift_read names the nodes it covers). A node that is off is never probed. With no console, or one without the route, the same function answers in this process; a refusal (401) stays an error |
project_detail |
/api/project/{name} |
One project's drill-down |
harness_health |
/api/state health |
Six-layer scorecard and trip wires, tripped first |
harness_scorecard |
/api/state harnesses |
Per-repo AI harness inventory, trends, attention; repo for one entry |
live_snapshot |
/api/live |
Sessions, Claude live usage, jobs, spend, health, deep dive (needs bamr87/bamr87#432) |
sessions |
/api/live sessions |
Active and idle local agent sessions (needs #432) |
agent_activity |
/api/lake/review |
Local sessions + CI agent runs, analysed (days, repo, limit) |
lake_recall |
/api/lake/recall |
Past local Claude Code sessions by keyword (query cut to 300 characters, days up to 3650, repo, limit up to 50): every word must match the redacted text of the session's first prompt or one assistant turn, one result per session, best match first, each with a redacted excerpt of at most 300 characters; the lake is opened read-only (docs/HARNESS-OPS.md) |
ops_list |
/api/ops |
The allowlisted operations and their params |
jobs_list |
/api/jobs |
Recent jobs, each with its derived state, age_s, idle_s, stall_s and diagnostics (status filters the raw status, state the derived one: queued, running, stalled, done, failed; limit) |
job_status |
/api/jobs/{id}/status |
What one job is doing now, without its log: state (a running job whose log has not grown for stall_s is stalled), age_s, idle_s and diagnostics (queue_wait, collector_lag, long_step, no_heartbeat) — job-status.md |
job_log |
/api/jobs/{id} |
A job's status and log tail (offset, tail_chars) |
spend_vs_budget |
/api/state usage + contract |
Claude spend and Actions minutes vs the _data/fleet.yml budgets |
lake_status |
/api/lake |
The data lake (traces plane) |
lake_runs |
/api/lake/runs |
Recent runs / traces (limit) |
workflow_lines |
/api/lake/lines |
Every workflow with provenance and kill switch (filter: all, failing, noswitch, ai) |
observability |
/api/observability |
Log and metrics planes (Elasticsearch/Kibana, Prometheus/Grafana, Phoenix) |
prom_query |
/api/telemetry/prom |
PromQL over claude_code_* metrics only (query; start, end, step for a range): every selector must name a claude_code_* metric, so a __name__ matcher, a bare {…} selector and info() are refused; window and every [range] ≤ 30 days, ≤ 200 series (truncated: true), ≤ 500 points a series, 10 s; an identity label (user_email, user_account_uuid, organization_id …) may not be named anywhere in the query, so it cannot be matched, grouped on or copied by label_replace / label_join, and it is dropped from every series; cost is API-equivalent (estimate) |
logs_search |
/api/telemetry/logs |
Log hits from Elasticsearch, always logs-fleet.*, newest first (repo, run, trace, session, event, level, since, until, text, limit): window ≤ 30 days, ≤ 100 hits, 10 s; allowlisted fields only, secret-shaped values and emails redacted |
traces_query |
/api/telemetry/traces |
Phoenix project claude-code-otel only: one trace's spans (trace_id), a session's spans (session), or the window's traces, slowest first with slowest — span kind, model, tokens, latency, status; ≤ 50 rows, window ≤ 30 days, 10 s; sends PHOENIX_API_KEY when set |
code_search |
/api/index/search, /api/index/harmonize |
Semantic search over the worktrees (mode: search, harmonize) |
index_coverage |
/api/index/coverage |
What the code index covers, which collection it read and where it asked |
deep_dive |
/api/data/deep_dive |
Deep-dive cycle progress and per-repo status |
work_board |
/api/work |
One page of the Work board (lane, repo, kind, stage, priority, q, limit, offset, summary) |
work_item |
/api/work/item |
One item's drill-down: its board row and source record (key) |
work_preview |
/api/work, POST /api/work/preview |
What a prioritising plan would change — writes nothing: the console's change lines, each item before → after, the files an apply would edit, undo_plan and the plan_id that work_apply needs |
loops |
/api/state loops |
The control-plane loops |
refine_status |
/api/refine |
Harness refinement (docs/HARNESS-REFINEMENT.md): the hub's surface check, the fleet sweep's totals, one Propose–Probe–Compose plan per agent step with its ceiling, the library's count, the evidence trees and the review queue; section returns one key in full (surface, fleet_surface, plans, library, evidence, reviews, config) |
refine_library |
/api/refine library |
The experience library's lessons (cue, lesson, evidence, confidence, verdicts), newest first (loop, domain, limit) — data to re-verify, never a rule |
refine_reviews |
/api/refine reviews |
Every local loop-run attempt whose dry-run preview has not been filed, with whether its step can file (can_apply) |
assist_activity |
/api/assist/activity |
How the console's assistant is observed (the console README): its messages from the AI ledger (outcome, cost, turns, model), what its sessions did to pages from the page bridge's audit (the dock's session or a paired one, the console's page or a fleet page and its origin, action, target, mode, outcome), the fleet pages sharing themselves now, and its entry in the agent inventory (days, 0 for all time; limit). No session id, no typed text |
decision_queue |
/api/decisions (or, with no console, tools/console/decision_index.py in the MCP process) |
What waits on Amr across the whole fleet, in one call (docs/DECISION-INDEX.md): needs_amr, ratification, dependabot (failing or major) and ready_to_merge items, each with its why, the counts of the whole queue and the per-repo inventory (kind, repo, limit, refresh: auto, never, force; budget_s, at most 15). Served from the local index; status is fresh · partial · stale · expired · unavailable, and warnings, errors and hint say which part is old and why |
gh_projects |
/api/gh-projects (or, with no console, tools/console/gh_projects.py in the MCP process) |
GitHub Projects (v2) of every fleet owner in one call (docs/PROJECTS-FRAMEWORK.md § 3a): each owner ok with its project count or scope_missing / error / skipped with the reason, every project with its id, field names and Status options (owner, include_closed, summary, refresh); status is fresh · partial · scope_missing · unavailable, with a hint |
gh_project_items |
/api/gh-projects/{project_id}/items (or the module in the MCP process) |
One project's items, paged: kind, repo, number, title, state, field values, FEAT/FR refs and the issues a PR closes (status, kind, q, limit up to 200 summarised or 50 with commits, offset, summary, refresh); counts cover the whole project, the read stops at 500 items and says so (capped); the project id is checked before it reaches a URL |
fleet_overview / fleet_apps / fleet_inbox / fleet_work |
committed signals (tools/fleetcore) |
The merged fleet server's views; no console needed |
fleet_workflows |
the checkout's .github/ (dash-gen workflow_atlas); with fleet, the local lake read-only (tools/fleetcore/workflows.py) |
The workflow atlas: every hub workflow and composite action with its triggers, crons, Claude call sites, kill switch and findings; workflow returns one in full, health adds run health and failure causes from the local lake over days. fleet=true returns the fleet model instead (fleet-workflows/v1, filled by tools/dash workflows sync): every registry repository with when it was read or why not, its findings and its checks' states; repo narrows to one repository's workflows, repo + workflow to one in full (docs/WORKFLOW-ATLAS.md); no console needed |
workflow_lint |
dash-gen workflow_atlas.lint_text |
A draft workflow's findings against the hub's standards and _data/fleet.yml (text, id); nothing is written |
fleet_graph |
the checkout (tools/fleetcore/graph.py) |
The fleet graph (docs/FLEET-GRAPH.md): action = summary · find (text, kind) · show (node) · impact (node, depth: what depends on it) · lineage (what it needs) · path (node, to) · check (findings, with the surface-parity notes); no console needed |
fleet_learning |
the local lake, read-only (tools/fleetcore/learn.py) |
Outcome learning in shadow (docs/LEARNING.md): per loop the outcomes, the landing estimate, the plan for the next slots, the replay test and the backlog advice (loop, slots, limit); available: false with the reason when there is no lake; steers nothing |
console_ops / console_jobs / console_job_log |
as ops_list / jobs_list / job_log |
Legacy fleet names |
Write tools — registered only with HARNESS_MCP_ALLOW_WRITES=1, annotated destructiveHint: true, and each refuses unless called with confirm=true (the agent's host must ask the human first):
| Tool | Console route | Effect |
|---|---|---|
run_op |
POST /api/jobs |
Start an allowlisted operation (op, params) |
run_op with op: loop-run |
POST /api/jobs |
The JEV loop runner as a job: params: {loop, step, target, rehearse} — a dry run that files nothing; rehearse: true is $0, a live attempt spends and needs the console's confirm; apply: true files the reviewed preview through the engine's publish gate (constitution § 11.8, the OPS remote-write path) and needs confirm=true like every GitHub write — refused up front for a step whose agent_steps entry says can_apply: false (its filer cannot file yet, #488); run_id publishes an earlier reviewed preview, with item naming it by the preview's key (owner/repo, or owner/repo:path for the doctor) when the run has several |
cancel_job |
POST /api/jobs/{id}/cancel |
Cancel a running job |
console_run / console_cancel |
as run_op / cancel_job |
Legacy fleet names (also with --fleet-compat; the console's confirm gate still applies) |
workflow_kill_switch |
POST /api/github/repos/{owner}/{repo}/actions |
workflow.enable / workflow.disable by workflow_id (needs the console's GitHub writes on) |
Page tools — a page a person has open, through the console's page bridge (ADR 0013, the assistant): a console page, or a page of any fleet site or app that carries the assistant kit's payload (ADR 0014, templates/assistant/), which is reached by pairing only. Registered on the stdio transport only (an HTTP server is one process shared by every client, and a page binding is per process). A session reaches a page in one of two ways: the console starts the server for a docked-assistant message with HARNESS_MCP_PAGE_SESSION, or the person switches pairing on in the assistant dock and gives the session the code for page_attach.
| Tool | Console route | What it does |
|---|---|---|
page_attach(code) |
POST /api/assist/page-attach |
Pair this session with the page whose dock or panel shows that code (eight characters, single use, ten minutes; wrong codes lock pairing). Absent from a docked session, which is already bound. Returns the mode, the ceiling and what kind of page it is; for a fleet page also its origin and what it says it is (repo, source, route). The session id never leaves the server process |
page_snapshot(max_chars) |
POST /api/assist/page-command |
The route, title, an outline of the page with a ref per control, open dialogs, page errors, loading and failed documents, the console's pages by path, and the mode the person chose. Refs are valid until the next snapshot |
page_read(ref, max_chars) |
same | The full text of one region |
page_data(key, max_chars) |
same | A document the page loaded from the console API, or the list of them |
page_highlight(ref, note) |
same | Scroll an element into view and ring it |
page_navigate(path) · page_click(ref) · page_fill(ref, text, submit) · page_press(key, ref) |
same | Use the page. Registered only with the page scope. Refused in the dock's Look mode; in Ask first each click, fill and key press waits up to 90 s for the person; never inside a modal dialog, never on a secret field, never a link that leaves the console |
A refusal, a decline and a timeout come back as tool errors that carry the reason (refused: …, declined: …, timeout: …, page: …). They are the person's or the page's answer, not something to retry or route around.
Resources: harness://overview, harness://health, harness://ops, harness://deep-dive, harness://live.
Scoped write access (HARNESS_MCP_SCOPES)¶
HARNESS_MCP_ALLOW_WRITES=1 is all or nothing. run_op passes the console's own confirm, so one flag the agent sets reaches every allowlisted operation: secrets-push, keys-rotate, config-sync, the deploys, CI dispatch, observe-reset and live loop-run. Over a public tunnel that is too much. HARNESS_MCP_SCOPES grants narrow slices instead, and leaves the broad tools unregistered:
| Scope | Tools | What they can do |
|---|---|---|
jobs |
job_dispatch(op, params, confirm, wait_s), job_cancel(job_id, confirm) |
Start one op from a fixed allowlist of local, $0 reports and checks: config-show, status, audit, drift, schema-lint, workflows-lint, observe-status, observe-verify, lake-status and refine-surface. None of them writes to GitHub, reads or writes a secret, or starts or destroys a container. job_cancel stops only a job of one of those ops. |
work |
work_apply(plan, plan_id, confirm) |
Apply a prioritising Work-board plan that work_preview returned: priority, pins, unpin and notes. It writes _data/work_queue.yml (and, for a roadmap:FF-… key's priority, _data/roadmap.yml) in the console's working tree and commits nothing. Committing the file is the approval the loops read (docs/WORK-BOARD.md). |
page |
page_navigate(path), page_click(ref), page_fill(ref, text, submit), page_press(key, ref) |
Use the console page this server is attached to, as far as the page bridge allows: the assistant.page_access ceiling in _data/fleet.yml, the mode the person picked in the dock, and their yes on each click, fill and key press in Ask first. Stdio only. The gate here is the dock, not a confirm argument: a click can only do what that person could do on that page, and the console's own confirm, always a modal dialog, is out of a session's reach. Audited by the console (assist/page-audit.jsonl under its job directory), not in the MCP audit file |
These guards apply to every scoped call, and the console's own gates still apply behind them:
- Approval. Every call needs
confirm=true, which the agent's host sets only after asking the person.work_applyalso needs theplan_idfrom awork_previewof the same plan. An id that no longer matches the plan, or the board, is refused: the preview has to be shown again. - Allowlists and validation. An op off the list, a parameter the op does not declare, a parameter value that is not a short plain token (
[A-Za-z0-9._/-], at most 64 characters), a plan field outside the four, more than 25 items in a plan, or a note longer than 500 characters is refused before the console is asked.stagemoves change GitHub labels and roadmap status edits change a roadmap entry's lifecycle, so they stay on the console's Work board. - Defence in depth.
job_dispatchre-reads the op's card from/api/opsand refuses it if the console marks itremote_write, spending or unavailable. It always sends the consoleconfirm=false, so the console's own gate refuses anything remote even if the list here were wrong.work_applysendsconfirm=falsetoo, and the console needsconfirmonly for a label move. - Bounded execution. Each op has a wall clock:
config-showgets 120 s, the others 300–900 s. A daemon thread cancels a dispatched job that passes its limit. At most 2 dispatched jobs run at once and 20 start per hour, andwork_applyis limited to 30 per hour.wait_s(up to 120) waits for the job and returns the end of its log;job_logreads it later. The limits live in this process, so a restarted server forgets the deadlines of jobs it had started. Each allowlisted op still ends on its own. - Audit. Every scoped call is written as one JSON line, whether it ran, was refused or failed: time, tool, scope, op or plan,
plan_id, job id, the outcome and the reason, the transport and the client's self-reported name. Forwork_applythe line also holds the per-change results and the diff. It goes toHARNESS_MCP_AUDIT(default.fleet/mcp/audit.jsonl, gitignored) and to stderr asharness-mcp audit {…}, which is the record wherever the file cannot be written. Token-shaped strings are scrubbed first. The client name is a label, not an identity: the bearer token is the gate. - Undo.
work_previewandwork_applyreturnundo_plan, the plan that puts every named item back as it was: its override or computed priority, its note and its lane's pin order. Preview it and apply it like any other plan, or restore the file from git. - Annotations. Like every write tool, the scoped ones are marked
destructiveHint: true(NFR9), so a host asks before each call. They are also markedopenWorldHint: false, because they change only local state.
The jobs and work scopes do not write to GitHub, so neither is a write-back path under constitution § 11; under § 13.6 their actions are reversible, local and $0. The page scope has no write of its own either: what a click reaches is whatever that page offers the person, and a page action that would write to GitHub or spend opens the console's confirm, which stays theirs. The person's confirm comes before each one, and each is audited. A scope can only narrow what the console allows. Turning a scope on for the sidecar is a runtime change on the Mac: set HARNESS_MCP_SCOPES in .env or the environment, then recreate the mcp service.
Result size¶
HARNESS_MCP_MAX_CHARS (60,000) is the last line of defence: a result over it becomes {truncated, total_chars, json_prefix}, which an agent reads as nothing useful. So a tool whose route answers with the whole of something pages instead of relying on the clip. work_board is the one that needs it — /api/work is ~390,000 characters over ~400 items, a quarter of it each item's detail record — so it defaults to summary=true and 40 items (~25,000 characters) and reports matched, matched_by_lane and next_offset so the rest can be walked. summary=false returns full items and caps limit at 25; one item's whole record is work_item / fleet_work. fleet_status, jobs_list, lake_runs, workflow_lines and job_log take the same shape of limit.
Reaching the planes from a container¶
The MCP sidecar and the console run in containers, and the _data/fleet.yml URLs are the browser's (loopback — they are also the links the console renders). Every server-side probe therefore goes through fleet_observe.probe_url, which prefers ES_URL, KIBANA_URL, GRAFANA_URL, QDRANT_URL, OLLAMA_URL, PROMETHEUS_URL — set on console and devenv in docker-compose.yml to the service-DNS form. The code index missed this and asked the container's own 127.0.0.1:6333, so index_coverage and code_search reported "Qdrant has no collection" against a store holding 17,341 points. Kilo's collection name is a hash of the workspace root path, which differs between the host (/Users/bamr87/bamr87) and a container (/workspace), so it is never recomputed: the store is listed and a ws- collection chosen (the fullest, when there are several). QDRANT_COLLECTION overrides that choice and wins even when the store cannot be listed. index_coverage returns qdrant, collection, collections and collection_source so a wrong pick is visible rather than looking like an index that covers nothing.
MCP Registry manifest (server.json)¶
../server.json describes this server in the MCP Registry's server.json format (schema 2025-12-11), as constitution § 16.4 asks of every fleet MCP server. It is a description only: nothing publishes it, and publishing to the public registry, with the namespace sign-in that needs, is the maintainer's decision.
- name
io.github.bamr87/fleet: the registry's GitHub namespace for the owner, thenfleet, the server's stable id under § 25.4 and in_data/mcp_servers.yml. The repository name (bamr87) would name the hub, not this server, and the hub registers more than one. - version equals
VERSIONinmcp_layer/server.py(0.3.0). Bump both together:tools/mcp_servers_lint.pyandtools/test_mcp_servers_lint.pyfail when they differ. - repository points at
tools/consoleinbamr87/bamr87. - No
packagesorremotes. The schema requires a package to name a registry (npm, PyPI, OCI, NuGet or MCPB), and this server is not published to any of them; a checkout runs it. A remote needs a URL, and the only HTTP endpoints are loopback or a quick tunnel whose hostname changes, which § 25.6 keeps out of git. How a checkout starts it is therefore recorded under_meta→io.modelcontextprotocol.registry/publisher-provided: transportstdio, the launchtools/console/mcp.sh --fleet-compat(what.mcp.jsonruns) from the repository root, and the environment variables it reads, by name only.
python3 tools/mcp_servers_lint.py check . lints every committed server.json in the hub: the shape, the name, a specific version, a transport, no secret literal and no machine-local endpoint. It does not check the full JSON Schema, because jsonschema is not a hub dependency. To validate against the official schema, use a scratch virtualenv:
python3 -m venv /tmp/mcp-schema && /tmp/mcp-schema/bin/pip install -q jsonschema
curl -fsS -o /tmp/mcp-schema/server.schema.json https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json
/tmp/mcp-schema/bin/python -c 'import json,sys,jsonschema; jsonschema.validate(json.load(open(sys.argv[2])), json.load(open(sys.argv[1]))); print("valid")' \
/tmp/mcp-schema/server.schema.json tools/console/server.json
Tests¶
tools/console/mcp.sh --list-tools >/dev/null # bootstrap .venv-mcp once
.venv-mcp/bin/python tools/console/test_mcp_layer.py # unit: mocked HTTP, the protocol, HTTP auth, scopes
.venv-mcp/bin/python tools/console/smoke_mcp_layer.py # live: stdio against the running console
.venv-mcp/bin/python tools/console/smoke_mcp_layer.py --url http://127.0.0.1:4002/mcp # live: the HTTP sidecar
python3 tools/test_mcp_servers_lint.py # server.json: the lint, and its version equal to VERSION
test_mcp_layer.py skips cleanly where mcp is not installed. It covers the scoped tools too: which tools each scope registers, the refusals (no confirm, an op off the allowlist, an undeclared parameter, a stale plan_id, a stage move), the running and hourly caps, the watchdog's cancel, the round trip of a plan and its undo_plan, and the audit's scrubbing. The smoke test lists tools and resources and calls a few read tools, printing sizes and top-level keys only. With --url it runs the remote handshake against a running HTTP server, reading the bearer token in-process, and fails when no tools are listed. The page tools are covered too: which server carries them (never the HTTP one), that the docked session cannot re-pair, the action and arguments each tool sends and how long it waits, and that a refusal, a decline and a timeout arrive as tool errors with their reason; test_page_bridge.py covers the console's side.
Not yet¶
- No
/mcproute on the console itself (the sidecar covers always-on). live_snapshotandsessionsneed/api/livefrom bamr87/bamr87#432; on a console without it they return a tool error naming the PR.- No SSE streaming of
/api/live/streamas MCP notifications yet.