MCP server scaffold generator (TypeScript and Python)
A Model Context Protocol server exposes tools, resources and prompts to AI clients over stdio or Streamable HTTP. List your tools, pick a language and transport, and copy the server code, package files and the Claude Desktop or Claude Code config to run it.
Updated
TypeScript · stdio
2 tools, 2 resources, 1 prompt
94 lines of server code · pick a file to copy or download
src/index.ts
import { McpServer, ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import * as z from "zod/v4";
function createServer(): McpServer {
const server = new McpServer({ name: "weather-tools", version: "1.0.0" });
server.registerTool(
"get_forecast",
{
title: "Get forecast",
description: "Get a short weather forecast for a city",
inputSchema: {
city: z.string().describe("City name"),
days: z.number().int().optional().describe("Days ahead, 1 to 7"),
},
},
async ({ city, days }) => {
// TODO: replace this stub with the real work.
const result = { city, days };
return {
content: [{ type: "text", text: `get_forecast is not implemented yet. Received: ${JSON.stringify(result)}` }],
};
},
);
server.registerTool(
"add_numbers",
{
title: "Add numbers",
description: "Add two numbers",
inputSchema: {
a: z.number(),
b: z.number(),
},
},
async ({ a, b }) => {
// TODO: replace this stub with the real work.
const result = { a, b };
return {
content: [{ type: "text", text: `add_numbers is not implemented yet. Received: ${JSON.stringify(result)}` }],
};
},
);
server.registerResource(
"config_app",
"config://app",
{ title: "Config app", description: "Application settings", mimeType: "text/plain" },
async (uri) => ({
contents: [{ uri: uri.href, text: "TODO: return the content of this resource" }],
}),
);
server.registerResource(
"users_userId_profile",
new ResourceTemplate("users://{userId}/profile", { list: undefined }),
{ title: "Users userId profile", description: "A user's profile", mimeType: "text/plain" },
async (uri, { userId }) => ({
contents: [{ uri: uri.href, text: `TODO: return the content for ${userId}` }],
}),
);
server.registerPrompt(
"summarise_text",
{
title: "Summarise text",
description: "Ask the model to summarise a block of text",
argsSchema: {
text: z.string(),
},
},
({ text }) => ({
messages: [
{ role: "user", content: { type: "text", text: `Ask the model to summarise a block of text: ${text}` } },
],
}),
);
return server;
}
// stdio: the client starts this process and talks over stdin/stdout, so never write logs to stdout.
// Use console.error for logging.
async function main() {
const server = createServer();
await server.connect(new StdioServerTransport());
console.error("weather-tools MCP server running on stdio");
}
main().catch((error) => {
console.error("Fatal error:", error);
process.exit(1);
});
- src/index.ts
- 94 linesServer code
- package.json
- 18 linespackage.json / pyproject.toml
- tsconfig.json
- 15 linestsconfig.json (TypeScript only)
- README.md
- 25 linesREADME.md
- claude_desktop_config.json
- 10 linesClaude Desktop config
- claude-code-setup.txt
- 14 linesClaude Code setup
- Pinned to @modelcontextprotocol/sdk 1.32.2, the latest npm release on 2026-11-11. The newer v2 SDK ships as separate packages (@modelcontextprotocol/server and @modelcontextprotocol/client) with a different import layout; this scaffold uses the v1.x API.
- With stdio the client starts the server and talks to it over stdin and stdout. Anything your code prints to stdout corrupts the protocol, so log to stderr.
- Tool bodies are stubs that echo their input. Replace each TODO with your logic, then test in the MCP Inspector before adding it to a client.
What does a minimal MCP server contain?
The Model Context Protocol lets an AI app (a client such as Claude Desktop or Claude Code) discover and call things your server offers. A server exposes up to three kinds: tools, which do something and return a result; resources, which are readable data identified by a URI; and prompts, which are reusable message templates. This tool writes a server that registers the ones you list, with typed parameters.
The transport is how client and server talk. With stdio the client launches your server as a child process and exchanges JSON-RPC messages over stdin and stdout, so a stdio server must never print to stdout. With Streamable HTTP you run the server yourself and the client sends requests to a URL such as http://localhost:3000/mcp. The generated HTTP server is stateless: a new server and transport handle each request, which is the pattern the SDKs use for simple API-style servers.
The TypeScript output uses @modelcontextprotocol/sdk with zod schemas for tool inputs, registerTool, registerResource (with ResourceTemplate for URIs containing placeholders) and registerPrompt. The Python output uses FastMCP from the mcp package, where type hints and the docstring become the tool's schema and description. Both pin to the v1.x API line, noted in the result.
tool → registerTool(name, { description, inputSchema }, handler)
resource → registerResource(name, uri, { mimeType }, readHandler)
prompt → registerPrompt(name, { argsSchema }, handler)Tool input schemas follow JSON Schema; to fit one to a model API's strict mode, use JSON Schema to structured output.
To describe your docs to AI agents as well, build a file with llms.txt generator.
How do I connect the generated server to a client?
| Client | Transport | How | Where it lives |
|---|---|---|---|
| Claude Desktop | stdio | mcpServers entry with command and args (absolute paths) | macOS: ~/Library/Application Support/Claude/claude_desktop_config.json |
| Claude Desktop | stdio | Same file on Windows; quit and restart the app after saving | Windows: %APPDATA%\Claude\claude_desktop_config.json |
| Claude Code | stdio | claude mcp add --transport stdio NAME -- COMMAND ARGS | Local scope: ~/.claude.json |
| Claude Code | HTTP | claude mcp add --transport http NAME URL | Project scope: .mcp.json at the project root |
| MCP Inspector | either | npx -y @modelcontextprotocol/inspector, then connect | Runs locally |
How to create an MCP server
- 1Name it and pick a language and transportChoose stdio for a tool that runs on the user's own machine, Streamable HTTP for one you host.
- 2List the toolsOne per line as name(param: type, other?: type) - description. The description is what the model reads to decide when to call it, so write it for the model.
- 3Add resources and prompts if you need themResources are data the client can read by URI; prompts are templates the user can pick.
- 4Copy each file, build, and testSwitch the file selector or download them, run the install and build commands from the README, and try the server in the MCP Inspector before connecting a client.
Frequently asked questions
Should I choose stdio or Streamable HTTP?
Why does my stdio server break when I add console.log?
What are resource templates?
Which SDK version does the scaffold use?
Is a bearer token enough to secure a public MCP server?
Can I add the generated HTTP server to Claude Desktop?
Sources
- MCP TypeScript SDK, v1.x README and server docs (npm @modelcontextprotocol/sdk 1.32.2) (checked 11 Nov 2026)
- MCP TypeScript SDK, stateless Streamable HTTP example (v1.x) (checked 11 Nov 2026)
- MCP Python SDK, v1.x README and server docs (FastMCP) (checked 11 Nov 2026)
- MCP Python SDK, current README (v2, MCPServer) (checked 11 Nov 2026)
- Model Context Protocol: Connect to local MCP servers (Claude Desktop config) (checked 11 Nov 2026)
- Claude Code: Connect Claude Code to tools via MCP (checked 11 Nov 2026)
Need a custom dev tool for your team?
We build internal tools, dashboards, APIs, and SaaS platforms. If you can describe it, we can ship it.
Built by CountryDevs · No signup · No ads · We count visits, never what you enter