Repository navigation
fix(mcp): load plugin MCP bundles when the Paca host resolves to a private IP - #831
Conversation
…ttps resolveImportUrl rejects any https:// plugin entry whose hostname resolves to a private/internal IP (SSRF guard). On a LAN or split-horizon-DNS deployment the operator's own Paca host resolves to a private address (e.g. paca.example.lan -> 192.168.x.x), and every plugin's path-only remoteEntryUrl (/plugins-mcp/<id>/mcp.js) resolves against exactly that host, so every plugin failed with "resolves to private/internal IP" and no plugin tool (bdd_*, checklist_*, dashboard_*, time_logging_*) was ever registered. Core tools kept working, which made the failure look like the plugin was simply not active. The http:// branch already trusts the baseURL / gateway host. Apply the same rule to https://: skip the private-IP check only when the entry's hostname equals the configured base host; any other https:// host is still resolved and rejected if private. Hoist the baseURL hostname parsing so both branches share it, and cover both cases with tests.
There was a problem hiding this comment.
ℹ️ No critical issues — one defense-in-depth note and a stale doc line.
Approach: sound — the https:// branch now trusts the operator-configured base/gateway host exactly as the http:// branch already did, so path-only plugin entries load on LAN/split-horizon deployments without weakening the guard for third-party hosts.
Reviewed changes
- Trust the configured host over
https://—resolveImportUrlhoists thebaseURLhostname parse and skipsassertNotPrivateHostonly when the entry's hostname matches it; every otherhttps://host is still resolved and rejected if private, andfetchAsDataUrlstill usesredirect: "error". - Tests — two new cases cover the trusted base host over
https://(no DNS lookup) and a private non-base host still being rejected. - Docs — the
resolveImportUrldoc comment andapps/mcp/CHANGELOG.mddescribe the new exception.
ℹ️ docs/plugins/skills-plugin-system.md still describes the old https:// rule
The comparison section says the MCP loader allows https:// "unless the hostname resolves to a private/internal IP" and only http:// trusts the configured gateway host. This PR adds the same gateway-host exception to https://, so that sentence is now stale. It is a hand-maintained doc with no CI check, so it will not be caught elsewhere.
Technical details
# Update the MCP loader's SSRF allowlist description
## Affected sites
- docs/plugins/skills-plugin-system.md:136 — describes the `https://` allowlist without the base-host exception.
## Required outcome
- The sentence matches the new behavior: `https://` is allowed unless the hostname resolves to a private/internal IP, except for the configured gateway/base host; `http://` is allowed only for localhost or that host.deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏
Comparing only the hostname made https://<base-host>:<any-port>/... skip the private-IP guard, so a manifest could point at another TLS service on the same machine. Compare URL.host (hostname plus effective port) instead, for both the https:// and http:// branches. URL.host omits a default port, so a path-only entry resolved against https://paca.lan still matches while https://paca.lan:8443 does not, and an internal gateway such as http://paca-gateway.paca-ns.svc:8080 keeps matching its own port. Full origin is not compared because the scheme is already fixed by the branch.
There was a problem hiding this comment.
✅ No new issues found.
Approach: sound — scoping the trust to URL.host keeps the LAN/split-horizon fix while narrowing the skipped SSRF check to the configured host and port.
Reviewed changes
- Port-scoped host trust —
isBaseURLHostnow comparesURL.host(hostname plus effective port) instead of hostname alone, sohttps://<base-host>:<other-port>goes back throughassertNotPrivateHostandhttp://gateway:<other-port>is no longer treated as the configured gateway. - Tests — added cases for a different port on the base host over both schemes, and for an explicit-port gateway host resolving a path-only entry over
http://. - Changelog — the
[Unreleased]entry now states the trusted host comparison includes the port.
deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏
pikann
left a comment
There was a problem hiding this comment.
LGTM! Thank you for the contribution! 🚀

Problem
On a self-hosted Paca whose hostname only resolves inside the LAN (split-horizon DNS, e.g.
paca.example.lan → 192.168.x.x), the MCP server never registers any plugin tool.resolveImportUrlresolves everyhttps://plugin entry via DNS and rejects private addresses (SSRF guard). Every plugin's path-onlyremoteEntryUrl(/plugins-mcp/<id>/mcp.js) resolves against the operator's ownPACA_GATEWAY_URL/PACA_API_URLhost, so all of them fail:Core tools keep working, so from the agent's point of view the BDD / checklist / dashboard / time-logging plugins simply look "not active". Reproduced with the published
@paca-ai/[email protected]against a v0.22.0 instance: 85 core tools, 0 plugin tools, 4 plugins failed with the error above.Fix
The
http://branch already trusts the configured base/gateway host. Apply the same rule tohttps://: skip the private-IP check only when the entry's hostname equals the configured base host. Any otherhttps://host is still resolved and rejected if it is private, and redirects are still refused, so the SSRF guard is unchanged for third-party URLs. The baseURL hostname parsing is hoisted so both branches share it.Verification
vitest run src/__tests__/plugin-loader.test.ts: 15 tests pass (2 new: trusted base host over https, private non-base https host still rejected).biome lintandtsc --noEmitclean.bdd_list_scenarios,bdd_create_scenario,checklist_*,dashboard_*,time_logging_*.Checklist
apps/mcp/CHANGELOG.mdupdated under Unreleased / Fixed;resolveImportUrldoc comment updated