Skip to content

xmcp TypeScript Starter

Baseline xmcp template with typed tools, prompts, and resources using HTTP transport.

Categories
HTTP
TypeScript
Share
Post on X

A minimal MCP server with tools, prompts, and resources using TypeScript and HTTP transport.

Features

  • File-based routing for tools, prompts, and resources
  • Zod schema validation for all inputs
  • Type-safe with InferSchema utility
  • HTTP and STDIO transport support
  • Auto-discovery of tools, prompts, and resources from directories

Getting Started

1. Create the project

Shell

2. Install & run

Shell

Requires Node.js 22.12 or newer. pnpm install also installs @xmcp-dev/compiler, the dev dependency that runs xmcp dev and xmcp build.

The MCP server will start with HTTP transport at http://localhost:3001.

Project Structure

Text

Adding Tools

Create a new .ts file in src/tools/:

TypeScript

The tool is automatically discovered and registered.

Adding Prompts

Create a new .ts file in src/prompts/:

TypeScript

Adding Resources

Create a new .ts file in src/resources/. Use folder structure to define the URI — for example, (users)/[userId]/profile.ts maps to users://{userId}/profile.

TypeScript

Deploy

Build for production:

Shell

Run the compiled server:

Shell

Learn More

Other templates

One framework to rule them all