feat(web): copy an environment's MCP URL for outside agents #16337
t3code/mcp/oauth-sign-in fromt3code/mcp/copy-mcp-url·merged by juliusmarminge View on GitHubPart 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 addexample. - The URL comes from
environmentMcpUrlinclient-runtime(shared with mobile if it ever wants it): the bearer profile'shttpBaseUrl, or relay discovery'sendpoint.httpBaseUrlfor 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.mdgains "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 |
|---|---|
![]() | ![]() |
After choosing it:

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), thenclaude 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
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
juliusmarminge added labelsmacroscope-review
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
Thread transfer impact#
✅ Thread transfer remains within every enforced ceiling.
ℹ️ No successful
mainbaseline artifact is available yet. This run establishes the initial measurement.Provider Metric Main baseline This PR Impact PR ceiling Codex Total thread wire — 5.0 KiB — 6.8 KiB ✅ Codex Thread snapshot wire — 3.8 KiB — 4.9 KiB ✅ Codex Live turn WebSocket wire — 1.2 KiB — 2.0 KiB ✅ Codex Live turn WebSocket decoded — 20.9 KiB — 29.3 KiB ✅ Codex Live turn messages — 2 — 8 ✅ Claude Total thread wire — 5.0 KiB — 6.8 KiB ✅ Claude Thread snapshot wire — 3.8 KiB — 4.9 KiB ✅ Claude Live turn WebSocket wire — 1.2 KiB — 2.0 KiB ✅ Claude Live turn WebSocket decoded — 21.2 KiB — 29.3 KiB ✅ Claude Live turn messages — 1 — 8 ✅ Baseline: unavailable · PR result:
2dfe3a7· Source CI: successScenario 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.
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_commitssetting.Use the following commands to manage reviews:
@coderabbitai resumeto resume automatic reviews.@coderabbitai reviewto 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.tsenvironmentMcpUrlbuilds/mcpURLs 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.mdSaved 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:
t3dotggMerge Risk: ⚪ Minimal · up to
77a25This 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 name Status Explanation Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request. Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request. Title check ✅ Passed The title clearly and concisely describes the main change: adding a way to copy an environment’s MCP URL for outside agents. Description check ✅ Passed The 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.juliusmarminge merged thisfbe5df2
juliusmarminge closed this
Sign in to join this conversation.


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
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).2dfe3a7. Prior analysis still applies.