mcp-server-skills

Build MCP servers in Next.js with shared Zod schemas and multi-transport endpoints.

22|7|Updated Dec 20, 2025
One-click install
npx skills add https://github.com/gocallum/nextjs16-agent-skills --skill mcp-server-skills
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mcp-server-skills
Source: https://github.com/gocallum/nextjs16-agent-skills/tree/main/skills/mcp-server-skills
Command: npx skills add https://github.com/gocallum/nextjs16-agent-skills --skill mcp-server-skills

SYSTEM DOCUMENTATION & REQUIREMENTS

## What problem does it solve? Pattern for building MCP servers in Next.js with mcp-handler, shared Zod schemas, and reusable server actions. It reduces duplication, ensures a single source of truth, and simplifies multi-transport server orchestration.

## Core Features & Use Cases

  • Shared Zod schemas and tool definitions to validate inputs and reuse logic across MCP route.ts and server actions.
  • Minimal route wiring; central server logic lives in lib/* for consistency.
  • Quick bootstrap for multi-transport MCP endpoints (HTTP, SSE) with a single MCP registry.

### Quick Start Create a new skill folder skills/mcp-server-skills, add SKILL.md with the frontmatter above, then implement app/api/[transport]/route.ts, app/actions/mcp-actions.ts, and lib/dice.ts as shown in the skill doc.

Frequently Asked Questions about mcp-server-skills

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build an MCP server in Next.js with shared schemas?

Build MCP servers in Next.js by defining shared Zod schemas in a central lib/ folder, then reference them in both your route.ts handlers and server actions. This single source of truth eliminates duplication and ensures consistent validation across HTTP, SSE, and other transports.

Can I use Next.js server actions with MCP handlers?

Yes. MCP handlers work with Next.js server actions by sharing Zod-validated tool definitions. Define your actions in app/actions/ and wire them to your MCP routes through a shared schema registry, enabling reusable logic across transports.

What's the best way to set up multi-transport MCP endpoints?

Set up multi-transport MCP endpoints by implementing a single MCP registry and routing it through app/api/[transport]/route.ts. This pattern handles HTTP, SSE, and other protocols with minimal route wiring and centralized server logic.

Do I need separate route files for each MCP transport?

No. Use a dynamic route parameter [transport] in app/api/[transport]/route.ts to handle multiple MCP protocols with one handler. Route all transports through a unified MCP registry defined in your shared lib/ schema files.

How do Zod schemas reduce MCP server boilerplate?

Zod schemas serve as both validation and documentation for MCP tool definitions. Define them once in lib/ and import them in routes and actions, eliminating duplicate type definitions and ensuring input validation consistency across your MCP endpoints.

What's required to bootstrap an MCP server pattern in Next.js 16?

Bootstrap with frontmatter-driven identity in SKILL.md, implement app/api/[transport]/route.ts for transport handling, create app/actions/ for server logic, and centralize tool schemas in lib/. This structure provides a complete multi-transport MCP foundation.