mcp-server-skills

Share Zod schemas and core logic across Next.js MCP routes and server actions.

Updated Jun 16, 2017
One-click install
npx skills add https://github.com/vuanhtu1993/vuanhtu1993.github.io --skill mcp-server-skills-vuanhtu1993
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mcp-server-skills
Source: https://github.com/vuanhtu1993/vuanhtu1993.github.io/tree/main/.gemini/skills/mcp-server-skills
Command: npx skills add https://github.com/vuanhtu1993/vuanhtu1993.github.io --skill mcp-server-skills-vuanhtu1993

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Pattern for building MCP servers in Next.js with a single source of truth for schemas and logic across MCP handlers, actions, and UI.

Core Features & Use Cases

  • Centralized Zod schemas and tool definitions that power both the MCP HTTP/SSE route and server actions.
  • Lightweight routing with a shared code path for multiple transports and UI integration.
  • Reusable server actions and guidelines to accelerate MCP server development.
  • Use Case: Implement an MCP server for dice-rolling that uses a shared schema and route across client and server.

Quick Start

Configure a Next.js app following the mcp-server-skills pattern: place shared logic under lib/, implement tools under lib/dice.ts, server actions under app/actions/, and wire the MCP route under app/api/[transport]/route.ts. Run the app and test via the web UI or API calls.

Frequently Asked Questions about mcp-server-skills

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

FAQPage Schema
How do I share schemas and logic between Next.js API routes and server actions?

A single route handler in Next.js can support multiple MCP transports by applying a lightweight wiring approach under app/api/[transport]/route.ts. This shared code path routes different transport requests through the same core logic.

How do I structure a Next.js project for a multi-transport MCP server?

Structure a Next.js MCP server by placing shared logic in lib/, tool implementations in files like lib/dice.ts, server actions in app/actions/, and the multi-transport MCP route in app/api/[transport]/route.ts. This enforces a single source of truth and standardized response shapes.

What is the best way to prevent inconsistency in MCP server development?

The best way to prevent inconsistency in MCP server development is using a modular pattern that enforces centralized validation with Zod and a single source of truth in lib/*. This ensures standardized response shapes for tools and clients across all endpoints.

Can I use Zod validation for both MCP tools and UI integration in Next.js?

Yes, you can use centralized Zod schemas to power both MCP HTTP/SSE routes and server actions in Next.js. This shared validation logic guarantees that UI integration and client-server interactions rely on identical tool definitions and response shapes.

When do I need a single source of truth for MCP server patterns?

You need a single source of truth for MCP server patterns when your Next.js application requires a single route handler for multiple transports, centralized validation, and consistent UI integration to solve duplication and inconsistency across server actions and API routes.

Related Skills