Borrowing it
Nothing to install: this file belongs to alifanov/scopegate. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/alifanov/scopegate/master/.claude/commands/add-api.mdgit clone --depth 1 https://github.com/alifanov/scopegateWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/commands/alifanov/scopegate/add-api)<a href="https://agentmods.dev/commands/alifanov/scopegate/add-api"><img src="https://agentmods.dev/badge/commands/alifanov/scopegate/add-api/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/commands/alifanov/scopegate/add-api"><img src="https://agentmods.dev/badge/commands/alifanov/scopegate/add-api.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00015 | $0.00985 |
| Opus 5.5 | $0.00006 | $0.00394 |
| Sonnet 5.5 | $0.00003 | $0.00197 |
| Haiku 4.5 | $0.00002 | $0.00098 |
Grade A, and why
add-api scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 80 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Context
ScopeGate is an MCP gateway that connects AI agents to third-party APIs via OAuth. Each integration requires:
- An OAuth module (
src/lib/{provider}-oauth.ts) - OAuth route handlers (
src/app/api/oauth/{provider}/route.ts+callback/route.ts) - An MCP API wrapper (
src/lib/mcp/{provider}.ts) - MCP tool definitions (
src/lib/mcp/tools.ts) - Permission groups (
src/lib/mcp/permissions.ts) - UI updates for service connection (
src/components/)
The user will specify which API/service to add. Use $ARGUMENTS for the service name.
Your Task
Add a complete API integration for the specified service.
Steps
-
Research the API auth flow
- Search the web for the service's OAuth documentation
- Identify: auth URL, token URL, required scopes, token refresh mechanism
- Check if it uses OAuth 2.0, OAuth 1.0a, or API key auth
- Determine token expiration and refresh strategy
-
Study existing patterns
- Read a similar existing OAuth module (e.g.,
src/lib/threads-oauth.tsfor simple OAuth 2.0,src/lib/google-oauth.tsfor refresh token flows) - Read the corresponding callback route in
src/app/api/oauth/ - Read the MCP wrapper in
src/lib/mcp/ - Note the structure and follow it exactly
- Read a similar existing OAuth module (e.g.,
-
Implement OAuth module (
src/lib/{provider}-oauth.ts)buildAuthUrl()— construct OAuth authorization URL with correct scopesexchangeCodeForTokens()— exchange auth code for access (and refresh) tokensgetUserInfo()— fetch authenticated user info for the account labelgetValidAccessToken()— retrieve + auto-refresh token from DB- Add env vars:
{PROVIDER}_CLIENT_ID,{PROVIDER}_CLIENT_SECRET
-
Implement OAuth routes
src/app/api/oauth/{provider}/route.ts— initiate OAuth flow (redirect to auth URL)src/app/api/oauth/{provider}/callback/route.ts— handle callback, store tokens in DB
-
Implement MCP wrapper (
src/lib/mcp/{provider}.ts)- Create
{provider}Fetch()function that handles auth and API calls - Follow the pattern from existing wrappers (e.g.,
src/lib/mcp/twitter.ts)
- Create
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 1mo ago First seen · 80 lines · 15 tokens per session scan A fd026f8b23c5
add-api is a command published in the GitHub repository alifanov/scopegate (18 stars, last pushed yesterday), licensed MIT. It adds 15 tokens to every session and 985 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other commands, from other repositories
init
Annotate all unannotated source files in the project with CodeDNA module headers. Uses your current Claude session — no API key required.
celigo-troubleshoot
Diagnose a failing, partial, empty, or stuck Celigo flow -- read its runs, errors, and execution logs, find the root cause, and say what to fix. Read-only until I ask for the fix.
celigo-handlebars
Author or debug a Celigo Handlebars expression (mapping, HTTP body, SQL, URI, filter, or file path) using the helper catalog.
pn-audit-data
Design or review database schema — normalization, indexing strategy, migration plan, and data model decisions. Surgical command for database design. Use standalone or as part of pn-backend-audit.
pn-audit-api
Surgical API design review — REST conventions, status codes, response shapes, validation, and schema leaks. Use standalone or as part of pn-backend-audit. Outputs a scored fix roadmap.
pn-audit-errors
Standardize error handling — consistent shapes, structured logging, correlation IDs, safe client responses. Surgical command for error handling. Use standalone or as part of pn-backend-audit.