MCP Scaffold Generator
Quickly scaffold a new MCP (Model Context Protocol) server with TypeScript, proper typing, and best-practice patterns.
What is MCP?
The Model Context Protocol allows AI assistants like Claude to securely interact with external tools and data sources. An MCP server exposes tools, resources, and prompts that AI can use.
Usage
Select your server configuration and the scaffold generator creates a ready-to-use project:
- Server name — Your MCP server identifier
- Transport — stdio (CLI) or SSE (HTTP)
- Tools — Define the tools your server will expose
- Resources — Static or dynamic data resources
API Endpoint
POST /api/tools/mcp-scaffold
Request Body
{
"name": "my-mcp-server",
"transport": "stdio",
"tools": [
{
"name": "search_docs",
"description": "Search documentation by query",
"parameters": {
"query": { "type": "string", "description": "Search query" },
"limit": { "type": "number", "description": "Max results" }
}
}
],
"resources": [
{
"uri": "docs://overview",
"name": "Documentation Overview",
"description": "Full documentation index"
}
]
}
Response
Returns a zip archive containing:
my-mcp-server/
package.json
tsconfig.json
src/
index.ts # Server entry point
tools/
search_docs.ts # Tool implementation stub
resources/
overview.ts # Resource handler stub
README.md
Generated Code Example
The scaffold generates properly typed tool handlers:
server.setRequestHandler(CallToolRequestSchema, async (request) => {
switch (request.params.name) {
case 'search_docs': {
const { query, limit } = request.params.arguments;
// TODO: implement search logic
return {
content: [{ type: 'text', text: JSON.stringify({ results: [] }) }],
};
}
default:
throw new McpError(ErrorCode.MethodNotFound, 'Unknown tool');
}
});
Best Practices
- Always validate tool input parameters
- Return structured JSON in tool responses
- Use descriptive tool and parameter names
- Include error handling with meaningful messages
- Add resource URIs for static data the AI might need