Skip to content

fix(agent-core): use portable NO_PROXY for MCP children - #2866

Open
weivwang wants to merge 1 commit into
MoonshotAI:mainfrom
weivwang:fix/portable-child-no-proxy
Open

fix(agent-core): use portable NO_PROXY for MCP children#2866
weivwang wants to merge 1 commit into
MoonshotAI:mainfrom
weivwang:fix/portable-child-no-proxy

Conversation

@weivwang

Copy link
Copy Markdown
Contributor

Related Issue

Resolve #1931

Problem

See linked issue. Kimi Code appends both bare and bracketed IPv6 loopback entries to NO_PROXY before spawning stdio MCP servers. The bracketed form is required by Node's environment-proxy implementation, but Python httpx parses it as an invalid port and can terminate before the MCP handshake.

What changed

  • Generate a portable child NO_PROXY value without [::1] for non-Node MCP launchers while retaining the bare ::1 entry.
  • Detect known Node launchers, including their Windows executable forms, and retain [::1] so Node still bypasses proxies for IPv6 loopback.
  • Preserve an explicit per-server [::1] override for wrapper commands whose runtime cannot be inferred, and keep wildcard semantics unchanged.
  • Apply the same behavior to both agent-core engines and add regression coverage for portable, Node, explicit-override, inherited, and wildcard paths.
  • Add a patch changeset for the shipped CLI behavior.

Validation:

  • pnpm --filter @moonshot-ai/agent-core test (4137 passed)
  • pnpm --filter @moonshot-ai/agent-core-v2 test (4957 passed)
  • pnpm --filter @moonshot-ai/agent-core typecheck
  • pnpm --filter @moonshot-ai/agent-core-v2 typecheck
  • pnpm exec oxlint on all changed TypeScript files
  • Live compatibility probes confirmed Python httpx accepts the portable form and rejects [::1], while Undici needs [::1] to bypass an IPv6 loopback proxy.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

@changeset-bot

changeset-bot Bot commented Aug 12, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 96fa8ce

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@weivwang
weivwang marked this pull request as ready for review August 12, 2026 16:52
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.

stdio MCP child env injects bracketed [::1] into NO_PROXY, crashing Python httpx-based MCP servers

1 participant