Skip to content

fix(kas): keep bridging header-bearing http:// MCP servers by default - #31164

Closed
iamwhatever wants to merge 1 commit into
mainfrom
fix/kas-n7-review-followup
Closed

iamwhatever wants to merge 1 commit into
mainfrom
fix/kas-n7-review-followup

Conversation

@iamwhatever

Copy link
Copy Markdown
Contributor

Answers bolichen97's review on #30643, which merged before the review landed.

Fixes #31160
Refs #30630

Problem / Motivation

Goal: keep today's header-bearing http:// MCP servers running on kas by default, with the #30643 refusal as an opt-in.

#30643 stopped bridging a header-bearing plain http:// MCP server on another host, so on the kas backend that server stopped running. Before #30643 it ran through Crew's local bridge. bolichen97 asked to keep that behavior by default and make the refusal opt-in. The review also asked to replace a new regex in kas_env_launch.py with a plain check.

Why it matters

A user whose MCP server is on another machine over plain http:// with a token header lost that server after upgrading, with no setting to get it back.

Not a goal

What changed

  • On the kas backend, a plain http:// MCP server on another host that has headers runs again through Crew's local bridge, as before fix(kas): name MCP servers KAS will not run, and relay env/headers without a session key #30643. Its headers go unencrypted, as before, and it keeps using the environment proxy.
  • The refusal from fix(kas): name MCP servers KAS will not run, and relay env/headers without a session key #30643 is now opt-in: set agent.kas_mcp_http_loopback_only to true and such a server does not run, and the session notice names it. Default false. The key is added to config-baseline.json.
  • Any value that is not a JSON boolean, or a config file that cannot be read, reads as true, because the refusal is the safe side.
  • _normalized_host now uses all(c in "0123456789abcdefx." for c in candidate) plus a non-empty check, so kas_env_launch.py has no import re. Same behavior: urlsplit lowercases the host. The function moved to kiro_crew/kas_http_bridge.py (standard library only), so the bridge's own loopback test uses the same rule.
  • The bridge drops the environment proxy only for a loopback http host, so a bridge to another host keeps the proxy as before.
  • Docs: src/kiro_crew/docs/configuration.md (new row), src/kiro_crew/docs/agent-spec-fields.md and docs/system-specs/modules/security.md now describe the default and the opt-in.
  • Unchanged from fix(kas): name MCP servers KAS will not run, and relay env/headers without a session key #30643: the notice still names a plain http:// server to another host that is not bridged, and registry-mode servers. Loopback spellings (127.1, 0x7f000001, 127.0.0.1.) are still normalised, and a loopback http:// bridge still ignores environment proxies.

Sibling sweep

Siblings: none -- bridgeable in src/kiro_crew/acp/kas_env_launch.py is the one place that decides whether a remote server is bridged, and _opener in src/kiro_crew/kas_http_bridge.py is the one place that sets the bridge's proxy.

Tests

  • TestPlainHttpBridgedByDefault (setting off): the server is bridged and its snapshot holds the url. A server with no headers is still named. A bridge to another host keeps the proxy. The setting is read from config.json, and a malformed value turns the refusal on.
  • TestInsecureUrl (setting on): the fix(kas): name MCP servers KAS will not run, and relay env/headers without a session key #30643 refusal tests, unchanged.
  • test_config_load_pipeline_field_defaults.py: the new key's malformed-value default is true.
  • The malformed-value test fails 6/6 without the loader_pipeline.py coercion.
  • Related KAS and config suites pass. These tests fail the same way on main in the agent sandbox: test_kas_bundle*, test_kas_route, test_config_loader_stt.
  • Local GPT and Opus reviews. GPT's one blocker (a quoted "true" read as false) is fixed in this commit, and a verifier confirmed it closed.

Proof: PROVEN test/test_config_load_pipeline_field_defaults.py::TestAWrongTypedValueLoadsTheFieldDefault::test_every_field_of_the_section[agent], test/test_config_load_pipeline_field_defaults.py::test_each_read_stage_departure_names_a_field_and_differs_from_its_default, test/test_kas_mcp_not_run_notice.py::TestPlainHttpBridgedByDefault::test_a_plain_http_server_with_headers_is_bridged, test/test_kas_mcp_not_run_notice.py::TestPlainHttpBridgedByDefault::test_a_bridge_to_another_host_keeps_the_environment_proxy (head e962fc0)

Pattern harvest

Not generalizable: a review that landed after merge asked for a different default; the code had no defect to generalize.

Breaking: none. This restores the behavior from before #30643 by default.

Answers bolichen97's review on #30643.

- A header-bearing plain http:// server on another host is bridged again,
  as before #30643. The refusal moves behind agent.kas_mcp_http_loopback_only,
  off by default. The session notice still names servers that will not run,
  and the loopback host normalisation stays.
- A bridge to another host keeps the environment proxy, as before; only a
  loopback http bridge ignores it.
- _normalized_host uses a plain character check instead of a regex, so
  kas_env_launch needs no import re. It moves to kas_http_bridge, so the
  bridge's own loopback test reads the same rule.

Refs #30630
@iamwhatever
iamwhatever requested review from a team and KiroCrewCaptain as code owners November 6, 2026 07:00
@iamwhatever
iamwhatever requested a review from Zedmor November 6, 2026 07:00
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 6, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Duplicate of #31064 (merge f0d6dc0), which covers both review points from #30643.

@iamwhatever iamwhatever closed this Nov 6, 2026
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention labels Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

KAS: keep bridging header-bearing http:// MCP servers by default; refusal opt-in (#30643 review)

1 participant