|
1 | 1 | --- |
2 | 2 | name: superagent |
3 | | -description: Configure and safely use Superagent's remote MCP server and webhooks for findings, security reports, Contributor Trust, Context Guardrails, and Runtime Guardrails. Use when the user asks to install, connect, configure, troubleshoot, operate, or set up webhook notifications for Superagent from Cursor, Claude Code, Codex CLI, or another MCP client. |
| 3 | +description: Set up Superagent Context Guardrails at coding-agent tool boundaries, configure and safely use the remote MCP server, and manage signed webhooks for findings, security reports, Contributor Trust, and Runtime Guardrails. Use when the user asks to enable context scanning before an agent consumes URLs, files, email, skills, or MCP repositories; integrate coding-agent hooks; or install, connect, configure, troubleshoot, or operate Superagent from Cursor, Claude Code, Codex CLI, or another MCP client. |
4 | 4 | --- |
5 | 5 |
|
6 | | -# Superagent MCP |
| 6 | +# Superagent |
7 | 7 |
|
8 | | -Connect a coding agent to Superagent, then use its MCP tools without exposing |
9 | | -credentials or surprising the user with remote, billable, destructive, or |
10 | | -policy-changing actions. |
| 8 | +Set up Context Guardrails so external context is checked before a coding agent |
| 9 | +consumes it, connect the agent to Superagent over MCP, or configure signed |
| 10 | +webhooks. Keep credentials protected and avoid surprising the user with remote, |
| 11 | +billable, destructive, or policy-changing actions. |
11 | 12 |
|
12 | 13 | Superagent MCP is an authenticated remote service. Do not connect to it, send |
13 | 14 | it data, or change an MCP client configuration unless the user explicitly asks. |
14 | 15 |
|
15 | | -## Setup workflow |
| 16 | +Route setup requests by intent: |
16 | 17 |
|
17 | | -1. Identify the MCP client and whether the user wants setup, troubleshooting, |
18 | | - or an operation on an existing connection. |
| 18 | +- **Context Guardrails setup or coding-agent hooks**: follow |
| 19 | + [Context Guardrails integration](#context-guardrails-integration). Connecting |
| 20 | + MCP alone does not enforce pre-consumption checks. |
| 21 | +- **Connect or troubleshoot Superagent MCP**: follow |
| 22 | + [MCP setup workflow](#mcp-setup-workflow). |
| 23 | +- **Signed event delivery**: follow [Webhook setup](#webhook-setup). |
| 24 | + |
| 25 | +## MCP setup workflow |
| 26 | + |
| 27 | +1. Identify the MCP client and whether the user wants a new connection, |
| 28 | + troubleshooting, or an operation on an existing connection. |
19 | 29 | 2. For setup, direct the user to create an organization API key at |
20 | 30 | [Superagent Settings](https://www.superagent.sh/app/settings#api-keys). |
21 | 31 | Never ask them to paste the key into chat. |
@@ -109,6 +119,125 @@ result and preserve identifiers the user needs for a follow-up. For |
109 | 119 | asynchronous operations, report the returned status or identifier and avoid |
110 | 120 | tight polling. |
111 | 121 |
|
| 122 | +## Context Guardrails integration |
| 123 | + |
| 124 | +Distinguish a one-off scan from enforcement: |
| 125 | + |
| 126 | +- For "scan/check this URL, file, email, skill, or MCP repository," use the |
| 127 | + corresponding MCP tool. |
| 128 | +- For "add/enable/integrate Context Guardrails," install a check at the tool |
| 129 | + boundary before the agent consumes the context. A `SKILL.md`, `AGENTS.md`, |
| 130 | + rule, or system prompt is guidance, not enforcement. |
| 131 | + |
| 132 | +Use this setup workflow: |
| 133 | + |
| 134 | +1. Ask which context origins to protect, whether the setup is project-local or |
| 135 | + global, and whether an unavailable scanner should block the action. Recommend |
| 136 | + fail-closed for security-sensitive workflows and user-level or managed hooks |
| 137 | + for controls that use an organization API key. Use project hooks only in a |
| 138 | + trusted repository. |
| 139 | +2. Inspect the client's current hook configuration and supported events. Merge |
| 140 | + with existing configuration; never replace it wholesale. |
| 141 | +3. Gate the action that introduces context, before consumption: web-fetch and |
| 142 | + `curl`/`wget` actions for pages, download actions for public files, skill |
| 143 | + installation for skills, MCP add/install configuration for MCP repositories, |
| 144 | + and the inbound-message wrapper for email. Do not treat every later MCP tool |
| 145 | + call as a repository scan. |
| 146 | +4. Map each selected origin to the narrowest client pre-execution boundary: |
| 147 | + - Cursor: `preToolUse`, `beforeShellExecution`, or `beforeMCPExecution`. |
| 148 | + - Claude Code: `PreToolUse` matched to `WebFetch`, `Bash`, `Skill`, or the |
| 149 | + relevant MCP tool. |
| 150 | + - Codex CLI: `PreToolUse` for supported local and MCP tools. Hosted |
| 151 | + `WebSearch` is not hookable, so disclose that gap instead of claiming full |
| 152 | + coverage. |
| 153 | + - Other clients: their equivalent before-tool hook, wrapper, middleware, or |
| 154 | + enforced rule plus an approved wrapper. |
| 155 | +5. Show the exact hook, helper, paths, scope, verdict policy, outage behavior, |
| 156 | + and known coverage gaps. Obtain approval before writing files, changing |
| 157 | + client configuration, or sending a test target to Superagent. |
| 158 | +6. For enforced hooks, install a small local helper that calls the Context |
| 159 | + Guardrails REST API with `SUPERAGENT_API_KEY`. Some clients support MCP-backed |
| 160 | + hook handlers, but a scan tool's result is not automatically a client-specific |
| 161 | + allow or deny decision, and MCP errors may fail open. Use MCP directly for |
| 162 | + interactive scans, not as the cross-client enforcement adapter. Keep the key |
| 163 | + in the environment, never in the helper or hook configuration. Prefer a |
| 164 | + user-controlled helper outside the repository and reference it by absolute |
| 165 | + path so repository code cannot silently replace it. |
| 166 | +7. Test one allowed target and one blocked or unresolved target, then restart |
| 167 | + or reload the client if its hook system requires it. Use the client's hook |
| 168 | + inspector when available and verify the action itself was blocked, not merely |
| 169 | + that the helper printed a warning. |
| 170 | + |
| 171 | +The helper must call the matching `/api/v1/context/*` endpoint: |
| 172 | + |
| 173 | +- Web page URL -> `GET /context/web_page/{identifier}` |
| 174 | +- Public text or PDF URL -> `POST /context/file` |
| 175 | +- Raw RFC 822 email -> `POST /context/email` |
| 176 | +- skills.sh or public GitHub skill -> `POST /context/skill` |
| 177 | +- Public GitHub MCP repository -> `POST /context/mcp` |
| 178 | + |
| 179 | +Skill and MCP scans support public GitHub targets only and require an active |
| 180 | +Superagent Security GitHub App installation. Verify that prerequisite before |
| 181 | +claiming those hook paths are enforced. Keep agent lifecycle hooks distinct |
| 182 | +from package, Git, or other install hooks found inside scanned content; the |
| 183 | +latter are threat signals. |
| 184 | + |
| 185 | +Do not upload local private files through the public-URL file scanner, and get |
| 186 | +explicit authorization before sending raw email or other user content. Package |
| 187 | +and general repository scanning are not Context Guardrails origins: use |
| 188 | +Superagent supply-chain scanning for packages and repository reports for source |
| 189 | +repositories. Do not port an old package-install hook and claim that Context |
| 190 | +Guardrails scanned the package. |
| 191 | + |
| 192 | +For an enforcement decision, parse the JSON response rather than relying only |
| 193 | +on score headers. Apply the selected tolerance consistently: |
| 194 | + |
| 195 | +- `safe`: allow. |
| 196 | +- `caution`: require user review unless the user explicitly chose a different |
| 197 | + policy. |
| 198 | +- `suspicious` or `dangerous`: deny. |
| 199 | +- `pending_deep_scan: true`, unscannable results, malformed responses, and |
| 200 | + scanner timeouts: treat as unresolved and follow the approved outage policy. |
| 201 | + |
| 202 | +Do not let a preliminary identity score silently allow consumption while the |
| 203 | +deep scan is pending. Either request `mode=full` with a hook timeout long enough |
| 204 | +for completion, or block/ask and tell the agent to retry after the asynchronous |
| 205 | +scan finishes. Exempt the Superagent scanner calls themselves from generic MCP |
| 206 | +gates to avoid recursive checks. |
| 207 | + |
| 208 | +### Hook safety requirements |
| 209 | + |
| 210 | +Follow the installed client's current hook schema rather than copying one |
| 211 | +client's JSON response into another: |
| 212 | + |
| 213 | +- Use narrow, anchored tool matchers and command predicates. Broad hooks add |
| 214 | + latency and create bypasses or accidental blocks. |
| 215 | +- Parse stdin as structured JSON. Never use `eval`, shell interpolation, or |
| 216 | + string-built commands with untrusted tool input. URL-encode identifiers and |
| 217 | + pass values as quoted arguments or request bodies. |
| 218 | +- Emit only the client's documented decision JSON on stdout; send diagnostics |
| 219 | + to stderr. Treat malformed input and output as a security failure under the |
| 220 | + chosen outage policy. |
| 221 | +- Use one bounded HTTPS request with explicit connection and total timeouts. |
| 222 | + Do not log authorization headers, raw email, or response bodies containing |
| 223 | + user content. |
| 224 | +- Do not let hook configuration auto-approve an action that the client's normal |
| 225 | + permission system denies. Context Guardrails should only add restrictions. |
| 226 | + |
| 227 | +Apply platform failure behavior explicitly: |
| 228 | + |
| 229 | +- **Cursor:** security hooks fail open on crashes, timeouts, and invalid JSON |
| 230 | + unless the hook sets `failClosed: true`. Set it for enforced boundaries. |
| 231 | + `permission: "ask"` is not enforced for `preToolUse`; when review is required, |
| 232 | + use a boundary that supports asking or deny with a clear review instruction. |
| 233 | +- **Claude Code:** use a `PreToolUse` denial response or exit code `2` for a hard |
| 234 | + block. A timed-out command, HTTP, or MCP-tool hook continues through normal |
| 235 | + permission flow, so timeout alone is not fail-closed. Keep normal permission |
| 236 | + rules in place as defense in depth. |
| 237 | +- **Codex CLI:** use the documented `PreToolUse` denial JSON or exit code `2` |
| 238 | + with the reason on stderr. Invalid fields and hook failures can continue the |
| 239 | + tool call. Hosted tools such as `WebSearch` remain outside hook coverage. |
| 240 | + |
112 | 241 | ## Webhook setup |
113 | 242 |
|
114 | 243 | Use webhooks when the user wants Superagent events delivered to an agent, |
@@ -196,3 +325,7 @@ Tool annotations are hints, not a substitute for this gate. |
196 | 325 | - [Findings](https://www.superagent.sh/docs/findings) |
197 | 326 | - [Red Team reports](https://www.superagent.sh/docs/red-team) |
198 | 327 | - [Context Guardrails](https://www.superagent.sh/docs/context-guardrails) |
| 328 | +- [Context Guardrails API](https://www.superagent.sh/docs/api/context-guardrails) |
| 329 | +- [Cursor hooks](https://cursor.com/docs/hooks) |
| 330 | +- [Claude Code hooks](https://code.claude.com/docs/en/hooks) |
| 331 | +- [Codex CLI hooks](https://developers.openai.com/codex/hooks) |
0 commit comments