Skip to content

Commit 9d92c44

Browse files
committed
fix(web): clarify who can reach the local MCP URL
A loopback address only works on the host, so the row says that instead of offering it to an outside agent. Correct the saved-environment route description as well.
1 parent bbff835 commit 9d92c44

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

‎apps/web/src/components/settings/SavedEnvironmentRows.tsx‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ import { useManagedTunnelUsage } from "~/cloud/managedRelayState";
5757
import { useT3ConnectAccountPage } from "../clerk/T3ConnectAccountPages";
5858
import { TunnelLimitAlert, TunnelUsageMeter } from "../cloud/TunnelUsage";
5959
import { environmentCatalog } from "~/connection/catalog";
60+
import { isLoopbackHostname } from "~/environments/primary/target";
6061
import { readEnvironmentScope } from "~/state/session";
6162
import { type EnvironmentPresentation, useRelayEnvironmentDiscovery } from "~/state/environments";
6263
import { APP_VERSION } from "~/branding";
@@ -449,14 +450,17 @@ export function LocalEnvironmentMcpUrlRow({ entry }: { readonly entry: Connectio
449450
tunnelHttpBaseUrl: cloudLink.data?.managedTunnelHttpBaseUrl,
450451
});
451452
if (mcpUrl === null) return null;
452-
const hosted = cloudLink.data?.managedTunnelHttpBaseUrl != null;
453+
const tunnelAvailable = cloudLink.data?.managedTunnelHttpBaseUrl != null;
454+
const loopback = isLoopbackHostname(new URL(mcpUrl).hostname);
453455
return (
454456
<SettingsRow
455457
{...searchableSetting("mcp-url")}
456458
description={
457-
hosted
459+
tunnelAvailable
458460
? `Give this URL to a hosted agent, such as ChatGPT: ${mcpUrl}`
459-
: `Give this URL to an agent outside T3 Code: ${mcpUrl}`
461+
: loopback
462+
? `Give this URL to an agent running on this machine: ${mcpUrl}`
463+
: `Give this URL to an agent that can reach this environment: ${mcpUrl}`
460464
}
461465
control={
462466
<Button size="sm" variant="outline" onClick={() => copyMcpUrl(mcpUrl, { url: mcpUrl })}>

‎docs/user/outside-agents.md‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@ running T3 Code can reach.
2323
For a saved remote environment, open **Settings → Environments**, open the
2424
environment's menu, and choose **Copy MCP URL**.
2525

26-
The copied URL uses the environment's T3 Connect address when it has one, and
27-
otherwise the route this device is connected over, so an agent on the same
28-
device can reach it.
26+
For the local environment, the copied URL uses its T3 Connect address when the
27+
tunnel is available, and otherwise a loopback or `https` route.
28+
29+
For a saved remote environment, the copied URL uses the connected route when
30+
that route has an address, and otherwise the first saved route with one.
2931

3032
- **An agent on your own computers** can use `localhost` on the host, T3
3133
Connect, or any `https` address, such as

0 commit comments

Comments
 (0)