INTEGRATION · NESTJS

NestJS MCP Integration

NestJS apps are heavily structured with decorators and DTOs. By piping that metadata into an OpenAPI spec, wmcp.sh instantly serves your robust, typed routes as AI agent tools without writing a single line of custom MCP logic.

Reusing your Types and Guards

Writing a custom MCP server usually means abandoning your carefully crafted NestJS guards, interceptors, and DTO validations. You end up maintaining two separate APIs.

By using @nestjs/swagger, the types you already wrote compile perfectly to OpenAPI. wmcp.sh reads that spec, converting it directly into Claude or LangChain tool-use schemas while relying on your actual Nest server to process the traffic safely.

Extracting MCP tools from Nest

// TypeScript - NestJS Controller
import { Controller, Post, Body, UseGuards } from '@nestjs/common';
import { ApiTags, ApiOperation, ApiBearerAuth } from '@nestjs/swagger';

@ApiTags('agent')
@Controller('tasks')
export class TaskController {
  
  @Post()
  @UseGuards(JwtAuthGuard)
  @ApiBearerAuth()
  @ApiOperation({ summary: 'Create new task' })
  create(@Body() createTaskDto: CreateTaskDto) {
    return this.taskService.create(createTaskDto);
  }
}

// Agents will now prompt: "Create new task" mapping precisely to CreateTaskDto
curl -X GET "https://wmcp.sh/api/v1/tools?url=https://your-nest-app.com/api-json&tag=agent"

Feature translation via OpenAPI

CapabilityWithout wmcp.shWith wmcp.sh
DTO Validation⚠️ Duplicate schemas in MCP✅ Validated at the edge natively
Auth & Guards❌ Must be ported✅ Executes seamlessly on your backend
Multi-module scoping⚠️ Hard to isolate✅ Tag controllers using @ApiTags
Versioning⚠️ Manage version headers✅ Fully supported per-route

Common questions.

How does NestJS generate the spec?

Using the official @nestjs/swagger module, which reads @ApiOperation and @ApiResponse decorators, as well as your DTO classes.

Do I need to rewrite my Guards?

No. Because wmcp.sh proxies the HTTP requests using the auth tokens provided by the agent, your existing @UseGuards() decorators execute exactly as they do for human clients.

Is this compatible with Express or Fastify adapters?

Yes. OpenAPI generation in NestJS works regardless of whether you use the Express or Fastify underlying adapter.

How do I select specific modules?

When setting up SwaggerModule in NestJS, you can pass an include array of modules. Alternatively, tag specific controllers with @ApiTags('agent') and pass that tag to wmcp.sh.

Need this done for you?

Skip the wiring — we build, deploy, and monitor.

Custom adapter + hosted MCP at mcp.yourbrand.com + verified badge. From $499 one-time setup.

See /managed → Submit (free)