router: multi-domain MCP gateway (per-domain + merged) #118
No reviewers
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_router!118
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "development_router_multidomain_mcp"
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?
Closes #117.
Makes the router's MCP gateway multi-domain. Previously every service collapsed to its first domain; multi-domain services (e.g.
hero_proc= jobs/logs/secrets/system) only exposed one domain over MCP.What changed
acca99c):ServiceEntry.domain_specs(domain→spec); the scanner now fetches every domain's/api/<d>/openrpc.json(not just the first) and sums method counts.spec_for_domain()/domain_spec_pairs()helpers.51eef73): newPOST /mcp/{id}/{domain}(one domain, plain tool names, forwarded to/api/{domain}/rpc);POST /mcp/{id}is now a merged endpoint (multi-domain tools qualified as<domain>__<tool>, single-domain/legacy keep flat names + old behavior).tools/callresolves the domain (route or prefix) and forwards to the right/api/{domain}/rpc. Tool map re-keyed(service,domain,tool); GET/DELETE per-domain wrappers.f48fb3e): the/mcpoverview lists the merged + each per-domain endpoint; the OpenRPC explorer was already domain-aware.1aef9bf):fake_service --domainsmulti-domain mode +functional/mcp.rscases (merged qualified names, per-domain plain names, per-domain & mergedtools/callrouting).Model
Single
rpc.sockper service; domains are path segments (/api/<domain>/rpc|openrpc.json|events,GET /api/domains.json) — matches the currentopenrpc_server!services.Verification
Built +
cargo clippyclean (only pre-existing unrelated warnings). Verified live standalone (router + a 2-domain fake service):tools/list→alpha__alpha_ping,beta__beta_ping, …/mcp/svc/alpha→ plainalpha_pingtools/call→ routed to alpha (pong:alpha)(The full
hero_router_testharness needs a live hero_proc to register against — currently down/being stabilized — but the standalone run proves the code and the tests compile.)Out of scope (follow-ups)
access.rsproc-secrets wire fix (tracked separately).Adds POST /mcp/{id}/{domain} exposing a single domain's tools (plain names, forwarded to /api/{domain}/rpc), and turns the existing POST /mcp/{id} into a MERGED endpoint that lists every domain's tools — multi-domain services get <domain>__<tool> qualified names so they don't collide, single-domain/legacy services keep flat names and behave exactly as before. - mcp_handler/mcp_handler_domain delegate to a shared mcp_dispatch(domain: Option). - tools/list builds per-domain or merged tool sets and records a per-(service, domain) tool->method map. - tools/call resolves (domain, tool) — from the route or the <domain>__ prefix — and forwards to /api/{domain}/rpc. - mcp_tool_map re-keyed to (service_id, domain, tool); proxy_to_service gains a domain param (path /api/{domain}/rpc, 'main' for legacy). - GET/DELETE per-domain wrappers for the Streamable-HTTP session legs. Refs #117For multi-domain services the MCP overview now lists the merged /mcp/{id} endpoint plus each per-domain /mcp/{id}/{domain} endpoint. The OpenRPC explorer is already domain-aware (domain selector). Refs #117