Sponsored by Deepsite.site

Nestjs Api To Postman Collection

Created By
ChiragKr047 months ago
A Model Context Protocol (MCP) tool that automatically converts your NestJS controllers into importable Postman API collections. This eliminates the need to manually create Postman collections or implement complex swagger documentation directly within your code.
Content

NestJS to Postman Collection Generator (MCP)

License: ISC

A Model Context Protocol (MCP) tool that automatically converts your NestJS controllers into importable Postman API collections. This eliminates the need to manually create Postman collections or implement complex swagger documentation directly within your code.

Features

  • 🚀 Automatic API Collection Generation: Transform NestJS controllers into complete Postman collections with a single command
  • 🔍 Intelligent Type Detection: Automatically detects request and response types to generate meaningful examples
  • 🔐 Auth Integration: Identifies authentication guards and adds appropriate auth configurations
  • 📊 Complete Endpoint Documentation: Captures routes, methods, request bodies, and query parameters
  • 🧩 Clean Integration: Works without modifying your NestJS codebase (no decorators or comments needed)
  • 🔌 MCP Integration: Works as an AI tool with any Model Context Protocol compatible assistant

Installation

  1. Clone the repository:
git clone https://github.com/ChiragKr04/nestJS-api-postman-MCP.git
cd nestJS-api-postman-MCP
  1. Install dependencies and build the project:
npm install
npm run build

Usage

As an MCP Tool

This tool is designed to work with any AI assistant that supports the Model Context Protocol. After installation, you need to configure your MCP-compatible AI assistant to use this tool.

Configuration

For Claude Desktop

Add the following configuration to your Claude Desktop settings:

{
  "mcpServers": {
    "Nest-Js-MCP-Postman-Generator": {
      "command": "node",
      "args": [
        "/path/to/your/clone/nestJS-api-postman-MCP/dist/main.js",
        "start"
      ]
    }
  }
}
For GitHub Copilot/Cursor/Windsurf/Other VS Code based AI tools

Add the following configuration to your VS Code settings.json:

{
  "mcp": {
    "servers": {
      "Nest-Js-MCP-Postman-Generator": {
        "command": "node",
        "args": [
          "/path/to/your/clone/nestJS-api-postman-MCP/dist/main.js",
          "start"
        ]
      }
    }
  }
}

Note: Replace /path/to/your/clone/ with the actual path where you cloned the repository.

Usage

Once configured:

  1. Just ask the AI to generate a Postman collection for your NestJS controller
  2. The AI will use this tool to analyze your controller and generate the collection

Example prompt:

Generate a Postman collection for my user.controller.ts file in my NestJS project.

Direct Command Line Usage

The tool also provides a command-line interface for direct usage:

# Generate using the CLI
node dist/main.js generate /path/to/nestjs/project -o collection.json -n "My API Collection"

API Reference

When used as an MCP tool, the following parameters are available:

ParameterTypeDescription
controllerFilePathstringPath to the NestJS controller file (relative to project root)
projectPathstringPath to the NestJS project (containing tsconfig.json)
collectionNamestringName for the generated Postman collection

Why Use This?

No More Manual Updates

Each time you change your API endpoints, your Postman collection automatically stays in sync.

Clean Code

Unlike Swagger/OpenAPI decorators that clutter your codebase with documentation:

// No more of this annotation clutter
@ApiOperation({ summary: 'Create a new user' })
@ApiBody({ type: CreateUserDto })
@ApiResponse({ status: 201, description: 'User created successfully' })
@ApiResponse({ status: 400, description: 'Bad Request' })
@Post()
create(@Body() createUserDto: CreateUserDto) {
  return this.userService.create(createUserDto);
}

Accurate Documentation

The tool analyzes your actual code including:

  • Route paths from controller decorators
  • HTTP methods from method decorators
  • Request body types from parameter decorators
  • Query parameters and their types
  • Authentication requirements

Example Output

The generated Postman collection will look like this:

{
  "name": "User API",
  "item": [
    {
      "name": "POST /api/users (createUser)",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/api/users",
          "host": ["{{baseUrl}}"],
          "path": ["api", "users"],
          "query": []
        },
        "body": {
          "mode": "raw",
          "raw": "{\n  \"email\": \"user@example.com\",\n  \"password\": \"password123\",\n  \"name\": \"John Doe\"\n}"
        },
        "description": "Generated from createUser in UserController."
      }
    }
  ]
}

Requirements

  • Node.js 16+
  • A NestJS project with TypeScript

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the ISC License - see the LICENSE file for details.

Server Config

{
  "mcpServers": {
    "Nest-Js-MCP-Postman-Generator": {
      "command": "node",
      "args": [
        "<path_of_cloned_repo>/nestjs-mcp-generator/dist/main.js",
        "start"
      ]
    }
  }
}
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
CursorThe AI Code Editor
WindsurfThe new purpose-built IDE to harness magic
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
Serper MCP ServerA Serper MCP Server
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
Playwright McpPlaywright MCP server
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
Amap Maps高德地图官方 MCP Server
ChatWiseThe second fastest AI chatbot™
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Tavily Mcp
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
DeepChatYour AI Partner on Desktop