@devries-cameron20 / t3code-1 / commits / 7fe1310ee5
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(web): Copy MCP URL uses the T3 Connect address (#32937)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Theo Browne committed Nov 8, 2026 at 15:25 UTC 7fe1310ee552e508a6be318e664d5e546c6a4bc5
3 files changed +17 -9
docs/user/outside-agents.md
+3 -2
@@ -16,8 +16,9 @@ example:
16 https://<environment-address>/mcp
17 ```
18
19 -The copied URL uses the route this device is connected over, so an agent on the
20 -same device can reach it.
19 +When T3 Connect serves the environment, the copied URL is its T3 Connect
20 +address, which agents can reach from anywhere. Otherwise it uses the route this
21 +device is connected over, so an agent on the same device can reach it.
22
23 - **An agent on your own computers** can use `localhost` on the host, T3
24 Connect, or any `https` address, such as
packages/client-runtime/src/connection/presentation.test.ts
+8 -1
@@ -50,7 +50,7 @@ function supervisorState(overrides: Partial<SupervisorConnectionState>): Supervi
50 }
51
52 describe("connection presentation", () => {
53 - it("copies the MCP address of the route this device is connected over", () => {
53 + it("copies the T3 Connect MCP address first, then the route this device is connected over", () => {
54 const route = (connectionId: string, httpBaseUrl: string): ConnectionRoute => {
55 const target = new BearerConnectionTarget({ ...TARGET, connectionId });
56 return {
@@ -80,6 +80,13 @@ describe("connection presentation", () => {
80 "http://100.115.1.44:3773/mcp",
81 );
82 expect(environmentMcpUrl({ entry })).toBe("http://192.168.4.53:3773/mcp");
83 + expect(
84 + environmentMcpUrl({
85 + entry,
86 + connectedTarget: lan.target,
87 + relayHttpBaseUrl: "https://tunnel.example.test",
88 + }),
89 + ).toBe("https://tunnel.example.test/mcp");
90 });
91
92 // regression: #16909 Copy MCP URL falls back to an alternate route when the relay route has no address
packages/client-runtime/src/connection/presentation.ts
+6 -6
@@ -95,24 +95,24 @@ export function connectionStatusTitle(connection: EnvironmentConnectionPresentat
95 }
96
97 /**
98 - * SSH connections ride a local forward that disappears with the client, so they have no stable
99 - * address.
98 + * The T3 Connect address wins whenever it is known: it works for agents anywhere, while the
99 + * connected route is often a LAN or loopback address. SSH routes ride a local forward that
100 + * disappears with the client, so they have no stable address.
101 */
102 export function environmentMcpUrl(input: {
103 readonly entry: ConnectionCatalogEntry;
104 readonly relayHttpBaseUrl?: string | undefined;
105 readonly connectedTarget?: ConnectionTarget | null | undefined;
106 }): string | null {
107 + const relayMcpUrl = input.relayHttpBaseUrl ? mcpUrlFromBase(input.relayHttpBaseUrl) : null;
108 + if (relayMcpUrl !== null) return relayMcpUrl;
109 const connectedRouteId = input.connectedTarget ? connectionRouteId(input.connectedTarget) : null;
110 const routes = connectionRoutes(input.entry);
111 const connectedRoute = routes.find(
112 (route) => connectionRouteId(route.target) === connectedRouteId,
113 );
114 for (const route of connectedRoute ? [connectedRoute, ...routes] : routes) {
112 - const httpBaseUrl =
113 - route.target._tag === "RelayConnectionTarget"
114 - ? (input.relayHttpBaseUrl ?? null)
115 - : routeHttpBaseUrl(route);
115 + const httpBaseUrl = routeHttpBaseUrl(route);
116 const mcpUrl = httpBaseUrl === null ? null : mcpUrlFromBase(httpBaseUrl);
117 if (mcpUrl !== null) return mcpUrl;
118 }