MCP Server Template

Generate a TypeScript or Python MCP server boilerplate with your tools and resources pre-configured.

Last updated Mar 2026

Tool 1
server.ts
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';

const server = new McpServer({
  name: 'my-mcp-server',
  version: '1.0.0',
});

// ── Tools ──

  server.tool(
    'hello',
    'Say hello to a user',
    {
          name: { type: 'string', description: 'name parameter' },
        required: ['name'],
    },
    async (params) => {
      // TODO: Implement hello
      return {
        content: [{ type: 'text', text: `hello called with ${JSON.stringify(params)}` }],
      };
    },
  );

// ── Start server ──

async function main() {
  const transport = new StdioServerTransport();
  await server.connect(transport);
  console.error('my-mcp-server MCP server running on stdio');
}

main().catch(console.error);

How MCP Server Templates Work

An MCP server is a program that exposes tools, resources, and prompts to AI assistants via the Model Context Protocol. This template generator creates a ready-to-run server file with your tools pre-defined. Choose TypeScript (using @modelcontextprotocol/sdk) or Python (using mcp[cli] with FastMCP), define your tools with their parameters, and the generator outputs code you can run immediately.

Getting Started After Downloading

TypeScript:

npm init -y && npm install @modelcontextprotocol/sdk
npx tsx server.ts

Python:

pip install "mcp[cli]"
python server.py

Transport Options

stdio is the default for local development — the AI client launches your server as a subprocess and communicates via stdin/stdout. Use this for tools that access local files, databases, or CLI commands. SSE (Server-Sent Events) runs your server as an HTTP endpoint that AI clients connect to remotely — use this for cloud-deployed servers or shared tools.

Related Tools