Installation
Learn how to configure mcpcraft-sdk in your project.
Installation
Set up and configure mcpcraft-sdk in your project folder.
Install the Package
First, add mcpcraft-sdk and zod to your project:
npm install mcpcraft-sdk zodpnpm add mcpcraft-sdk zodyarn add mcpcraft-sdk zodbun add mcpcraft-sdk zodConfigure TSConfig
mcpcraft-sdk requires modern TypeScript settings. Ensure your tsconfig.json contains at least the following configuration:
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"esModuleInterop": true,
"strict": true
}
}Without moduleResolution: NodeNext (or Bundler if using a bundler), you may encounter import issues when importing the low-level transport classes from @modelcontextprotocol/sdk.
Create Your Server
Create a server file (e.g. server.ts) and define your tools and resource endpoints:
import { createServer } from "mcpcraft-sdk";
const server = createServer({
name: "my-mcp-server",
version: "1.0.0"
});
// Start listening on stdio transport
server.start();Under the Hood
mcpcraft-sdk wraps the official @modelcontextprotocol/sdk. When you install it, the official SDK is installed automatically as a dependency.
You do not need to write low-level JSON-RPC message handlers or manually manage standard input/output streams; mcpcraft-sdk abstracts this into a clean, event-driven interface.