Files
PaperClipAI/ui/src/lib/app-gallery-copy.ts
T
Devin Foley 53105d5830 feat(apps): add Gauge connection (#15596)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - Agents reach external services through the Apps catalog. Each
catalog entry is a reviewed `AppDefinition` that connects a provider's
hosted MCP server to Paperclip's shared vault, grants, policies,
gateway, and audit trail.
> - Gauge (`withgauge.com`) measures how AI answer engines mention and
cite a brand. Its hosted MCP server also gives SEO, analytics and ads
reports, and runs a content pipeline that can publish to a connected
CMS.
> - Gauge is not in the catalog. Operators must use the generic "Connect
your own MCP server" flow. That flow has no branding, no organization
guidance, and no warning about live CMS publishing.
> - The connector playbook supports this provider with existing
definition fields. The server supports dynamic client registration with
a reviewed `mcp` scope, and it accepts an organization API key as a
bearer header.
> - This pull request adds the Gauge definition, its artwork, the
research and permission-review ledger rows, documentation, and
deterministic tests.
> - The benefit is a branded, governed Gauge connection with browser
sign-in, an API-key option, and a clear publish warning.

## Linked Issues or Issue Description

**Problem or motivation**

Marketing and growth teams use Gauge to track their brand in AI answers
and to run content workflows. They want their Paperclip agents to read
visibility, keyword and traffic data, and to prepare content. Gauge is
not in the Apps catalog. Operators must paste the MCP URL into the
generic remote-MCP flow, which gives no branding, no method guidance,
and no warning that content tools can publish live.

**Proposed solution**

Add a catalog-only Gauge connection built from the connector playbook.
Browser sign-in uses Gauge's dynamic client registration and requests
only the reviewed `mcp` scope. The user selects one Gauge organization
on the consent screen. An optional method sends a customer-created
organization API key as an `Authorization: Bearer` header. Both methods
warn the operator to set publish actions to Ask first. Every discovered
tool stays governed by the normal per-action policies.

**Alternatives considered**

A plugin was not needed because no custom UI, tables, workers, or
webhooks are involved. The identity scopes that Gauge also advertises
(`openid`, `profile`, `email`, `organizations`) are not requested,
because Gauge selects the organization on its consent screen. A
Gauge-specific `classifyRisk` rule was not added, because the tool names
cannot be seen without an account. The generic rule already classifies
`publish`, `create` and `update` tools as writes.

**Roadmap alignment**

This extends the existing self-serve remote-MCP connection catalog and
does not overlap planned core work.

## What Changed

- Added the `gauge` provider to `scripts/ingest-app-definitions.mjs`
(category `analytics`, API-key placement, guidance, warnings,
description) and regenerated
`packages/shared/src/app-definitions/gauge.json` and the generated
registry.
- Added the Gauge row to the self-serve MCP research ledger with
`dcr_or_api_key` auth and risk tier S3.
- Added permission reviews for `gauge/mcp-oauth` (explicit scope `mcp`,
from Gauge's live authorization-server metadata) and `gauge/mcp-api-key`
(provider key), with evidence links.
- Added Gauge's mark (`ui/public/brands/apps/gauge.png`, the avatar of
Gauge's official GitHub organization) and the brand manifest entry.
- Added gallery copy for the Gauge card.
- Added `doc/connections/GAUGE.md` (endpoints, scopes, administrator
setup, capabilities and policy, manifest, brand provenance, validation
hook) and linked it from the connections README and the permission
audit.
- Tests: Gauge definition shape, store visibility and artwork, URL
recognition, reviewed scope, bearer-header placement, the connect form's
sign-in default and API-key gating, and the pinned catalog counts.

## Verification

- `pnpm exec vitest run packages/shared/src/app-definitions.test.ts
packages/shared/src/app-definitions-url.test.ts
ui/src/pages/apps/AppsConnect.test.tsx ui/src/pages/apps/Browse.test.tsx
ui/src/lib/app-brand-assets.test.ts
ui/src/pages/apps/AppLogo.brand-assets.test.tsx
server/src/__tests__/tool-access-service.test.ts` — 738 passed.
- `node scripts/check-app-brand-assets.mjs` and `node --test
scripts/app-brand-validation.test.mjs` — passed.
- `pnpm --filter @paperclipai/shared typecheck`, `pnpm --filter
@paperclipai/server typecheck`, `pnpm --filter @paperclipai/ui
typecheck` — clean.
- `node scripts/ingest-app-definitions.mjs --definitions-only` produces
no Gauge drift.
- Manual: on a local instance, open Apps → Browse and confirm the Gauge
card and icon. Open `/apps/connect?source=gauge` and confirm that
sign-in is the default and that the API-key method is under Advanced.
- Live metadata probe on 2026-10-08: an unauthenticated `initialize` on
`https://app.withgauge.com/mcp` returns 401 with `resource_metadata`.
Both `.well-known` documents return the recorded endpoints and scopes.
Dynamic client registration succeeds. The authorize endpoint accepts
`scope=mcp` and rejects an unknown scope with HTTP 400.

## Risks

- Low risk to existing providers: the change is additive catalog data
plus tests. The generated registry only gains one import.
- Gauge content tools can publish to a connected CMS, including live,
and a bulk keyword update replaces each prompt's keyword list. Both
methods warn the operator, and the API-key helper text tells operators
to set publish actions to Ask first.
- Gauge API keys are not scoped and reach the whole organization.
Paperclip cannot narrow an issued key.
- The permission-review ledger records live proof for both methods as
not run. The lifecycle checklist in `doc/connections/GAUGE.md` still
needs a documented pass with a Gauge organization.

> For core feature work, check [`ROADMAP.md`](ROADMAP.md) first and
discuss it in `#dev` before opening the PR. Feature PRs that overlap
with planned core work may need to be redirected — check the roadmap
first. See `CONTRIBUTING.md`.

## Model Used

- Claude Opus 5.5 (`claude-opus-5-5`, 1M context) in Claude Code, with
tool use (shell, file editing, web research).

## 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
- [ ] All Paperclip CI gates are green
- [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge
2026-10-08 12:37:06 -07:00

182 lines
6.0 KiB
TypeScript

/**
* Prosumer copy for the Apps surface (PAP-10856).
*
* The P1a gallery manifest carries developer-flavoured taglines and credential
* labels (e.g. "Connect Zapier-hosted MCP actions", "Zapier MCP token"). Those
* strings would fail the vocabulary gate from PAP-10827 — no "MCP", "server",
* "profile", "policy", "gateway", or "transport" anywhere on this surface. So
* the UI never renders the raw manifest copy directly: it looks up plain copy
* here, and `sanitizeProsumerCopy` is a final backstop for any free-text we do
* surface (app names, fallback taglines).
*/
/** Words that must never appear in prosumer-facing copy on the Apps surface. */
const BANNED_WORDS = [
"mcp",
"server",
"profile",
"policy",
"gateway",
"transport",
"stdio",
"endpoint",
];
const BANNED_RE = new RegExp(`\\b(${BANNED_WORDS.join("|")})s?\\b`, "gi");
/**
* Strip banned vocabulary from a free-text string as a last-resort backstop.
* Prefer curated copy below; this only protects against manifest text we can't
* fully control (e.g. a newly added gallery app with no curated entry yet).
*/
export function sanitizeProsumerCopy(text: string): string {
return text
.replace(BANNED_RE, "")
.replace(/\s{2,}/g, " ")
.replace(/\s+([.,])/g, "$1")
.trim();
}
export interface AppCopy {
/** Two short lines for the gallery card (M2). */
tagline: string;
/** Single line for the connect step header (M3b). */
short: string;
}
/**
* Curated prosumer copy keyed by gallery key. Taken from the M-series wires
* (https://happy-grove-jzyc.here.now/). Apps without an entry fall back to a
* generic, gate-safe line.
*/
const APP_COPY: Record<string, AppCopy> = {
zapier: {
tagline: "Reach 9,000+ apps your team already uses.",
short: "Reach 9,000+ apps from your agents.",
},
github: {
tagline: "Read code and pull requests, comment on issues.",
short: "Read code and pull requests, comment on issues.",
},
slack: {
tagline: "Send and read messages in your team's channels.",
short: "Send and read messages in your channels.",
},
notion: {
tagline: "Read and update pages in your workspace.",
short: "Read and update pages in your workspace.",
},
railway: {
tagline: "Inspect services, read logs, and manage deployments.",
short: "Connect Railway for deployments, logs, and container access.",
},
posthog: {
tagline: "Explore product usage, errors, flags, and experiments.",
short: "Sign in with PostHog. Project pinning and access controls are optional.",
},
gauge: {
tagline: "Track your brand in AI answers and run content workflows.",
short: "Sign in with Gauge and pick an organization. API keys are optional.",
},
neon: {
tagline: "Manage Postgres projects, branches, and queries.",
short: "Sign in with Neon. Project pinning and read-only mode are optional.",
},
superagent: {
tagline: "Review security findings and run red-team checks.",
short: "Connect with a Superagent API key. Billable and destructive tools stay under action policies.",
},
linear: {
tagline: "Create, update and read tickets.",
short: "Create, update and read tickets.",
},
"google-sheets": {
tagline: "Read and update selected spreadsheets.",
short: "Read spreadsheets or update the files you choose.",
},
gmail: {
tagline: "Read mail and create drafts for your review.",
short: "Read mail and create drafts for your review.",
},
"google-drive": {
tagline: "Find, read, and create files in Drive.",
short: "Find, read, and create files in Drive.",
},
"google-docs": {
tagline: "Read and update documents.",
short: "Read and update documents.",
},
"google-slides": {
tagline: "Read and update presentations.",
short: "Read and update presentations.",
},
"google-calendar": {
tagline: "Review calendars and manage events.",
short: "Review calendars and manage events.",
},
"google-chat": {
tagline: "Read conversations and send messages.",
short: "Read conversations and send messages.",
},
"google-people": {
tagline: "Look up contacts and people in your directory.",
short: "Look up contacts and people in your directory.",
},
"google-workspace-search": {
tagline: "Search across your Google workspace.",
short: "Search across your Google workspace.",
},
hubspot: {
tagline: "Look up contacts and update deal stages.",
short: "Look up contacts and update deal stages.",
},
intercom: {
tagline: "Read and reply to customer conversations.",
short: "Read and reply to customer conversations.",
},
figma: {
tagline: "Read files and post comments on frames.",
short: "Read files and post comments on frames.",
},
stripe: {
tagline: "Read customers, invoices, and payouts.",
short: "Read customers, invoices, and payouts.",
},
context7: {
tagline: "Look up up-to-date docs for your libraries.",
short: "Look up up-to-date docs for your libraries.",
},
};
const GENERIC: AppCopy = {
tagline: "Give your agents access to this app.",
short: "Give your agents access to this app.",
};
/** Curated, gate-safe copy for a gallery app. */
export function appCopyFor(key: string, fallbackTagline?: string | null): AppCopy {
const curated = APP_COPY[key];
if (curated) return curated;
if (fallbackTagline) {
const cleaned = sanitizeProsumerCopy(fallbackTagline);
if (cleaned) return { tagline: cleaned, short: cleaned };
}
return GENERIC;
}
/**
* Label for a single credential field on the key-paste step (M3b). The raw
* manifest label can contain banned vocab ("Zapier MCP token"), so for the
* common single-field case we present "Your {App} key" per the wires; multi-
* field apps fall back to a sanitized version of the manifest label.
*/
export function credentialFieldLabel(
appName: string,
rawLabel: string,
fieldCount: number,
): string {
if (fieldCount <= 1) return `Your ${appName} key`;
const cleaned = sanitizeProsumerCopy(rawLabel);
return cleaned || `Your ${appName} key`;
}