add

A project command that scaffolds the code needed to connect a Next.js application to an existing integration. Next.js is a framework for building web applications with JavaScript or TypeScript.

In plain words
What is it for?
Adding connector integrations to Next.js projects that use the App Router, such as a Notion connector.
Why use it?
It removes the repetitive setup involved in adding an integration, while checking credentials, the integration name and the project's routing setup.

Command

Part of the connector-platform plugin — 1 skill, 4 commands, 1 MCP server shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/danielsalles/connector-platform-plugin/add
Clone the repo
git clone --depth 1 https://github.com/danielsalles/connector-platform-plugin

Or install connector-platform, the plugin that ships this one along with the rest of its 1 skill, 4 commands, 1 MCP server.

Per session 14 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,636 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5 $0.00014 $0.01636
Opus 5 $0.00007 $0.00818
Sonnet 5 $0.00003 $0.00327
Haiku 4.5 $0.00001 $0.00164

Measured 2d ago against content hash 86109ce2f4d7, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

add scanned grade A with 1 finding 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 2d 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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

`GET ${CONNECTOR_BASE_URL}/v1/connectors/io.io-platform/<slug>` with bearer. Use Bash + curl.
commands/add.md · 192 lines

How it starts

The opening of the file, as written. The whole thing — 192 lines — stays where its author put it; the contents beside it link to each section on GitHub.

The user is running /connector add <slug> (e.g. /connector add notion).

Step 1 — Read credentials

Read .env.local. Need CONNECTOR_API_KEY, CONNECTOR_BASE_URL, CONNECTOR_BUILDER_ID. If missing, error:

Not logged in. Run /connector login <cpt_token> first.

Stop.

Step 2 — Validate the integration exists

GET ${CONNECTOR_BASE_URL}/v1/connectors/io.io-platform/<slug> with bearer. Use Bash + curl.

If 404, reply:

Integration <slug> not found. Run /connector list to see what's available.

Save the connector's name (human-readable from response).

Step 3 — Detect framework

Read package.json. Required: next in dependencies. If absent, reply:

This plugin currently only scaffolds Next.js (App Router) projects. Open an issue if you need Express, FastAPI, or another framework.

Stop.

Detect App Router vs Pages by checking which exists at the project root:

  • If src/app/ or app/ directory exists → App Router (target this)
  • Else → Pages Router

If Pages Router, reply:

This plugin only scaffolds App Router. Migrate to App Router or open an issue.

Stop.

Determine the source root: src/app if src/ exists, else app.

Step 4 — Write the connect handler

Create <src_root>/api/connect/<slug>/route.ts. If file already exists, ask the user before overwriting.

Use this exact template (substitute <slug> and <name> from step 2):

import { NextResponse } from 'next/server';

// Triggers the connect flow for <name>. Redirects the end_user to the
// authorization page (OAuth or API key form) and returns to the success URL
// after they authorize. The end_user is identified by `external_ref` — replace
// the hardcoded value below with your actual user ID lookup (session, JWT, etc).
//
// Default `__dev__` matches the alias `self` on your MCP URL: connections
// authorized in dev are immediately visible inside Claude Desktop / your MCP
// client. Once you have real customers, swap for your session user ID.
export async function GET(req: Request) {
  const url = new URL(req.url);
  const externalRef = url.searchParams.get('user_id') ?? '__dev__';

  // 1. Ensure the end_user exists in Connector Platform (idempotent).
  const userRes = await fetch(`${process.env.CONNECTOR_BASE_URL}/v1/users`, {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${process.env.CONNECTOR_API_KEY}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({ external_ref: externalRef }),
  });
  if (!userRes.ok) {
    return NextResponse.json({ error: 'failed to create end_user', detail: await userRes.text() }, { status: 500 });
  }
  const { id: endUserId } = await userRes.json();

  // 2. Create a connect-session that returns an authorization URL.
  const successUrl = `${url.origin}/integrations/<slug>/connected`;
  const sessRes = await fetch(`${process.env.CONNECTOR_BASE_URL}/v1/connect-sessions`, {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${process.env.CONNECTOR_API_KEY}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      end_user_id: endUserId,
      connector_namespace: 'io.io-platform',
      connector_slug: '<slug>',
      success_redirect_url: successUrl,
    }),
  });
  if (!sessRes.ok) {
    return NextResponse.json({ error: 'failed to create session', detail: await sessRes.text() }, { status: 500 });
  }
  const session = await sessRes.json();

  return NextResponse.redirect(session.session_url ?? session.url);
}

Read the full file on GitHub · 192 lines

Changes

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.

  1. 2d ago First seen · 192 lines · 14 tokens per session scan A 86109ce2f4d7

Subscribe to this mod's changes

add is a command published in the GitHub repository danielsalles/connector-platform-plugin (0 stars, last pushed 4mo ago), licensed MIT. It adds 14 tokens to every session and 1,636 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.