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 rationaledevelopment
Close the loop on a Linear ticket when its work ships - move the status and post a deploy comment with the PR link, what shipped, and a try-it link, mentioning the collaborator. Used as the tail of /ro:linear-nightshift for every merged mirror, or manually after an ad-hoc build. Triggers on "linear update", "update the linear ticket", "mark NUT-x done", "tell eoin it shipped", "/ro:linear-update".
devops
Run a night-shift against a collaborator's Linear board. Pulls the team's Grilled tickets (/ro:linear-grill moves a ticket to Grilled once its questions are answered), VERIFIES the questions were actually answered (unanswered → bounce the ticket to the "Question for <name>" state), mirrors verified tickets to ephemeral GitHub issues with ready-for-agent, then runs the standard /ro:night-shift machinery on GitHub. Tail-calls /ro:linear-update for everything that merged + deployed. Triggers on "linear nightshift", "nightshift linear", "drain the linear board", "run the shift off linear", "/ro:linear-nightshift".
development
Grill a collaborator's Linear tickets and move every processed ticket to where it belongs. Resolves the board from the repo's .ro-linear.json, reads the collaborator's Backlog / Ready-for-agent issues, then per ticket either posts 3-5 decision-extracting questions (state moves to "Question for <name>") or confirms it build-ready (state moves to "Grilled", the gate /ro:linear-nightshift consumes); shipped-and-confirmed tickets close as Done. The async-collaborator counterpart of /ro:day-shift for people who never touch GitHub. Triggers on "grill linear", "grill eoin's tickets", "linear grill", "add questions to the linear tickets", "/ro:linear-grill".
development
--- name: about-page description: Add a standard About page to any web app, what it is, the tech stack, and an FAQ, wired into a footer link with a sticky footer. Built with Spartan + Tailwind (the canonical component layer) and falls back to semantic HTML so it ships reliably. Use whenever building, polishing, or shipping an app, every app should have one. Triggers on "add an about page", "about page", "footer about link", or as a standard step in app build/polish. category: frontend argument-h