Skip to content

feat(mcp): 允许局域网访问开关(默认关闭,仅私有网段) - #247

Merged
Slacker-LLC merged 3 commits into
mainfrom
feat/mcp-lan-bind
Oct 18, 2026
Merged

Slacker-LLC merged 3 commits into
mainfrom
feat/mcp-lan-bind

Conversation

@Slacker-LLC

Copy link
Copy Markdown
Owner

背景

MCP 服务固定绑 127.0.0.1,电脑/其他设备无法直接用复制出的配置连接,只能 adb forward。

改动

  • 设置页新增“允许局域网访问”开关,默认关闭,需已配置 token 才能开启。
  • 开启后监听通配地址,但只服务 loopback、私有网段、链路本地、CGNAT(100.64/10,如 Tailscale)、IPv6 ULA 的对端;其余来源在读取任何字节前断开。
  • 开启时“复制连接配置”使用手机的局域网 IPv4 地址。
  • 合同 02/04 同步更新:局域网绑定只能显式开启,仍是明文 HTTP,不扩展到公网。

验证

  • MCPServerExposureContractTest 新增 4 个用例(默认回环、无 token 不能开启、关闭时拒绝非回环对端、局域网模式拒绝公网对端),MCPServerTest / MCPServerManagerTest 一并通过。
  • 未在真机上验证局域网连接。

🤖 Generated with Claude Code

MCP 服务默认仍只绑 127.0.0.1。开启开关后监听通配地址,但只接受
loopback / 私有 / 链路本地 / CGNAT / IPv6 ULA 对端,其余来源在读取前断开;
需要已配置 token,仍是明文 HTTP。连接配置在开启时使用局域网地址。

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@Slacker-LLC
Slacker-LLC enabled auto-merge (squash) October 18, 2026 13:06
Slacker-LLC and others added 2 commits October 18, 2026 21:14
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@Slacker-LLC
Slacker-LLC merged commit 0e1c12a into main Oct 18, 2026
14 checks passed
@Slacker-LLC
Slacker-LLC deleted the feat/mcp-lan-bind branch October 18, 2026 14:03
@Slacker-LLC Slacker-LLC mentioned this pull request Oct 18, 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.

1 participant