mcpcraft

mcpcraft

A lightweight SDK for building Model Context Protocol (MCP) servers with zero-config setup, automatic TypeScript type inference, and Zod runtime validation.

Category
Visit Server

README

mcpcraft

npm version License

A lightweight and elegant SDK for building Model Context Protocol (MCP) servers fast.


Why mcpcraft?

The official MCP SDK is powerful but requires significant JSON-RPC boilerplate and manual schema definitions. mcpcraft wraps it to provide a streamlined, zero-config API with automatic TypeScript type inference and Zod runtime schema validation.

Install

npm install mcpcraft zod

Quick Start

import { createServer, tool } from "mcpcraft";

const server = createServer({ name: "my-mcp-server" });

server.add(tool({
  name: "get_weather",
  description: "Get the current weather for a location",
  input: {
    location: { type: "string", description: "City name" }
  },
  run: async ({ location }) => {
    return { temp: 22, condition: "Sunny", city: location };
  }
}));

server.start();

API Reference

createServer(options)

Creates a new server instance.

  • options:
    • name: string (required) - Name of the server.
    • version?: string (optional) - Version of the server (default: 0.1.0).
    • description?: string (optional) - Description of the server.

Returns: A server instance with:

  • add(item: Tool | Resource): Register a tool or a resource (chainable).
  • start(): Starts the server listening on the standard input/output (stdio) transport.
  • server: Access the underlying official Server instance if low-level control is needed.

tool(options)

Defines an MCP tool with schema validation.

  • options:
    • name: string - The name of the tool (alphanumeric and underscores).
    • description: string - A description explaining what the tool does (used by the LLM).
    • input?: Record<string, { type: "string" | "number" | "boolean"; description?: string; required?: boolean }> - Parameter schemas.
    • run: (args) => Promise<any> | any - The execution logic. The args parameter is fully typed and inferred automatically based on input.

resource(options)

Defines an MCP resource or resource template.

  • options:
    • name: string - The name of the resource.
    • description: string - Description of the resource.
    • uri: string - The URI (e.g. info://system) or URI Template (e.g. users://{userId}/profile).
    • mimeType?: string - The MIME type (e.g., application/json, text/plain).
    • fetch: (params) => Promise<any> | any - Handler that returns the resource content. If the URI is a template, params is populated with parsed dynamic variables.

Built on top of the official MCP SDK

mcpcraft is designed to play nicely with the official ecosystem. It runs directly on top of @modelcontextprotocol/sdk and uses the standard stdio transport, meaning it works out-of-the-box with Cursor, Claude Desktop, and all other MCP hosts.

License

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured