convez.ai
MCP ServerDesenvolvimento WebIntermediário
abdunur-dev

mcpcraft-sdk

abdunur-dev/mcpcraft

Build MCP servers em TypeScript com 10 linhas, não 100

Ver no GitHub
InicialPluginScore · de 0 a 100

SDK TypeScript leve para construir servidores MCP com zero boilerplate e segurança de tipos completa. Reduz de ~100 linhas de código boilerplate para ~10 linhas, com geração automática de schemas e validação de entrada integrada.

Instalação

$npx convez-ai abdunur-dev/mcpcraft

1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.

Métricas

Estrelas
3
Forks
0
Acompanhando
0
Saúde
28%
Último commit
há 5 meses
Versão
v0.1.0
Issues abertas
0
Contribuidores
3

Casos de uso

  • Criar ferramentas customizadas para Claude e outros agentes de IA
  • Integrar APIs legadas com Model Context Protocol
  • Construir agents que executam ações com type safety automático

Veredito

Solução pragmática para o ecossistema MCP: elimina boilerplate real sem abstrair MCP além do necessário. Bem posicionado para devs que querem rapidez com segurança de tipos — massa crítica começa pequena, mas SDK é sólido para produção.

README

A tradução para o português deste README ainda está na fila.

mcpcraft-sdk

npm version License

A lightweight TypeScript SDK for building Model Context Protocol (MCP) servers — zero boilerplate, full type safety, automatic schema generation.


What is MCP?

The Model Context Protocol (MCP) is an open standard that lets AI apps (Claude, Cursor, VS Code Copilot) call functions and read data from your server — the same way HTTP lets browsers talk to APIs. MCP is to AI what HTTP is to the web.

Why mcpcraft-sdk?

The official @modelcontextprotocol/sdk requires ~100 lines of boilerplate per server. mcpcraft-sdk distills that down to ~10 lines — with automatic schema generation, type inference, and input validation.

import { createServer, tool } from "mcpcraft-sdk"

const server = createServer({ name: "hello-world" })

server.add(tool({
  name: "greet",
  description: "Greets a user by name",
  input: {
    name: { type: "string", description: "The user's name" }
  },
  run: async ({ name }) => {
    return { message: `Hello, ${name}!` }
  }
}))

server.start()

Install

npm install mcpcraft-sdk zod
pnpm add mcpcraft-sdk zod
yarn add mcpcraft-sdk zod

Quick Start

1. Create your server

import { createServer, tool } from "mcpcraft-sdk"

const server = createServer({ name: "my-first-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()

2. Run it

npx ts-node server.ts

3. Connect it

Add to your MCP client config:

{
  "mcpServers": {
    "my-first-server": {
      "command": "node",
      "args": ["dist/server.js"]
    }
  }
}

Architecture

AI Agent (Claude, Cursor)
  │
  ▼  JSON-RPC over stdio/SSE
MCP Client
  │
  ▼
Your MCP Server (mcpcraft-sdk)
  │
  ├── Tools (executable functions)
  └── Resources (read-only data)

API Reference

createServer(options)

Creates a new MCP server instance with automatic transport setup.

ParamTypeRequiredDefaultDescription
namestringYes—Server name (shown to MCP clients)
versionstringNo"0.1.0"SemVer version
descriptionstringNo—Human-readable description

Methods:

  • server.add(item) — Register a tool or resource (chainable)
  • server.start() — Launch the server on stdio transport
  • server.server — Access the underlying raw SDK Server instance

tool(options)

Defines an executable function that LLMs can invoke.

ParamTypeRequiredDescription
namestringYesAlphanumeric identifier
descriptionstringYesExplains the tool to the LLM
inputInputSchemaNoParameter definitions
run(args) => anyYesExecution handler (typed args)

Input Schema:

input: {
  query:   { type: "string",  description: "Search query" },
  limit:   { type: "number",  description: "Max results", required: false },
  verbose: { type: "boolean", description: "Detailed output", required: false }
}

resource(options)

Defines a read-only data source identified by URI.

ParamTypeRequiredDescription
namestringYesResource identifier
descriptionstringYesDescribes the data to the LLM
uristringYesURI or URI template (users://{id}/profile)
mimeTypestringNoMIME type (default: application/json)
fetch(params) => anyYesReturns the resource data

Documentation

Full documentation is available at mcpcraft.org:


License

MIT

Ver o original no GitHub

Bom para

Relacionados