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

Lower case letters, digits and hyphens. It names the server and the folder.

Types: string, number, integer, boolean. A ? makes a parameter optional.

A {placeholder} in the URI makes a resource template.

Prompt arguments are always strings.

A static token is for a private server. For many users, use OAuth as in the MCP authorization spec.

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 setup shapes (Claude Desktop and Claude Code docs, checked 2026-11-11)
ClientTransportHowWhere it lives
Claude DesktopstdiomcpServers entry with command and args (absolute paths)macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Claude DesktopstdioSame file on Windows; quit and restart the app after savingWindows: %APPDATA%\Claude\claude_desktop_config.json
Claude Codestdioclaude mcp add --transport stdio NAME -- COMMAND ARGSLocal scope: ~/.claude.json
Claude CodeHTTPclaude mcp add --transport http NAME URLProject scope: .mcp.json at the project root
MCP Inspectoreithernpx -y @modelcontextprotocol/inspector, then connectRuns locally

How to create an MCP server

  1. 1
    Name 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.
  2. 2
    List 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.
  3. 3
    Add resources and prompts if you need themResources are data the client can read by URI; prompts are templates the user can pick.
  4. 4
    Copy 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?
Use stdio when the client and server run on the same machine and you want the simplest setup, as the client starts the process for you. Use Streamable HTTP when many users or machines need one running server. The SDK documents the older HTTP+SSE transport as kept only for backwards compatibility.
Why does my stdio server break when I add console.log?
Because stdout is the protocol channel. A log line mixed into it is read by the client as a malformed message. Log to stderr instead (console.error in Node, logging or print to stderr in Python); Claude Desktop writes a server's stderr to its mcp-server log file.
What are resource templates?
A resource whose URI has a placeholder, such as users://{userId}/profile. The client asks for users://42/profile and your handler receives userId = 42. A resource without a placeholder, such as config://app, is a fixed document.
Which SDK version does the scaffold use?
The TypeScript scaffold pins @modelcontextprotocol/sdk 1.32.2, the npm latest on 2026-11-11. The Python scaffold uses mcp[cli]>=1.28,<2: the SDK's README says to keep a <2 bound to stay on the 1.x line, since pip now installs 2.x by default.
Is a bearer token enough to secure a public MCP server?
No. A single shared token proves a caller knows the token and nothing about who they are. For a server used by other people, implement OAuth as described in the MCP authorization docs; the TypeScript SDK ships requireBearerAuth for verifying tokens against an authorization server.
Can I add the generated HTTP server to Claude Desktop?
The Claude Desktop config shown in the MCP docs launches local commands, so it fits the stdio version. We haven't verified a JSON entry for a remote URL there, so for the HTTP version use Claude Code's claude mcp add --transport http or test it in the MCP Inspector.

Sources

Related tools

See all 135 free tools

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