Skip to main content

Prerequisites

Before you begin, ensure you have the following installed:
  • Node.js 20.x or higher
  • npm, yarn, or pnpm package manager

Quick Install

Install xmcp in your project using your preferred package manager:
npm install xmcp zod
xmcp requires zod as a peer dependency for schema validation.

Create a New Project

The fastest way to get started is to create a new xmcp application using the official CLI:
1

Run the create command

Bootstrap a new xmcp application with one command:
npx create-xmcp-app@latest
2

Follow the prompts

The CLI will guide you through the setup process:
  • Choose a project name
  • Select a template (TypeScript, MCP Apps, GPT Apps)
  • Choose styling options (default or Tailwind)
  • Configure your project preferences
3

Navigate to your project

cd your-project-name
4

Start the development server

npm run dev
Your xmcp server will start with hot reloading enabled.

Add to Existing Project

If you have an existing Next.js or Express project, you can initialize xmcp in it:
1

Run the init command

Initialize xmcp in your existing project:
npx init-xmcp@latest
2

Follow the setup wizard

The init script will:
  • Detect your project type (Next.js, Express, etc.)
  • Install necessary dependencies
  • Create the required directory structure
  • Add example tools and configuration
3

Create your configuration

Create an xmcp.config.ts file in your project root:
xmcp.config.ts
import { defineConfig } from "xmcp";

export default defineConfig({
  server: {
    name: "my-mcp-server",
    version: "1.0.0",
  },
});
4

Start building

Start the xmcp development server:
xmcp dev
Or add it to your package.json scripts:
package.json
{
  "scripts": {
    "dev:xmcp": "xmcp dev",
    "build:xmcp": "xmcp build"
  }
}

Project Structure

After installation, your project will have the following structure:
my-xmcp-app/
├── src/
│   ├── tools/          # Your tool implementations
│   ├── prompts/        # Your prompt templates
│   └── middleware.ts   # Optional middleware
├── xmcp.config.ts      # xmcp configuration
├── package.json
└── tsconfig.json

Verify Installation

Verify that xmcp is installed correctly:
npx xmcp --version
You should see the version number of xmcp (currently 0.0.3).

Next Steps

Now that you have xmcp installed, you’re ready to build your first MCP server:

Quickstart Guide

Build your first tool in minutes

Core Concepts

Learn how xmcp works

Configuration

Configure your xmcp server

Examples

Explore example projects

Build docs developers (and LLMs) love