mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-29 23:56:43 +01:00
feat(apps): add Superagent connection (#15394)
## 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. > - Superagent (`superagent.sh`) is a security platform. Its hosted MCP server lets agents read and triage security findings, start red-team reports, run Contributor Trust and dependency update jobs, and score web pages, email, files, skills, MCP repositories, and packages before an agent trusts them. > - Superagent is not in the catalog. Operators must use the generic "Connect your own MCP server" flow. That flow has no branding, no key guidance, and no warning about billable or destructive tools. > - The connector playbook supports this provider with existing definition fields. The server accepts an organization API key as a bearer header. It publishes no OAuth authorization-server metadata, so browser sign-in is not possible. > - This pull request adds the Superagent definition, its artwork, the research and permission-review ledger rows, documentation, deterministic tests, and one reviewed risk-classification rule. > - The benefit is a branded, governed Superagent connection with clear key guidance and a warning about tools that cost credits or delete data. ## Linked Issues or Issue Description **Problem or motivation** Teams that use Superagent for PR security, red teaming, and agent guardrails want their Paperclip agents to read findings, return structured reports, and score content before they use it. Superagent is not in the Apps catalog. Operators must paste the MCP URL and an `Authorization` header into the generic remote-MCP flow. That flow gives no branding and no provider guidance. It also does not tell the operator that the key reaches the whole organization, or that some tools consume credits or permanently delete findings. **Proposed solution** Add a catalog-only Superagent connection that follows the connector playbook. It has one method: a customer organization API key (`sk_live_...`), sent as an `Authorization: Bearer` header to `https://www.superagent.sh/mcp`. The field helper text explains that Superagent keys are not scoped. The method warning tells operators to set billable and destructive actions to Ask first before agents run unattended. All discovered tools stay governed by the normal per-action policies. **Alternatives considered** A browser sign-in method was not added. The server's protected-resource metadata names `https://superagent.sh` as its authorization server, but that origin publishes no `oauth-authorization-server` or `openid-configuration` document, so Paperclip cannot discover OAuth endpoints. A plugin was not needed because the connection needs no custom UI, tables, workers, or webhooks. Relying on the generic risk classifier was not enough. Several Superagent mutations (`triage_finding`, `scan_*`, `restore_agent_builtin_rule`) use names that it reads as reads, so a narrow reviewed Superagent rule was added instead. **Roadmap alignment** This extends the existing self-serve remote-MCP connection catalog. It does not overlap planned core work. ## What Changed - Added the `superagent` row to `packages/shared/src/self-serve-mcp-research.json` (API-key auth, risk tier S4). - Added the `superagent` provider to `scripts/ingest-app-definitions.mjs` (category, key placement and placeholder, console links, guidance, description). Regenerated `packages/shared/src/app-definitions/superagent.json` and the generated registry. - Added the `superagent/mcp-api-key` permission review to `doc/connections/tool-method-permission-reviews.json`, with key-permission text and evidence links. - Added Superagent's official mark (`ui/public/brands/apps/superagent.png`, the 460×460 avatar of the official `superagent-ai` GitHub organization) and the brand manifest entry. - Added gallery copy for the Superagent card. - Added a reviewed Superagent rule to `classifyRisk` in `server/src/services/tool-access.ts`. Only `list_*` and `get_*` tools, and tools that Superagent marks read-only, are reads. `delete_*` and `revoke_agent_client` are destructive. All other tools are writes, so billable and rule-changing tools can be set to Ask first. - Put the Ask-first advice in the API-key helper text, because the key form shows helper text and not method warnings. - Added `doc/connections/SUPERAGENT.md` (transport and auth, why there is no OAuth, administrator setup, capabilities and policy, manifest, brand provenance, validation hook). Linked it from the connections README and the permission audit. - Tests: definition shape, store visibility and artwork, URL recognition, the bearer header on discovery with the key kept out of connection config, read/write/destructive classification of fixture tools, the Superagent risk rule (including `triage_finding` and `restore_agent_builtin_rule`), the visible Ask-first advice and API-key gating of the connect form, 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`: 317 passed. - `pnpm exec vitest run server/src/__tests__/tool-access-service.test.ts`: 385 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`, and `pnpm --filter @paperclipai/ui typecheck`: clean. - Manual: in a local instance, open Apps → Browse and confirm the Superagent card and icon. Open `/apps/connect?source=superagent`. Confirm the single API-key method, and confirm that Connect enables only after a key is entered. - Live metadata probe on 2026-10-06: an unauthenticated `initialize` on `https://www.superagent.sh/mcp` returns 401 with `resource_metadata="https://www.superagent.sh/.well-known/oauth-protected-resource"`. That document returns 200. No authorization-server metadata exists at the named issuer. ## Risks - Low risk to existing providers. The change is additive catalog data plus tests. The generated registry only gains one import. The new risk rule runs only for Superagent connections. - A Superagent key reaches its whole organization. Some tools consume credits (`create_*_report`, `triage_finding`) or delete data permanently (`delete_finding`). Every action starts Allowed under the current product default. The key helper text tells operators to set these actions to Ask first. - The permission-review ledger records live proof as not run. No Superagent account was used. The lifecycle checklist in `doc/connections/SUPERAGENT.md` needs a documented pass before the entry is fully qualified. > 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 extended thinking and tool use (shell, file editing, web fetch, browser checks). ## 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
This commit is contained in:
1 parent
5c15be3715
commit
8cbd21b3e7
16 files changed
+452
-29
No files matched your search
@@ -5183,7 +5183,7 @@ describeEmbeddedPostgres("tool access service", () => {
|
||||
"local",
|
||||
]),
|
||||
);
|
||||
expect(res.body.apps).toHaveLength(66);
|
||||
expect(res.body.apps).toHaveLength(67);
|
||||
for (const slug of ["openrouter", "bedrock", "responses-api", "messages-api", "chat-completions-api", "local"]) {
|
||||
expect(res.body.apps.find((app: { slug: string }) => app.slug === slug).tags).toContain("model-provider");
|
||||
}
|
||||
@@ -6309,6 +6309,52 @@ describeEmbeddedPostgres("tool access service", () => {
|
||||
).rejects.toMatchObject({ status: 400 });
|
||||
});
|
||||
|
||||
it("connects Superagent with an organization API key sent as a bearer header", async () => {
|
||||
const company = await createCompany(db);
|
||||
const service = createTestToolAccessService(db);
|
||||
const fetchMock = mockToolsList([
|
||||
{ name: "list_findings", annotations: { readOnlyHint: true } },
|
||||
{ name: "create_repository_report" },
|
||||
{ name: "delete_finding", annotations: { destructiveHint: true } },
|
||||
]);
|
||||
|
||||
const result = await service.connectGalleryApp(
|
||||
company.id,
|
||||
{
|
||||
galleryKey: "superagent",
|
||||
credentialValues: { "credentials.authorization": "sk_live_test-secret" },
|
||||
},
|
||||
{ actorType: "user", actorId: "board" },
|
||||
);
|
||||
|
||||
expect(fetchMock).toHaveBeenCalledWith(
|
||||
"https://www.superagent.sh/mcp",
|
||||
expect.objectContaining({
|
||||
headers: expect.objectContaining({
|
||||
Authorization: "Bearer sk_live_test-secret",
|
||||
}),
|
||||
}),
|
||||
);
|
||||
expect(result.connection).toMatchObject({
|
||||
authKind: "api_key",
|
||||
config: {
|
||||
url: "https://www.superagent.sh/mcp",
|
||||
sourceTemplateKey: "superagent",
|
||||
connectionMethodKey: "mcp-api-key",
|
||||
},
|
||||
});
|
||||
expect(JSON.stringify(result.connection.config)).not.toContain(
|
||||
"sk_live_test-secret",
|
||||
);
|
||||
expect(result.catalog).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({ toolName: "list_findings", riskLevel: "read", status: "active" }),
|
||||
expect.objectContaining({ toolName: "create_repository_report", riskLevel: "write", status: "active" }),
|
||||
expect.objectContaining({ toolName: "delete_finding", riskLevel: "destructive", status: "active" }),
|
||||
]),
|
||||
);
|
||||
});
|
||||
|
||||
it("projects Neon's optional project pin and read-only mode into the hosted server URL", async () => {
|
||||
const company = await createCompany(db);
|
||||
const service = createTestToolAccessService(db);
|
||||
@@ -19191,6 +19237,30 @@ describe("classifyRisk", () => {
|
||||
expect(classifyRisk({ name: "fireflies_share_meeting", annotations: { destructiveHint: true } }, "fireflies")).toBe("destructive");
|
||||
});
|
||||
|
||||
it("classifies Superagent mutations whose names read like reads as writes", () => {
|
||||
for (const name of ["list_findings", "get_finding", "get_context_score", "list_agent_alerts"])
|
||||
expect(classifyRisk({ name }, "superagent")).toBe("read");
|
||||
for (const name of [
|
||||
"triage_finding",
|
||||
"restore_agent_builtin_rule",
|
||||
"scan_package",
|
||||
"discover_application_inventory",
|
||||
"trigger_dependency_updates",
|
||||
"test_telemetry_endpoint",
|
||||
"create_repository_report",
|
||||
"set_agent_builtin_rule_mode",
|
||||
])
|
||||
expect(classifyRisk({ name }, "superagent")).toBe("write");
|
||||
for (const name of ["delete_finding", "delete_agent_rule", "revoke_agent_client"])
|
||||
expect(classifyRisk({ name }, "superagent")).toBe("destructive");
|
||||
// A provider write hint wins over a read-looking name; a read-only hint
|
||||
// opts a tool outside list/get into reads.
|
||||
expect(classifyRisk({ name: "get_finding", annotations: { readOnlyHint: false } }, "superagent")).toBe("write");
|
||||
expect(classifyRisk({ name: "validate_agent_rule", annotations: { readOnlyHint: true } }, "superagent")).toBe("read");
|
||||
// Without the provider rule, the generic classifier treats these as reads.
|
||||
expect(classifyRisk({ name: "triage_finding" })).toBe("read");
|
||||
});
|
||||
|
||||
it("classifies Enterpret run_graph_query as write despite readOnlyHint", () => {
|
||||
expect(
|
||||
classifyRisk(
|
||||
|
||||
@@ -2406,6 +2406,15 @@ export function classifyRisk(
|
||||
return "write";
|
||||
if (sourceTemplateKey === "posthog" && normalizedToolName === "exec")
|
||||
return "destructive";
|
||||
// Superagent mirrors its REST API, and several mutations use verbs the
|
||||
// generic classifier reads as reads: billable triage_finding, scans,
|
||||
// restore_agent_builtin_rule, and credential-revoking revoke_agent_client.
|
||||
// Only list/get tools and tools the provider marks read-only are reads.
|
||||
if (sourceTemplateKey === "superagent") {
|
||||
if (verbMatches(tool.name, "delete|remove|destroy|revoke")) return "destructive";
|
||||
if (annotations.readOnlyHint === false || annotations.writeHint === true) return "write";
|
||||
return /^(list|get)-/.test(normalizedToolName) || annotations.readOnlyHint === true ? "read" : "write";
|
||||
}
|
||||
if (
|
||||
sourceTemplateKey === "shopify" &&
|
||||
SHOPIFY_DESTRUCTIVE_TOOLS.has(normalizedToolName)
|
||||
|
||||
Reference in new issue
Block a user