Skip to main content

MCP server for generating Postman collections from API codebases

Project description

Postman Collection Generator MCP Server

An MCP (Model Context Protocol) server that automatically generates Postman collections from API codebases. Supports multiple frameworks including FastAPI, Spring Boot, Flask, Express, and any codebase with OpenAPI/Swagger specifications.

Features

  • 🚀 Multi-Framework Support: FastAPI, Spring Boot, Flask, Express, NestJS
  • 📋 OpenAPI/Swagger First: Automatically detects and uses OpenAPI specs when available
  • 🔍 Smart Code Analysis: Falls back to AST/pattern matching when no spec is found
  • 🔐 Authentication Support: Handles Bearer, Basic, and API Key authentication
  • 📁 Organized Output: Groups endpoints by tags or path segments
  • 🎯 Accurate Detection: Extracts request bodies, parameters, and response examples

Installation

For End Users (via uvx)

The easiest way to use this MCP server is with uvx:

# Install and run directly
uvx postman-collection-generator-mcp

# Or install globally
uv tool install postman-collection-generator-mcp

For Development

# Clone the repository
git clone https://github.com/yourusername/postman-collection-generator-mcp.git
cd postman-collection-generator-mcp

# Install dependencies with Poetry
poetry install

# Run in development
poetry run postman-collection-generator-mcp

Configuration

Claude Desktop Configuration

Add this to your Claude Desktop configuration file:

For uvx installation (recommended):

{
  "mcpServers": {
    "postman-generator": {
      "command": "uvx",
      "args": ["--no-cache", "postman-collection-generator-mcp"],
      "env": {
        "BITBUCKET_EMAIL": "your-username",
        "BITBUCKET_API_TOKEN": "your-app-password",
        "output_directory": "/path/to/output"
      }
    }
  }
}

For local development:

{
  "mcpServers": {
    "postman-generator": {
      "command": "poetry",
      "args": ["run", "postman-collection-generator-mcp"],
      "cwd": "/path/to/postman-collection-generator-mcp",
      "env": {
        "BITBUCKET_EMAIL": "your-username",
        "BITBUCKET_API_TOKEN": "your-app-password",
        "output_directory": "/path/to/output"
      }
    }
  }
}

Environment Variables

  • BITBUCKET_EMAIL: Your Bitbucket username (not email)
  • BITBUCKET_API_TOKEN: Bitbucket app password with repository read access
  • GITHUB_TOKEN: GitHub personal access token (for private repos)
  • output_directory: Where to save generated Postman collections (default: current directory)

Usage

Once configured, you can use the following commands in Claude:

Generate a Postman collection from https://github.com/username/repo.git

Create Postman collection for https://bitbucket.org/team/api-project.git

The server will:

  1. Clone the repository
  2. Detect the framework and analyze the codebase
  3. Extract all API endpoints with their parameters and examples
  4. Generate a Postman v2.1 collection file
  5. Save it to your output directory

Supported Frameworks

With Full Support

  • FastAPI (Python) - Full OpenAPI integration
  • Spring Boot (Java) - Annotation-based detection
  • Express (Node.js) - Route pattern matching
  • Flask (Python) - Decorator-based detection
  • Django REST (Python) - ViewSet and path detection

Coming Soon

  • NestJS (TypeScript)
  • Ruby on Rails
  • ASP.NET Core

Publishing Updates to PyPI

One-Time Setup

# Configure PyPI token (get from https://pypi.org/manage/account/token/)
poetry config pypi-token.pypi YOUR-PYPI-TOKEN

Publishing Updates Workflow

  1. Update Version

    # Update version in pyproject.toml
    poetry version patch  # for bug fixes (0.1.0 -> 0.1.1)
    poetry version minor  # for new features (0.1.0 -> 0.2.0)
    poetry version major  # for breaking changes (0.1.0 -> 1.0.0)
    
  2. Build Package

    poetry build
    
  3. Publish to PyPI

    poetry publish
    
  4. Test Installation

    # Test the published package
    uvx --reinstall postman-collection-generator-mcp
    

Automated Version Workflow

# Complete update workflow
poetry version patch && poetry build && poetry publish

Users Update with uvx

After publishing, users can update with:

uvx --reinstall postman-collection-generator-mcp

Development

Running Tests

poetry run pytest

Code Quality

# Format code
poetry run black .

# Lint code
poetry run ruff check .

Local Testing with MCP Inspector

# Start the server in HTTP mode for testing
poetry run postman-collection-generator-mcp --transport http --port 8000

# Then connect with MCP Inspector at http://localhost:8000/mcp

Architecture

The server follows clean architecture principles:

  • Models: Pydantic models for API endpoints and Postman collections
  • Analyzers: Framework-specific endpoint extraction logic
  • Generators: Postman collection generation from API models
  • Clients: Git repository access with authentication support

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

MIT License - see LICENSE file for details

Acknowledgments

  • Built with FastMCP framework
  • Inspired by API development workflows and the need for automation

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

postman_collection_generator_mcp-0.1.2.tar.gz (21.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file postman_collection_generator_mcp-0.1.2.tar.gz.

File metadata

File hashes

Hashes for postman_collection_generator_mcp-0.1.2.tar.gz
Algorithm Hash digest
SHA256 287f2fca752be2a9b38c5d2eb309b6382db50823ec34a97c0529cf1947b0c413
MD5 d7766748ba0793fd77deca1f3d49a2c3
BLAKE2b-256 4ad215d396cbbe0d79eb04411e96597358b72d3e6f014d4d0e00aa13e4378044

See more details on using hashes here.

File details

Details for the file postman_collection_generator_mcp-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for postman_collection_generator_mcp-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4e59af7310405cd1f3672248c184fde56b36afd90160e1606290ab9dcd668c4f
MD5 c7ea5799f2583df2c1c60ee9bb51bfe3
BLAKE2b-256 fa3e4945b2f86bbfde2c090f1f859455cd45480692eb1845a57a21f8df7cba98

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page