MCP Server Skills

Pattern for building MCP servers in Next.js with mcp-handler, shared Zod schemas, and reusable server actions.

23 stars 7 forksAI, LLMs & Agents

Install

skills CLI (Claude Code, Cursor, Codex and more)
npx skills add gocallum/nextjs16-agent-skills --skill mcp-server-skills
Manual install
git clone --depth 1 https://github.com/gocallum/nextjs16-agent-skills.git /tmp/nextjs16-agent-skills
mkdir -p ~/.claude/skills
cp -r /tmp/nextjs16-agent-skills/skills/mcp-server-skills ~/.claude/skills/mcp-server-skills

Personal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.

From the SKILL.md

## Links

- Model Context Protocol: https://modelcontextprotocol.io/
- mcp-handler (HTTP): https://www.npmjs.com/package/mcp-handler
- Reference implementation (Roll Dice): https://github.com/gocallum/rolldice-mcpserver
- Claude Desktop + mcp-remote bridge: https://www.npmjs.com/package/mcp-remote

## Folder Structure (Next.js App Router)

```
app/
  api/[transport]/route.ts   # One handler for all transports (e.g., /api/mcp)
  actions/mcp-actions.ts     # Server actions reusing the same logic/schemas
lib/
  dice.ts | tools.ts         # Zod schemas, tool definitions, pure logic
components/                  # UI that calls server actions for web testing
```

**Goal:** Keep `route.ts` minimal. Put logic + Zod schemas in `lib/*` so both the MCP handler and server actions share a single source of truth.

## Shared Zod Schema + Tool Definition

```ts
// lib/dice.ts
import { z } from "zod";

export const diceSchema = z.number().int().min(2);

export function rollDice(sides: number) {
  const validated = diceSchema.parse(sides);
  const value = 1 + Math.floor(Math.random() * validated);
  return { type: "text" as const, text: `🎲 You rolled a ${value}!` };
}

export const rollDiceTool = {
  name: "roll_dice",
  description: "Rolls an N-sided die",
  schema: { sides: diceSchema },
} as const;
```

## Reusable Server Actions (Web UI + Tests)
Read the full skill on GitHub

Details

Skill name
mcp-server-skills
Path
skills/mcp-server-skills/SKILL.md
Repo updated
21 January 2026

FAQ

What does the MCP Server Skills skill do?

Pattern for building MCP servers in Next.js with mcp-handler, shared Zod schemas, and reusable server actions.

How do I install the MCP Server Skills skill?

skills CLI (Claude Code, Cursor, Codex and more): npx skills add gocallum/nextjs16-agent-skills --skill mcp-server-skills. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.

Is MCP Server Skills popular?

It lives in gocallum/nextjs16-agent-skills, which has 23 GitHub stars and 7 forks.

Related skills

Browse the most popular Claude skills, all ai, llms & agents skills, or write your own with the skills generator.