import { Banner, ClipboardText, Select, Text } from "@cloudhal/ui"; import { Warning } from "@phosphor-icons/react"; import { useState } from "react"; import { useT } from "../i18n/index.tsx"; import { defaultOauthClient, OAUTH_CLIENTS, type OauthClient, type OauthClientStatus, type OauthServerInfo, oauthClientStatus, oauthSnippet, oauthSnippetLang, } from "../lib/oauth-clients.ts"; import { CodeHighlighted } from "./CodeHighlighted.tsx"; /** * "Connect by URL" (RFC-0044 §4, §11): the deployment's `/mcp` URL and, for one client at a time, * what to paste and where. No key: the client opens Studio to sign in and approve. A client that * cannot connect says so: Cursor needs DCR, and Claude.ai and ChatGPT cannot reach a local or * plain-http URL (the picker then starts on Claude Code). */ export function McpOauthSetup({ server, }: { /** `features.mcpOauthClients`: the `/mcp` resource tokens are bound to, and the switches. */ server: OauthServerInfo; }) { const t = useT(); const c = useT("connectedAgents"); const resource = server.resource; const [client, setClient] = useState(() => defaultOauthClient(resource)); const snippet = oauthSnippet(client, resource); const status = oauthClientStatus(client, server); return (
{c("connectedAgents.setup.url")} {c("connectedAgents.setup.urlDescription")}