Nts add mcp
Skill juncoding/nextjs-trpc-prisma-starter/skills/nts-add-mcp
Claude Code plugin: scaffold and maintain lightweight internal management systems on Next.js + tRPC + Prisma in SPA mode
npx -y skills add juncoding/nextjs-trpc-prisma-starter --skill nts-add-mcpAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
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.
SKILL.md
4.8 KB, as published. Nobody here has run it
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:
- Check for
src/server/auth/index.ts— abort if missing. - Check that Better Auth is in
package.jsondependencies — abort if missing.
If auth isn't wired, tell the user to run /nts-add-auth first.
What this skill does
- Adds the
mcpplugin to the Better Auth config. - Creates
src/app/api/mcp/route.ts— the Streamable HTTP endpoint, wrapped inwithMcpAuth. - Creates
src/app/.well-known/oauth-authorization-server/route.tsandsrc/app/.well-known/oauth-protected-resource/route.tsfor discovery. - Creates
src/server/mcp/registry.ts— the tool dispatch table. - Creates
src/server/mcp/tools/_example-search.ts— one worked tool wrapping a service. - Creates a Prisma migration to add the three OAuth tables (
oauth_application,oauth_access_token,oauth_consent). - Updates
CLAUDE.mdto document the MCP entry point. - Adds dev tunnel instructions to the README (Claude Desktop only accepts HTTPS connectors).
Confirmation flow
Before writing:
- Verify project structure (Better Auth present,
src/app/api/exists). - Pick the example tool — default is "search the first table the user has". If unclear, pick
example_searchagainst the_examplemodule if it exists. - Show the file list. Confirm.
File contents
Update src/server/auth/index.ts
Find the plugins: [...] array and add mcp({ loginPage: "/login" }):
import { mcp } from "better-auth/plugins/mcp";
export const auth = betterAuth({
// ... existing config
plugins: [
// ... existing plugins
mcp({ loginPage: "/login" }),
],
});
Create src/app/api/mcp/route.ts
Use the template at assets/mcp-route.ts.template from the scaffold-internal-tool skill (the content is portable — just substitute {{IF_*}} for the present case).
Create src/app/.well-known/oauth-authorization-server/route.ts
import { auth } from "@/server/auth";
export async function GET() {
return Response.json(await auth.api.getMcpOAuthMetadata());
}
(Better Auth's mcp plugin exposes this metadata helper — version may differ; check better-auth/plugins/mcp exports if the name changed.)
Create src/server/mcp/registry.ts and src/server/mcp/tools/_example-search.ts
Use the templates mcp-registry.ts.template and mcp-tool-example.ts.template from the scaffold-internal-tool skill.
Create migration
Run:
pnpm prisma migrate dev --name add_mcp_oauth_tables
Better Auth's CLI can generate the Prisma model declarations for the OAuth tables — see Better Auth docs for the current command (typically npx @better-auth/cli generate).
Update CLAUDE.md
Add to the stack section:
- **MCP:** Streamable HTTP at `/api/mcp`, Better Auth `mcp` plugin as OAuth provider. Tools in `src/server/mcp/tools/`.
Add to "Useful commands":
- Local MCP testing: Claude Desktop only accepts HTTPS connectors. Tunnel via `cloudflared tunnel --url http://localhost:3000` and update `BETTER_AUTH_URL` + `next.config.ts` `allowedDevOrigins` to the tunnel host while testing.
How to add more tools later
Tell the user (and put this in CLAUDE.md too):
To add an MCP tool:
- Create
src/server/mcp/tools/<tool-name>.tsexporting{ description, inputSchema, handler }.- The handler should validate its input via the same Zod schema as the corresponding tRPC procedure, then call the service method with the OAuth-derived
userId.- Register in
src/server/mcp/registry.ts.- Restart
pnpm dev. Test from Claude Desktop's MCP servers UI.
Verification
pnpm install
pnpm prisma migrate dev
pnpm tsc --noEmit
pnpm build
Don't try to actually exercise the MCP flow from this session — that requires an MCP client. Tell the user how to test it manually.
Gives 0 of the 12 instructions most mcp tooling skills give
Counted across 638 of the 750 authors here whose files we hold, read 2026-08-06
- create ten complex read-only evaluation questionsin 71 of 638, across 17 files
- test servers using MCP Inspectorin 60 of 638, across 18 files
- provide actionable error messagesin 56 of 638, across 14 files
- prioritize comprehensive API coverage over specific workflowsin 54 of 638, across 12 files
- use TypeScript and Streamable HTTP for remote serversin 53 of 638, across 7 files
- define structured output schemas where possiblein 51 of 638, across 9 files
- use Zod or Pydantic for input schemasin 48 of 638, across 6 files
- fetch MCP specification pages with markdown suffixin 46 of 638, across 4 files
- load framework documentation using WebFetchin 45 of 638, across 3 files
- verify each evaluation answer independentlyin 45 of 638, across 3 files
- implement API client with authentication and paginationin 45 of 638, across 3 files
- Define input schemas with validationin 28 of 638, across 10 files
Said here and by no other author read
- check for existing auth before proceeding
- prompt to run auth setup if missing
- add the mcp plugin to auth config
- create the mcp api route file
- create oauth discovery endpoints
- create a database migration for oauth tables
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once.