{"_id":"@asoviche/mcp-builder","name":"@asoviche/mcp-builder","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@asoviche/mcp-builder","version":"1.0.0","description":"A declarative, type-safe library for building MCP servers","main":"./dist/index.js","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"import":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"require":{"types":"./dist/index.d.ts","default":"./dist/index.js"}}},"scripts":{"build":"tsup","dev":"tsup --watch","prepublishOnly":"npm run build"},"keywords":["mcp","model-context-protocol","ai","tools","claude","cursor"],"author":{"name":"asoviche"},"license":"MIT","peerDependencies":{"zod":"^3.0.0"},"devDependencies":{"@types/node":"^25.0.3","tsup":"^8.0.0","typescript":"^5.0.0","zod":"^3.23.0"},"_id":"@asoviche/mcp-builder@1.0.0","_nodeVersion":"22.21.1","_npmVersion":"10.9.4","dist":{"integrity":"sha512-vNugOtmGOheGz8Ib6/43qUemBXfoVeQgIueszXS+2sL5/yxP+uMTf8aMsrSvrqywY9bcVS8aQhFDjM2AvQVjaQ==","shasum":"89c3927d8ea364c2bd5618445b1db3be5c76e263","tarball":"https://registry.npmjs.org/@asoviche/mcp-builder/-/mcp-builder-1.0.0.tgz","fileCount":8,"unpackedSize":61687,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIG1l4EWOxb96TuqlogO96keJk9pMmd5JUDysF99uZVehAiEA8TQuga1M/GWdSV4qFLYvJ4TD/bfipR5eYLwFKQfaZWQ="}]},"_npmUser":{"name":"asoviche","email":"amaury@ogment.ai"},"directories":{},"maintainers":[{"name":"asoviche","email":"amaury@ogment.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/mcp-builder_1.0.0_1767049843579_0.7238827334262117"},"_hasShrinkwrap":false}},"time":{"created":"2025-12-29T23:10:43.383Z","1.0.0":"2025-12-29T23:10:43.781Z","modified":"2025-12-29T23:10:44.191Z"},"maintainers":[{"name":"asoviche","email":"amaury@ogment.ai"}],"description":"A declarative, type-safe library for building MCP servers","keywords":["mcp","model-context-protocol","ai","tools","claude","cursor"],"author":{"name":"asoviche"},"license":"MIT","readme":"# @asoviche/mcp-builder\n\nA **declarative, type-safe** library for building [MCP (Model Context Protocol)](https://modelcontextprotocol.io/) servers.\n\n## Features\n\n- 🎯 **Declarative API** — Define tools and resources with minimal boilerplate\n- 🔒 **Type-safe** — Full TypeScript support with Zod schema validation\n- ⚡ **Zero config** — Sensible defaults, just define and serve\n- 🔌 **Extensible** — Custom transports supported\n\n## Installation\n\n```bash\nnpm install @asoviche/mcp-builder zod\n```\n\n## Quick Start\n\n```typescript\nimport { createMCP } from \"@asoviche/mcp-builder\";\nimport { z } from \"zod\";\n\nconst mcp = createMCP({\n  name: \"my-server\",\n  version: \"1.0.0\",\n});\n\n// Define a tool\nmcp.tool(\"greet\", {\n  description: \"Greet someone by name\",\n  parameters: z.object({\n    name: z.string().describe(\"Name to greet\"),\n  }),\n  execute: ({ name }) => {\n    return `Hello, ${name}!`;\n  },\n});\n\n// Define a resource\nmcp.resource(\"config://app\", {\n  description: \"Application configuration\",\n  read: () => JSON.stringify({ debug: true }),\n});\n\n// Start the server\nmcp.serve();\n```\n\n## API\n\n### `createMCP(config)`\n\nCreates a new MCP server builder.\n\n```typescript\nconst mcp = createMCP({\n  name: \"my-server\",      // Required: Server name\n  version: \"1.0.0\",       // Required: Server version\n  description: \"...\",     // Optional: Server description\n});\n```\n\n### `mcp.tool(name, definition)`\n\nRegisters a tool with the server.\n\n```typescript\nmcp.tool(\"calculate\", {\n  description: \"Perform calculations\",\n  parameters: z.object({\n    a: z.number(),\n    b: z.number(),\n    op: z.enum([\"add\", \"subtract\"]),\n  }),\n  execute: async ({ a, b, op }) => {\n    return op === \"add\" ? a + b : a - b;\n  },\n});\n```\n\n### `mcp.resource(uri, definition)`\n\nRegisters a resource with the server.\n\n```typescript\nmcp.resource(\"file://config.json\", {\n  description: \"Configuration file\",\n  mimeType: \"application/json\",\n  read: async () => {\n    return await fs.readFile(\"config.json\", \"utf-8\");\n  },\n});\n```\n\n### `mcp.serve(options?)`\n\nStarts the MCP server.\n\n```typescript\n// Default: stdio transport\nmcp.serve();\n\n// Custom transport\nmcp.serve({ transport: myCustomTransport });\n```\n\n## Using with Cursor\n\nAdd to your `.cursor/mcp.json`:\n\n```json\n{\n  \"mcpServers\": {\n    \"my-server\": {\n      \"command\": \"npx\",\n      \"args\": [\"tsx\", \"path/to/your/server.ts\"]\n    }\n  }\n}\n```\n\n## Supported Zod Types\n\nThe library automatically converts Zod schemas to JSON Schema for MCP:\n\n| Zod Type | JSON Schema |\n|----------|-------------|\n| `z.string()` | `{ type: \"string\" }` |\n| `z.number()` | `{ type: \"number\" }` |\n| `z.boolean()` | `{ type: \"boolean\" }` |\n| `z.enum([...])` | `{ type: \"string\", enum: [...] }` |\n| `z.array(...)` | `{ type: \"array\", items: {...} }` |\n| `z.object({...})` | `{ type: \"object\", properties: {...} }` |\n| `z.optional(...)` | Removes from `required` |\n| `z.default(...)` | Adds `default` value |\n| `.describe(...)` | Adds `description` |\n\n## Development\n\n```bash\n# Install dependencies\nnpm install\n\n# Build\nnpm run build\n\n# Watch mode\nnpm run dev\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md","_rev":"1-106d2878c4e1b77bf6f5b548a76ff3d6"}