# Minimal MCP Server Scaffold
Generated for: Next.js
Stack notes: Next.js, TypeScript, React, CSS modules
## package.json
```json
{
"name": "next-js-mcp-server",
"version": "0.1.0",
"type": "module",
"private": true,
"scripts": {
"dev": "tsx src/server.ts",
"build": "tsc",
"start": "node dist/server.js"
},
"dependencies": {
"@modelcontextprotocol/sdk": "latest",
"zod": "latest"
},
"devDependencies": {
"tsx": "latest",
"typescript": "latest"
}
}
```
## src/server.ts
```ts
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { z } from "zod";
const server = new McpServer({
name: "next-js-mcp-server",
version: "0.1.0"
});
server.registerTool(
"project_context",
{
title: "Project context",
description: "Return project-specific context for an AI coding tool.",
inputSchema: {
topic: z.string().describe("The context topic to retrieve")
}
},
async ({ topic }) => ({
content: [
{
type: "text",
text: `Context for ${topic}: replace this handler with a real lookup, API call, or local index.`
}
]
})
);
const transport = new StdioServerTransport();
await server.connect(transport);
```
## mcp.json
```json
{
"mcpServers": {
"next-js": {
"command": "node",
"args": ["dist/server.js"]
}
}
}
```
## Validation
- Build: `npm run build`
- Test: `npm test`
- Lint: `npm run lint`
## Implementation Notes
Before handoff, summarize changed files and mention any checks that could not be run.
Use the MCP Server Generator to scaffold a small custom MCP server when an existing marketplace server does not expose the data, tool, or workflow your AI coding setup needs.
What This Generates
The starter output includes a TypeScript package file, a stdio MCP server, one example tool, an mcp.json snippet, and validation notes. Treat it as a narrow MVP before adding authentication, persistence, or write actions.
When To Build Your Own Server
Build a custom MCP server for private APIs, internal docs, local indexes, product-specific workflows, or tools that need a stable schema. Prefer an existing maintained server when it already covers the use case.
Launch Checklist
Keep the first server read-only if possible, use environment variables for credentials, document the command in repo instructions, and test the exact mcp.json command from a clean terminal before sharing it.
FAQ
Is this different from an MCP config generator?
Yes. The config generator creates mcp.json for existing servers; this page generates a starter server you can implement yourself.
Should a custom MCP server use stdio or HTTP?
Stdio is a simple local-first starting point. HTTP is useful when the server must be shared, deployed, or accessed remotely.
What should the first tool do?
Start with one read-only tool that returns useful context. Add write actions only after permission and audit behavior are clear.