router: multi-domain MCP gateway (per-domain + merged) #117
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_router#117
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Goal
Make the router's MCP gateway multi-domain. Today the router collapses every service to a single (first) domain; multi-domain services (e.g.
hero_procwithjobs/logs/secrets/system) only expose their first domain over MCP.Model (confirmed): services serve one
rpc.sock, domains are path segments —GET /api/domains.json,GET /api/{domain}/openrpc.json,POST /api/{domain}/rpc,GET /api/{domain}/events. Discovery/proxy already follow this; the gap is the MCP layer + spec cache + UI.Gaps (verified on
development)scanner.rscaches onlydomains.first()'s spec -> other domains invisible.ServiceEntryhas a singleopenrpc_json+domains: Vec<String>(names only) — no per-domain specs.POST /mcp/{id};tools/listuses the oneentry.openrpc_json.tools/callisn't domain-aware; UI/explorer/markdown render one spec.Tasks
/mcp/{id}/{domain}+ merged/mcp/{id})tools/call(forward to/api/{domain}/rpc)Notes
Branch
development_router_multidomain_mcpoffdevelopment; PR ->development. Out of scope: router's own control-plane server stays hand-rolled (later);access.rsproc-secrets wire fix tracked separately.T1 done — per-domain spec cache.
ServiceEntry.domain_specs(domain→spec) added; scanner now fetches every domain via/api/<domain>/openrpc.json(not just the first) and sums method counts. Helpersspec_for_domain()/domain_spec_pairs(). Commitacca99c. Compiles clean (all-targets).T2 + T3 done — multi-domain MCP gateway. Added
POST /mcp/{id}/{domain}(per-domain, plain tool names) and made/mcp/{id}a merged endpoint (multi-domain tools qualified as<domain>__<tool>; single-domain/legacy keep flat names + old behavior).tools/callresolves the domain (route or<domain>__prefix) and forwards to/api/{domain}/rpc; tool map re-keyed(service,domain,tool). Commit51eef73. Compiles + clippy clean (only 2 pre-existing unrelated warnings remain).T4 done —
/mcpoverview now lists the merged endpoint + each per-domain/mcp/{id}/{domain}for multi-domain services. The OpenRPC explorer was already domain-aware (domain selector). Service-detail page still previews the first domain only (explorer is the canonical per-domain view) — noted as a minor follow-up. Commitf48fb3e.T5 done + PR opened. Added
fake_service --domainsmulti-domain mode +functional/mcp.rscases. Commit1aef9bf.Verified live (standalone router + 2-domain fake service): discovery cached both domains (methods=4); merged
tools/list→alpha__alpha_ping/beta__beta_ping; per-domain/mcp/svc/alpha→ plainalpha_ping; per-domain & mergedtools/call→ routed to alpha (pong:alpha). Build + clippy clean (only pre-existing warnings).Full
hero_router_testharness run is pending a live hero_proc (currently down / being stabilized).PR: #118 (development_router_multidomain_mcp → development).
Follow-up: SSE alignment to the canonical
/api/{domain}/events(dropsse.json, derive from the cachedx-sseper-domain) is tracked separately in #120 — it was deliberately out of scope for #118.