diff --git a/apps/web/src/components/settings/ConnectionsSettings.tsx b/apps/web/src/components/settings/ConnectionsSettings.tsx index a6cf6a03b3a28..272f79e18ba79 100644 --- a/apps/web/src/components/settings/ConnectionsSettings.tsx +++ b/apps/web/src/components/settings/ConnectionsSettings.tsx @@ -142,6 +142,7 @@ import { ITEM_ROW_CLASSNAME } from "./itemRows"; import { CloudLinkRow, CloudRemoteEnvironmentRows, + LocalEnvironmentMcpUrlRow, SavedBackendListRow, } from "./SavedEnvironmentRows"; import { AddEnvironmentDialog } from "./AddEnvironmentDialog"; @@ -1377,6 +1378,9 @@ function ConnectionsSettingsContent({ } /> ) : null} + {isPrimaryAccess && accessEnvironment ? ( + + ) : null} {accessEnvironment ? (
diff --git a/apps/web/src/components/settings/SavedEnvironmentRows.tsx b/apps/web/src/components/settings/SavedEnvironmentRows.tsx index dc6923a4c0656..2c7ecaf9369fa 100644 --- a/apps/web/src/components/settings/SavedEnvironmentRows.tsx +++ b/apps/web/src/components/settings/SavedEnvironmentRows.tsx @@ -21,6 +21,8 @@ import { connectionErrorText, connectionStatusText, environmentMcpUrl, + localEnvironmentMcpUrl, + type ConnectionCatalogEntry, } from "@t3tools/client-runtime/connection"; import * as Option from "effect/Option"; import { msg, T, useGT, useMessages } from "gt-react"; @@ -54,10 +56,13 @@ import { hasCloudPublicConfig } from "~/cloud/publicConfig"; import { isElectron } from "~/env"; import { useT3ConnectTurnOn } from "~/cloud/useT3ConnectTurnOn"; import { useCloudLinkController } from "~/cloud/useCloudLinkController"; +import { usePrimaryCloudLinkState } from "~/cloud/cloudLinkState"; +import { t3ConnectMcpUrl } from "~/cloud/t3ConnectState"; import { useManagedTunnelUsage } from "~/cloud/managedRelayState"; import { useT3ConnectAccountPage } from "../clerk/T3ConnectAccountPages"; import { TunnelLimitAlert, TunnelUsageMeter } from "../cloud/TunnelUsage"; import { environmentCatalog } from "~/connection/catalog"; +import { isLoopbackHostname } from "~/environments/primary/target"; import { readEnvironmentScope } from "~/state/session"; import { type EnvironmentPresentation, useRelayEnvironmentDiscovery } from "~/state/environments"; import { APP_VERSION } from "~/branding"; @@ -123,6 +128,35 @@ function savedBackendStatus( } } +function useCopyMcpUrl() { + const gt = useGT(); + return useCopyToClipboard<{ url: string }>({ + target: { + target: "MCP URL", + unavailableMessage: msg("Clipboard API is unavailable while copying MCP URL."), + failureMessage: msg("Failed to copy MCP URL to the clipboard."), + }, + onCopy: ({ url }) => { + toastManager.add({ + type: "success", + title: gt("MCP URL copied"), + description: gt("Add it to an agent, e.g. claude mcp add --transport http t3 {url}", { + url, + }), + }); + }, + onError: (error) => { + toastManager.add( + stackedThreadToast({ + type: "error", + title: gt("Could not copy MCP URL"), + description: error.message, + }), + ); + }, + }); +} + export function SavedBackendListRow({ environment, removingEnvironmentId, @@ -161,31 +195,7 @@ export function SavedBackendListRow({ const copyTraceId = (traceId: string) => { copyTraceIdToClipboard(traceId, { traceId }); }; - const { copyToClipboard: copyMcpUrl } = useCopyToClipboard<{ url: string }>({ - target: { - target: "MCP URL", - unavailableMessage: msg("Clipboard API is unavailable while copying MCP URL."), - failureMessage: msg("Failed to copy MCP URL to the clipboard."), - }, - onCopy: ({ url }) => { - toastManager.add({ - type: "success", - title: gt("MCP URL copied"), - description: gt("Add it to an agent, e.g. claude mcp add --transport http t3 {url}", { - url, - }), - }); - }, - onError: (error) => { - toastManager.add( - stackedThreadToast({ - type: "error", - title: gt("Could not copy MCP URL"), - description: error.message, - }), - ); - }, - }); + const { copyToClipboard: copyMcpUrl } = useCopyMcpUrl(); const versionMismatch = resolveServerConfigVersionMismatch(environment.serverConfig, messages); const serverUpdateState = useAtomValue(serverEnvironment.updateStateAtom(environmentId)); const resumingServerUpdate = @@ -472,6 +482,52 @@ export function SavedBackendListRow({ ); } +/** Copying the host's own MCP address, for hosted agents or agents on this machine. */ +export function LocalEnvironmentMcpUrlRow({ entry }: { readonly entry: ConnectionCatalogEntry }) { + const cloudLink = usePrimaryCloudLinkState(); + const setting = useSearchableSetting(); + const gt = useGT(); + const { copyToClipboard: copyMcpUrl } = useCopyMcpUrl(); + const tunnelMcpUrl = t3ConnectMcpUrl({ + thisMachine: true, + tunnelHostname: cloudLink.data?.tunnelHostname, + relayEndpoint: undefined, + }); + const mcpUrl = tunnelMcpUrl ?? localEnvironmentMcpUrl({ entry }); + if (mcpUrl === null) return null; + const tunnelAvailable = tunnelMcpUrl !== null; + const tunnelReachability = tunnelAvailable ? cloudLink.data?.reachability : undefined; + const loopback = isLoopbackHostname(new URL(mcpUrl).hostname); + return ( + copyMcpUrl(mcpUrl, { url: mcpUrl })}> + Copy + + } + /> + ); +} + function CloudLinkSwitch({ checked, disabled, diff --git a/apps/web/src/components/settings/settingsSearch.ts b/apps/web/src/components/settings/settingsSearch.ts index b02f8d2f0b0c8..778a8180bd985 100644 --- a/apps/web/src/components/settings/settingsSearch.ts +++ b/apps/web/src/components/settings/settingsSearch.ts @@ -1361,6 +1361,14 @@ export const SETTINGS_SEARCH_ITEMS = [ desktopOnly: true, cloudOnly: true, }, + { + id: "mcp-url", + localEnvironmentOnly: true, + title: msg("MCP URL"), + to: "/settings/access", + targetId: "connections-environment", + searchTerms: [msg("outside agents chatgpt claude codex hosted bot oauth server address copy")], + }, { id: "connect-device-approval", title: msg("Require approval for new devices"), diff --git a/apps/web/src/i18n/translations/de.json b/apps/web/src/i18n/translations/de.json index 4c9f0f6d27e4f..d233af06e6b27 100644 --- a/apps/web/src/i18n/translations/de.json +++ b/apps/web/src/i18n/translations/de.json @@ -9291,10 +9291,10 @@ "8cbb63fdff9fde72": "Verbindung fehlgeschlagen: {error}", "cf11cf105b6de783": "Die Zwischenablage-API ist beim Kopieren der MCP-URL nicht verfügbar.", "cdacfb87d557007b": "Die MCP-URL konnte nicht in die Zwischenablage kopiert werden.", - "a9f514109c355d42": "Trace-ID konnte nicht kopiert werden", "7ae6db00431a85fe": "MCP-URL kopiert", "6e824889a09c2f09": "Füge sie zu einem Agenten hinzu, z. B. claude mcp add --transport http t3 {url}", "69f1a5115bd716c8": "MCP-URL konnte nicht kopiert werden", + "a9f514109c355d42": "Trace-ID konnte nicht kopiert werden", "4112c1a7b3c1d029": "Wird neu gestartet", "543ef9fcaf8aa96f": "Ausgeschaltet", "5173c50b0a60847c": "Update verfügbar: {serverVersion} → {clientVersion}", @@ -9308,6 +9308,11 @@ "2c23e82262a1f74f": "Weitere Aktionen für {label}", "15bce7dec2700d4d": "Routen ausblenden", "a214401e7be2b6a9": "Von diesem Gerät entfernen…", + "5603f949e77925d5": "Tunnel verbunden. Gib diese URL einem gehosteten Agenten, z. B. ChatGPT: {url}", + "93a6d008cde82198": "T3 Connect ist derzeit nicht erreichbar. Ein gehosteter Agent kann diese URL verwenden, sobald der Tunnel wieder funktioniert: {url}", + "79e3840f1ef8741e": "Gib diese URL einem gehosteten Agenten, z. B. ChatGPT: {url}", + "1d5f687593c4e8ed": "Gib diese URL einem Agenten, der auf diesem Rechner läuft: {url}", + "3db385bf17d8f48e": "Gib diese URL einem Agenten, der diese Umgebung erreichen kann: {url}", "ee2d0d27c593a9da": "T3 Connect aktivieren", "42d294de5860fbea": "Deine Sitzung hat keine Berechtigung, den T3-Connect-Zugriff zu verwalten.", "bfc76dfe5cd48f47": "T3 Connect verknüpft", @@ -9343,6 +9348,7 @@ "0e4f42dd41b74e9a": "Klicke auf „Umgebung hinzufügen“, um eine weitere Umgebung zu koppeln.", "579a261154e2db62": "MCP-URL kopieren", "4a1e6124e121d54f": "Trace-ID kopieren", + "ffd3cdd328e21c9d": "Kopieren", "8693499e957364d1": "Mehr Tunnel erhalten", "903d91cbbe864b52": "Keine gespeicherten Remote-Umgebungen", "c6ecee717dfa118b": "So", @@ -11549,6 +11555,8 @@ "92c2528040ca7442": "serve magicdns endpunkt remote sicher netzwerk", "ab23b9c923cc4e80": "windows subsystem linux distro zweiter server projekte stoppen windows backend neustart nur wsl", "814c6f3ba7c29f7c": "verwalteter tunnel cloud andere geräte remote tunnel limit t3 chat", + "b96de95f92a8eeeb": "MCP-URL", + "c0ca4e817099761e": "externe Agenten chatgpt claude codex gehostet Bot oauth Server Adresse kopieren", "5b2b522e0edc3d32": "t3 connect geräte genehmigen ablehnen vertrauen widerrufen kopplungscode sicherheit konto", "b5cd79513a06e7c3": "Webhooks offline zurückhalten", "fadd0fcd7b9e1651": "webhook automatisierungen offline warteschlange postfach t3 connect", diff --git a/apps/web/src/i18n/translations/en.json b/apps/web/src/i18n/translations/en.json index c40470b46e6ae..4f66c5cead1d8 100644 --- a/apps/web/src/i18n/translations/en.json +++ b/apps/web/src/i18n/translations/en.json @@ -9299,10 +9299,10 @@ "8cbb63fdff9fde72": "Connection failed: {error}", "cf11cf105b6de783": "Clipboard API is unavailable while copying MCP URL.", "cdacfb87d557007b": "Failed to copy MCP URL to the clipboard.", - "a9f514109c355d42": "Could not copy trace ID", "7ae6db00431a85fe": "MCP URL copied", "6e824889a09c2f09": "Add it to an agent, e.g. claude mcp add --transport http t3 {url}", "69f1a5115bd716c8": "Could not copy MCP URL", + "a9f514109c355d42": "Could not copy trace ID", "4112c1a7b3c1d029": "Restarting", "543ef9fcaf8aa96f": "Switched off", "5173c50b0a60847c": "Update available: {serverVersion} → {clientVersion}", @@ -9316,6 +9316,11 @@ "2c23e82262a1f74f": "More actions for {label}", "15bce7dec2700d4d": "Hide routes", "a214401e7be2b6a9": "Remove from this device…", + "5603f949e77925d5": "Tunnel connected. Give this URL to a hosted agent, such as ChatGPT: {url}", + "93a6d008cde82198": "T3 Connect is unreachable right now, so a hosted agent can use this URL after the tunnel recovers: {url}", + "79e3840f1ef8741e": "Give this URL to a hosted agent, such as ChatGPT: {url}", + "1d5f687593c4e8ed": "Give this URL to an agent running on this machine: {url}", + "3db385bf17d8f48e": "Give this URL to an agent that can reach this environment: {url}", "ee2d0d27c593a9da": "Enable T3 Connect", "42d294de5860fbea": "Your session does not have permission to manage T3 Connect access.", "bfc76dfe5cd48f47": "T3 Connect linked", @@ -9351,6 +9356,7 @@ "0e4f42dd41b74e9a": "Click “Add environment” to pair another environment.", "579a261154e2db62": "Copy MCP URL", "4a1e6124e121d54f": "Copy trace ID", + "ffd3cdd328e21c9d": "Copy", "8693499e957364d1": "Get more tunnels", "903d91cbbe864b52": "No saved remote environments", "c6ecee717dfa118b": "Su", @@ -11557,6 +11563,8 @@ "92c2528040ca7442": "serve magicdns endpoint remote secure network", "ab23b9c923cc4e80": "windows subsystem linux distro second server projects stop windows backend restart wsl only", "814c6f3ba7c29f7c": "managed tunnel cloud other devices remote tunnels limit t3 chat", + "b96de95f92a8eeeb": "MCP URL", + "c0ca4e817099761e": "outside agents chatgpt claude codex hosted bot oauth server address copy", "5b2b522e0edc3d32": "t3 connect devices approve deny trust revoke pairing code security account", "b5cd79513a06e7c3": "Hold webhooks while offline", "fadd0fcd7b9e1651": "webhook automations offline queue mailbox t3 connect", diff --git a/apps/web/src/i18n/translations/es.json b/apps/web/src/i18n/translations/es.json index 68f63f589f51e..cac9684fc2bf0 100644 --- a/apps/web/src/i18n/translations/es.json +++ b/apps/web/src/i18n/translations/es.json @@ -9287,10 +9287,10 @@ "8cbb63fdff9fde72": "Falló la conexión: {error}", "cf11cf105b6de783": "La API del portapapeles no está disponible al copiar la URL de MCP.", "cdacfb87d557007b": "No se pudo copiar la URL de MCP al portapapeles.", - "a9f514109c355d42": "No se pudo copiar el ID de traza", "7ae6db00431a85fe": "URL de MCP copiada", "6e824889a09c2f09": "Añádela a un agente, p. ej., claude mcp add --transport http t3 {url}", "69f1a5115bd716c8": "No se pudo copiar la URL de MCP", + "a9f514109c355d42": "No se pudo copiar el ID de traza", "4112c1a7b3c1d029": "Reiniciando", "543ef9fcaf8aa96f": "Apagado", "5173c50b0a60847c": "Actualización disponible: {serverVersion} → {clientVersion}", @@ -9304,6 +9304,11 @@ "2c23e82262a1f74f": "Más acciones para {label}", "15bce7dec2700d4d": "Ocultar rutas", "a214401e7be2b6a9": "Quitar de este dispositivo…", + "5603f949e77925d5": "Túnel conectado. Dale esta URL a un agente alojado, como ChatGPT: {url}", + "93a6d008cde82198": "T3 Connect no está disponible ahora. Un agente alojado podrá usar esta URL cuando se recupere el túnel: {url}", + "79e3840f1ef8741e": "Dale esta URL a un agente alojado, como ChatGPT: {url}", + "1d5f687593c4e8ed": "Dale esta URL a un agente que se ejecute en esta máquina: {url}", + "3db385bf17d8f48e": "Dale esta URL a un agente que pueda acceder a este entorno: {url}", "ee2d0d27c593a9da": "Activar T3 Connect", "42d294de5860fbea": "Tu sesión no tiene permiso para gestionar el acceso a T3 Connect.", "bfc76dfe5cd48f47": "T3 Connect vinculado", @@ -9339,6 +9344,7 @@ "0e4f42dd41b74e9a": "Haz clic en «Añadir entorno» para emparejar otro entorno.", "579a261154e2db62": "Copiar URL de MCP", "4a1e6124e121d54f": "Copiar ID de traza", + "ffd3cdd328e21c9d": "Copiar", "8693499e957364d1": "Obtener más túneles", "903d91cbbe864b52": "No hay entornos remotos guardados", "c6ecee717dfa118b": "Do", @@ -11542,6 +11548,8 @@ "92c2528040ca7442": "serve magicdns endpoint remoto seguro red", "ab23b9c923cc4e80": "windows subsistema linux distro segundo servidor proyectos detener backend de windows reiniciar solo wsl", "814c6f3ba7c29f7c": "túnel gestionado nube otros dispositivos remoto túneles límite t3 chat", + "b96de95f92a8eeeb": "URL de MCP", + "c0ca4e817099761e": "agentes externos chatgpt claude codex alojado bot oauth servidor dirección copiar", "5b2b522e0edc3d32": "t3 connect dispositivos aprobar denegar confiar revocar código de emparejamiento seguridad cuenta", "b5cd79513a06e7c3": "Retener webhooks sin conexión", "fadd0fcd7b9e1651": "webhook automatizaciones sin conexión cola buzón t3 connect", diff --git a/apps/web/src/i18n/translations/fr.json b/apps/web/src/i18n/translations/fr.json index 442c22ed3a2d7..fd05339f6b7de 100644 --- a/apps/web/src/i18n/translations/fr.json +++ b/apps/web/src/i18n/translations/fr.json @@ -9289,10 +9289,10 @@ "8cbb63fdff9fde72": "Échec de la connexion : {error}", "cf11cf105b6de783": "L’API Presse-papiers n’est pas disponible pour copier l’URL MCP.", "cdacfb87d557007b": "Impossible de copier l’URL MCP dans le presse-papiers.", - "a9f514109c355d42": "Impossible de copier l’ID de trace", "7ae6db00431a85fe": "URL MCP copiée", "6e824889a09c2f09": "Ajoutez-la à un agent, par ex. claude mcp add --transport http t3 {url}", "69f1a5115bd716c8": "Impossible de copier l’URL MCP", + "a9f514109c355d42": "Impossible de copier l’ID de trace", "4112c1a7b3c1d029": "Redémarrage", "543ef9fcaf8aa96f": "Éteint", "5173c50b0a60847c": "Mise à jour disponible : {serverVersion} → {clientVersion}", @@ -9306,6 +9306,11 @@ "2c23e82262a1f74f": "Plus d’actions pour {label}", "15bce7dec2700d4d": "Masquer les routes", "a214401e7be2b6a9": "Retirer de cet appareil…", + "5603f949e77925d5": "Tunnel connecté. Donnez cette URL à un agent hébergé, comme ChatGPT : {url}", + "93a6d008cde82198": "T3 Connect est actuellement inaccessible. Un agent hébergé pourra utiliser cette URL après le rétablissement du tunnel : {url}", + "79e3840f1ef8741e": "Donnez cette URL à un agent hébergé, comme ChatGPT : {url}", + "1d5f687593c4e8ed": "Donnez cette URL à un agent exécuté sur cette machine : {url}", + "3db385bf17d8f48e": "Donnez cette URL à un agent pouvant accéder à cet environnement : {url}", "ee2d0d27c593a9da": "Activer T3 Connect", "42d294de5860fbea": "Votre session n’est pas autorisée à gérer l’accès T3 Connect.", "bfc76dfe5cd48f47": "T3 Connect associé", @@ -9341,6 +9346,7 @@ "0e4f42dd41b74e9a": "Cliquez sur « Ajouter un environnement » pour appairer un autre environnement.", "579a261154e2db62": "Copier l’URL MCP", "4a1e6124e121d54f": "Copier l’ID de trace", + "ffd3cdd328e21c9d": "Copier", "8693499e957364d1": "Obtenir plus de tunnels", "903d91cbbe864b52": "Aucun environnement distant enregistré", "c6ecee717dfa118b": "Di", @@ -11547,6 +11553,8 @@ "92c2528040ca7442": "serve magicdns point de terminaison distant sécurisé réseau", "ab23b9c923cc4e80": "windows sous-système linux distribution second serveur projets arrêter backend windows redémarrer wsl uniquement", "814c6f3ba7c29f7c": "tunnel géré cloud autres appareils tunnels distants limite t3 chat", + "b96de95f92a8eeeb": "URL MCP", + "c0ca4e817099761e": "agents externes chatgpt claude codex hébergé bot oauth serveur adresse copier", "5b2b522e0edc3d32": "t3 connect appareils approuver refuser confiance révoquer code d’appairage sécurité compte", "b5cd79513a06e7c3": "Conserver les webhooks hors ligne", "fadd0fcd7b9e1651": "webhook automatisations file d’attente hors ligne boîte aux lettres t3 connect", diff --git a/apps/web/src/i18n/translations/ja.json b/apps/web/src/i18n/translations/ja.json index c9417551b208c..cde8c649c46cf 100644 --- a/apps/web/src/i18n/translations/ja.json +++ b/apps/web/src/i18n/translations/ja.json @@ -9244,10 +9244,10 @@ "8cbb63fdff9fde72": "接続に失敗しました: {error}", "cf11cf105b6de783": "MCP の URL をコピーする際にクリップボード API を利用できませんでした。", "cdacfb87d557007b": "MCP の URL をクリップボードにコピーできませんでした。", - "a9f514109c355d42": "トレース ID をコピーできませんでした", "7ae6db00431a85fe": "MCP URL をコピーしました", "6e824889a09c2f09": "エージェントに追加してください。例: claude mcp add --transport http t3 {url}", "69f1a5115bd716c8": "MCP URL をコピーできませんでした", + "a9f514109c355d42": "トレース ID をコピーできませんでした", "4112c1a7b3c1d029": "再起動中", "543ef9fcaf8aa96f": "オフ", "5173c50b0a60847c": "更新があります: {serverVersion} → {clientVersion}", @@ -9261,6 +9261,11 @@ "2c23e82262a1f74f": "{label} のその他の操作", "15bce7dec2700d4d": "ルートを非表示", "a214401e7be2b6a9": "このデバイスから削除…", + "5603f949e77925d5": "トンネルに接続しました。この URL を ChatGPT などのホスト型エージェントに渡してください: {url}", + "93a6d008cde82198": "現在 T3 Connect に接続できません。トンネルが復旧すると、ホスト型エージェントでこの URL を使用できます: {url}", + "79e3840f1ef8741e": "この URL を ChatGPT などのホスト型エージェントに渡してください: {url}", + "1d5f687593c4e8ed": "この URL をこのマシンで実行しているエージェントに渡してください: {url}", + "3db385bf17d8f48e": "この URL をこの環境にアクセスできるエージェントに渡してください: {url}", "ee2d0d27c593a9da": "T3 Connect を有効にする", "42d294de5860fbea": "あなたのセッションには T3 Connect のアクセスを管理する権限がありません。", "bfc76dfe5cd48f47": "T3 Connect をリンクしました", @@ -9296,6 +9301,7 @@ "0e4f42dd41b74e9a": "「環境を追加」をクリックして別の環境をペアリングしてください。", "579a261154e2db62": "MCP URL をコピー", "4a1e6124e121d54f": "トレース ID をコピー", + "ffd3cdd328e21c9d": "コピー", "8693499e957364d1": "トンネルを追加で入手", "903d91cbbe864b52": "保存されたリモート環境はありません", "c6ecee717dfa118b": "日", @@ -11497,6 +11503,8 @@ "92c2528040ca7442": "serve MagicDNS エンドポイント リモート 安全 ネットワーク tailscale", "ab23b9c923cc4e80": "Windows Subsystem for Linux ディストリビューション 2 つ目のサーバー プロジェクト 停止 Windows バックエンド 再起動 WSL のみ wsl", "814c6f3ba7c29f7c": "マネージドトンネル クラウド 他のデバイス リモート トンネル 上限 T3 Chat tunnel", + "b96de95f92a8eeeb": "MCP URL", + "c0ca4e817099761e": "外部 エージェント chatgpt claude codex ホスト型 ボット oauth サーバー アドレス コピー", "5b2b522e0edc3d32": "T3 Connect デバイス 承認 拒否 信頼 取り消し ペアリングコード セキュリティ アカウント devices", "b5cd79513a06e7c3": "オフライン中の Webhook を保持", "fadd0fcd7b9e1651": "Webhook オートメーション オフライン キュー メールボックス T3 Connect webhook", diff --git a/apps/web/src/i18n/translations/ko.json b/apps/web/src/i18n/translations/ko.json index 362d29d071a87..dc06e830e5c60 100644 --- a/apps/web/src/i18n/translations/ko.json +++ b/apps/web/src/i18n/translations/ko.json @@ -9247,10 +9247,10 @@ "8cbb63fdff9fde72": "연결 실패: {error}", "cf11cf105b6de783": "MCP URL을 복사하는 중 클립보드 API를 사용할 수 없습니다.", "cdacfb87d557007b": "MCP URL을 클립보드에 복사하지 못했습니다.", - "a9f514109c355d42": "추적 ID를 복사할 수 없습니다", "7ae6db00431a85fe": "MCP URL을 복사했습니다", "6e824889a09c2f09": "에이전트에 추가하세요. 예: claude mcp add --transport http t3 {url}", "69f1a5115bd716c8": "MCP URL을 복사할 수 없습니다", + "a9f514109c355d42": "추적 ID를 복사할 수 없습니다", "4112c1a7b3c1d029": "다시 시작 중", "543ef9fcaf8aa96f": "꺼짐", "5173c50b0a60847c": "업데이트 가능: {serverVersion} → {clientVersion}", @@ -9264,6 +9264,11 @@ "2c23e82262a1f74f": "{label}에 대한 추가 작업", "15bce7dec2700d4d": "경로 숨기기", "a214401e7be2b6a9": "이 기기에서 제거…", + "5603f949e77925d5": "터널이 연결되었습니다. ChatGPT 같은 호스팅된 에이전트에 이 URL을 전달하세요: {url}", + "93a6d008cde82198": "현재 T3 Connect에 연결할 수 없습니다. 터널이 복구되면 호스팅된 에이전트가 이 URL을 사용할 수 있습니다: {url}", + "79e3840f1ef8741e": "ChatGPT 같은 호스팅된 에이전트에 이 URL을 전달하세요: {url}", + "1d5f687593c4e8ed": "이 컴퓨터에서 실행 중인 에이전트에 이 URL을 전달하세요: {url}", + "3db385bf17d8f48e": "이 환경에 접근할 수 있는 에이전트에 이 URL을 전달하세요: {url}", "ee2d0d27c593a9da": "T3 Connect 사용", "42d294de5860fbea": "현재 세션에는 T3 Connect 액세스를 관리할 권한이 없습니다.", "bfc76dfe5cd48f47": "T3 Connect 연결됨", @@ -9299,6 +9304,7 @@ "0e4f42dd41b74e9a": "다른 환경을 페어링하려면 “환경 추가”를 클릭하세요.", "579a261154e2db62": "MCP URL 복사", "4a1e6124e121d54f": "추적 ID 복사", + "ffd3cdd328e21c9d": "복사", "8693499e957364d1": "터널 더 받기", "903d91cbbe864b52": "저장된 원격 환경 없음", "c6ecee717dfa118b": "일", @@ -11494,6 +11500,8 @@ "92c2528040ca7442": "serve magicdns 엔드포인트 원격 보안 네트워크", "ab23b9c923cc4e80": "windows subsystem linux 배포판 두 번째 서버 프로젝트 중지 windows 백엔드 다시 시작 wsl 전용", "814c6f3ba7c29f7c": "관리형 터널 클라우드 다른 기기 원격 터널 한도 T3 Chat", + "b96de95f92a8eeeb": "MCP URL", + "c0ca4e817099761e": "외부 에이전트 chatgpt claude codex 호스팅 봇 oauth 서버 주소 복사", "5b2b522e0edc3d32": "T3 Connect 기기 승인 거부 신뢰 취소 페어링 코드 보안 계정", "b5cd79513a06e7c3": "오프라인 동안 웹후크 보관", "fadd0fcd7b9e1651": "웹후크 자동화 오프라인 대기열 메일함 T3 Connect", diff --git a/apps/web/src/i18n/translations/pt-BR.json b/apps/web/src/i18n/translations/pt-BR.json index b598943e92383..4601f6f911e96 100644 --- a/apps/web/src/i18n/translations/pt-BR.json +++ b/apps/web/src/i18n/translations/pt-BR.json @@ -9288,10 +9288,10 @@ "8cbb63fdff9fde72": "Falha na conexão: {error}", "cf11cf105b6de783": "A API da área de transferência não está disponível ao copiar a URL do MCP.", "cdacfb87d557007b": "Falha ao copiar a URL do MCP para a área de transferência.", - "a9f514109c355d42": "Não foi possível copiar o ID do trace", "7ae6db00431a85fe": "URL do MCP copiada", "6e824889a09c2f09": "Adicione-a a um agente, ex.: claude mcp add --transport http t3 {url}", "69f1a5115bd716c8": "Não foi possível copiar a URL do MCP", + "a9f514109c355d42": "Não foi possível copiar o ID do trace", "4112c1a7b3c1d029": "Reiniciando", "543ef9fcaf8aa96f": "Desligado", "5173c50b0a60847c": "Atualização disponível: {serverVersion} → {clientVersion}", @@ -9305,6 +9305,11 @@ "2c23e82262a1f74f": "Mais ações para {label}", "15bce7dec2700d4d": "Ocultar rotas", "a214401e7be2b6a9": "Remover deste dispositivo…", + "5603f949e77925d5": "Túnel conectado. Forneça esta URL a um agente hospedado, como o ChatGPT: {url}", + "93a6d008cde82198": "O T3 Connect está inacessível no momento. Um agente hospedado poderá usar esta URL quando o túnel se recuperar: {url}", + "79e3840f1ef8741e": "Forneça esta URL a um agente hospedado, como o ChatGPT: {url}", + "1d5f687593c4e8ed": "Forneça esta URL a um agente em execução nesta máquina: {url}", + "3db385bf17d8f48e": "Forneça esta URL a um agente que possa acessar este ambiente: {url}", "ee2d0d27c593a9da": "Ativar T3 Connect", "42d294de5860fbea": "Sua sessão não tem permissão para gerenciar o acesso ao T3 Connect.", "bfc76dfe5cd48f47": "T3 Connect vinculado", @@ -9340,6 +9345,7 @@ "0e4f42dd41b74e9a": "Clique em “Adicionar ambiente” para parear outro ambiente.", "579a261154e2db62": "Copiar URL do MCP", "4a1e6124e121d54f": "Copiar ID de rastreamento", + "ffd3cdd328e21c9d": "Copiar", "8693499e957364d1": "Obter mais túneis", "903d91cbbe864b52": "Nenhum ambiente remoto salvo", "c6ecee717dfa118b": "Do", @@ -11546,6 +11552,8 @@ "92c2528040ca7442": "serve magicdns endpoint remoto seguro rede", "ab23b9c923cc4e80": "windows subsystem linux distro segundo servidor projetos parar backend do windows reiniciar só wsl", "814c6f3ba7c29f7c": "túnel gerenciado nuvem outros dispositivos remoto túneis limite t3 chat", + "b96de95f92a8eeeb": "URL do MCP", + "c0ca4e817099761e": "agentes externos chatgpt claude codex hospedado bot oauth servidor endereço copiar", "5b2b522e0edc3d32": "t3 connect dispositivos aprovar negar confiar revogar código de pareamento segurança conta", "b5cd79513a06e7c3": "Reter webhooks enquanto offline", "fadd0fcd7b9e1651": "webhook automações offline fila caixa de correio t3 connect", diff --git a/apps/web/src/i18n/translations/ru.json b/apps/web/src/i18n/translations/ru.json index a8a54a6500e59..7ce0832d14f21 100644 --- a/apps/web/src/i18n/translations/ru.json +++ b/apps/web/src/i18n/translations/ru.json @@ -9291,10 +9291,10 @@ "8cbb63fdff9fde72": "Ошибка подключения: {error}", "cf11cf105b6de783": "API буфера обмена недоступен при копировании URL MCP.", "cdacfb87d557007b": "Не удалось скопировать URL MCP в буфер обмена.", - "a9f514109c355d42": "Не удалось скопировать ID трассировки", "7ae6db00431a85fe": "URL MCP скопирован", "6e824889a09c2f09": "Добавьте его агенту, например claude mcp add --transport http t3 {url}", "69f1a5115bd716c8": "Не удалось скопировать URL MCP", + "a9f514109c355d42": "Не удалось скопировать ID трассировки", "4112c1a7b3c1d029": "Перезапуск", "543ef9fcaf8aa96f": "Выключено", "5173c50b0a60847c": "Доступно обновление: {serverVersion} → {clientVersion}", @@ -9308,6 +9308,11 @@ "2c23e82262a1f74f": "Другие действия для {label}", "15bce7dec2700d4d": "Скрыть маршруты", "a214401e7be2b6a9": "Удалить с этого устройства…", + "5603f949e77925d5": "Туннель подключён. Передайте этот URL размещённому агенту, например ChatGPT: {url}", + "93a6d008cde82198": "Сейчас T3 Connect недоступен. Размещённый агент сможет использовать этот URL после восстановления туннеля: {url}", + "79e3840f1ef8741e": "Передайте этот URL размещённому агенту, например ChatGPT: {url}", + "1d5f687593c4e8ed": "Передайте этот URL агенту, работающему на этом компьютере: {url}", + "3db385bf17d8f48e": "Передайте этот URL агенту, у которого есть доступ к этой среде: {url}", "ee2d0d27c593a9da": "Включить T3 Connect", "42d294de5860fbea": "У вашего сеанса нет прав на управление доступом T3 Connect.", "bfc76dfe5cd48f47": "T3 Connect привязан", @@ -9343,6 +9348,7 @@ "0e4f42dd41b74e9a": "Нажмите «Добавить окружение», чтобы выполнить сопряжение с другим окружением.", "579a261154e2db62": "Копировать URL MCP", "4a1e6124e121d54f": "Копировать ID трассировки", + "ffd3cdd328e21c9d": "Копировать", "8693499e957364d1": "Получить больше туннелей", "903d91cbbe864b52": "Нет сохранённых удалённых окружений", "c6ecee717dfa118b": "Вс", @@ -11547,6 +11553,8 @@ "92c2528040ca7442": "serve magicdns конечная точка удалённый защищённая сеть", "ab23b9c923cc4e80": "windows subsystem linux дистрибутив второй сервер проекты остановить бэкенд windows перезапуск только wsl", "814c6f3ba7c29f7c": "управляемый туннель облако другие устройства удалённые туннели лимит t3 chat", + "b96de95f92a8eeeb": "URL MCP", + "c0ca4e817099761e": "внешние агенты chatgpt claude codex размещённый бот oauth сервер адрес копировать", "5b2b522e0edc3d32": "t3 connect устройства одобрить отклонить доверять отозвать код сопряжения безопасность аккаунт", "b5cd79513a06e7c3": "Удерживать вебхуки в офлайне", "fadd0fcd7b9e1651": "вебхук автоматизации офлайн очередь почтовый ящик t3 connect", diff --git a/apps/web/src/i18n/translations/sv.json b/apps/web/src/i18n/translations/sv.json index adaf8566b6411..36982e886329c 100644 --- a/apps/web/src/i18n/translations/sv.json +++ b/apps/web/src/i18n/translations/sv.json @@ -9297,10 +9297,10 @@ "8cbb63fdff9fde72": "Anslutningen misslyckades: {error}", "cf11cf105b6de783": "Urklipps-API:t är inte tillgängligt vid kopiering av MCP-URL:en.", "cdacfb87d557007b": "Kunde inte kopiera MCP-URL:en till urklipp.", - "a9f514109c355d42": "Kunde inte kopiera spårnings-id", "7ae6db00431a85fe": "MCP-URL kopierad", "6e824889a09c2f09": "Lägg till den i en agent, t.ex. claude mcp add --transport http t3 {url}", "69f1a5115bd716c8": "Kunde inte kopiera MCP-URL", + "a9f514109c355d42": "Kunde inte kopiera spårnings-id", "4112c1a7b3c1d029": "Startar om", "543ef9fcaf8aa96f": "Avstängd", "5173c50b0a60847c": "Uppdatering tillgänglig: {serverVersion} → {clientVersion}", @@ -9314,6 +9314,11 @@ "2c23e82262a1f74f": "Fler åtgärder för {label}", "15bce7dec2700d4d": "Dölj rutter", "a214401e7be2b6a9": "Ta bort från den här enheten…", + "5603f949e77925d5": "Tunneln är ansluten. Ge denna URL till en molnbaserad agent, till exempel ChatGPT: {url}", + "93a6d008cde82198": "T3 Connect kan inte nås just nu. En molnbaserad agent kan använda denna URL när tunneln fungerar igen: {url}", + "79e3840f1ef8741e": "Ge denna URL till en molnbaserad agent, till exempel ChatGPT: {url}", + "1d5f687593c4e8ed": "Ge denna URL till en agent som körs på den här datorn: {url}", + "3db385bf17d8f48e": "Ge denna URL till en agent som kan nå den här miljön: {url}", "ee2d0d27c593a9da": "Aktivera T3 Connect", "42d294de5860fbea": "Din session har inte behörighet att hantera åtkomst till T3 Connect.", "bfc76dfe5cd48f47": "T3 Connect länkat", @@ -9349,6 +9354,7 @@ "0e4f42dd41b74e9a": "Klicka på ”Lägg till miljö” för att parkoppla en annan miljö.", "579a261154e2db62": "Kopiera MCP-URL", "4a1e6124e121d54f": "Kopiera spårnings-ID", + "ffd3cdd328e21c9d": "Kopiera", "8693499e957364d1": "Skaffa fler tunnlar", "903d91cbbe864b52": "Inga sparade fjärrmiljöer", "c6ecee717dfa118b": "Sö", @@ -11555,6 +11561,8 @@ "92c2528040ca7442": "serve magicdns slutpunkt fjärr säkert nätverk", "ab23b9c923cc4e80": "windows subsystem linux distro andra server projekt stoppa windows backend starta om bara wsl", "814c6f3ba7c29f7c": "hanterad tunnel moln andra enheter fjärr tunnlar gräns t3 chat", + "b96de95f92a8eeeb": "MCP-URL", + "c0ca4e817099761e": "externa agenter chatgpt claude codex molnbaserad bot oauth server adress kopiera", "5b2b522e0edc3d32": "t3 connect enheter godkänn neka lita på återkalla parkopplingskod säkerhet konto", "b5cd79513a06e7c3": "Håll kvar webhooks i offlineläge", "fadd0fcd7b9e1651": "webhook automatiseringar offline kö brevlåda t3 connect", diff --git a/apps/web/src/i18n/translations/zh.json b/apps/web/src/i18n/translations/zh.json index f386e717a0614..f4f1266cd7487 100644 --- a/apps/web/src/i18n/translations/zh.json +++ b/apps/web/src/i18n/translations/zh.json @@ -9305,10 +9305,10 @@ "8cbb63fdff9fde72": "连接失败:{error}", "cf11cf105b6de783": "复制 MCP URL 时剪贴板 API 不可用。", "cdacfb87d557007b": "无法将 MCP URL 复制到剪贴板。", - "a9f514109c355d42": "无法复制追踪 ID", "7ae6db00431a85fe": "已复制 MCP URL", "6e824889a09c2f09": "将其添加到智能体,例如 claude mcp add --transport http t3 {url}", "69f1a5115bd716c8": "无法复制 MCP URL", + "a9f514109c355d42": "无法复制追踪 ID", "4112c1a7b3c1d029": "正在重启", "543ef9fcaf8aa96f": "已停用", "5173c50b0a60847c": "有可用更新:{serverVersion} → {clientVersion}", @@ -9322,6 +9322,11 @@ "2c23e82262a1f74f": "{label} 的更多操作", "15bce7dec2700d4d": "隐藏线路", "a214401e7be2b6a9": "从此设备移除…", + "5603f949e77925d5": "隧道已连接。请将此 URL 提供给 ChatGPT 等托管代理:{url}", + "93a6d008cde82198": "T3 Connect 目前无法访问。隧道恢复后,托管代理即可使用此 URL:{url}", + "79e3840f1ef8741e": "请将此 URL 提供给 ChatGPT 等托管代理:{url}", + "1d5f687593c4e8ed": "请将此 URL 提供给在本机上运行的代理:{url}", + "3db385bf17d8f48e": "请将此 URL 提供给能够访问此环境的代理:{url}", "ee2d0d27c593a9da": "启用 T3 Connect", "42d294de5860fbea": "你当前的连接无权管理 T3 Connect 访问权限。", "bfc76dfe5cd48f47": "已关联 T3 Connect", @@ -9357,6 +9362,7 @@ "0e4f42dd41b74e9a": "点击“添加环境”配对其他环境。", "579a261154e2db62": "复制 MCP URL", "4a1e6124e121d54f": "复制追踪 ID", + "ffd3cdd328e21c9d": "复制", "8693499e957364d1": "获取更多隧道", "903d91cbbe864b52": "没有已保存的远程环境", "c6ecee717dfa118b": "日", @@ -11571,6 +11577,8 @@ "92c2528040ca7442": "serve magicdns 端点 远程 安全 网络", "ab23b9c923cc4e80": "windows 子系统 linux 发行版 第二服务器 项目 停止 windows 后端 重启 wsl 仅", "814c6f3ba7c29f7c": "托管隧道 云 其他设备 远程 隧道 限制 t3 chat", + "b96de95f92a8eeeb": "MCP URL", + "c0ca4e817099761e": "外部 代理 chatgpt claude codex 托管 机器人 oauth 服务器 地址 复制", "5b2b522e0edc3d32": "t3 connect 设备 批准 拒绝 信任 撤销 配对码 安全 账户", "b5cd79513a06e7c3": "离线时保留 webhook", "fadd0fcd7b9e1651": "webhook 自动化 离线 队列 邮箱 t3 connect", diff --git a/docs/user/outside-agents.md b/docs/user/outside-agents.md index 97bc0d385a3d7..36a22dc18e280 100644 --- a/docs/user/outside-agents.md +++ b/docs/user/outside-agents.md @@ -27,17 +27,27 @@ client ID cannot connect. ## Get the MCP URL -In **Settings → Environments**, open a saved environment's menu and choose -**Copy MCP URL**. The URL is the environment's address followed by `/mcp`, for -example: +For the environment on this machine, open **Settings → Sharing & access** and +find **MCP URL** on its card. With T3 Connect on and its tunnel connected, this +is the environment's public address followed by `/mcp`: ```text https:///mcp ``` -When T3 Connect serves the environment, the copied URL is its T3 Connect -address, which agents can reach from anywhere. Otherwise it uses the route this -device is connected over, so an agent on the same device can reach it. +That is the URL a hosted agent, such as ChatGPT, needs, because it can reach +this environment from anywhere. Without a tunnel URL, the setting shows a +loopback or `https` route instead; a plain-HTTP LAN route has no MCP URL row. +Only the loopback address is limited to the machine running T3 Code. + +For a saved remote environment, open **Settings → Environments**, open the +environment's menu, and choose **Copy MCP URL**. + +For the local environment, the copied URL uses its T3 Connect address when the +tunnel is available, and otherwise a loopback or `https` route. + +For a saved remote environment, the copied URL uses the connected route when +that route has an address, and otherwise the first saved route with one. - **An agent on your own computers** can use `localhost` on the host, T3 Connect, or any `https` address, such as diff --git a/docs/user/remote-access.md b/docs/user/remote-access.md index ad0fcb12503e1..b1b0bad07f613 100644 --- a/docs/user/remote-access.md +++ b/docs/user/remote-access.md @@ -350,8 +350,10 @@ environment of an already running T3 server. ## Connect an outside agent Claude Code, Codex, ChatGPT and other agents T3 Code did not start can drive -threads on an environment through its MCP server. See -[outside agents](./outside-agents.md) for setup. +threads on an environment through its MCP server. On the host, **Settings → +Sharing & access** shows the MCP URL to give the agent, including its T3 Connect +address when the tunnel is on. See [outside agents](./outside-agents.md) for +setup. ## Link another environment diff --git a/packages/client-runtime/src/connection/presentation.test.ts b/packages/client-runtime/src/connection/presentation.test.ts index 9ed24ab55b048..8f39813fc5e84 100644 --- a/packages/client-runtime/src/connection/presentation.test.ts +++ b/packages/client-runtime/src/connection/presentation.test.ts @@ -10,6 +10,7 @@ import { import { BearerConnectionTarget, ConnectionTransientError, + PrimaryConnectionTarget, RelayConnectionTarget, type SupervisorConnectionState, } from "./model.ts"; @@ -17,6 +18,7 @@ import { connectionStatusText, connectionStatusTitle, environmentMcpUrl, + localEnvironmentMcpUrl, presentConnectionState, } from "./presentation.ts"; @@ -120,6 +122,33 @@ describe("connection presentation", () => { ).toBe("https://tunnel.example.test/mcp"); }); + it("offers loopback and https, but never a plain-http LAN address", () => { + const primary = new PrimaryConnectionTarget({ + environmentId: TARGET.environmentId, + label: "This machine", + httpBaseUrl: "http://127.0.0.1:3773", + wsBaseUrl: "ws://127.0.0.1:3773", + }); + const entry: ConnectionCatalogEntry = { + ...ENTRY, + target: primary, + profile: Option.none(), + }; + + expect(localEnvironmentMcpUrl({ entry })).toBe("http://127.0.0.1:3773/mcp"); + + const lan: ConnectionCatalogEntry = { + ...entry, + target: new PrimaryConnectionTarget({ + environmentId: TARGET.environmentId, + label: "This machine", + httpBaseUrl: "http://192.168.4.53:3773", + wsBaseUrl: "ws://192.168.4.53:3773", + }), + }; + expect(localEnvironmentMcpUrl({ entry: lan })).toBeNull(); + }); + it("distinguishes initial connection, reconnect, and retry errors", () => { expect(presentConnectionState(supervisorState({ phase: "connecting", attempt: 1 }))).toEqual({ phase: "connecting", diff --git a/packages/client-runtime/src/connection/presentation.ts b/packages/client-runtime/src/connection/presentation.ts index 3e3a80530d2d0..74eaf4d68ffea 100644 --- a/packages/client-runtime/src/connection/presentation.ts +++ b/packages/client-runtime/src/connection/presentation.ts @@ -1,4 +1,5 @@ import type { ServerConfig } from "@t3tools/contracts"; +import { isLocalLoopbackHost } from "@t3tools/shared/hostClassification"; import * as Option from "effect/Option"; import { mFallback, msg } from "gt-i18n"; import type { MFunctionType } from "gt-i18n/types"; @@ -172,6 +173,22 @@ export function environmentMcpUrl(input: { return null; } +/** + * The MCP address for the environment this app runs. Agents only sign in over https or + * loopback, so a plain-http LAN address is not offered. + */ +export function localEnvironmentMcpUrl(input: { + readonly entry: ConnectionCatalogEntry; +}): string | null { + const mcpUrl = environmentMcpUrl({ entry: input.entry }); + return mcpUrl !== null && isAgentSignInMcpUrl(mcpUrl) ? mcpUrl : null; +} + +function isAgentSignInMcpUrl(mcpUrl: string): boolean { + const url = new URL(mcpUrl); + return url.protocol === "https:" || isLocalLoopbackHost(url.hostname); +} + function mcpUrlFromBase(httpBaseUrl: string): string | null { let url: URL; try {