Skip to content

feat!: Funnel off by default, safe stop_share, structured share_status, bounded CLI calls (0.2.0) - #61

Merged
TMHSDigital merged 6 commits into
mainfrom
fix/issue-batch-2
Oct 25, 2026
Merged

TMHSDigital merged 6 commits into
mainfrom
fix/issue-batch-2

Conversation

@TMHSDigital

Copy link
Copy Markdown
Owner

Summary

This batch finishes the safety work: no tool can expose a port to the internet or wipe shares by default, every CLI call is bounded, and the docs can't drift from the tools. It releases as 0.2.0 because two defaults change (see Breaking). There's one commit per issue.

Breaking

  • Funnel requires TAILSCALE_MCP_ALLOW_FUNNEL=1.
  • stop_share {} no longer resets everything; use {"all": true}.
  • share_status output is structured, and the raw status text appears only on old CLIs.
  • Ping path gains peer-relay and unknown.

Sources checked

  • The output formats were taken from Tailscale's source:
    • ipn/serve.go (ServeConfig/WebServerConfig/HTTPHandler)
    • cmd/tailscale/cli/ping.go (pong line format, peer-relay(...), rounded Go-duration latency, per-attempt timeout lines, --until-direct exit behavior)
  • The CLI source also confirms that turning off the last mount on a port clears Funnel for that port (RemoveWebHandler(..., cleanupFunnel=true)). That answers the open question from fix: ssh-config safety, macOS CLI resolution, share paths, test typecheck (0.1.4) #60.

Test plan

  • npm run typecheck (src + tests)
  • CI=true npm test: 91/91 on Linux (WSL, Node 22); 90 + 1 POSIX-only skip on Windows
  • The manifest test fails on a stale mcp-tools.json (including with CI=true) and passes after npm run gen:tools
  • Built dist/index.js over stdio against the real Tailscale 1.102.3 CLI:
    • Funnel denied by default
    • stop_share {} refused
    • real serve status --json ({}) parsed
    • read-only mode lists 4 tools
    • a malformed flag stops startup
  • A real child process is killed on abort (defaultCliRunner test)
  • Not captured from a live tailnet: the populated serve status --json fixture and the multi-pong/peer-relay lines are hand-built from the Go source above. The weekly contract tests in Weekly contract tests against the real tailscale CLI to catch output-format drift #47 should capture real ones.

Closes #33
Closes #34
Closes #36
Closes #40
Closes #41
Closes #43

🤖 Generated with Claude Code

TMHSDigital and others added 6 commits October 25, 2026 17:36
Timeouts (#34):
- CliProvider.run enforces a per-call deadline (default 10s, override via
  TAILSCALE_MCP_TIMEOUT_MS) through an AbortSignal the runner honors, plus
  a hard fallback if a runner ignores it; timeouts raise TIMEOUT with a
  remedy. serve keeps inspecting partial output so a blocked serve still
  reports SERVE_NOT_ENABLED.
- ping_all has a 45s overall deadline: in-flight pings are cancelled,
  unstarted ones skipped, and the response reports timedOut with per-row
  errors.

Ping parsing (#33):
- All pong lines are parsed; path/latency come from the last (settled)
  reply, with attempts and replies counts.
- path is direct | derp | peer-relay | unknown; peer-relay and TSMP/ICMP
  replies are no longer labeled direct. Latency is parsed as a Go
  duration (0s, 1.234s, 850us), which the old "in (\d+)ms" regex missed.

Closes #33
Closes #34

Co-Authored-By: Claude Opus 5.5 <[email protected]>
share_status parses tailscale serve status --json (ipn.ServeConfig) into
endpoints with url, serve port, mount path, target, a per-endpoint public
flag (AllowFunnel), and foreground-session marking, plus TCP forwards and
a top-level publicExposure. CLIs without --json fall back to the text form
(publicExposure: null).

Also gives the real-process runner test enough time to start on slow
machines.

Closes #43

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e/after

stop_share with no arguments used to run serve reset, wiping shares the
server never created. It now stops nothing and returns TARGET_REQUIRED
listing the active endpoints. Targets are exactly one of httpsPort/path
(one mount), mine=true (mounts share_port created this session), or
all=true (the old reset-everything behavior). Every call returns removed
and remaining endpoints, from share_status before and after.

BREAKING CHANGE: stop_share {} no longer clears the serve config; use
stop_share {"all": true}.

Closes #41

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- share_port public=true returns FUNNEL_DISABLED (before any CLI call)
  unless TAILSCALE_MCP_ALLOW_FUNNEL=1; the tool description says so, so
  agents know before trying.
- TAILSCALE_MCP_READONLY=1 leaves share_port and stop_share unregistered
  and makes generate_ssh_config refuse write=true (READ_ONLY); status,
  share_status, ping_all, and the ssh dry run remain.
- Env parsing moves to src/config.ts (also wiring TAILSCALE_MCP_BIN and
  TAILSCALE_MCP_TIMEOUT_MS); malformed values stop the server at startup
  instead of silently falling back.

BREAKING CHANGE: Funnel requires TAILSCALE_MCP_ALLOW_FUNNEL=1.

Closes #40

Co-Authored-By: Claude Opus 5.5 <[email protected]>
mcp-tools.json is now a vitest file snapshot of what a default install
advertises via listTools(), so the test suite (and therefore CI) fails
whenever a tool changes without regenerating it. npm run gen:tools
rewrites it. The regenerated file picks up descriptions, constraints, and
fields that had drifted from the hand-maintained version. Contributor docs
now point at gen:tools instead of hand edits.

Closes #36

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added code tests Test suite and coverage labels Oct 25, 2026
@TMHSDigital
TMHSDigital merged commit 74a1d63 into main Oct 25, 2026
6 checks passed
@TMHSDigital
TMHSDigital deleted the fix/issue-batch-2 branch October 25, 2026 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment