Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat(web): copy an environment's MCP URL for outside agents #16337

Mergedjuliusmarmingemerged 6 commits intot3code/mcp/oauth-sign-in fromt3code/mcp/copy-mcp-urlmerged by juliusmarminge View on GitHub

juliusmarmingecommented

Part 3 of 3 for MCP sign-in from outside T3 Code (access declarations → sign-in → this). Based on #16336. Replaces #15222, which GitHub would not move off its old stack.

Problem

After #16336 an outside agent can sign in to an environment's /mcp, but the user has to work out the right URL themselves. For a T3 Connect environment that address isn't shown anywhere in the UI.

Fix

  • Saved environments in Settings → Connections get Copy MCP URL in the row menu. The toast shows the URL and a claude mcp add example.
  • The URL comes from environmentMcpUrl in client-runtime (shared with mobile if it ever wants it): the bearer profile's httpBaseUrl, or relay discovery's endpoint.httpBaseUrl for T3 Connect environments. It is offered only for https or loopback addresses, because MCP clients refuse plain-http token endpoints elsewhere, and never for SSH, whose address is a local forward.
  • docs/user/remote-access.md gains "Connect an outside agent": add the URL, approve with a pairing code, choose Read only or a mode limit, which routes work, revoking in Connections, the 30-day sign-in.
  • Mobile: no UI by design; it's a client of agents, not where you set them up.

Evidence

Same saved environment (a second dev server served over Tailscale https), same viewport, base vs head:

Before (main)After
Before: the saved environment's menu has only Icon and Remove from this deviceAfter: the menu adds Copy MCP URL between Icon and Remove

After choosing it:

Toast reads MCP URL copied, with claude mcp add --transport http t3 https://cups.tail131df4.ts.net:38772/mcp

The "Updates Available" toast in the before shot is unrelated dev noise.

Verification

  • vp test run src/connection/presentation.test.ts (client-runtime): the https address yields /mcp, loopback http is allowed, and a plain-http tailnet IP yields nothing.
  • Typecheck clean for web and client-runtime.
  • End to end over a T3 Connect tunnel on a personal relay stage: claude mcp add --transport http t3 https://<tunnel>/mcp (the form this menu copies), then claude mcp login t3, signed in and ran T3 tools, including launching a thread. Details and approval-page screenshots are in #16336.

Model: Claude Opus 5.5 (1M context) via T3 Code's Claude Code harness.

🤖 Generated with Claude Code


Devin Review
    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    2. juliusmarminge added labelsmacroscope-review

    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Not approved

      Macroscope's review found this PR not approvable — This PR adds a new outside-agent MCP workflow with sign-in, pairing, revocation, and potentially supervised/full-access thread control. Although the code is localized and existing connection behavior is preserved, the new authentication-sensitive capability warrants human review.

      No code changes detected at 2dfe3a7. Prior analysis still applies.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. github-actions[bot](GitHub profile, opens in a new tab)commented

      Thread transfer impact

      ✅ Thread transfer remains within every enforced ceiling.

      ℹ️ No successful main baseline artifact is available yet. This run establishes the initial measurement.

      ProviderMetricMain baselineThis PRImpactPR ceiling
      CodexTotal thread wire—5.0 KiB—6.8 KiB✅
      CodexThread snapshot wire—3.8 KiB—4.9 KiB✅
      CodexLive turn WebSocket wire—1.2 KiB—2.0 KiB✅
      CodexLive turn WebSocket decoded—20.9 KiB—29.3 KiB✅
      CodexLive turn messages—2—8✅
      ClaudeTotal thread wire—5.0 KiB—6.8 KiB✅
      ClaudeThread snapshot wire—3.8 KiB—4.9 KiB✅
      ClaudeLive turn WebSocket wire—1.2 KiB—2.0 KiB✅
      ClaudeLive turn WebSocket decoded—21.2 KiB—29.3 KiB✅
      ClaudeLive turn messages—1—8✅

      Baseline: unavailable · PR result: 2dfe3a7 · Source CI: success

      Scenario and decoded snapshot size

      10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

      • Codex decoded thread snapshot: 108.5 KiB
      • Claude decoded thread snapshot: 108.8 KiB

      Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

    5. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Review in Change Stack →

      Note

      Reviews paused

      It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

      Use the following commands to manage reviews:

      • @coderabbitai resume to resume automatic reviews.
      • @coderabbitai review to trigger a single review.

      Use the checkboxes below for quick actions:

      • ▶️ Resume reviews
      • 🔍 Trigger review

      No actionable comments were generated in the recent review. 🎉

      ℹ️ Recent review info
      ⚙️ Run configuration
      • Configuration used: Path: .coderabbit.config.ts
      • Review profile: CHILL
      • Plan: Team
      • Run ID: 31a704b9-5323-463f-927b-dd5e3e0acf0b
      📥 Commits

      Reviewing files that changed from the base of the PR and between 2b38f5764516f93435389ccbe512769df2f28dd5 and 77a25b2e51206194a50b8201124ed2837bf8571c.

      📒 Files selected for processing (1)
      • docs/user/remote-access.md

      Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.


      📝 Walkthrough

      Walkthrough

      The client runtime builds MCP URLs for eligible connections. Saved environment menus offer a copy action with success and failure toasts. Remote-access documentation describes agent setup, access modes, accepted addresses, revocation, and sign-in duration.

      Changes

      MCP URL access

      Layer / File(s)Summary
      MCP URL generation and validation
      packages/client-runtime/src/connection/presentation.ts, packages/client-runtime/src/connection/presentation.test.ts
      environmentMcpUrl builds /mcp URLs for eligible connections. Tests cover HTTPS, loopback HTTP, and plain-HTTP LAN addresses.
      Saved environment copy flow and access instructions
      apps/web/src/components/settings/ConnectionsSettings.tsx, docs/user/remote-access.md
      Saved environment menus offer a copy action when an MCP URL is available. The UI retains the last discovered relay HTTP base URL and displays copy result toasts. Documentation describes outside-agent access and sign-in rules.

      Priority: ⬇️ Low

      Estimated code review effort: 2 (Simple) | ~10 minutes

      Change: Feature

      Suggested reviewers: t3dotgg

      Merge Risk: ⚪ Minimal · up to 77a25

      This change adds a way to copy an eligible environment’s MCP URL and instructions for outside-agent access. No actionable defect remains in the reviewed material, so no material merge risk is identified.

      🚥 Pre-merge checks | ✅ 4
      ✅ Passed checks (4 passed)
      Check nameStatusExplanation
      Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.
      Title check✅ PassedThe title clearly and concisely describes the main change: adding a way to copy an environment’s MCP URL for outside agents.
      Description check✅ PassedThe description explains the problem, the change, the scope rationale, and focused verification. It also includes before-and-after screenshots and reports observed test and typecheck results. It refer…
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Commit to this branch
      • Create a new PR
      • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

      Comment `@coderabbitai help` to get the list of available commands.
    6. juliusmarminge merged thisfbe5df2

    7. juliusmarminge closed this

Sign in to join this conversation.