From eb35831f05013779094fe460c6616fa6ce3dd455 Mon Sep 17 00:00:00 2001 From: Dotta <34892728+cryppadotta@users.noreply.github.com> Date: Sat, 5 Dec 2026 01:19:42 -0600 Subject: [PATCH] Add first-class SpreadJam and Okara remote MCP connectors (#23859) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - The Apps catalog ships first-class connectors for external services so teams can connect tools with verified endpoints, brand icons, permission reviews, and guided sign-in > - SpreadJam and Okara both publish official hosted remote MCP servers with OAuth discovery and dynamic client registration, so users currently fall back to unverified custom MCP entries without brand assets, scope defaults, or reviewed risk policies > - Adding catalog definitions with conservative risk classification, drift quarantine, and Ask-first defaults lets users discover both apps in the gallery and connect safely without unreviewed write/destructive actions auto-enabling > - This pull request adds first-class remote MCP connectors for SpreadJam (`https://api.spreadjam.com/mcp`) and Okara (`https://okara.ai/api/mcp`) with official brand SVGs, reviewed permission entries, reviewed tool risk + drift policies, Ask-first defaults for write/destructive actions, unit + fresh-OAuth server tests, and refreshed SDK public inputs > - The benefit is a guided connection flow with official branding, safer default OAuth scopes for Okara, optional project pinning and API-key support for SpreadJam, Ask-first approval on write/destructive tools, drift quarantine on catalog refresh, and automatic BYO URL recognition ## Linked Issues or Issue Description **Subsystem affected** Cross-cutting (packages/shared, server, ui, doc/connections) **Problem or motivation** Users connecting SpreadJam (`https://api.spreadjam.com/mcp`) or Okara (`https://okara.ai/api/mcp`) must configure them as unverified custom MCP servers. They get no official brand icon, no catalog entry, no curated permission review, no Okara default scope restriction (`mcp:read`, `mcp:write`), no SpreadJam `X-Jam-Project` or workspace API key setup guidance, and no reviewed risk classification or drift quarantine. **Proposed solution** Add both SpreadJam and Okara as first-class Track A remote MCP connectors in the Paperclip Apps catalog: - Register `spreadjam` with DCR OAuth (`dcr`) and workspace API key (`customer`, `Authorization: Bearer sk_...`) methods, optional `projectId` header pinning (`X-Jam-Project`), default agent instructions, verified `reviewedTools` (against `https://api.spreadjam.com/openapi.json`) with `quarantineNewEntries: true`, and official SVG branding. - Register `okara` with DCR OAuth (`dcr`) requesting `mcp:read` and `mcp:write` by default (omitting `mcp:publish` and `mcp:spend`), conservative `okaraRisk` classification with `quarantineNewEntries: true` in `connectorToolPolicy`, and official light and dark SVG branding. - Require Ask-first approval by default for `write` and `destructive` actions on fresh SpreadJam and Okara connections via `recommendedDefaultsForApp`, keeping read tools immediately usable. - Register permission reviews, manifest entries, generated catalog output, shared/server tests, and `source-sdk-public-inputs.json`. **Alternatives considered** Leaving both servers as custom BYO MCP connections was considered. Custom connections work after #23846, but they cannot provide curated brand assets, verified gallery placement, Okara's read/draft scope guardrails, reviewed tool risk + Ask-first defaults, or SpreadJam's `X-Jam-Project` pinning and API-key flow. **Roadmap alignment** Extends the existing declarative Track A remote MCP Apps catalog (`packages/shared/src/app-definitions/`) and connector risk policy registry (`server/src/services/connectors/`). Does not duplicate or alter planned core architecture in `ROADMAP.md`. **Additional context** Follows up on #23846, which improved custom remote MCP discovery and recovery. ## What Changed - Added SpreadJam connector override and generated definition (`scripts/app-definition-overrides/spreadjam.json`, `packages/shared/src/app-definitions/spreadjam.json`) for `https://api.spreadjam.com/mcp` with `mcp-oauth` (`dcr`), `mcp-api-key` (`customer`, Bearer `sk_...`), optional `X-Jam-Project` tenant header pinning, `spreadjam-default-v1` agent instructions, and `reviewedTools` (42 verified `GET` reads, 26 verified delete/publish/PR/credit-spending/billing-allocation destructive ops, `unlisted: "write"`, `quarantineNewEntries: true`). - Added Okara connector override and generated definition (`scripts/app-definition-overrides/okara.json`, `packages/shared/src/app-definitions/okara.json`) for `https://okara.ai/api/mcp` with `mcp-oauth` (`dcr`) and default `scopesHint: ["mcp:read", "mcp:write"]` (`Read and draft` capability profile, withholding `mcp:publish` and `mcp:spend`). - Added `server/src/services/connectors/okara/risk.ts` and registered `okara` in `server/src/services/connectors/tool-policy.ts` with `quarantineNewEntries: true` and fail-closed risk classification (only explicit `readOnlyHint: true` without destructive/write hints or verbs classifies as `read`; publish/spend/delete/launch verbs classify as `destructive`; unlisted/unannotated fail closed to `write`). - Updated `recommendedDefaultsForApp` in `packages/shared/src/app-definitions.ts` so new SpreadJam and Okara connections default to `askFirstRiskLevels: ["write", "destructive"]` while leaving read tools immediately usable. - Added verbatim official brand SVGs (`ui/public/brands/apps/spreadjam.svg`, `ui/public/brands/apps/okara.svg`, `ui/public/brands/apps/okara-dark.svg`) and registered both identities in `ui/public/brands/apps/manifest.json` without colliding with `jam-dev`'s existing `"jam"` alias. - Added reviewed method entries for `spreadjam/mcp-oauth`, `spreadjam/mcp-api-key`, and `okara/mcp-oauth` in `doc/connections/tool-method-permission-reviews.json`. - Added `"okara"` and `"spreadjam"` to `CONNECTABLE_APP_SLUGS` in `packages/shared/src/app-definitions.ts` and regenerated `packages/shared/src/app-definitions.generated.ts`. - Added unit and embedded-Postgres integration tests in `packages/shared/src/app-definitions.test.ts` and `server/src/__tests__/connector-tool-policy.test.ts` covering definitions, risk classification, fresh OAuth Ask-first policy creation, and drift quarantine on catalog refresh. - Refreshed `tests/runner-e2e/source-sdk-public-inputs.json` to match the updated shared exports. ## Verification - Brand, asset, and override validation: - `node scripts/check-app-brand-assets.mjs` (pass: 117 brand identities validated) - `node --test scripts/app-definition-overrides.test.mjs scripts/app-brand-validation.test.mjs` (pass: 16/16) - Build, typecheck, and Vitest suites: - `pnpm --filter @paperclipai/shared build && pnpm --filter @paperclipai/shared typecheck` (pass) - `pnpm --filter @paperclipai/server typecheck` (pass) - `pnpm --filter @paperclipai/ui typecheck` (pass) - `pnpm exec vitest run packages/shared/src/app-definitions.test.ts server/src/services/tool-access/oauth/client-settings.test.ts server/src/__tests__/connector-tool-policy.test.ts ui/src/pages/apps/AppsConnect.test.tsx` (pass: 4 files, 97/97 tests) - `node tests/runner-e2e/source-sdk-public-inputs.mjs $(git rev-parse HEAD) --check` (pass: `changed: false`) - Live non-registering preflight against local Paperclip dev server: - `GET /api/companies/:id/tools/apps/spreadjam/preflight` → `endpointReachable: true` (`401 application/json`), `oauth.metadataFound: true`, `oauth.registrationAdvertised: true` - `GET /api/companies/:id/tools/apps/okara/preflight` → `endpointReachable: true` (`401 application/json`), `oauth.metadataFound: true`, `oauth.registrationAdvertised: true`, `oauth.clientIdMetadataDocumentSupported: true` - Local browser verification against isolated dev server: - Verified both tiles render in the Apps gallery with official SVG logos (dark and light theme contrast verified for Okara's light/dark icons). - Verified `/apps/connect?source=spreadjam` shows no unverified badge, default agent instructions, OAuth + API key methods, and optional `Pin to project ID` field. - Verified `/apps/connect?source=okara` shows no unverified badge and clean one-click OAuth flow. - Verified BYO URL recognition (`/apps/byo?link=...`) detects and suggests guided setup for both `https://api.spreadjam.com/mcp` and `https://okara.ai/api/mcp`. ### Production Validation Matrix | Check | SpreadJam | Okara | | --- | --- | --- | | Public docs & live OAuth metadata discovery | Passed | Passed | | Non-registering Paperclip preflight endpoint | Passed | Passed | | Deterministic unit, server OAuth policy, typecheck, and brand asset checks | Passed | Passed | | Local UI gallery, connect flow, light/dark logos, and BYO recognition | Passed | Passed | | Live account-bound OAuth sign-in / tool call execution | Not run (no live user credentials provided) | Not run (no live user credentials provided) | ## Risks - Low risk: additive declarative catalog definitions, static brand SVGs, connector risk policy, tests, and generated metadata only; no database schema, migration, or generic OAuth runtime changes. - Live account-bound OAuth consent, token exchange, and post-connect MCP tool invocation were not executed in this verification pass because no live SpreadJam or Okara account credentials were used. - SpreadJam OAuth and workspace API keys inherit the signed-in user's workspace role; new connections mitigate accidental side effects by starting write and destructive actions on Ask first and quarantining newly added tools on catalog refresh. ## Model Used - Google Antigravity (`gemini-3-pro`, extended thinking, tool use and code execution) ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] All Paperclip CI gates are green - [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge --------- Co-authored-by: Paperclip --- .../tool-method-permission-reviews.json | 57 +++++ .../shared/src/app-definitions.generated.ts | 10 +- packages/shared/src/app-definitions.test.ts | 106 ++++++++- packages/shared/src/app-definitions.ts | 13 ++ .../shared/src/app-definitions/okara.json | 54 +++++ .../shared/src/app-definitions/spreadjam.json | 204 ++++++++++++++++++ scripts/app-definition-overrides/okara.json | 54 +++++ .../app-definition-overrides/spreadjam.json | 203 +++++++++++++++++ .../__tests__/connector-tool-policy.test.ts | 187 +++++++++++++++- server/src/services/connectors/okara/risk.ts | 33 +++ server/src/services/connectors/tool-policy.ts | 2 + .../runner-e2e/source-sdk-public-inputs.json | 8 +- ui/public/brands/apps/manifest.json | 13 ++ ui/public/brands/apps/okara-dark.svg | 9 + ui/public/brands/apps/okara.svg | 9 + ui/public/brands/apps/spreadjam.svg | 8 + 16 files changed, 959 insertions(+), 11 deletions(-) create mode 100644 packages/shared/src/app-definitions/okara.json create mode 100644 packages/shared/src/app-definitions/spreadjam.json create mode 100644 scripts/app-definition-overrides/okara.json create mode 100644 scripts/app-definition-overrides/spreadjam.json create mode 100644 server/src/services/connectors/okara/risk.ts create mode 100644 ui/public/brands/apps/okara-dark.svg create mode 100644 ui/public/brands/apps/okara.svg create mode 100644 ui/public/brands/apps/spreadjam.svg diff --git a/doc/connections/tool-method-permission-reviews.json b/doc/connections/tool-method-permission-reviews.json index f7dee72de65..28106f3b447 100644 --- a/doc/connections/tool-method-permission-reviews.json +++ b/doc/connections/tool-method-permission-reviews.json @@ -3052,6 +3052,63 @@ "reviewedAt": "2026-11-18", "liveProof": "2026-11-18 spike in the Paperclip dev AWS account (doc/plans/2026-11-17-aws-connector-and-minted-credentials.md, Spike findings): a Paperclip-signed connection token assumed its role, another connection's token was denied, the bearer exchange and tools/list passed, and run_script read and wrote. A read-only session read and AWS refused its write. Both access-key paths obtained a bearer. The production connector path itself is not yet live-tested.", "keyPermissions": "Use a dedicated IAM user for this connection. It needs AWSMCPSignInOAuthAccessPolicy, sts:GetFederationToken, and the permissions agents should have; Paperclip cannot raise them." + }, + { + "app": "spreadjam", + "method": "mcp-oauth", + "auth": "oauth", + "policy": "provider-default", + "requestedScopes": [], + "capability": "provider-controlled", + "supportedActions": "Read AI search visibility analytics, prompts, citations, brand profiles, plan actions, content, and credits; run research requests, update prompts and actions, and manage or publish content under the signed-in user's Jam workspace role.", + "providerDefaultReason": "SpreadJam's OAuth authorization server advertises no scopes_supported and documents that there are no OAuth scopes; an OAuth grant inherits the signed-in user's Jam workspace permissions, and individual tools are governed by Paperclip's action policies.", + "evidence": [ + "https://docs.spreadjam.com/api-reference/mcp", + "https://docs.spreadjam.com/onboard-with-your-agent/other-clients", + "https://api.spreadjam.com/.well-known/oauth-protected-resource", + "https://api.spreadjam.com/.well-known/oauth-authorization-server" + ], + "reviewedAt": "2026-12-04", + "liveProof": "not-run", + "evidenceLimit": "Public MCP and OAuth metadata, official docs, and local non-registering preflight verified. No live SpreadJam account token, tool execution, or revocation run was completed in this change." + }, + { + "app": "spreadjam", + "method": "mcp-api-key", + "auth": "api_key", + "policy": "provider-key", + "requestedScopes": [], + "capability": "provider-controlled", + "supportedActions": "Full SpreadJam workspace MCP tool surface (visibility analytics, prompts, citations, research, actions, content, credits, and webhooks) matching the API key creator's workspace role. Keys cannot create new keys and can only revoke themselves.", + "evidence": [ + "https://docs.spreadjam.com/api-reference/mcp", + "https://docs.spreadjam.com/api-reference/overview", + "https://docs.spreadjam.com/onboard-with-your-agent/other-clients" + ], + "reviewedAt": "2026-12-04", + "liveProof": "not-run", + "keyPermissions": "Create a workspace API key in SpreadJam under Settings → Developer → Create API key (keys start with sk_ and are shown once). Keys act with their creator's workspace role on live data; Paperclip cannot narrow an existing key. Keep publishing, deleting, and credit-spending tools on Ask first before agents run unattended.", + "evidenceLimit": "Public API documentation and schema validation only; no live API key call was executed in this change." + }, + { + "app": "okara", + "method": "mcp-oauth", + "auth": "oauth", + "policy": "explicit", + "requestedScopes": [ + "mcp:read", + "mcp:write" + ], + "capability": "write", + "supportedActions": "Inspect SEO audits, Search Console and analytics performance, AI search citations, brand voice, and Reddit threads; draft posts, articles, replies, and paused campaign plans across projects accessible to the signed-in Okara user. External publishing (mcp:publish) and paid ad spend (mcp:spend) are intentionally omitted from default OAuth scopes.", + "evidence": [ + "https://okara.ai/mcp", + "https://okara.ai/.well-known/oauth-protected-resource", + "https://okara.ai/.well-known/oauth-authorization-server" + ], + "reviewedAt": "2026-12-04", + "liveProof": "not-run", + "evidenceLimit": "Public MCP and OAuth metadata and local non-registering preflight verified. mcp:publish and mcp:spend are intentionally withheld from default OAuth scopes so external publishing and ad spend stay opt-in. No live Okara account token, tool discovery, or governed write run was completed in this change." } ] } diff --git a/packages/shared/src/app-definitions.generated.ts b/packages/shared/src/app-definitions.generated.ts index c8b1c79300c..ff53dba62b1 100644 --- a/packages/shared/src/app-definitions.generated.ts +++ b/packages/shared/src/app-definitions.generated.ts @@ -109,8 +109,10 @@ import a107 from "./app-definitions/daytona.json" with { type: "json" }; import a108 from "./app-definitions/github-copilot.json" with { type: "json" }; import a109 from "./app-definitions/linkedin.json" with { type: "json" }; import a110 from "./app-definitions/monday.json" with { type: "json" }; -import a111 from "./app-definitions/paperclip-notebook.json" with { type: "json" }; -import a112 from "./app-definitions/unikraft.json" with { type: "json" }; -import a113 from "./app-definitions/speko.json" with { type: "json" }; +import a111 from "./app-definitions/okara.json" with { type: "json" }; +import a112 from "./app-definitions/paperclip-notebook.json" with { type: "json" }; +import a113 from "./app-definitions/spreadjam.json" with { type: "json" }; +import a114 from "./app-definitions/unikraft.json" with { type: "json" }; +import a115 from "./app-definitions/speko.json" with { type: "json" }; import type { AppDefinition } from "./types/app-definition.js"; -export const APP_DEFINITIONS=[a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20,a21,a22,a23,a24,a25,a26,a27,a28,a29,a30,a31,a32,a33,a34,a35,a36,a37,a38,a39,a40,a41,a42,a43,a44,a45,a46,a47,a48,a49,a50,a51,a52,a53,a54,a55,a56,a57,a58,a59,a60,a61,a62,a63,a64,a65,a66,a67,a68,a69,a70,a71,a72,a73,a74,a75,a76,a77,a78,a79,a80,a81,a82,a83,a84,a85,a86,a87,a88,a89,a90,a91,a92,a93,a94,a95,a96,a97,a98,a99,a100,a101,a102,a103,a104,a105,a106,a107,a108,a109,a110,a111,a112,a113] as AppDefinition[]; +export const APP_DEFINITIONS=[a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20,a21,a22,a23,a24,a25,a26,a27,a28,a29,a30,a31,a32,a33,a34,a35,a36,a37,a38,a39,a40,a41,a42,a43,a44,a45,a46,a47,a48,a49,a50,a51,a52,a53,a54,a55,a56,a57,a58,a59,a60,a61,a62,a63,a64,a65,a66,a67,a68,a69,a70,a71,a72,a73,a74,a75,a76,a77,a78,a79,a80,a81,a82,a83,a84,a85,a86,a87,a88,a89,a90,a91,a92,a93,a94,a95,a96,a97,a98,a99,a100,a101,a102,a103,a104,a105,a106,a107,a108,a109,a110,a111,a112,a113,a114,a115] as AppDefinition[]; diff --git a/packages/shared/src/app-definitions.test.ts b/packages/shared/src/app-definitions.test.ts index d346bbae1c7..0574cc49b06 100644 --- a/packages/shared/src/app-definitions.test.ts +++ b/packages/shared/src/app-definitions.test.ts @@ -839,7 +839,12 @@ describe("AppDefinition catalog", () => { it("limits Ask-first defaults to reviewed high-risk connection methods", () => { for (const app of APP_DEFINITIONS) for (const method of app.methods) { - if (app.slug === "enterpret" || (app.slug === "gmail" && method.capabilityProfile?.key === "archive")) { + if ( + app.slug === "enterpret" || + app.slug === "spreadjam" || + app.slug === "okara" || + (app.slug === "gmail" && method.capabilityProfile?.key === "archive") + ) { expect(recommendedDefaultsForApp(app, method.key)).toEqual({ access: "all_agents", askFirstRiskLevels: ["write", "destructive"], @@ -948,7 +953,7 @@ describe("AppDefinition catalog", () => { "ticktick", "xero", ]); - expect(APP_STORE_DEFINITIONS).toHaveLength(92); + expect(APP_STORE_DEFINITIONS).toHaveLength(94); const connectableSlugs = new Set( CONNECTABLE_APP_DEFINITIONS.map((entry) => entry.slug), ); @@ -1707,3 +1712,100 @@ it("uses Slack MCP user OAuth endpoints and includes user-scope and MCP prerequi expect(mcpOAuth.guidanceMd).toContain("User Token Scopes"); expect(mcpOAuth.guidanceMd).toContain("Model Context Protocol"); }); + +describe("SpreadJam and Okara first-class remote MCP connectors", () => { + it("registers SpreadJam with OAuth + API key methods, reviewed tools, X-Jam-Project pinning, and URL matching", () => { + const spreadjam = getConnectableAppDefinition("spreadjam"); + expect(spreadjam).toBeDefined(); + expect(spreadjam!.name).toBe("SpreadJam"); + expect(spreadjam!.branding).toEqual({ logoUrl: "/brands/apps/spreadjam.svg" }); + expect(spreadjam!.redirectConstraints).toBe("https-or-loopback-http"); + expect(spreadjam!.agentInstructions?.id).toBe("spreadjam-default-v1"); + expect(spreadjam!.reviewedTools).toMatchObject({ + sourceUrl: "https://api.spreadjam.com/openapi.json", + unlisted: "write", + quarantineNewEntries: true, + }); + expect(spreadjam!.reviewedTools?.read).toContain("get_me"); + expect(spreadjam!.reviewedTools?.read).toContain("get_analytics_overview"); + expect(spreadjam!.reviewedTools?.destructive).toEqual( + expect.arrayContaining([ + "publish_content", + "create_research_request", + "create_site_change_pull_request", + "set_billing_allocations", + "remove_prompt", + "revoke_api_key", + ]), + ); + expect(getAppDefinitionForUrl("https://api.spreadjam.com/mcp")?.slug).toBe("spreadjam"); + + const oauth = spreadjam!.methods.find((method) => method.key === "mcp-oauth"); + expect(oauth).toMatchObject({ + transport: "mcp_remote", + auth: "oauth", + ownershipModes: ["dcr"], + defaults: { serverUrl: "https://api.spreadjam.com/mcp" }, + riskTier: "S4", + }); + expect(oauth!.defaults?.scopesHint).toBeUndefined(); + expect(oauth!.tenantFields).toEqual([ + expect.objectContaining({ + key: "projectId", + advanced: true, + transport: { location: "header", name: "X-Jam-Project" }, + }), + ]); + expect(recommendedDefaultsForApp(spreadjam!, "mcp-oauth")).toEqual({ + access: "all_agents", + askFirstRiskLevels: ["write", "destructive"], + }); + + const apiKey = spreadjam!.methods.find((method) => method.key === "mcp-api-key"); + expect(apiKey).toMatchObject({ + transport: "mcp_remote", + auth: "api_key", + ownershipModes: ["customer"], + defaults: { serverUrl: "https://api.spreadjam.com/mcp" }, + keyPlacement: { location: "header", name: "Authorization", prefix: "Bearer " }, + riskTier: "S4", + }); + expect(apiKey!.credentialFields).toEqual([ + expect.objectContaining({ key: "authorization", placeholder: "sk_...", secret: true }), + ]); + expect(recommendedDefaultsForApp(spreadjam!, "mcp-api-key")).toEqual({ + access: "all_agents", + askFirstRiskLevels: ["write", "destructive"], + }); + }); + + it("registers Okara with light/dark branding, URL matching, Ask-first write defaults, and least-privilege read/write OAuth scopes", () => { + const okara = getConnectableAppDefinition("okara"); + expect(okara).toBeDefined(); + expect(okara!.name).toBe("Okara"); + expect(okara!.branding).toEqual({ + logoUrl: "/brands/apps/okara.svg", + darkLogoUrl: "/brands/apps/okara-dark.svg", + }); + expect(okara!.redirectConstraints).toBe("https-or-loopback-http"); + expect(getAppDefinitionForUrl("https://okara.ai/api/mcp")?.slug).toBe("okara"); + + const oauth = okara!.methods.find((method) => method.key === "mcp-oauth"); + expect(oauth).toMatchObject({ + transport: "mcp_remote", + auth: "oauth", + ownershipModes: ["dcr"], + defaults: { + serverUrl: "https://okara.ai/api/mcp", + scopesHint: ["mcp:read", "mcp:write"], + }, + riskTier: "S3", + }); + expect(oauth!.defaults?.scopesHint).not.toContain("mcp:publish"); + expect(oauth!.defaults?.scopesHint).not.toContain("mcp:spend"); + expect(recommendedDefaultsForApp(okara!, "mcp-oauth")).toEqual({ + access: "all_agents", + askFirstRiskLevels: ["write", "destructive"], + }); + }); +}); diff --git a/packages/shared/src/app-definitions.ts b/packages/shared/src/app-definitions.ts index 94340a2b9c6..07627009c3b 100644 --- a/packages/shared/src/app-definitions.ts +++ b/packages/shared/src/app-definitions.ts @@ -27,6 +27,8 @@ export const CONNECTABLE_APP_SLUGS = new Set([ "posthog", "linear", "linkedin", + "okara", + "spreadjam", "google-sheets", "context7", "shopify", @@ -308,6 +310,17 @@ export function recommendedDefaultsForApp(app: AppDefinition, methodKey?: string askFirstRiskLevels: ["write", "destructive"], }; } + // SpreadJam OAuth and workspace API keys inherit the signed-in user's full + // workspace role (including publishing, credit-spending, billing allocation, + // and delete actions), and Okara's mcp:write scope allows mutations across + // all accessible projects. Start write and destructive actions on Ask first + // on new connections while keeping read actions immediately usable. + if (app.slug === "spreadjam" || app.slug === "okara") { + return { + access: "all_agents", + askFirstRiskLevels: ["write", "destructive"], + }; + } return { access: "all_agents", askFirstRiskLevels: [], diff --git a/packages/shared/src/app-definitions/okara.json b/packages/shared/src/app-definitions/okara.json new file mode 100644 index 00000000000..f5c8d89f192 --- /dev/null +++ b/packages/shared/src/app-definitions/okara.json @@ -0,0 +1,54 @@ +{ + "schemaVersion": 1, + "slug": "okara", + "name": "Okara", + "description": "Run SEO and AI visibility audits, find Reddit threads, and draft marketing posts and campaigns with Okara AI CMO.", + "categories": [ + "analytics", + "content" + ], + "featured": false, + "branding": { + "logoUrl": "/brands/apps/okara.svg", + "darkLogoUrl": "/brands/apps/okara-dark.svg" + }, + "urlPatterns": [ + "https://okara.ai/api/mcp*", + "https://okara.ai/*" + ], + "docsUrl": "https://okara.ai/mcp", + "redirectConstraints": "https-or-loopback-http", + "methods": [ + { + "key": "mcp-oauth", + "label": "Sign in with Okara", + "transport": "mcp_remote", + "auth": "oauth", + "ownershipModes": [ + "dcr" + ], + "whenToUse": "Use browser sign-in for Okara's hosted MCP server.", + "defaults": { + "serverUrl": "https://okara.ai/api/mcp", + "scopesHint": [ + "mcp:read", + "mcp:write" + ] + }, + "guidanceMd": "Sign in to Okara and approve read and draft access for your projects. Paperclip requests mcp:read and mcp:write by default so agents can run audits and prepare drafts without external publishing or paid ad spend.", + "warnings": [ + "The connection reaches every Okara project owned by or shared with the signed-in user.", + "External publishing (mcp:publish) and paid ad spend (mcp:spend) are omitted from the default OAuth request. New connections start write and destructive actions on Ask first, and newly added tools are quarantined on refresh until reviewed." + ], + "consoleLinks": { + "docs": "https://okara.ai/mcp" + }, + "riskTier": "S3", + "capabilityProfile": { + "key": "write", + "label": "Read and draft", + "description": "Inspect SEO, GEO, and Reddit opportunities and draft content or paused campaigns without requesting external publishing or paid ad spend scopes." + } + } + ] +} diff --git a/packages/shared/src/app-definitions/spreadjam.json b/packages/shared/src/app-definitions/spreadjam.json new file mode 100644 index 00000000000..2626d485d23 --- /dev/null +++ b/packages/shared/src/app-definitions/spreadjam.json @@ -0,0 +1,204 @@ +{ + "schemaVersion": 1, + "slug": "spreadjam", + "name": "SpreadJam", + "description": "Track AI search visibility across ChatGPT, Gemini, and Perplexity, inspect prompts and citations, and run AEO actions in Jam.", + "categories": [ + "analytics", + "content" + ], + "featured": false, + "branding": { + "logoUrl": "/brands/apps/spreadjam.svg" + }, + "urlPatterns": [ + "https://api.spreadjam.com/*", + "https://www.spreadjam.com/*", + "https://app.spreadjam.com/*" + ], + "docsUrl": "https://docs.spreadjam.com/api-reference/mcp", + "redirectConstraints": "https-or-loopback-http", + "reviewedTools": { + "reviewedAt": "2026-12-05", + "sourceUrl": "https://api.spreadjam.com/openapi.json", + "read": [ + "get_action", + "get_analytics_overview", + "get_billing", + "get_brand", + "get_content", + "get_content_revision", + "get_credits", + "get_me", + "get_opportunity", + "get_opportunity_brief", + "get_pricing", + "get_project", + "get_prompt", + "get_prompt_cap", + "get_prompt_suggestion", + "get_research", + "get_research_report", + "get_site_change", + "get_support_request", + "get_visibility_run", + "list_actions", + "list_analytics_metrics", + "list_answers", + "list_api_keys", + "list_brand_competitors", + "list_content", + "list_content_deliveries", + "list_content_destinations", + "list_content_publications", + "list_content_revisions", + "list_destinations", + "list_keywords", + "list_notification_rules", + "list_opportunities", + "list_projects", + "list_prompt_analytics", + "list_prompt_answers", + "list_prompt_topics", + "list_prompts", + "list_support_requests", + "list_visibility_runs", + "list_webhooks" + ], + "destructive": [ + "cancel_content_publishing", + "cancel_prompt_suggestion", + "configure_destination_github", + "create_action_execution", + "create_plan_batch", + "create_research_request", + "create_site_change_pull_request", + "delete_webhook", + "discard_content", + "discard_site_change", + "edit_prompts_bulk", + "publish_content", + "recalibrate_brand", + "regenerate_content", + "release_opportunity_claim", + "remove_brand_competitor", + "remove_destination", + "remove_prompt", + "remove_prompt_topic", + "replace_prompt", + "request_content_edit", + "request_opportunity_plan", + "revoke_api_key", + "set_billing_allocations", + "unpin_competitors", + "update_destination" + ], + "unlisted": "write", + "quarantineNewEntries": true + }, + "agentInstructions": { + "id": "spreadjam-default-v1", + "version": 1, + "text": "Start a SpreadJam session with get_me to confirm the active workspace and projects, then inspect get_analytics_overview, list_prompts (always pass a bounded limit), or list_actions before making changes. Tools that spend credits, publish content, delete records, or change billing allocations are destructive — verify target projectId and confirm before running them." + }, + "methods": [ + { + "key": "mcp-oauth", + "label": "Sign in with SpreadJam", + "transport": "mcp_remote", + "auth": "oauth", + "ownershipModes": [ + "dcr" + ], + "whenToUse": "Use browser sign-in for SpreadJam's hosted MCP server.", + "defaults": { + "serverUrl": "https://api.spreadjam.com/mcp" + }, + "tenantFields": [ + { + "key": "projectId", + "label": "Pin to project ID", + "type": "text", + "advanced": true, + "placeholder": "Optional Jam project ID", + "helperMd": "Optional. Pin every tool call on this connection to one Jam project via X-Jam-Project. Leave blank to pass projectId per call or use the newest active project.", + "validation": { + "pattern": "^[A-Za-z0-9_-]+$", + "maxLength": 128 + }, + "transport": { + "location": "header", + "name": "X-Jam-Project" + } + } + ], + "guidanceMd": "Sign in to SpreadJam and approve access. The connection inherits the signed-in user's workspace role. Leave Pin to project ID blank to target projects per call, or enter a Jam project ID under Advanced to pin every request.", + "warnings": [ + "SpreadJam OAuth does not define narrow scopes: the connection acts with the signed-in user's workspace role.", + "Research, publishing, billing allocation, and delete tools can spend workspace credits or modify live content. New connections start write and destructive actions on Ask first, and newly added tools are quarantined on refresh until reviewed." + ], + "consoleLinks": { + "docs": "https://docs.spreadjam.com/api-reference/mcp", + "settings": "https://app.spreadjam.com" + }, + "riskTier": "S4" + }, + { + "key": "mcp-api-key", + "label": "Use a SpreadJam API key", + "transport": "mcp_remote", + "auth": "api_key", + "ownershipModes": [ + "customer" + ], + "whenToUse": "Use a workspace API key from SpreadJam Settings → Developer for unattended access.", + "defaults": { + "serverUrl": "https://api.spreadjam.com/mcp" + }, + "tenantFields": [ + { + "key": "projectId", + "label": "Pin to project ID", + "type": "text", + "advanced": true, + "placeholder": "Optional Jam project ID", + "helperMd": "Optional. Pin every tool call on this connection to one Jam project via X-Jam-Project. Leave blank to pass projectId per call or use the newest active project.", + "validation": { + "pattern": "^[A-Za-z0-9_-]+$", + "maxLength": 128 + }, + "transport": { + "location": "header", + "name": "X-Jam-Project" + } + } + ], + "credentialFields": [ + { + "key": "authorization", + "label": "SpreadJam API key", + "type": "password", + "required": true, + "placeholder": "sk_...", + "secret": true, + "helperMd": "Create a workspace API key in SpreadJam under Settings → Developer → Create API key (keys start with sk_ and are shown once). Keys act with their creator's workspace role on live data; Paperclip cannot narrow an existing key. Keep publishing, deleting, and credit-spending tools on Ask first before agents run unattended." + } + ], + "keyPlacement": { + "location": "header", + "name": "Authorization", + "prefix": "Bearer " + }, + "guidanceMd": "Create an API key in SpreadJam under Settings → Developer → Create API key, then paste the sk_... key here. Keys act with their creator's workspace role and are shown once.", + "warnings": [ + "SpreadJam API keys reach live workspace data under their creator's role; there are no test keys.", + "Research, publishing, billing allocation, and delete tools can spend workspace credits or modify live content. New connections start write and destructive actions on Ask first, and newly added tools are quarantined on refresh until reviewed." + ], + "consoleLinks": { + "docs": "https://docs.spreadjam.com/onboard-with-your-agent/other-clients", + "keys": "https://app.spreadjam.com" + }, + "riskTier": "S4" + } + ] +} diff --git a/scripts/app-definition-overrides/okara.json b/scripts/app-definition-overrides/okara.json new file mode 100644 index 00000000000..f5c8d89f192 --- /dev/null +++ b/scripts/app-definition-overrides/okara.json @@ -0,0 +1,54 @@ +{ + "schemaVersion": 1, + "slug": "okara", + "name": "Okara", + "description": "Run SEO and AI visibility audits, find Reddit threads, and draft marketing posts and campaigns with Okara AI CMO.", + "categories": [ + "analytics", + "content" + ], + "featured": false, + "branding": { + "logoUrl": "/brands/apps/okara.svg", + "darkLogoUrl": "/brands/apps/okara-dark.svg" + }, + "urlPatterns": [ + "https://okara.ai/api/mcp*", + "https://okara.ai/*" + ], + "docsUrl": "https://okara.ai/mcp", + "redirectConstraints": "https-or-loopback-http", + "methods": [ + { + "key": "mcp-oauth", + "label": "Sign in with Okara", + "transport": "mcp_remote", + "auth": "oauth", + "ownershipModes": [ + "dcr" + ], + "whenToUse": "Use browser sign-in for Okara's hosted MCP server.", + "defaults": { + "serverUrl": "https://okara.ai/api/mcp", + "scopesHint": [ + "mcp:read", + "mcp:write" + ] + }, + "guidanceMd": "Sign in to Okara and approve read and draft access for your projects. Paperclip requests mcp:read and mcp:write by default so agents can run audits and prepare drafts without external publishing or paid ad spend.", + "warnings": [ + "The connection reaches every Okara project owned by or shared with the signed-in user.", + "External publishing (mcp:publish) and paid ad spend (mcp:spend) are omitted from the default OAuth request. New connections start write and destructive actions on Ask first, and newly added tools are quarantined on refresh until reviewed." + ], + "consoleLinks": { + "docs": "https://okara.ai/mcp" + }, + "riskTier": "S3", + "capabilityProfile": { + "key": "write", + "label": "Read and draft", + "description": "Inspect SEO, GEO, and Reddit opportunities and draft content or paused campaigns without requesting external publishing or paid ad spend scopes." + } + } + ] +} diff --git a/scripts/app-definition-overrides/spreadjam.json b/scripts/app-definition-overrides/spreadjam.json new file mode 100644 index 00000000000..e935cc61f9c --- /dev/null +++ b/scripts/app-definition-overrides/spreadjam.json @@ -0,0 +1,203 @@ +{ + "schemaVersion": 1, + "slug": "spreadjam", + "name": "SpreadJam", + "description": "Track AI search visibility across ChatGPT, Gemini, and Perplexity, inspect prompts and citations, and run AEO actions in Jam.", + "categories": [ + "analytics", + "content" + ], + "featured": false, + "branding": { + "logoUrl": "/brands/apps/spreadjam.svg" + }, + "urlPatterns": [ + "https://api.spreadjam.com/*", + "https://www.spreadjam.com/*", + "https://app.spreadjam.com/*" + ], + "docsUrl": "https://docs.spreadjam.com/api-reference/mcp", + "redirectConstraints": "https-or-loopback-http", + "reviewedTools": { + "reviewedAt": "2026-12-05", + "sourceUrl": "https://api.spreadjam.com/openapi.json", + "read": [ + "get_action", + "get_analytics_overview", + "get_billing", + "get_brand", + "get_content", + "get_content_revision", + "get_credits", + "get_me", + "get_opportunity", + "get_opportunity_brief", + "get_pricing", + "get_project", + "get_prompt", + "get_prompt_cap", + "get_prompt_suggestion", + "get_research", + "get_research_report", + "get_site_change", + "get_support_request", + "get_visibility_run", + "list_actions", + "list_analytics_metrics", + "list_answers", + "list_api_keys", + "list_brand_competitors", + "list_content", + "list_content_deliveries", + "list_content_destinations", + "list_content_publications", + "list_content_revisions", + "list_destinations", + "list_keywords", + "list_notification_rules", + "list_opportunities", + "list_projects", + "list_prompt_analytics", + "list_prompt_answers", + "list_prompt_topics", + "list_prompts", + "list_support_requests", + "list_visibility_runs", + "list_webhooks" + ], + "destructive": [ + "cancel_content_publishing", + "cancel_prompt_suggestion", + "configure_destination_github", + "create_action_execution", + "create_plan_batch", + "create_research_request", + "create_site_change_pull_request", + "delete_webhook", + "discard_content", + "discard_site_change", + "edit_prompts_bulk", + "publish_content", + "recalibrate_brand", + "regenerate_content", + "release_opportunity_claim", + "remove_brand_competitor", + "remove_destination", + "remove_prompt", + "remove_prompt_topic", + "replace_prompt", + "request_content_edit", + "request_opportunity_plan", + "revoke_api_key", + "set_billing_allocations", + "unpin_competitors", + "update_destination" + ], + "unlisted": "write", + "quarantineNewEntries": true + }, + "agentInstructions": { + "id": "spreadjam-default-v1", + "version": 1, + "text": "Start a SpreadJam session with get_me to confirm the active workspace and projects, then inspect get_analytics_overview, list_prompts (always pass a bounded limit), or list_actions before making changes. Tools that spend credits, publish content, delete records, or change billing allocations are destructive — verify target projectId and confirm before running them." + }, + "methods": [ + { + "key": "mcp-oauth", + "label": "Sign in with SpreadJam", + "transport": "mcp_remote", + "auth": "oauth", + "ownershipModes": [ + "dcr" + ], + "whenToUse": "Use browser sign-in for SpreadJam's hosted MCP server.", + "defaults": { + "serverUrl": "https://api.spreadjam.com/mcp" + }, + "tenantFields": [ + { + "key": "projectId", + "label": "Pin to project ID", + "type": "text", + "advanced": true, + "placeholder": "Optional Jam project ID", + "helperMd": "Optional. Pin every tool call on this connection to one Jam project via X-Jam-Project. Leave blank to pass projectId per call or use the newest active project.", + "validation": { + "pattern": "^[A-Za-z0-9_-]+$", + "maxLength": 128 + }, + "transport": { + "location": "header", + "name": "X-Jam-Project" + } + } + ], + "guidanceMd": "Sign in to SpreadJam and approve access. The connection inherits the signed-in user's workspace role. Leave Pin to project ID blank to target projects per call, or enter a Jam project ID under Advanced to pin every request.", + "warnings": [ + "SpreadJam OAuth does not define narrow scopes: the connection acts with the signed-in user's workspace role.", + "Research, publishing, billing allocation, and delete tools can spend workspace credits or modify live content. New connections start write and destructive actions on Ask first, and newly added tools are quarantined on refresh until reviewed." + ], + "consoleLinks": { + "docs": "https://docs.spreadjam.com/api-reference/mcp", + "settings": "https://app.spreadjam.com" + }, + "riskTier": "S4" + }, + { + "key": "mcp-api-key", + "label": "Use a SpreadJam API key", + "transport": "mcp_remote", + "auth": "api_key", + "ownershipModes": [ + "customer" + ], + "whenToUse": "Use a workspace API key from SpreadJam Settings → Developer for unattended access.", + "defaults": { + "serverUrl": "https://api.spreadjam.com/mcp" + }, + "tenantFields": [ + { + "key": "projectId", + "label": "Pin to project ID", + "type": "text", + "advanced": true, + "placeholder": "Optional Jam project ID", + "helperMd": "Optional. Pin every tool call on this connection to one Jam project via X-Jam-Project. Leave blank to pass projectId per call or use the newest active project.", + "validation": { + "pattern": "^[A-Za-z0-9_-]+$", + "maxLength": 128 + }, + "transport": { + "location": "header", + "name": "X-Jam-Project" + } + } + ], + "credentialFields": [ + { + "key": "authorization", + "label": "SpreadJam API key", + "type": "password", + "required": true, + "placeholder": "sk_...", + "secret": true + } + ], + "keyPlacement": { + "location": "header", + "name": "Authorization", + "prefix": "Bearer " + }, + "guidanceMd": "Create an API key in SpreadJam under Settings → Developer → Create API key, then paste the sk_... key here. Keys act with their creator's workspace role and are shown once.", + "warnings": [ + "SpreadJam API keys reach live workspace data under their creator's role; there are no test keys.", + "Research, publishing, billing allocation, and delete tools can spend workspace credits or modify live content. New connections start write and destructive actions on Ask first, and newly added tools are quarantined on refresh until reviewed." + ], + "consoleLinks": { + "docs": "https://docs.spreadjam.com/onboard-with-your-agent/other-clients", + "keys": "https://app.spreadjam.com" + }, + "riskTier": "S4" + } + ] +} diff --git a/server/src/__tests__/connector-tool-policy.test.ts b/server/src/__tests__/connector-tool-policy.test.ts index 3c68119268e..0388d9b9394 100644 --- a/server/src/__tests__/connector-tool-policy.test.ts +++ b/server/src/__tests__/connector-tool-policy.test.ts @@ -1,5 +1,6 @@ import { randomUUID } from "node:crypto"; -import { companies, createDb } from "@paperclipai/db"; +import { companies, companyMemberships, createDb, toolPolicies } from "@paperclipai/db"; +import { and, eq } from "drizzle-orm"; import { afterAll, beforeAll, describe, expect, it, vi } from "vitest"; import { connectorToolPolicy } from "../services/connectors/tool-policy.js"; import { DAYTONA_API_URL, DAYTONA_METHOD } from "../services/daytona.js"; @@ -12,6 +13,7 @@ describe("reviewed connector risk dispatch", () => { for (const [source, name] of [ ["railway", "list-projects"], ["daytona", "daytona_api_list_sandboxes"], ["enterpret", "run_graph_query"], ["braintrust", "sql_query"], + ["spreadjam", "get_me"], ["okara", "get_audit_report"], ]) { for (const annotations of [{ destructiveHint: true }, { destructive: true }]) { expect(classifyRisk({ name, annotations }, source)).toBe("destructive"); @@ -56,6 +58,39 @@ describe("reviewed connector risk dispatch", () => { expect(connectorToolPolicy("circleback").quarantineNewEntries).toBe(false); }); + it("classifies SpreadJam reviewed read, write, and destructive tools conservatively", () => { + for (const name of ["get_me", "get_analytics_overview", "list_prompts", "list_actions", "get_credits"]) { + expect(classifyRisk({ name }, "spreadjam")).toBe("read"); + } + for (const name of [ + "publish_content", + "create_research_request", + "create_site_change_pull_request", + "create_action_execution", + "create_plan_batch", + "set_billing_allocations", + "remove_prompt", + "revoke_api_key", + "delete_webhook", + ]) { + expect(classifyRisk({ name, annotations: { readOnlyHint: true } }, "spreadjam")).toBe("destructive"); + } + expect(classifyRisk({ name: "add_prompt", annotations: { readOnlyHint: true } }, "spreadjam")).toBe("write"); + expect(classifyRisk({ name: "unlisted_future_tool", annotations: { readOnlyHint: true } }, "spreadjam")).toBe("write"); + expect(classifyRisk({ name: "get_me", annotations: { writeHint: true } }, "spreadjam")).toBe("write"); + expect(connectorToolPolicy("spreadjam").quarantineNewEntries).toBe(true); + }); + + it("classifies Okara dynamic MCP tools conservatively and quarantines drift", () => { + expect(classifyRisk({ name: "audit_seo", annotations: { readOnlyHint: true } }, "okara")).toBe("read"); + expect(classifyRisk({ name: "draft_reddit_post" }, "okara")).toBe("write"); + expect(classifyRisk({ name: "draft_reddit_post", annotations: { readOnlyHint: false } }, "okara")).toBe("write"); + for (const name of ["publish_article", "spend_ad_budget", "delete_draft", "launch_campaign"]) { + expect(classifyRisk({ name, annotations: { readOnlyHint: true } }, "okara")).toBe("destructive"); + } + expect(connectorToolPolicy("okara").quarantineNewEntries).toBe(true); + }); + it("retains generic risk behavior when the connector has no reviewed override", () => { expect(classifyRisk({ name: "get_object" }, "custom")).toBe("read"); expect(classifyRisk({ name: "new_tool", annotations: { readOnlyHint: true } }, "custom")).toBe("read"); @@ -64,7 +99,7 @@ describe("reviewed connector risk dispatch", () => { }); describe("reviewed connector catalog policies", () => { - it.each(["railway", "enterpret", "daytona", "unikraft", "braintrust"])("declares the initial drift policy for %s", source => { + it.each(["railway", "enterpret", "daytona", "unikraft", "braintrust", "spreadjam", "okara"])("declares the initial drift policy for %s", source => { expect(connectorToolPolicy(source).quarantineNewEntries).toBe(true); }); @@ -143,4 +178,152 @@ const support = await getEmbeddedPostgresTestSupport(); expect(refreshed.connection.config?.sourceTemplateKey).toBe("custom"); expect(request).toHaveBeenCalled(); }); + + it.each([ + { + galleryKey: "spreadjam", + issuer: "https://api.spreadjam.com", + serverUrl: "https://api.spreadjam.com/mcp", + readTool: { name: "get_me", annotations: { readOnlyHint: true } }, + writeTool: { name: "add_prompt" }, + destructiveTool: { name: "create_research_request" }, + }, + { + galleryKey: "okara", + issuer: "https://okara.ai", + serverUrl: "https://okara.ai/api/mcp", + readTool: { name: "audit_seo", annotations: { readOnlyHint: true } }, + writeTool: { name: "draft_reddit_post" }, + destructiveTool: { name: "publish_article" }, + }, + ])("completes a fresh $galleryKey OAuth connection with Ask-first policies on write and destructive tools", async ({ + galleryKey, + issuer, + serverUrl, + readTool, + writeTool, + destructiveTool, + }) => { + const [company] = await db.insert(companies).values({ + name: `${galleryKey} OAuth policy fixture`, + issuePrefix: `OP${randomUUID().slice(0, 6)}`, + }).returning(); + await db.insert(companyMemberships).values({ + companyId: company!.id, + principalType: "user", + principalId: "policy-reviewer", + status: "active", + membershipRole: "admin", + }); + let tools: McpToolDescriptor[] = [readTool, writeTool, destructiveTool]; + const redirectUri = "http://localhost:3100/api/tools/oauth/callback"; + const request = vi.fn(async (url: string, init?: RequestInit) => { + if (url.includes("/.well-known/oauth-protected-resource")) { + return Response.json({ resource: serverUrl, authorization_servers: [issuer] }); + } + if (url.includes("/.well-known/oauth-authorization-server")) { + return Response.json({ + issuer, + authorization_endpoint: `${issuer}/oauth/authorize`, + token_endpoint: `${issuer}/oauth/token`, + registration_endpoint: `${issuer}/oauth/register`, + response_types_supported: ["code"], + grant_types_supported: ["authorization_code", "refresh_token"], + code_challenge_methods_supported: ["S256"], + token_endpoint_auth_methods_supported: ["none"], + }); + } + if (url === `${issuer}/oauth/register`) { + const body = JSON.parse(String(init?.body ?? "{}")); + return Response.json({ + client_id: `${galleryKey}-dcr-client`, + redirect_uris: body.redirect_uris ?? [redirectUri], + grant_types: body.grant_types ?? ["authorization_code", "refresh_token"], + response_types: body.response_types ?? ["code"], + token_endpoint_auth_method: body.token_endpoint_auth_method ?? "none", + }); + } + if (url === `${issuer}/oauth/token`) { + return Response.json({ + access_token: `${galleryKey}-access-token`, + token_type: "Bearer", + expires_in: 3600, + }); + } + if (url === serverUrl) { + const rpc = JSON.parse(String(init?.body ?? "{}")); + if (rpc.method === "initialize") { + return Response.json({ + jsonrpc: "2.0", + id: rpc.id, + result: { + protocolVersion: "2025-06-18", + capabilities: { tools: {} }, + serverInfo: { name: galleryKey, version: "1" }, + }, + }); + } + if (rpc.method === "notifications/initialized") { + return new Response(null, { status: 202 }); + } + if (rpc.method === "tools/list") { + return Response.json({ jsonrpc: "2.0", id: rpc.id, result: { tools } }); + } + } + return new Response("not found", { status: 404 }); + }); + + const service = toolAccessService(db, { + remoteHttpRequest: request, + remoteHttpEndpointLookup: async () => [{ address: "8.8.8.8", family: 4 }], + }); + const actor = { actorType: "user" as const, actorId: "policy-reviewer" }; + const connected = await service.connectGalleryApp( + company!.id, + { galleryKey, connectionMethodKey: "mcp-oauth" }, + actor, + ); + const start = await service.startOAuth(company!.id, connected.connectionId, { redirectUri, actor }); + const state = new URL(start.authorizationUrl).searchParams.get("state")!; + const completed = await service.completeOAuthCallback({ + state, + code: "test-auth-code", + iss: issuer, + redirectUri, + actor, + }); + + expect(completed.connection.config).toMatchObject({ + sourceTemplateKey: galleryKey, + quarantineNewEntries: true, + }); + const byName = new Map(completed.catalog.map((entry) => [entry.toolName, entry])); + expect(byName.get(readTool.name)).toMatchObject({ riskLevel: "read", status: "active" }); + expect(byName.get(writeTool.name)).toMatchObject({ riskLevel: "write", status: "active" }); + expect(byName.get(destructiveTool.name)).toMatchObject({ riskLevel: "destructive", status: "active" }); + + const policies = await db + .select() + .from(toolPolicies) + .where( + and( + eq(toolPolicies.companyId, company!.id), + eq(toolPolicies.policyType, "require_approval"), + eq(toolPolicies.enabled, true), + ), + ); + const askFirstIds = new Set( + policies.map((policy) => (policy.selectors as { catalogEntryId?: string } | null)?.catalogEntryId), + ); + expect(askFirstIds.has(byName.get(readTool.name)!.id)).toBe(false); + expect(askFirstIds.has(byName.get(writeTool.name)!.id)).toBe(true); + expect(askFirstIds.has(byName.get(destructiveTool.name)!.id)).toBe(true); + + tools = [...tools, { name: "provider_added_tool", annotations: { readOnlyHint: true } }]; + const refreshed = await service.refreshCatalog(connected.connectionId, actor, { enableAllByDefault: true }); + expect(refreshed.catalog.find((entry) => entry.toolName === "provider_added_tool")).toMatchObject({ + status: "quarantined", + quarantineReason: "pending_review", + }); + }); }); diff --git a/server/src/services/connectors/okara/risk.ts b/server/src/services/connectors/okara/risk.ts new file mode 100644 index 00000000000..c07ef9c35fe --- /dev/null +++ b/server/src/services/connectors/okara/risk.ts @@ -0,0 +1,33 @@ +import type { ToolRiskLevel } from "@paperclipai/shared"; + +const DESTRUCTIVE_VERB = + /(?:^|-)(?:delete|remove|destroy|unpublish|publish|spend|launch|activate|cancel|revoke)(?:$|-)/; + +/** + * Okara serves a dynamic hosted MCP catalog without a static public tool list. + * Destructive, publishing, and ad-spend hints or verbs classify as destructive; + * only tools the provider explicitly marks read-only (without destructive or + * write hints/verbs) classify as read; unlisted or unannotated tools fail + * closed to write. + */ +export function okaraRisk(tool: { + name: string; + annotations?: Record; +}): ToolRiskLevel { + const annotations = tool.annotations ?? {}; + const normalized = tool.name + .replace(/([a-z0-9])([A-Z])/g, "$1-$2") + .toLowerCase() + .replace(/[:._-]+/g, "-"); + if ( + annotations.destructiveHint === true || + annotations.destructive === true || + DESTRUCTIVE_VERB.test(normalized) + ) { + return "destructive"; + } + if (annotations.readOnlyHint === false || annotations.writeHint === true) { + return "write"; + } + return annotations.readOnlyHint === true ? "read" : "write"; +} diff --git a/server/src/services/connectors/tool-policy.ts b/server/src/services/connectors/tool-policy.ts index 37cf6df0ea6..fcb9fbd390c 100644 --- a/server/src/services/connectors/tool-policy.ts +++ b/server/src/services/connectors/tool-policy.ts @@ -4,6 +4,7 @@ import { NATIVE_PROVIDER_CATALOGS } from "../native-provider-catalogs.js"; import { classifyRailwayToolRisk, isRailwayEndpoint } from "../railway.js"; import { braintrustRisk } from "./braintrust/risk.js"; import { enterpretRisk } from "./enterpret/risk.js"; +import { okaraRisk } from "./okara/risk.js"; interface ToolDescriptor { name: string; @@ -50,6 +51,7 @@ const reviewedPolicies: ReviewedToolPolicy[] = [ })), { sourceTemplateKey: "enterpret", quarantineNewEntries: true, classifyRisk: enterpretRisk }, { sourceTemplateKey: "braintrust", quarantineNewEntries: true, classifyRisk: braintrustRisk }, + { sourceTemplateKey: "okara", quarantineNewEntries: true, classifyRisk: okaraRisk }, ]; /** diff --git a/tests/runner-e2e/source-sdk-public-inputs.json b/tests/runner-e2e/source-sdk-public-inputs.json index 92dfc711ece..54ce293638a 100644 --- a/tests/runner-e2e/source-sdk-public-inputs.json +++ b/tests/runner-e2e/source-sdk-public-inputs.json @@ -77,10 +77,10 @@ "packages/shared/src/antigravity-runtime.test.ts": "f9ebcc9430be51c342b42644b735f1434b405ec7", "packages/shared/src/api.ts": "1d61cdff51433c4136368d52ee7cf2f16aa820ed", "packages/shared/src/app-definitions-url.test.ts": "56792d6745a5bc7eafc36e7403f4c9bbd671ae99", - "packages/shared/src/app-definitions.generated.ts": "c8b1c79300c650ffee5703901775c7b7c9616ec6", + "packages/shared/src/app-definitions.generated.ts": "ff53dba62b1b4e26398e175313aa44dc133346d4", "packages/shared/src/app-definitions.ingestion-report.json": "a7b60c7c16a484a411989315e9f08d48258fa647", - "packages/shared/src/app-definitions.test.ts": "d346bbae1c7fc870da2bc970482fb0f61a272b92", - "packages/shared/src/app-definitions.ts": "94340a2b9c6c2aa72a9abe0302fb84d0c3d0e27f", + "packages/shared/src/app-definitions.test.ts": "0574cc49b06a7db3ebe779f4a25d6cf9eda2d47a", + "packages/shared/src/app-definitions.ts": "07627009c3bf40075904428288f997b534e09a6e", "packages/shared/src/app-definitions/1password.json": "c11a4777de2c78805b2d391da5eb075a9511e0f8", "packages/shared/src/app-definitions/agentmail.json": "edd0799b1980d0f5f43b89c8f7a1173dc623f7fa", "packages/shared/src/app-definitions/airtable.json": "c9b216a2bbe693bc6167413255d41c33512d418d", @@ -156,6 +156,7 @@ "packages/shared/src/app-definitions/netlify.json": "b94365447e8f890ea9534dfa455cd122b5f5cb71", "packages/shared/src/app-definitions/notion.json": "54d07923fc2f79fc95c6bbf0098eb3c179af3a7d", "packages/shared/src/app-definitions/oauth-generic.json": "b9a7ece3c237bd152c6870e0df1e286b822d3b91", + "packages/shared/src/app-definitions/okara.json": "f5c8d89f192887564e33b75524e17b0d9838c29c", "packages/shared/src/app-definitions/openai.json": "14708e9bacff1e65b4041979f4c27aeb6c1c322b", "packages/shared/src/app-definitions/openrouter.json": "d4d1be16fce8f5e33ad1597d0f02076e40d485b8", "packages/shared/src/app-definitions/oreilly.json": "297f25e790f61c72b0190970ee4b4b3aabfbc6da", @@ -175,6 +176,7 @@ "packages/shared/src/app-definitions/similarweb.json": "37a912287b7ad323cf783eb32d01b943a93e83fd", "packages/shared/src/app-definitions/slack.json": "0a3e028d0c729f1448be06eaff3a7b51f08b194d", "packages/shared/src/app-definitions/speko.json": "8edaad773c06372ee8cd9e7ee3e5b03ffe875a5f", + "packages/shared/src/app-definitions/spreadjam.json": "2626d485d232b3968dc5612189e663ddd170629e", "packages/shared/src/app-definitions/stripe.json": "708fb6d3498dbb57902dd5ebc45c8fded5d6b578", "packages/shared/src/app-definitions/supabase.json": "9a92a2f30af01e1c9f4cebdf7d4ba0101353c1c6", "packages/shared/src/app-definitions/superagent.json": "6e1a847cc0c754a326250caa8dc93401b5c823f1", diff --git a/ui/public/brands/apps/manifest.json b/ui/public/brands/apps/manifest.json index 63b2c119cc5..73a930c9177 100644 --- a/ui/public/brands/apps/manifest.json +++ b/ui/public/brands/apps/manifest.json @@ -757,6 +757,19 @@ "provider": "Tailscale", "catalogVisible": false, "localAsset": "/brands/apps/tailscale.png" + }, + { + "slug": "spreadjam", + "provider": "SpreadJam", + "catalogVisible": true, + "localAsset": "/brands/apps/spreadjam.svg" + }, + { + "slug": "okara", + "provider": "Okara", + "catalogVisible": true, + "localAsset": "/brands/apps/okara.svg", + "darkAsset": "/brands/apps/okara-dark.svg" } ] } diff --git a/ui/public/brands/apps/okara-dark.svg b/ui/public/brands/apps/okara-dark.svg new file mode 100644 index 00000000000..fed05fe547c --- /dev/null +++ b/ui/public/brands/apps/okara-dark.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/ui/public/brands/apps/okara.svg b/ui/public/brands/apps/okara.svg new file mode 100644 index 00000000000..9abeb7b3244 --- /dev/null +++ b/ui/public/brands/apps/okara.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/ui/public/brands/apps/spreadjam.svg b/ui/public/brands/apps/spreadjam.svg new file mode 100644 index 00000000000..10c5f33e6cd --- /dev/null +++ b/ui/public/brands/apps/spreadjam.svg @@ -0,0 +1,8 @@ + + + + + + + +