diff --git a/doc/connections/GOOGLE-WORKSPACE.md b/doc/connections/GOOGLE-WORKSPACE.md index d515c78b9ab..251b02b534a 100644 --- a/doc/connections/GOOGLE-WORKSPACE.md +++ b/doc/connections/GOOGLE-WORKSPACE.md @@ -482,7 +482,8 @@ profiles. 5. Choose the services and sign in with Google. Google's guide: -[Configure Google Workspace MCP servers](https://developers.google.com/workspace/guides/configure-mcp-servers). +[Create an OAuth client ID](https://developers.google.com/workspace/guides/create-credentials#oauth-client-id). +The setup screen links to the same guide. An unverified Google app shows a warning screen and has a user cap; only you can decide whether to submit your own app for Google's verification. diff --git a/packages/shared/src/app-definitions/google-workspace.json b/packages/shared/src/app-definitions/google-workspace.json index c3b55dc3ec5..7a4acb34fb2 100644 --- a/packages/shared/src/app-definitions/google-workspace.json +++ b/packages/shared/src/app-definitions/google-workspace.json @@ -16,7 +16,6 @@ "urlPatterns": [ "https://workspace.google.com/*" ], - "docsUrl": "https://developers.google.com/workspace/guides/configure-mcp-servers", "setupPrerequisite": { "title": "Google Developer Preview access required", "description": "Google must register the Workspace email and the Cloud project that owns the OAuth client before these services can be used.", @@ -111,10 +110,10 @@ "prompt": "consent" } }, - "guidanceMd": "Enable the Google Workspace MCP APIs and register Paperclip's callback URI. Choose which permissions to grant on Google's consent screen; declined permissions disable only the corresponding actions.", + "guidanceMd": "Enable the Gmail, Drive, Docs, Sheets, Slides, and Calendar APIs in your Google Cloud project and register Paperclip's callback URI. Choose which permissions to grant on Google's consent screen; declined permissions disable only the corresponding actions.", "consoleLinks": { "register": "https://console.cloud.google.com/auth/clients", - "docs": "https://developers.google.com/workspace/guides/configure-mcp-servers" + "docs": "https://developers.google.com/workspace/guides/create-credentials#oauth-client-id" }, "riskTier": "S4" } diff --git a/packages/shared/src/google-workspace-setup-links.test.ts b/packages/shared/src/google-workspace-setup-links.test.ts new file mode 100644 index 00000000000..d86428b26e7 --- /dev/null +++ b/packages/shared/src/google-workspace-setup-links.test.ts @@ -0,0 +1,31 @@ +import { describe, expect, it } from "vitest"; +import { getConnectableAppDefinition } from "./app-definitions.js"; + +const MCP_SERVERS_GUIDE = "configure-mcp-servers"; +const OAUTH_CLIENT_GUIDE = "https://developers.google.com/workspace/guides/create-credentials#oauth-client-id"; + +describe("Google Workspace setup links and copy", () => { + const app = getConnectableAppDefinition("google-workspace")!; + const method = (key: string) => app.methods.find((candidate) => candidate.key === key)!; + + it("never sends a user to Google's MCP servers guide", () => { + expect(JSON.stringify(app)).not.toContain(MCP_SERVERS_GUIDE); + }); + + it("gives the Paperclip-managed sign-in no requirements link", () => { + expect(app.docsUrl).toBeUndefined(); + expect(method("paperclip-workspace").consoleLinks?.docs).toBeUndefined(); + }); + + it("links the customer-owned client method to Google's OAuth client guide", () => { + expect(method("customer-workspace-oauth").consoleLinks?.docs).toBe(OAUTH_CLIENT_GUIDE); + }); + + it("does not mention MCP in user-facing method text", () => { + for (const entry of app.methods) { + for (const text of [entry.label, entry.whenToUse, entry.guidanceMd, ...(entry.warnings ?? [])]) { + expect(text ?? "").not.toMatch(/\bMCP\b/); + } + } + }); +}); diff --git a/server/src/__tests__/google-workspace-rest-transport.test.ts b/server/src/__tests__/google-workspace-rest-transport.test.ts index 4fad149c81f..c603cbe9fc7 100644 --- a/server/src/__tests__/google-workspace-rest-transport.test.ts +++ b/server/src/__tests__/google-workspace-rest-transport.test.ts @@ -280,6 +280,7 @@ const support = await getEmbeddedPostgresTestSupport(); const audit = await db.select().from(toolAccessAuditEvents).where(and(eq(toolAccessAuditEvents.companyId, f.company.id), eq(toolAccessAuditEvents.action, "call_completed"))); expect(audit).toHaveLength(1); expect(JSON.stringify(audit[0])).toContain("Google Workspace REST"); + expect(JSON.stringify(audit[0])).not.toContain("mcpMethod"); expect(JSON.stringify([invocation, audit])).not.toContain("workspace-access-1"); }); diff --git a/server/src/services/tool-gateway.ts b/server/src/services/tool-gateway.ts index 18caa403fcb..4781ea2f768 100644 --- a/server/src/services/tool-gateway.ts +++ b/server/src/services/tool-gateway.ts @@ -641,7 +641,7 @@ type RemoteHttpExecutionAudit = { protocol: "MCP JSON-RPC 2.0" | "Railway GraphQL" | "Railway GraphQL + SSH" | "Google Workspace REST"; httpMethod: "POST"; endpoint: string; - mcpMethod: "tools/call"; + mcpMethod?: "tools/call"; requestId: string; upstreamToolName: string; dispatched: true; @@ -8419,6 +8419,7 @@ export function createToolGatewayService( }; if (workspaceTarget?.transport === "paperclip_rest") { execution.request.protocol = "Google Workspace REST"; + delete execution.request.mcpMethod; execution.request.endpoint = googleWorkspaceRestAuditEndpoint(workspaceTarget.service); await assertWorkspaceGrantCurrent(); const signal = taskSignals.run ? AbortSignal.any([controller.signal, taskSignals.run]) : controller.signal; diff --git a/tests/runner-e2e/source-sdk-public-inputs.json b/tests/runner-e2e/source-sdk-public-inputs.json index e96931b7fe5..a849307dc1c 100644 --- a/tests/runner-e2e/source-sdk-public-inputs.json +++ b/tests/runner-e2e/source-sdk-public-inputs.json @@ -130,7 +130,7 @@ "packages/shared/src/app-definitions/google-sheets.json": "de87b58007fca0b719d242148a838e2b5c26ddca", "packages/shared/src/app-definitions/google-slides.json": "289366009d46be6b770eee6cd0bc650eb59a240c", "packages/shared/src/app-definitions/google-workspace-search.json": "f3ec9d00ed0116b7cb8b9b1b71353cb8d6dc8cf4", - "packages/shared/src/app-definitions/google-workspace.json": "c3b55dc3ec502f6b86008e1e5b421748bdd50e91", + "packages/shared/src/app-definitions/google-workspace.json": "7a4acb34fb2ab5106860e910de50573070cbed2b", "packages/shared/src/app-definitions/google.json": "f0bab0467612f915c88137eddbac0b320ac1aa2a", "packages/shared/src/app-definitions/gsc-wizard.json": "a4ba6f183d5f35a25d0a420ade18f00d3fb64534", "packages/shared/src/app-definitions/honcho.json": "17185eaf5189fc8c443388997c90ebf833bc9327", @@ -272,6 +272,7 @@ "packages/shared/src/google-sign-in-deployment.ts": "2e4e4cc3c24347642e20c91186581e1dce81d740", "packages/shared/src/google-workspace-connectors.test.ts": "26316900a50e5ab384e0dcf9c45a2bb4abc0830d", "packages/shared/src/google-workspace-connectors.ts": "88d942d1e66d7facc68cf8645f665cdc80c8c005", + "packages/shared/src/google-workspace-setup-links.test.ts": "d86428b26e74e54ab2902d1a14c0f06f562de775", "packages/shared/src/grok-bot.ts": "9de68f00e7926c397729ff62bf8e277f5a41c525", "packages/shared/src/heartbeat-inbox.ts": "227dc89705c20460ca02194091cb162e11503186", "packages/shared/src/home-paths.test.ts": "81235c17c376224e1be3abd3f034a8400f079c66", diff --git a/ui/src/features/connections/ConnectionSetupFlow.tsx b/ui/src/features/connections/ConnectionSetupFlow.tsx index 110edcf9dee..1b6de4cd3c9 100644 --- a/ui/src/features/connections/ConnectionSetupFlow.tsx +++ b/ui/src/features/connections/ConnectionSetupFlow.tsx @@ -3131,7 +3131,7 @@ export function OAuthConnectStateScreen({ return (
({ toolsApi: {} })); +vi.mock("@/pages/apps/AppLogo", () => ({ AppLogo: () => null })); + +describe("Google Workspace sign-in state screen", () => { + let root: Root; + let container: HTMLDivElement; + + beforeEach(() => { + container = document.createElement("div"); + document.body.append(container); + root = createRoot(container); + }); + afterEach(() => { + act(() => root.unmount()); + container.remove(); + }); + + async function render(phase: OAuthConnectPhase, error?: string) { + await act(async () => { + root.render( + undefined} + onBack={() => undefined} + onCancel={() => undefined} + />, + ); + }); + } + + const links = () => [...container.querySelectorAll("a")].map((link) => link.getAttribute("href") ?? ""); + + it.each<[string, OAuthConnectPhase, string | undefined]>([ + ["opening the sign-in", "redirecting", undefined], + ["preparing the sign-in", "starting", undefined], + ["failing to open the sign-in window", "error", "Paperclip couldn’t open the sign-in window."], + ])("shows no MCP wording or MCP guide link while %s", async (_label, phase, error) => { + await render(phase, error); + expect(container.textContent).toContain("Connect Google Workspace"); + expect(container.textContent).toContain("Secure sign-in"); + expect(container.textContent).not.toMatch(/\bMCP\b/); + expect(links().some((href) => href.includes("configure-mcp-servers"))).toBe(false); + }); + + it("keeps the MCP label for a server the user pasted", async () => { + await act(async () => { + root.render( + undefined} + onBack={() => undefined} + onCancel={() => undefined} + />, + ); + }); + expect(container.textContent).toContain("Secure MCP sign-in"); + }); +}); diff --git a/ui/src/lib/connection-transport-label.test.ts b/ui/src/lib/connection-transport-label.test.ts new file mode 100644 index 00000000000..7b42f7ce8c4 --- /dev/null +++ b/ui/src/lib/connection-transport-label.test.ts @@ -0,0 +1,15 @@ +import { describe, expect, it } from "vitest"; +import { auditTransportLabel, connectionTransportLabel } from "./connection-transport-label"; + +describe("connection transport labels", () => { + it("names a connection type without the raw transport value", () => { + expect(connectionTransportLabel("mcp_remote")).toBe("Remote HTTP"); + expect(connectionTransportLabel("local_stdio")).toBe("Local command"); + }); + + it("labels audit details with the same names", () => { + expect(auditTransportLabel("mcp_remote")).toBe("Remote HTTP"); + expect(auditTransportLabel("local_stdio")).toBe("Local command"); + expect(auditTransportLabel("other")).toBe("other"); + }); +}); diff --git a/ui/src/lib/connection-transport-label.ts b/ui/src/lib/connection-transport-label.ts new file mode 100644 index 00000000000..641853202d4 --- /dev/null +++ b/ui/src/lib/connection-transport-label.ts @@ -0,0 +1,11 @@ +import type { ToolConnection } from "@paperclipai/shared"; + +export function connectionTransportLabel(transport: ToolConnection["transport"]): string { + if (transport === "mcp_remote") return "Remote HTTP"; + if (transport === "local_stdio") return "Local command"; + return "Unknown"; +} + +export function auditTransportLabel(transport: string): string { + return transport === "mcp_remote" || transport === "local_stdio" ? connectionTransportLabel(transport) : transport; +} diff --git a/ui/src/pages/apps/app-detail/AdvancedPanel.tsx b/ui/src/pages/apps/app-detail/AdvancedPanel.tsx index ea7f0edf63a..52da56a0ef5 100644 --- a/ui/src/pages/apps/app-detail/AdvancedPanel.tsx +++ b/ui/src/pages/apps/app-detail/AdvancedPanel.tsx @@ -22,6 +22,7 @@ import { useToast } from "@/context/ToastContext"; import { redactUrlSecrets } from "@/lib/redact-url-secrets"; import { useAuthorizationWindow } from "@/hooks/useAuthorizationWindow"; import { cn } from "@/lib/utils"; +import { connectionTransportLabel } from "@/lib/connection-transport-label"; import { Link } from "@/lib/router"; import type { AppDetailSectionProps } from "./types"; import { RevokeGrantDialog } from "./IdentitiesSection"; @@ -628,8 +629,4 @@ export function connectionAddress(connection: ToolConnection): string { return "Not set"; } -export function connectionTransportLabel(transport: ToolConnection["transport"]): string { - if (transport === "mcp_remote") return "Remote HTTP"; - if (transport === "local_stdio") return "Local command"; - return "Unknown"; -} +export { connectionTransportLabel }; diff --git a/ui/src/pages/tools/AuditTab.tsx b/ui/src/pages/tools/AuditTab.tsx index 65e752932c8..2e0991fdf23 100644 --- a/ui/src/pages/tools/AuditTab.tsx +++ b/ui/src/pages/tools/AuditTab.tsx @@ -27,6 +27,7 @@ import { AgentSelect } from "@/components/AgentMultiSelect"; import { ToolsPageHeader, LoadingState, RelativeTime } from "./shared"; import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy"; import { googleAccessRetrySummary } from "../../features/connections/googleAccessRemoval"; +import { auditTransportLabel } from "@/lib/connection-transport-label"; const PAGE_SIZE = 50; const ALL = "__all"; @@ -286,7 +287,7 @@ function ActivityRow({ {runId ? : null} - {transport ? : null} + {transport ? : null} {requestMethod && endpoint ? : null} {mcpMethod ? : null} {requestId ? : null}