← ClaudeAtlas

nts-add-mcplisted

Add an MCP (Model Context Protocol) entry point to an existing project scaffolded with nextjs-trpc-prisma-starter. Use this when the user wants AI clients (Claude Desktop, Cursor) to query the project's data over OAuth, mentions MCP, wants to expose tools to AI, or invokes /nts-add-mcp. Wires up /api/mcp/route.ts, the MCP plugin in Better Auth (the project's OAuth provider), the .well-known OAuth discovery endpoints, a tool registry at src/server/mcp/registry.ts, one example tool, and the migration for the three OAuth tables. Requires Better Auth to be wired — if not, prompts to run /nts-add-auth first.
juncoding/nextjs-trpc-prisma-starter · ★ 0 · API & Backend · score 70
Install: claude install-skill juncoding/nextjs-trpc-prisma-starter
# Add MCP entry point to an existing project ## Use when - User wants Claude Desktop, Cursor, or any MCP-compatible AI client to interact with the app. - User says "expose this to MCP" / "add MCP tools" / "let AI query the data". - User invokes `/nts-add-mcp`. ## Prerequisite check This skill requires **Better Auth** to be wired (the OAuth provider behind the MCP plugin). Before doing anything else: 1. Check for `src/server/auth/index.ts` — abort if missing. 2. Check that Better Auth is in `package.json` dependencies — abort if missing. If auth isn't wired, tell the user to run `/nts-add-auth` first. ## What this skill does 1. Adds the `mcp` plugin to the Better Auth config. 2. Creates `src/app/api/mcp/route.ts` — the Streamable HTTP endpoint, wrapped in `withMcpAuth`. 3. Creates `src/app/.well-known/oauth-authorization-server/route.ts` and `src/app/.well-known/oauth-protected-resource/route.ts` for discovery. 4. Creates `src/server/mcp/registry.ts` — the tool dispatch table. 5. Creates `src/server/mcp/tools/_example-search.ts` — one worked tool wrapping a service. 6. Creates a Prisma migration to add the three OAuth tables (`oauth_application`, `oauth_access_token`, `oauth_consent`). 7. Updates `CLAUDE.md` to document the MCP entry point. 8. Adds dev tunnel instructions to the README (Claude Desktop only accepts HTTPS connectors). ## Confirmation flow Before writing: 1. Verify project structure (Better Auth present, `src/app/api/` exists). 2. Pick the example tool