fix(mcp): NIL_MCP_ALLOWED_HOSTS widens the streamable-HTTP DNS-rebinding allowlist#57
Open
Basheirkh wants to merge 2 commits into
Open
fix(mcp): NIL_MCP_ALLOWED_HOSTS widens the streamable-HTTP DNS-rebinding allowlist#57Basheirkh wants to merge 2 commits into
Basheirkh wants to merge 2 commits into
Conversation
added 2 commits
June 24, 2026 17:22
…se form is reachable The panel was hidden when zero automations existed — but the '+ New cross-system automation' button and operator-token field live inside it, so a first automation could never be created. Always render it, with an empty state.
…ing allowlist
FastMCP only honors transport_security as a constructor kwarg and otherwise
auto-enables a localhost-only allowlist, so the remote MCP 421s ('Invalid Host
header') when reached by its container/service name or a public mcp.* host
behind a reverse proxy. build_server now accepts allowed_hosts and threads a
TransportSecuritySettings; build_asgi_app reads NIL_MCP_ALLOWED_HOSTS (JSON or
comma-separated, host:* wildcard ok). /mcp stays bearer-gated.
Basheirkh
added a commit
that referenced
this pull request
Jun 26, 2026
… host allowlist (#59) * fix(cp): always show the Automations panel (empty state) so the compose form is reachable The panel was hidden when zero automations existed — but the '+ New cross-system automation' button and operator-token field live inside it, so a first automation could never be created. Always render it, with an empty state. * fix(mcp): NIL_MCP_ALLOWED_HOSTS widens the streamable-HTTP DNS-rebinding allowlist FastMCP only honors transport_security as a constructor kwarg and otherwise auto-enables a localhost-only allowlist, so the remote MCP 421s ('Invalid Host header') when reached by its container/service name or a public mcp.* host behind a reverse proxy. build_server now accepts allowed_hosts and threads a TransportSecuritySettings; build_asgi_app reads NIL_MCP_ALLOWED_HOSTS (JSON or comma-separated, host:* wildcard ok). /mcp stays bearer-gated. * feat(mcp): read-only Business Graph tools (nil_graph/cycles/overview/instances/activity) Adds deterministic brain-read tools so an agent answers 'show my policies / cycles / what changed / what's overdue' from the brain read-model instead of improvising (curl, file search) or mistaking a graph question for a missing kernel verb. BrainTools is a thin HTTP relay to the brain's /api/graph/* GET endpoints (kernel stays decoupled — it relays, never imports the brain). Env-gated by NIL_BRAIN_URL (+ NIL_BRAIN_TOKEN/TENANT); policies are surfaced as nodes via nil_graph(kind='policy'). 11 new tests; full MCP suite green. Stacks on #57 (fix/mcp-allowed-hosts). * feat(ssot): approval executor — approving a held proposal EXECUTES it (CP commits against the active adapter) The keystone of the core-SSOT plan. Before: a held HIGH-tier proposal lived only in MCP memory (ephemeral) and its CP approval was dead data — execution required the agent to re-nil_commit, so a dashboard Approve did nothing. Now: the gate threads the proposal's verb/tier/preview onto the hold event (so the owner sees WHAT they approve and it survives MCP restarts), and on Approve the control plane itself commits the proposal against the workspace's active adapter (reusing the _live_runner client path) and returns the outcome. Approval DRIVES the effect; the agent never re-commits. Honest on failure (expired / already committed / unreachable). 60 CP tests green. * feat(dataplane): universal read data plane — lean/filtered/paginated reads, refuse-not-truncate, export handles The 590 KB flood (crm.list_contacts dumped whole res.partner records → context overflow → agent fell back to read_file) was an architectural gap: the read path had no contract. This adds one, enforced at the contract + relay seams. nilscript.dataplane: - primitives: enforce_byte_cap (REFUSE, never truncate), project/project_items, parse_filter/Predicate (closed typed op set). - ReadPlane engine over a ReadBackend protocol — schema/count/search/get/aggregate/ export implemented ONCE so every adapter inherits: default projection, byte-cap refuse, keyset cursor, capability fallback (edge-filter within a bound, else refuse), read-side authz (sensitive fields dropped + redaction declared), and bulk-export gating (BulkApprovalRequired — closes the "reads are free" exfil hole). - export → tenant-scoped, TTL'd, PII-at-rest data handles (rows never enter context). - bulk-write spine: batched, resumable, stoppable, partial-failure policy. MCP relay: byte-cap backstop in the query path (a misbehaving adapter still can't flood the agent) + nil_search/count/get/aggregate/export tools. Contract: read-plane.schema.json (the SSOT adapters conform to); SKILL.md gains the count/search/export discipline + the ABSOLUTE "never read_file business data" rule. 426 tests pass (33 new), zero regressions. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: AI Bot <bot@wosool.ai> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The remote NIL-MCP server 421s
Invalid Host headerwhenever it is reached by any name other than localhost — its container/service name (e.g. another in-cluster agent dialingnilscript-mcp:8765) or a publicmcp.*host behind a reverse proxy. FastMCP only honorstransport_securityas a constructor kwarg (theFASTMCP_*env is ignored for it) and otherwise auto-enables a localhost-only allowlist, so there was no way to deploy the MCP reachable by service/public hostname.Fix
build_servergains anallowed_hostsparam; when set it threads aTransportSecuritySettings(enable_dns_rebinding_protection=True, allowed_hosts=…, allowed_origins=['*'])into FastMCP.build_asgi_appreadsNIL_MCP_ALLOWED_HOSTS(JSON list or comma-separated;host:*wildcard-port form supported) and passes it through./mcpstays bearer-gated regardless; unset env keeps the localhost-only default (no behavior change for existing deploys).Tests
test_build_server_honors_allowed_hosts— settings carry the hosts + protection on.test_build_asgi_app_reads_allowed_hosts_from_env— env (JSON) is parsed and threaded.Verified live
Deployed to wosool.ai: with
NIL_MCP_ALLOWED_HOSTSset, the in-cluster Hermes agent now connects tonilscript-mcp:8765and discovers all 12 governed NIL tools (previously 421).