Get the FREE Ultimate OpenClaw Setup Guide →

template

Template to quickly set up your own MCP server

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio mcpdotdirect-template-mcp-server npx -y @mcpdotdirect/template-mcp-server

How to use

This MCP server template provides a starting point for building a Model Context Protocol (MCP) server using FastMCP with TypeScript. It includes a basic server structure that supports two transport methods: a stdio (CLI) transport for local development and an SSE (HTTP) transport for web-based or remote usage. The template is designed to be extended with custom MCP tools, resources, and prompts, allowing you to rapidly scaffold a working server and then tailor it to your specific workflows. You can test your server’s tooling and integration using the included FastMCP utilities and by connecting via Cursor or a direct HTTP endpoint.

To use, install dependencies, then run either the stdio or HTTP server as described in the repository’s instructions. The stdio mode is ideal for local command-line tools and development, while the HTTP mode enables networked usage and collaboration across machines. You can also run in development mode with auto-reload to streamline iteration while building tools and resources.

How to install

Prerequisites:

  • Node.js (LTS) and npm/yarn/pnpm (or Bun as suggested by the template)
  • Basic familiarity with TypeScript and npm scripts

Installation steps:

  1. Ensure Node.js and your preferred package manager are installed.
    • node -v
    • npm -v (or yarn -v / pnpm -v / bun -v)
  2. Create or clone the MCP server project using the template (examples assume npm is available):
    • npx @mcpdotdirect/template-mcp-server
    • or, if you’re starting from an existing repo, run: npm install
  3. Install project dependencies:
    • npm install
    • or using yarn/pnpm/bun as you prefer

  4. Validate the setup by listing available scripts or attempting a build:
    • npm run build
    • npm run start # for stdio transport
    • npm run start:http # for HTTP/SSE transport
  5. Start the server in stdio mode (CLI):
    • npm start
  6. Start the server in HTTP mode (SSE):
    • npm run start:http
  7. For development with auto-reload (if configured in package.json):
    • npm run dev
    • npm run dev:http

Notes:

  • The template may default to Bun-based scripts; if you prefer Node.js runtimes, adjust the npm scripts in package.json accordingly to use node or ts-node as needed.

Additional notes

Tips and considerations:

  • The template supports two transports: stdio and SSE. Use stdio for local tool development and SSE for remote or team usage.
  • Environment variables such as PORT (for the HTTP server) can be used to customize behavior. Example: PORT=8080 npm run start:http
  • If Cursor integration is planned, you can export mcp.json configurations in .cursor/mcp.json with both stdio (command) and SSE (url) entries.
  • When extending with tools, resources, and prompts, follow the existing TypeScript patterns shown in the template to ensure compatibility with FastMCP expectations.
  • If you encounter Bun-specific runtime notes, modify the scripts to run with Node.js or your preferred runtime to avoid runtime-specific issues.

Related MCP Servers

Sponsor this space

Reach thousands of developers