skills/add-mcp-to-app/SKILL.md
--- name: add-mcp-to-app description: Expose an existing TanStack Start + Cloudflare Workers app as an MCP server that MCP-speaking agents (Claude Code, Codex, Cursor, anything that talks the Model Context Protocol) can install in one command. Adds the OAuth 2.1 authorization-server routes (.well-known discovery, /oauth/authorize with auth-code + PKCE, /oauth/token, /oauth/register for Dynamic Client Registration), an /api/mcp handler that accepts both Bearer-token PATs and OAuth access tokens,
npx skillsauth add RonanCodes/ronan-skills skills/add-mcp-to-appInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Take an app you already shipped (TanStack Start on Cloudflare Workers) and turn it into a one-command install for any MCP-speaking agent. The reference implementation this skill was distilled from is Simplicity-Labs/dataforce (the app) + Simplicity-Labs/dataforce-plugin (the plugin), shipped on 2026-05-14.
The pattern this skill scaffolds:
Your agent (Claude Code / Codex / Cursor) ── stdio ──► npx -y mcp-remote ──► HTTPS ──► https://<your-app>/api/mcp
│
└── browser OAuth on first run (Clerk → your app → mcp-remote → agent)
mcp-remote is the cross-agent OAuth client. The same npx -y mcp-remote <url> command works in any MCP host, which is why the same plugin repo serves every agent. Two-repo distribution decouples the public plugin manifest from the (often private) app codebase.
Use when:
claude mcp add per teammate.Skip when:
/ro:new-mcp-server <name> --stdio is the right tool (local stdio, no OAuth machinery)./ro:new-tanstack-app and /ro:cf-ship first; this skill assumes a working production URL./api/mcp route, no OAuth backend needed; this skill is overkill./ro:clerk install first.gh CLI authed against the GitHub org that will host both repos.<app-name>-plugin.Existing TanStack Start + CF Workers app?
├── No → /ro:new-tanstack-app first, then come back
└── Yes
├── Already has /api/mcp handler?
│ ├── No → this skill scaffolds the handler (step B)
│ └── Yes → skip step B, extend handler to accept OAuth tokens
├── Already has /.well-known/oauth-authorization-server?
│ ├── No → this skill adds the full OAuth backend (step A)
│ └── Yes → diff the discovery doc, ensure it advertises authorization_code grant
└── Plugin repo (<app>-plugin) on GitHub?
├── No → this skill scaffolds and publishes (step C)
└── Yes → updates .mcp.json + setup-skill in place (step D)
The skill walks four steps in order, prompting via AskUserQuestion before each structural change. Steps A and B touch the app repo; steps C and D touch (or create) the plugin repo. The user can opt out of any step with the corresponding --skip-* flag.
This is the load-bearing piece. mcp-remote defaults to OAuth 2.1 auth-code + PKCE (not device flow), so the app needs:
/.well-known/oauth-authorization-server advertising the authorization, token, and registration endpoints plus supported grant types and PKCE methods./oauth/authorize — a Clerk-gated (or WorkOS / Better Auth-gated) consent page where the human clicks Allow / Deny./api/oauth/authorize — issues authorization codes server-side after consent, persists client_id + redirect_uri + code_challenge + code_challenge_method to a new oauth_authorization_code table./api/oauth/token — multiplexes existing grant types (refresh_token, client_credentials, device_code if you have it) with the new authorization_code grant, validating the PKCE verifier on exchange./oauth/register — POST endpoint that returns a client_id for any client that registers, so mcp-remote can self-register on first use rather than requiring a hand-shared client ID.AskUserQuestion before scaffolding:
"About to add five routes (
/.well-known/oauth-authorization-server,/oauth/authorize,/api/oauth/authorize,/api/oauth/token,/oauth/register) and one Drizzle migration (oauth_authorization_codetable). Proceed?"
If yes, base the implementation on the dataforce reference. The shape that worked:
src/lib/oauth.ts <- pkceS256Challenge, startAuthorizationCode,
exchangeAuthorizationCode helpers
src/routes/api/oauth.token.ts <- token endpoint, multiplexes grant types
src/routes/api/oauth.authorize.ts <- server handler, GET returns client info,
POST records consent + redirects with code
src/routes/oauth.authorize.tsx <- consent page (gated by Clerk auth)
src/routes/api/oauth.register.ts <- DCR endpoint, returns minted client_id
src/routes/.well-known/oauth-authorization-server.ts <- discovery doc
drizzle/NNNN_<name>.sql <- oauth_authorization_code table
src/db/schema.ts <- oauthAuthorizationCode table declaration
Reference commit: dataforce PR #142 (auth-code + PKCE on /oauth/authorize), merged 2026-05-14.
Key implementation notes:
code_challenge_methods_supported: ["S256"]. mcp-remote does S256, not plain.oauth_authorization_code row stores code_challenge, code_challenge_method, client_id, redirect_uri, scope, user_id (from Clerk session), and an expiry of 10 minutes max. Delete on exchange. Single-use.mcp-remote has nothing to register and fails before the consent step.pnpm drizzle-kit generate && wrangler d1 migrations apply <db> --local (and --remote after testing).If the app does not already expose /api/mcp, scaffold it. The handler MUST accept both:
personal_access_token table.mcp-remote). Verify the token against whatever the OAuth backend issued (JWT or DB-backed opaque token).AskUserQuestion before scaffolding:
"Scaffold a new
/api/mcphandler? If you already have one, choose 'extend existing' so I add OAuth-token validation alongside whatever you already have."
If scaffolding from scratch, lean on cloudflare:build-mcp (load via the Skill tool) for the McpAgent boilerplate, then layer auth on top. Tools, resources, and prompts are app-specific; this skill does not invent them. It just wires the handler.
The plugin repo is intentionally a separate GitHub repo from the app. Why:
/plugin marketplace add <org>/<app-name>-plugin URL.AskUserQuestion before creating:
"Create a new repo at
<org>/<app-name>-pluginon GitHub and scaffold the plugin? Or point me at an existing plugin repo path?"
If new, scaffold this exact shape:
<app-name>-plugin/
├── .claude-plugin/
│ ├── plugin.json
│ └── marketplace.json
├── .mcp.json
├── skills/
│ └── <app-name>-setup/
│ └── SKILL.md
├── LICENSE
└── README.md
.mcp.json (the cross-agent install command — NO tokens, OAuth handles auth):
{
"mcpServers": {
"<app-name>": {
"command": "npx",
"args": [
"-y",
"mcp-remote",
"https://<your-app-host>/api/mcp"
]
}
}
}
.claude-plugin/plugin.json — declares the plugin, its version, its keywords. Set homepage to the app's public URL and repository to the plugin repo's GitHub URL.
.claude-plugin/marketplace.json — declares this repo IS the marketplace, with the single plugin inside.
skills/<app-name>-setup/SKILL.md — the cross-agent configurator, the piece that makes this pattern pay off beyond Claude Code. The skill:
~/.claude.json, ~/.codex/config.toml, ~/.cursor/mcp.json).npx -y mcp-remote --help works and the MCP endpoint responds (401 is fine — that's the OAuth prompt).The dataforce-setup skill (source) is the working reference — copy the structure, substitute the app name and MCP URL.
Crucially: the setup skill does NOT write a Claude Code MCP config when the plugin is installed via marketplace — that's already handled by .mcp.json. Writing it again double-registers the server. Skip with a note.
After scaffolding:
cd <plugin-repo>
git init && git add -A && git commit -m "✨ feat: scaffold <app-name>-plugin (Claude Code marketplace)"
gh repo create <org>/<app-name>-plugin --public --source=. --remote=origin --push
AskUserQuestion before publishing:
"Push the plugin repo to
<org>/<app-name>-pluginas public? It needs to be public for/plugin marketplace addto work without auth."
After push, the install command is:
/plugin marketplace add <org>/<app-name>-plugin
/plugin install <app-name>@<app-name>-plugin
For Codex / Cursor / anything else, /<app-name>-setup (the bundled skill) wires it.
After all four steps, run end-to-end:
curl https://<your-app-host>/.well-known/oauth-authorization-server — should return JSON with the four endpoints and code_challenge_methods_supported: ["S256"].npx -y mcp-remote https://<your-app-host>/api/mcp --version — should print a version and exit without erroring on the URL./plugin marketplace add <org>/<app-name>-plugin then /plugin install <app-name>@<app-name>-plugin. First tool call should pop a browser, Clerk login → consent → token issued → tool returns data.If the browser pop fails, the OAuth backend is wrong. The discovery doc + Step A are where the bug is. The plugin side is purely declarative.
After running, print:
.mcp.json/<app-name>-setup)mcp-remote) use PKCE precisely so a client secret isn't needed.<app-name>-setup skill MUST NOT touch ~/.mcp-auth/ — tokens live there, managed by mcp-remote itself. The skill only writes the command that invokes mcp-remote.<path>.bak.<unix-timestamp>./.well-known/oauth-authorization-server already exists, diff it before overwriting. Some apps stub the discovery doc before implementing the endpoints (the dataforce path: the doc landed in an earlier PR before #142 finished the implementation).mcp-remote is what unifies them..mcp.json in the app repo. Decouple. The plugin repo's whole job is distribution; the app repo's whole job is the API./oauth/register, the install dies before the consent page on a fresh machine.device_code grant alone. mcp-remote defaults to auth-code + PKCE; device flow is a fallback for environments without a browser (CI, headless), not the primary path./ro:new-mcp-server — scaffold a brand-new MCP server (this skill is for adding MCP to an existing app)/ro:clerk (default IdP), /ro:workos, /ro:better-auth — user-identity layer underneath the OAuth authorization server/ro:new-tanstack-app — the upstream scaffold this skill assumes/ro:cf-ship — deploy the app repo after OAuth routes are addedcloudflare:build-mcp (Cloudflare plugin) — McpAgent boilerplate for the /api/mcp handlerpatterns/mcp-on-cf-workers-with-oauth.md for the architectural rationaletesting
--- name: linear-pipeline description: The Fable orchestrator for a single dispatched Linear ticket. Holds almost no context itself; it receives `--issue <ID> --detached`, decides the stage sequence, and fans out a sub-agent per stage, passing forward only each stage's artifact (never re-derived, never inlined into its own context). Step zero, before any planning or stage routing, is a boundary triage against `canon/security-boundary.md` (#199): a match tags Ronan Connolly and stops the run, no
development
--- name: in-your-face description: Capture a chat-only answer into a durable artifact (markdown + HTML, PDF when cheap) and launch it automatically so the user cannot miss it. Use when user says "in your face", "don't let me lose this", "save that answer", "make that durable", or right after answering a substantive side question (a recipe, comparison, how-to, or generated prompt) that would otherwise die with the context. category: workflow argument-hint: [--no-open] [--vault <short>] [hint of
tools
One-shot headless OpenAI Codex CLI calls for background/admin AI tasks — summaries, classification, extraction, admin glue. The default engine for anything that runs AI constantly in the background (daemon-driven, per-event), because it bills the flat ChatGPT subscription instead of Claude usage or per-token API spend, and it keeps working while Claude is rate-limited. NEVER for coding — coding stays Claude. Use when a skill or daemon needs a cheap always-on AI call, when the user says "use codex", "ask codex", "codex as backup", or when building a background summarizer/classifier into a listener or loop. Reads auth from ~/.codex/auth.json (ChatGPT account, no API key).
research
Turn a warranty rejection, repair quote, or RMA email into a cited decision brief — legal read (NL/EU consumer law), is the part user-serviceable, live part and new-unit prices, repair-vs-DIY-vs-new economics, before-you-send-it checklist, deadlines. Use when the user pastes or screenshots a repair quote, warranty rejection, "not covered" email, onderzoekskosten fee, or asks "should I repair or replace this".