{"_id":"@bamada/nestjs-mcp","_rev":"2-9c1d829db99efba2eac8b86391b41126","name":"@bamada/nestjs-mcp","dist-tags":{"latest":"0.2.1"},"versions":{"0.2.0":{"name":"@bamada/nestjs-mcp","version":"0.2.0","keywords":["nestjs","nest","mcp","model","context","protocol","server","integration","ai","llm"],"author":{"name":"bamada"},"license":"MIT","_id":"@bamada/nestjs-mcp@0.2.0","maintainers":[{"name":"bamada","email":"kyle.mamadi@gmail.com"}],"homepage":"https://github.com/bamada/nestjs-mcp#readme","bugs":{"url":"https://github.com/bamada/nestjs-mcp/issues"},"dist":{"shasum":"577931db028f713e1f55984b9c8ceabb9207b870","tarball":"https://registry.npmjs.org/@bamada/nestjs-mcp/-/nestjs-mcp-0.2.0.tgz","fileCount":33,"integrity":"sha512-kehHrhtJOp6yvV+f2ZJ0VrQIjJssPLemoLfedVOe4+lXOkn8kN0P7QmQt6HPGnHrP2W+SMOScMZ+49Bn2nHyxQ==","signatures":[{"sig":"MEUCIQDScTPB3OfzQmrMPWDvgMTh8PB6Wqsl3Yspmz0K3JcbGwIgTAf6sH4upOGpjYv2OVQyKsKKtXxdwwajIzNCdIBQgyY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":81447},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"379c6b4348c979a460c91f58b13700b092b4864d","scripts":{"lint":"eslint \"src/**/*.ts\" --fix","test":"jest","build":"rimraf dist && tsc -p tsconfig.build.json","clean":"npm cache clean --force","format":"prettier --write \"src/**/*.ts\"","prepare":"husky","release":"release-it","test:cov":"jest --coverage","test:debug":"node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand","test:watch":"jest --watch","publish:next":"npm publish --access public --tag next","prepublishOnly":"npm run build"},"_npmUser":{"name":"bamada","email":"kyle.mamadi@gmail.com"},"repository":{"url":"git+https://github.com/bamada/nestjs-mcp.git","type":"git"},"_npmVersion":"10.9.2","description":"A NestJS module providing seamless integration for implementing Model Context Protocol (MCP) servers, enabling resources, tools, and prompts via decorators.","directories":{},"_nodeVersion":"23.6.0","dependencies":{},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"zod":"^3.24.2","rxjs":"^7.8.1","husky":"9.1.7","eslint":"9.25.1","rimraf":"^6.0.0","prettier":"3.5.3","release-it":"^19.0.1","typescript":"5.8.3","@types/node":"22.14.1","@nestjs/core":"^11.0.1","@nestjs/common":"^11.0.1","@types/express":"^4.17.21","reflect-metadata":"^0.2.2","typescript-eslint":"8.31.0","eslint-config-prettier":"10.1.2","eslint-plugin-prettier":"5.2.6","@nestjs/platform-express":"^11.0.1","@modelcontextprotocol/sdk":"^1.9.0","@typescript-eslint/parser":"8.31.0","@typescript-eslint/eslint-plugin":"8.31.0","@release-it/conventional-changelog":"^10.0.1"},"peerDependencies":{"zod":"^3.0.0","rxjs":"^7.2.0","@nestjs/core":"^10.0.0 || ^11.0.0","@nestjs/common":"^10.0.0 || ^11.0.0","reflect-metadata":"0.2.2","@nestjs/platform-express":"^10.0.0 || ^11.0.0","@modelcontextprotocol/sdk":"^1.10.2"},"_npmOperationalInternal":{"tmp":"tmp/nestjs-mcp_0.2.0_1745619358241_0.314981264956399","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"@bamada/nestjs-mcp","version":"0.2.1","description":"A NestJS module providing seamless integration for implementing Model Context Protocol (MCP) servers, enabling resources, tools, and prompts via decorators.","author":{"name":"bamada"},"license":"MIT","keywords":["nestjs","nest","mcp","model","context","protocol","server","integration","ai","llm"],"main":"dist/index.js","types":"dist/index.d.ts","repository":{"type":"git","url":"git+https://github.com/bamada/nestjs-mcp.git"},"bugs":{"url":"https://github.com/bamada/nestjs-mcp/issues"},"homepage":"https://github.com/bamada/nestjs-mcp#readme","publishConfig":{"access":"public"},"scripts":{"build":"rimraf dist && tsc -p tsconfig.build.json","format":"prettier --write \"src/**/*.ts\"","lint":"eslint \"src/**/*.ts\" --fix","test":"jest","test:watch":"jest --watch","test:cov":"jest --coverage","test:debug":"node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand","prepublishOnly":"npm run build","publish:next":"npm publish --access public --tag next","release":"release-it","prepare":"husky","clean":"npm cache clean --force"},"peerDependencies":{"@modelcontextprotocol/sdk":"^1.10.2","@nestjs/common":"^10.0.0 || ^11.0.0","@nestjs/core":"^10.0.0 || ^11.0.0","@nestjs/platform-express":"^10.0.0 || ^11.0.0","reflect-metadata":"0.2.2","rxjs":"^7.2.0","zod":"^3.0.0"},"dependencies":{},"devDependencies":{"@modelcontextprotocol/sdk":"^1.9.0","@nestjs/common":"^11.0.1","@nestjs/core":"^11.0.1","@nestjs/platform-express":"^11.0.1","reflect-metadata":"^0.2.2","rxjs":"^7.8.1","zod":"^3.24.2","rimraf":"^6.0.0","typescript":"5.8.3","@types/express":"^4.17.21","@types/node":"22.14.1","@release-it/conventional-changelog":"^10.0.1","@typescript-eslint/eslint-plugin":"8.31.0","@typescript-eslint/parser":"8.31.0","eslint":"9.25.1","eslint-config-prettier":"10.1.2","eslint-plugin-prettier":"5.2.6","prettier":"3.5.3","husky":"9.1.7","release-it":"^19.0.1","typescript-eslint":"8.31.0"},"_id":"@bamada/nestjs-mcp@0.2.1","gitHead":"2b2aba3d312fe372754368c691492b55582f115f","_nodeVersion":"23.6.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-lnVDq3MHZbjkJfoW72kfWseR+gu2TdabDcPZUrKQJjijoXWOllt8kMrC5bnXCXTkqUwBxuIpUw0BfIsX+ELc8w==","shasum":"193375339074d27838ca4c701dd5fc2233e86b21","tarball":"https://registry.npmjs.org/@bamada/nestjs-mcp/-/nestjs-mcp-0.2.1.tgz","fileCount":33,"unpackedSize":81438,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIF/bLzEP6JL65R0Hu3synqCKaNKUhtnRdMZc1nV3Tfa4AiAo+Zc1SRp11BjDOmi7UPRKaZLYbpMp3DfGc9NXvBCy7g=="}]},"_npmUser":{"name":"bamada","email":"kyle.mamadi@gmail.com"},"directories":{},"maintainers":[{"name":"bamada","email":"kyle.mamadi@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/nestjs-mcp_0.2.1_1745661362893_0.5718945870542747"},"_hasShrinkwrap":false}},"time":{"created":"2025-04-25T22:15:58.099Z","modified":"2025-04-26T09:56:03.284Z","0.2.0":"2025-04-25T22:15:58.472Z","0.2.1":"2025-04-26T09:56:03.098Z"},"bugs":{"url":"https://github.com/bamada/nestjs-mcp/issues"},"author":{"name":"bamada"},"license":"MIT","homepage":"https://github.com/bamada/nestjs-mcp#readme","keywords":["nestjs","nest","mcp","model","context","protocol","server","integration","ai","llm"],"repository":{"type":"git","url":"git+https://github.com/bamada/nestjs-mcp.git"},"description":"A NestJS module providing seamless integration for implementing Model Context Protocol (MCP) servers, enabling resources, tools, and prompts via decorators.","maintainers":[{"name":"bamada","email":"kyle.mamadi@gmail.com"}],"readme":"# NestJS MCP Module\n\n<p align=\"center\">\n  <a href=\"https://github.com/bamada/nestjs-mcp\" target=\"blank\"><img src=\"logo.svg\" width=\"200\" alt=\"Stars\"  /></a>\n</p>\n\n<p align=\"center\">\n  <a href=\"https://www.npmjs.com/package/@bamada/nestjs-mcp\" target=\"_blank\"><img src=\"https://img.shields.io/npm/v/@bamada/nestjs-mcp.svg\" alt=\"NPM Version\" /></a>\n  <a href=\"https://www.npmjs.com/package/@bamada/nestjs-mcp\" target=\"_blank\"><img src=\"https://img.shields.io/npm/l/@bamada/nestjs-mcp.svg\" alt=\"Package License\" /></a>\n  <a href=\"https://www.npmjs.com/package/@bamada/nestjs-mcp\" target=\"_blank\"><img src=\"https://img.shields.io/npm/dm/@bamada/nestjs-mcp.svg\" alt=\"NPM Downloads\" /></a>\n  <a href=\"https://github.com/bamada/nestjs-mcp/actions\"><img src=\"https://github.com/bamada/nestjs-mcp/workflows/CI/badge.svg\" alt=\"CI Status\" /></a>\n  <a href=\"https://github.com/bamada/nestjs-mcp#contributors-\"><img src=\"https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square\" alt=\"All Contributors\" /></a>\n  <a href=\"https://github.com/prettier/prettier\"><img src=\"https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square\" alt=\"code style: prettier\" /></a>\n</p>\n\nA NestJS module providing seamless integration for implementing [Model Context Protocol (MCP)](https://modelcontextprotocol.org/) servers. This module simplifies the process of exposing resources, tools, and prompts to MCP clients using familiar NestJS method decorators (`@McpResource`, `@McpTool`, `@McpPrompt`) and patterns. It supports multiple transport layers, including STDIO and HTTP/SSE.\n\n## Table of Contents\n\n- [Features](#features)\n- [Installation](#installation)\n- [Peer Dependencies](#peer-dependencies)\n- [Quick Start](#quick-start)\n  - [Import `McpModule`](#import-mcpmodule)\n  - [Create an MCP Provider](#create-an-mcp-provider)\n    - [MCP Tool Example](#mcp-tool-example)\n    - [MCP Resource Examples](#mcp-resource-examples)\n    - [MCP Prompt Example](#mcp-prompt-example)\n  - [Use `StderrLogger` (for STDIO Transport)](#use-stderrlogger-for-stdio-transport)\n  - [Run your application](#run-your-application)\n  - [Configuration](#configuration)\n- [API Reference (Decorators)](#api-reference-decorators)\n- [Development & Contributing](#development--contributing)\n- [License](#license)\n- [Links](#links)\n\n## ✨ Features\n\n- **Seamless MCP Integration:** Easily build MCP-compliant servers within your NestJS application using the `@modelcontextprotocol/sdk`.\n- **Method Decorator-Based:** Define MCP resources, tools, and prompts by decorating methods within your NestJS providers (`@McpResource`, `@McpTool`, `@McpPrompt`).\n- **Automatic Discovery:** Uses NestJS discovery mechanisms (`@nestjs/core/discovery`) to find decorated methods.\n- **Transport Handling:**\n  - Built-in support for **STDIO** transport (ideal for CLI tools).\n  - Built-in support for **HTTP/SSE** transport via a dedicated controller (`McpHttpController` at `/api/mcp`).\n  - Configurable transport selection.\n- **Zod Schemas:** Define tool parameters and prompt arguments using Zod schemas for validation and type safety.\n- **NestJS Native:** Built using standard NestJS modules, providers, and dependency injection.\n- **Strongly Typed:** Leverages TypeScript for robust development.\n- **Configurable:** Supports configuration options via standard `forRoot` and `forRootAsync` patterns.\n- **Stderr Logging:** Includes `StderrLogger` to ensure application logs don't interfere with STDIO transport.\n\n## 📦 Installation\n\nFirst, ensure you have the required peer dependencies installed. Then, install the module:\n\n```bash\n# Using npm\nnpm install @bamada/nestjs-mcp\n\n# Using yarn\nyarn add @bamada/nestjs-mcp\n```\n\n## ⚠️ Peer Dependencies\n\nThis module relies on core NestJS packages, the MCP SDK, and other libraries that need to be installed in your host application. Make sure your `package.json` includes compatible versions of:\n\n- `@modelcontextprotocol/sdk`: `^1.10.2` (or compatible based on your `@bamada/nestjs-mcp` version)\n- `@nestjs/platform-express`: `^10.0.0` or `^11.0.0` (or your chosen platform if not Express)\n- `zod`: `^3.0.0`\n\nFailure to install these peer dependencies will result in runtime errors.\n\n## 🚀 Quick Start\n\n1. **Import `McpModule`:**\n   Import `McpModule` into your root `AppModule` (or feature module) and configure it using `.forRoot()` or `.forRootAsync()`. Provide the required `serverInfo`.\n\n   ```typescript\n   // src/app.module.ts\n   import { Module } from '@nestjs/common';\n   import { McpModule, TransportType } from '@bamada/nestjs-mcp';\n   import { MyMcpProvider } from './my-mcp.provider';\n\n   @Module({\n     imports: [\n       McpModule.forRoot({\n         serverInfo: {\n           name: 'my-awesome-mcp-app',\n           version: '1.0.0',\n         },\n         serverOptions: {},\n         transport: TransportType.SSE, // Use HTTP/SSE controller\n       }),\n     ],\n     providers: [MyMcpProvider],\n   })\n   export class AppModule {}\n   ```\n\nHere's how to define an MCP Tool using the `@McpTool` decorator:\n### MCP Tool Example\n\n```typescript\nimport {\n  McpTool,\n  RequestHandlerExtra,\n  CallToolResult,\n} from '@bamada/nestjs-mcp';\nimport { Injectable, Logger } from '@nestjs/common';\nimport { z } from 'zod';\nimport { Request, Notification } from '@modelcontextprotocol/sdk/types';\n\n@Injectable()\nexport class MyMcpProvider {\n  private readonly logger = new Logger(MyMcpProvider.name);\n\n  @McpTool({\n    name: 'add',\n    description: 'Adds two numbers together.',\n    paramsSchema: {\n      a: z.number().describe('The first number to add'),\n      b: z.number().describe('The second number to add'),\n      optionalMessage: z\n        .string()\n        .nullable()\n        .optional()\n        .describe('An optional message'),\n    },\n  })\n  addTool(\n    params: { a: number; b: number; optionalMessage?: string },\n    extra: RequestHandlerExtra<Request, Notification>,\n  ): CallToolResult {\n    const clientId =\n      extra.authInfo?.clientId ?? extra.sessionId ?? 'Unknown Client';\n    this.logger.log(\n      `Tool 'add' called by client ${clientId} with params: ${JSON.stringify(params)}`,\n    );\n\n    const sum = params.a + params.b;\n    let resultText = `The sum is ${sum}.`;\n    if (params.optionalMessage) {\n      resultText += ` Your message: ${params.optionalMessage}`;\n    }\n    return {\n      content: [{ type: 'text', text: resultText }],\n    };\n  }\n}\n```\n\nDefine fixed and template MCP Resources using the `@McpResource` decorator:\n### MCP Resource Examples\n\n```typescript\nimport {\n  RequestHandlerExtra,\n  McpResource,\n  ReadResourceResult,\n  Variables,\n} from '@bamada/nestjs-mcp';\nimport { Injectable, Logger } from '@nestjs/common';\nimport { Request, Notification } from '@modelcontextprotocol/sdk/types';\n\n@Injectable()\nexport class MyMcpProvider {\n  private readonly logger = new Logger(MyMcpProvider.name);\n\n  @McpResource({\n    name: 'static-config',\n    uri: 'mcp://my-app/config/settings.json',\n    description: 'Provides static configuration settings.',\n  })\n  getStaticConfig(\n    uri: string,\n    extra: RequestHandlerExtra<Request, Notification>,\n  ): ReadResourceResult {\n    this.logger.log(`Resource 'static-config' requested for URI: ${uri}`);\n    const clientId =\n      extra.authInfo?.clientId ?? extra.sessionId ?? 'Unknown Client';\n    return {\n      contents: [\n        {\n          type: 'application/json',\n          text: JSON.stringify({\n            theme: 'dark',\n            featureFlags: ['newUI'],\n            clientId,\n          }),\n          uri: uri.toString(),\n        },\n      ],\n    };\n  }\n\n  // Template Resource\n  @McpResource({\n    name: 'user-profile',\n    uriTemplate: 'mcp://my-app/users/{userId}/profile',\n    description: 'Provides user profile data based on userId.',\n  })\n  getUserProfile(\n    uri: string,\n    variables: Variables,\n    extra: RequestHandlerExtra<Request, Notification>,\n  ): ReadResourceResult {\n    const clientId =\n      extra.authInfo?.clientId ?? extra.sessionId ?? 'Unknown Client';\n    const userId = Array.isArray(variables.userId)\n      ? variables.userId.join(', ')\n      : String(variables.userId);\n    this.logger.log(`Resource 'user-profile' requested for userId: ${userId}`);\n    // Fetch user data based on userId...\n    const userProfile = {\n      id: userId,\n      name: `User ${userId}`,\n      email: `${userId}@example.com`,\n      clientId,\n    };\n    return {\n      contents: [\n        {\n          type: 'application/json',\n          text: JSON.stringify(userProfile),\n          uri: uri.toString(),\n        },\n      ],\n    };\n  }\n}\n```\nCreate an MCP Prompt handler using the `@McpPrompt` decorator:\n\n### MCP Prompt Example\n\n```typescript\nimport { McpPrompt, RequestHandlerExtra } from '@bamada/nestjs-mcp';\nimport { Injectable, Logger } from '@nestjs/common';\nimport {\n  Request,\n  Notification,\n  GetPromptResult,\n} from '@modelcontextprotocol/sdk/types';\n\n@Injectable()\nexport class MyMcpProvider {\n  private readonly logger = new Logger(AppProvider.name);\n\n  @McpPrompt({\n    name: 'greetingPrompt',\n    description: 'Generates a personalized greeting message',\n    arguments: [\n      {\n        name: 'userName',\n        description: 'The name of the person to greet',\n        required: true,\n      },\n      {\n        name: 'style',\n        description: 'Greeting style (e.g., formal, casual)',\n        required: false,\n      },\n    ],\n  })\n  generateGreeting(\n    params: { userName: string; style?: string },\n    extra: RequestHandlerExtra<Request, Notification>,\n  ): GetPromptResult {\n    this.logger.log(\n      `Prompt 'greetingPrompt' called with params: ${JSON.stringify(params)}`,\n    );\n    const clientId =\n      extra.authInfo?.clientId ?? extra.sessionId ?? 'Unknown Client';\n    const greeting = params.style === 'formal' ? 'Greetings' : 'Hello';\n    return {\n      messages: [\n        {\n          role: 'assistant',\n          content: {\n            type: 'text',\n            text: `${greeting}, ${params.userName}! Welcome. How can I assist you today? clientId: ${clientId}`,\n          },\n        },\n      ],\n      // Optional: context, toolCalls, toolResult etc.\n    };\n  }\n}\n```\n\n3. **Use `StderrLogger` (for STDIO Transport):**\n   If using `TransportType.STDIO`, ensure NestJS logs go to `stderr` so they don't interfere with MCP communication over `stdout`.\n\n   ```typescript\n   import 'reflect-metadata';\n   import { NestFactory } from '@nestjs/core';\n   import { AppModule } from './app.module';\n   import { StderrLogger } from '@bamada/nestjs-mcp';\n   async function bootstrap() {\n     const app = await NestFactory.create(AppModule, {\n       // Use the StderrLogger IF using STDIO transport\n       logger: new StderrLogger(),\n     });\n     await app.listen(3000); // Or app.init() for non-HTTP apps\n     console.error('NestJS application started...'); // Log to stderr\n   }\n   bootstrap();\n   ```\n\n4. **Run your application:**\n   The module will discover your decorated provider methods and register them with the underlying MCP server. Depending on the configured transport, it will either listen via STDIO or expose endpoints via the `McpHttpController` (default: `/api/mcp/sse` and `/api/mcp/messages`).\n\n### ⚙️ Configuration\n\nUse `McpModule.forRoot(options)` or `McpModule.forRootAsync(options)` to configure the module.\n\n**`McpModuleOptions`:**\n\n```typescript\nimport { Implementation } from '@modelcontextprotocol/sdk/types';\nimport { ServerOptions } from '@modelcontextprotocol/sdk/server';\nexport enum TransportType {\n  STDIO = 'stdio',\n  SSE = 'sse',\n  NONE = 'none',\n}\nexport interface McpModuleOptions {\n  /**\n   * Required. Server implementation information.\n   */\n  serverInfo: Implementation;\n  /**\n   * Optional. Server configuration options passed to the MCP SDK's McpServer.\n   * @see https://github.com/modelcontextprotocol/tsp-sdk/blob/main/server/src/server_options.ts\n   */\n  serverOptions?: ServerOptions;\n  /**\n   * Optional. Selects the transport mechanism.\n   * - `STDIO`: For CLI tools, uses stdin/stdout for MCP, logs to stderr (use StderrLogger).\n   * - `SSE`: Assumes HTTP/SSE transport via McpHttpController (default path /api/mcp).\n   * - `NONE`: No transport is automatically managed by this module (e.g., for custom transport).\n   */\n  transport?: TransportType;\n}\n```\n\n**Synchronous Configuration (`.forRoot`)**\n\n```typescript\nimport { McpModule, TransportType } from '@bamada/nestjs-mcp';\n@Module({\n  imports: [\n    McpModule.forRoot({\n      serverInfo: { name: 'my-mcp-server', version: '0.1.0' },\n      transport: TransportType.SSE,\n      serverOptions: { maxConnections: 10 },\n    }),\n  ],\n})\nexport class AppModule {}\n```\n\n**Asynchronous Configuration (`.forRootAsync`)**\n\nUseful for injecting `ConfigService` or using factories.\n\n```typescript\nimport { McpModule, TransportType } from '@bamada/nestjs-mcp';\nimport { ConfigModule, ConfigService } from '@nestjs/config';\n@Module({\n  imports: [\n    ConfigModule.forRoot(),\n    McpModule.forRootAsync({\n      imports: [ConfigModule],\n      useFactory: (configService: ConfigService) => ({\n        serverInfo: {\n          name: configService.get<string>(\n            'MCP_SERVER_NAME',\n            'default-mcp-server',\n          ),\n          version: configService.get<string>('APP_VERSION', '0.0.1'),\n        },\n        transport: configService.get<TransportType>(\n          'MCP_TRANSPORT',\n          TransportType.SSE,\n        ),\n        serverOptions: {\n          // Example: get options from config\n          maxConnections: configService.get<number>('MCP_MAX_CONNECTIONS'),\n        },\n      }),\n      inject: [ConfigService],\n    }),\n  ],\n})\nexport class AppModule {}\n```\n\n## 📜 API Reference (Decorators)\n\nThese decorators are applied to **methods** within your NestJS providers (services).\n\n### `@McpResource(options: ResourceOptions)`\n\nDecorates a method to identify it as an MCP Resource handler. The method will receive the requested `uri`, extracted `variables` (for templates), and `extra` context, and should return a `ReadResourceResult`.\n\n- `options`: An object conforming to `ResourceOptions` (either `FixedResourceOptions` or `TemplateResourceOptions`):\n  - `name`: (string) **Required**. Unique identifier for the resource.\n  - `description?`: (string) Optional description.\n  - `uri`: (string) **Required for fixed resources**. The exact URI of the resource.\n  - `uriTemplate`: (string | ResourceTemplate) **Required for template resources**. The URI pattern (e.g., `/users/{id}`).\n  - `metadata?`: (ResourceMetadata) Optional metadata like `contentType`, `schema`, etc.\n\n### `@McpTool(options: ToolOptions)`\n\nDecorates a method to expose it as an MCP Tool. The method will receive the validated `params` object (matching `paramsSchema`) and `extra` context, and should return a `CallToolResult`.\n\n- `options`: An object conforming to `ToolOptions`:\n  - `name`: (string) **Required**. Unique identifier for the tool.\n  - `description?`: (string) Optional description of what the tool does.\n  - `paramsSchema?`: (`ZodRawShape`) Optional. A Zod raw shape object defining the tool's input parameters. Keys are parameter names, values are Zod schemas (e.g., `z.string()`, `z.number().optional()`). Use `.describe()` on Zod schemas to provide descriptions for the MCP client.\n\n### `@McpPrompt(options: PromptType)`\n\nDecorates a method to expose it as an MCP Prompt handler. The method will receive the validated `params` object (matching the `arguments` definition) and `extra` context, and should return a `GetPromptResult`.\n\n- `options`: An object conforming to the `Prompt` type from `@modelcontextprotocol/sdk/types.js`:\n  - `name`: (string) **Required**. Unique identifier for the prompt.\n  - `description?`: (string) Optional description.\n  - `arguments?`: (Array) Optional array defining the prompt's input arguments:\n    - `name`: (string) **Required**. Parameter name (must match keys in the handler's `params` object).\n    - `description?`: (string) Optional parameter description.\n    - `required?`: (boolean) Whether the argument is required (default: false).\n  - `input?`: (PromptInputDefinition) Defines expected input format (e.g., text, image).\n  - `output?`: (PromptOutputDefinition) Defines expected output format.\n\n## 🛠️ Development & Contributing\n\nContributions are welcome! Please follow these steps:\n\n1. **Fork & Clone:** Fork the repository and clone it locally.\n\n   ```bash\n   git clone https://github.com/YOUR_USERNAME/nestjs-mcp.git\n   cd nestjs-mcp\n   ```\n\n2. **Install Dependencies:**\n\n   ```bash\n   npm install\n   # or\n   yarn install\n   ```\n\n3. **Development:** Make your changes in the `src` directory. Use `npm link` or Yarn/PNPM workspaces for local development against a consuming application.\n4. **Lint & Format:** Ensure code quality and consistency.\n\n   ```bash\n   npm run lint\n   npm run format\n   ```\n\n5. **Build:** Compile TypeScript to JavaScript.\n\n   ```bash\n   npm run build\n   ```\n\n6. **Test:** Run the test suite.\n\n   ```bash\n   npm test\n   # For coverage:\n   npm run test:cov\n   ```\n\n7. **Commit & Push:** Commit your changes with clear messages.\n8. **Create Pull Request:** Open a PR against the `main` branch of the original repository.\n\nPlease report bugs or suggest features using the [GitHub Issues](https://github.com/bamada/nestjs-mcp/issues) page.\n\n## 📜 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## 🔗 Links\n\n- **Author:** [bamada](https://github.com/bamada)\n- **Repository:** [https://github.com/bamada/nestjs-mcp](https://github.com/bamada/nestjs-mcp)\n- **Issues:** [https://github.com/bamada/nestjs-mcp/issues](https://github.com/bamada/nestjs-mcp/issues)\n- **Model Context Protocol:** [https://modelcontextprotocol.org/](https://modelcontextprotocol.org/)\n- **MCP TypeScript SDK:** [https://github.com/modelcontextprotocol/tsp-sdk](https://github.com/modelcontextprotocol/tsp-sdk)\n","readmeFilename":"README.md"}