MCP HubMCP Hub
giovannicocco

mcp-server-postman-tool-generation

by: giovannicocco

mcp server postman tool generation

9created 27/01/2025
Visit
Postman
generation

📌Overview

Purpose: The MCP Server aims to seamlessly generate AI tools from Postman collections and requests, enabling enhanced integration with various AI frameworks.

Overview: The MCP Server utilizes the Model Context Protocol (MCP) to provide type-safe code generation from Postman API endpoints while supporting multiple AI frameworks. This server enables users to interact with their Postman account using natural language, simplifying the process of tool creation for AI applications.

Key Features:

  • Type-Safe Code Generation: Automatically generates TypeScript/JavaScript code from Postman collections, ensuring that generated code is reliable and free from common errors.

  • Multi-Framework Support: Compatible with a variety of AI frameworks such as OpenAI, Mistral, Gemini, Anthropic, LangChain, and AutoGen, allowing broader applicability and integration.

  • Comprehensive Error Handling: Robust error handling mechanisms to catch invalid parameters, API failures, JSON parsing errors, and network issues, providing detailed feedback for smooth troubleshooting.


Postman Tool Generation MCP Server

An MCP server that generates AI agent tools from Postman collections and requests. This server integrates with the Postman API to convert API endpoints into type-safe code usable with various AI frameworks.

Model Context Protocol (MCP) is a standardized protocol for managing context between large language models (LLMs) and external systems. This repository provides an installer and an MCP Server for the Postman Tool Generation API.

You can use clients like Claude Desktop or any MCP Client (e.g., Cline) to interact with your Postman account using natural language, for example:

Create an AI tool for:
collectionID: 12345-abcde
requestID: 67890-fghij
typescript
openai

Features

  • Generate TypeScript/JavaScript code from Postman collections
  • Support for multiple AI frameworks: OpenAI, Mistral, Gemini, Anthropic, LangChain, AutoGen
  • Type-safe code generation
  • Error handling and response validation

Demo

Watch the demo on YouTube:
https://youtu.be/G1O9ECYRk1M

Setup

  1. Install dependencies:

    npm install
    
  2. Build the server:

    npm run build
    
  3. Configure the MCP settings by adding the following to your Claude settings file (cline_mcp_settings.json):

    {
      "mcpServers": {
        "postman-ai-tools": {
          "command": "node",
          "args": [
            "/path/to/postman-tool-generation-server/build/index.js"
          ],
          "env": {
            "POSTMAN_API_KEY": "your-postman-api-key"
          },
          "disabled": false,
          "autoApprove": []
        }
      }
    }
    

Usage

The server provides a single tool called generate_ai_tool with these parameters:

{
  collectionId: string;    // The Public API Network collection ID
  requestId: string;       // The public request ID
  language: "javascript" | "typescript";  // Programming language to use
  agentFramework: "openai" | "mistral" | "gemini" | "anthropic" | "langchain" | "autogen";  // AI framework
}

Example

const result = await use_mcp_tool({
  server_name: "postman-ai-tools",
  tool_name: "generate_ai_tool",
  arguments: {
    collectionId: "your-collection-id",
    requestId: "your-request-id",
    language: "typescript",
    agentFramework: "openai"
  }
});

Generated Code

The generated code includes:

  • Type definitions for request and response
  • Error handling
  • API integration
  • OpenAI function definitions
  • Documentation and examples

Development

  1. Install dependencies:

    npm install
    
  2. Modify src/index.ts as needed.

  3. Build the server:

    npm run build
    
  4. Restart the Claude app to load the updated server.

Environment Variables

  • POSTMAN_API_KEY: Your Postman API key (required)

Error Handling

The server handles errors including:

  • Invalid parameters
  • API failures
  • JSON parsing errors
  • Network issues

Error responses contain detailed messages for easier debugging.

Contributing

Contributions are welcome! Please submit a Pull Request.

License

MIT License