Bootstrap Model Context Protocol server projects
template-mcp-server is a CLI scaffold that generates a FastMCP-based MCP server project with stdio and HTTP transports built in.
Why it matters
Scaffold new MCP server projects with TypeScript configuration, dual transport support, and an extensible architecture so developers can quickly start building protocol-compliant servers without manual setup.
Outcomes
What it gets done
Generate TypeScript project structure with proper configuration files
Set up dual transport options for server communication
Create extensible boilerplate code for MCP server implementation
Initialize CLI tool scaffolding with best practices
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/mcp-template-mcp-server | bash Overview
Template MCP Server
template-mcp-server is a CLI generator that scaffolds a FastMCP-based TypeScript MCP server project with stdio and HTTP transports, tool/resource/prompt structure, and dev scripts already in place. Use it when starting a brand-new MCP server project and you want a working FastMCP + TypeScript skeleton instead of building the protocol boilerplate from scratch.
What it does
@mcpdotdirect/template-mcp-server is a CLI tool that scaffolds a new Model Context Protocol server project built on the FastMCP framework. Running the generator produces a TypeScript project with both stdio and HTTP transport options already wired up, a structure for defining MCP tools, resources, and prompts, TypeScript configuration, and development scripts - so a new MCP server starts from a working skeleton rather than an empty repository.
When to use - and when NOT to
Use this when starting a brand-new MCP server project and you want stdio (for local, Cursor-managed CLI tools) and HTTP/SSE (for network-accessible, team-shared tools) transports both scaffolded from the start, on a FastMCP + TypeScript foundation. It is a project generator, not a runtime library to import into an existing codebase - it is meant to be run once to create a new project directory, after which the generated code is yours to extend.
Inputs and outputs
Running npx @mcpdotdirect/create-mcp-server or npm init @mcpdotdirect/mcp-server generates the project. The generated server supports npm start/npm run dev for stdio mode and npm run start:http/npm run dev:http for HTTP mode (default port 3001, configurable via PORT, host via HOST). Custom tools, resources, and prompts are added with server.addTool, server.addResourceTemplate, and server.addPrompt calls using Zod schemas for parameter validation.
Integrations
The generated project connects to Cursor via its MCP Servers settings (command type for stdio, url type for SSE at http://localhost:3001/sse), or through a project-level .cursor/mcp.json (or a global ~/.cursor/mcp.json) for portable, shareable configuration. FastMCP itself provides built-in testing tools (npx fastmcp dev server.js, npx fastmcp inspect server.ts). The template project is released under the MIT License.
Who it's for
Developers starting a new MCP server from scratch who want a working FastMCP + TypeScript skeleton with both stdio and HTTP transports already configured, instead of wiring up the protocol boilerplate themselves.
The template documents the tradeoff between its two transports explicitly: stdio runs only on the local machine, is managed automatically by Cursor, and communicates directly via stdout, making it ideal for personal development tools; SSE over HTTP can run locally or remotely, is managed by the developer, communicates over the network, and can be shared across machines, making it the choice for team-collaboration tooling. Dependencies can be installed with npm, yarn, pnpm, or bun, and by default the generated package.json scripts assume Bun as the runtime, though they can be edited to target Node.js instead.
npx @mcpdotdirect/create-mcp-server
Source README
@mcpdotdirect/template-mcp-server
A CLI tool to quickly get started building your very own MCP (Model Context Protocol) server using FastMCP
๐ Usage
# with npx
npx @mcpdotdirect/create-mcp-server
# Or with npm
npm init @mcpdotdirect/mcp-server
๐ญ What's Included
The template includes:
- Basic server setup with both stdio and HTTP transport options using FastMCP
- Structure for defining MCP tools, resources, and prompts
- TypeScript configuration
- Development scripts and configuration
โจ Features
- FastMCP: Built using the FastMCP framework for simpler implementation
- Dual Transport Support: Run your MCP server over stdio or HTTP
- TypeScript: Full TypeScript support for type safety
- Extensible: Easy to add custom tools, resources, and prompts
๐ Getting Started
After creating your project:
Install dependencies using your preferred package manager:
# Using npm npm install # Using yarn yarn # Using pnpm pnpm install # Using bun bun installStart the server:
# Start the stdio server npm start # Or start the HTTP server npm run start:httpFor development with auto-reload:
# Development mode with stdio npm run dev # Development mode with HTTP npm run dev:http
Note: The default scripts in package.json use Bun as the runtime (e.g.,
bun run src/index.ts). If you prefer to use a different package manager or runtime, you can modify these scripts in your package.json file to use Node.js or another runtime of your choice.
๐ Detailed Usage
Transport Methods
The MCP server supports two transport methods:
stdio Transport (Command Line Mode):
- Runs on your local machine
- Managed automatically by Cursor
- Communicates directly via
stdout - Only accessible by you locally
- Ideal for personal development and tools
SSE Transport (HTTP Web Mode):
- Can run locally or remotely
- Managed and run by you
- Communicates over the network
- Can be shared across machines
- Ideal for team collaboration and shared tools
Running the Server Locally
stdio Transport (CLI Mode)
Start the server in stdio mode for CLI tools:
# Start the stdio server
npm start
# or with other package managers
yarn start
pnpm start
bun start
# Start the server in development mode with auto-reload
npm run dev
# or
yarn dev
pnpm dev
bun dev
HTTP Transport (Web Mode)
Start the server in HTTP mode for web applications:
# Start the HTTP server
npm run start:http
# or
yarn start:http
pnpm start:http
bun start:http
# Start the HTTP server in development mode with auto-reload
npm run dev:http
# or
yarn dev:http
pnpm dev:http
bun dev:http
By default, the HTTP server runs on port 3001. You can change this by setting the PORT environment variable:
# Start the HTTP server on a custom port
PORT=8080 npm run start:http
Connecting to the Server
Connecting from Cursor
To connect to your MCP server from Cursor:
- Open Cursor and go to Settings (gear icon in the bottom left)
- Click on "Features" in the left sidebar
- Scroll down to "MCP Servers" section
- Click "Add new MCP server"
- Enter the following details:
- Server name:
my-mcp-server(or any name you prefer) - For stdio mode:
- Type:
command - Command: The path to your server executable, e.g.,
npm start
- Type:
- For SSE mode:
- Type:
url - URL:
http://localhost:3001/sse
- Type:
- Server name:
- Click "Save"
Using mcp.json with Cursor
For a more portable configuration, create an .cursor/mcp.json file in your project's root directory:
{
"mcpServers": {
"my-mcp-stdio": {
"command": "npm",
"args": [
"start"
],
"env": {
"NODE_ENV": "development"
}
},
"my-mcp-sse": {
"url": "http://localhost:3001/sse"
}
}
}
You can also create a global configuration at ~/.cursor/mcp.json to make your MCP servers available in all your Cursor workspaces.
Note:
- The
commandtype entries run the server in stdio mode - The
urltype entry connects to the HTTP server using SSE transport - You can provide environment variables using the
envfield - When connecting via SSE with FastMCP, use the full URL including the
/ssepath:http://localhost:3001/sse
Testing Your Server with CLI Tools
FastMCP provides built-in tools for testing your server:
# Test with mcp-cli
npx fastmcp dev server.js
# Inspect with MCP Inspector
npx fastmcp inspect server.ts
Using Environment Variables
You can customize the server using environment variables:
# Change the HTTP port (default is 3001)
PORT=8080 npm run start:http
# Change the host binding (default is 0.0.0.0)
HOST=127.0.0.1 npm run start:http
๐ ๏ธ Adding Custom Tools and Resources
When adding custom tools, resources, or prompts to your FastMCP server:
Tools
server.addTool({
name: "hello_world",
description: "A simple hello world tool",
parameters: z.object({
name: z.string().describe("Name to greet")
}),
execute: async (params) => {
return `Hello, ${params.name}!`;
}
});
Resources
server.addResourceTemplate({
uriTemplate: "example://{id}",
name: "Example Resource",
mimeType: "text/plain",
arguments: [
{
name: "id",
description: "Resource ID",
required: true,
},
],
async load({ id }) {
return {
text: `This is an example resource with ID: ${id}`
};
}
});
Prompts
server.addPrompt({
name: "greeting",
description: "A simple greeting prompt",
arguments: [
{
name: "name",
description: "Name to greet",
required: true,
},
],
load: async ({ name }) => {
return `Hello, ${name}! How can I help you today?`;
}
});
๐ Documentation
For more information about FastMCP, visit FastMCP GitHub Repository.
For more information about the Model Context Protocol, visit the MCP Documentation.
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
FAQ
Common questions
Discussion
Questions & comments ยท 0
Sign In Sign in to leave a comment.