Get started in three steps
This guide will walk you through creating your first xmcp application, implementing a tool, and testing it.Create your xmcp app
Bootstrap a new xmcp application using the CLI:Follow the prompts to configure your project. For this quickstart, select the TypeScript template.Navigate to your project directory:
Create your first tool
Create a new file
src/tools/greet.ts with the following code:src/tools/greet.ts
What’s happening here?
- schema: Defines the input parameters using Zod for validation
- metadata: Provides information about the tool for MCP clients
- default export: The tool implementation that returns content
Start the development server
Run the xmcp development server with hot reloading:You should see output indicating your server is running:
Test your tool
Your tool is now ready to be used by any MCP client. You can test it using:
Using the MCP Inspector
The MCP Inspector is a great tool for testing your MCP server:-
Install the MCP Inspector:
-
Run the inspector:
-
Connect to your xmcp server and test the
greettool
Using Claude Desktop
To use your tool with Claude Desktop:-
Open Claude Desktop configuration:
-
Add your xmcp server:
- Restart Claude Desktop and ask it to greet someone
Understanding the Tool Structure
Every xmcp tool follows this pattern:1. Schema Definition
Define your tool’s input parameters using Zod:2. Metadata
Provide metadata about your tool:3. Implementation
Implement your tool logic:Add More Tools
Adding more tools is as simple as creating new files in thesrc/tools directory.
Create src/tools/random-number.ts:
src/tools/random-number.ts
Next Steps
Congratulations! You’ve built your first xmcp application. Here’s what to explore next:Core Concepts
Learn about tools, prompts, and resources
Middleware
Add authentication and custom logic
Configuration
Customize your xmcp server
Deployment
Deploy your app to production
Examples
Explore more examples in the xmcp GitHub repository:- with-express: Integration with Express.js
- with-nextjs: Integration with Next.js
- with-nestjs: Integration with NestJS
- middlewares-api-key: API key authentication
- http-transport: HTTP transport examples
Need help? Join the community or report issues on GitHub.