mcpField
T
Template for MCP Server

Template for MCP Server

Local
github.com/bladnmanDeveloper Tools2Updated 86w ago

About Template for MCP Server

A starter template for developers building TypeScript MCP servers. It includes a string-reversal tool, sample resources, and stdio and SSE transports.

Key features

  1. 01String reversal tool
  2. 02stdio and SSE transports
  3. 03TypeScript build process
  4. 04Greeting and server-info resources

Use cases

  1. 01Starting a new MCP server project
  2. 02Testing the string-reversal tool
  3. 03Inspecting message traffic with MCP Inspector

MCP support

The template implements an MCP server that exposes a string-reversal tool and greeting and server-info resources to clients, over stdio or SSE.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"template-bladnman": {
"command": "npx",
"args": [
"-y",
"make-mine"
]
}
}
}
Run commandnpx -y make-mine

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
npmmake-mine

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

Template for MCP Server

A starting point for an MCP Server.

DUPLICATE ME

The whole idea here is for you to take this for your own. Running this to create a new folder with your own copy of this template (git removed and replaced with a new one).

replace mcp-server with name of your choice:

npx make-mine https://github.com/bladnman/mcp-server-template.git <mcp-server>

Features

  • Simple string reversal tool
  • Support for both stdio and SSE transports
  • TypeScript implementation with full build process

Tools

reverse

Takes a string input and returns it reversed.

Example:

  • Input: "hello world"
  • Output: "dlrow olleh"

Resources

  • greeting://hello: A welcome greeting
  • welcome://info: Information about the server and its capabilities

Getting Started

Testing with MCP Inspector

There's a way to test the server itself using a generic inspector tool which allows you to see the transiting message between the server and the client. It is dropping to shell and running this command.

npx fastmcp inspect server.ts

And then going to the url it provides (likely): http://localhost:5173

and for the current server that we're running here this server we will want to execute the run server.sh file that you see in the root directory as stdio with no arguments.

<full_path_to_server>/run-server.sh
Prerequisites
  • Node.js (v14 or higher)
  • npm
Installation
# Install dependencies
npm install
Running the Server
# Build and run with stdio transport (default)
bash run-server.sh

# Or, to run with SSE transport
TRANSPORT_TYPE=sse npm run start

By default, the SSE server runs on port 4000. Change in the CONST.ts file.

Development

# Run in development mode with hot reloading
npm run dev

# Watch for changes and rebuild automatically
npm run watch

Building

# Build TypeScript to JavaScript
npm run build

The built files will be in the dist directory.

License

ISC License

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.