Improve MCP with docs-backed onboarding and edge access checks - #770
Conversation
Fetch runbooks from public docs (catalog via GitHub raw runbooks.md) and verify identity+IP against access passes, based on the armcconnell mcp-onboarding mockup.
Restore production read_docs/pipeline behavior and error messages; onboarding still fetches runbooks from raw docs only.
armcconnell
left a comment
There was a problem hiding this comment.
Good direction, and the move from the mockup's in-memory fake to a real dz_access_passes_current lookup is the right call. Two things block merge.
1. check_edge_access reports active for unapproved passes. Only expired maps to pending, but the status enum is requested | connected | disconnected | expired. A requested pass — the case the tool exists to catch — comes back active.
2. get_onboarding_runbook is dead on arrival. docs/runbooks.md 404s on malbeclabs/docs@main right now, so every call errors, and the tool is already advertised in the server card and on the web MCP page. The embed fallback doesn't help — it covers the body, not the index.
The rest are smaller: docsfetch duplicates the existing read_docs fetch rather than replacing it, the access-pass query uses the privileged pool where execute_sql uses the read-only one, and there's an exported mutable global for test injection.
On rollout: this depends on a change in another repo and lights up a tool for every MCP client on merge. Since it's your first change in this repo, please pair with a maintainer on the sequencing — docs page merged first, then this, and confirm behavior against a preview env before it hits prod.
Also worth noting the mockup's dz-edge-subscriber.md came over verbatim, including hardcoded Hyperliquid ports and multicast group. That was fine for a demo; if it's shipping, it should live in docs like every other runbook rather than as an embed.
|
Both blockers are addressed, replies with SHAs on each thread. Summary of the round (f3fe506..ef656fc):
One direction change to flag: Jared redirected the access check off ClickHouse — it now execs On |
addressed, and approved by our lord and savior Karl
Summary
get_onboarding_runbookloads walkthroughs from public docs (catalog from GitHub rawdocs/runbooks.md).check_edge_accessthat execsdoublezero access-pass get --user-payer <pubkey> --client-ip <ip> --jsonon the API host, so onchain state is the source of truth. Only aconnectedpass reportsactive;requested/disconnected/expiredreportpendingwith per-status guidance.utils/pkg/docsfetch(shared byread_docsand the runbook loader), bounded at 10k per page.api/handlers/runbooks/). Catalog and bodies come only from docs — no in-repo mockups.lake-private/mcp-onboarding).Docs dependency (cross-repo — cannot merge here)
The runbook index (
docs/runbooks.md) and the runbook pages land via malbeclabs/docs#197 in a separate repo. There is no embed fallback: until that PR merges,get_onboarding_runbookcannot list or load runbooks. Merge docs#197 first (or together), then this.Deployment note
check_edge_accessrequires thedoublezeroCLI on the API host. Hosts without it get a clear tool error ("access pass lookup failed"); no other tool is affected.Testing Verification
runbooks.mdindex format parses with the catalog parser (fenced example block is stripped; all three runbook entries parse).doublezero access-pass getbehavior against a live testnet host: connected pass with0.0.0.0wildcard resolves for an arbitrary receiving IP, lowercasestatusin JSON, exit 1 +Error: Access Pass not foundon a miss.requestedpass reportedactive; the new tests fail on that code and pass on the fix.get_onboarding_runbookexercised with local docs fixtures; missing index / missing page return clear errors (no embed path).