AO

abutbul/openapi-mcp-generator

Developer tools

이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기

28 stars 9 forks 품질 50 트렌드 11MIT

OpenAPI (Swagger, ETAPI) 호환 사양을 완전히 기능 모델 Context Protocol (MCP) 서버로 자동 변환하는 Python 도구입니다.

개요

OpenAPI 사양을 완전 기능 모델 Context Protocol (MCP) 서버로 자동 변환하는 Python 도구입니다. SSE/IO 통신 프로토콜, 인증 및 포괄적인 오류 처리 지원으로 Docker-ready 구현을 생성합니다. - MCP 도구 / 리소스 변환에 ܧ OpenAPI - 멀티 스테이지 빌드와 李俊億 발전기는 backward 호환성을 유지하면서 적절한 Python 패키지로 재구성되었습니다. 1. : generator.py 스크립트는 여전히 이전에 작동합니다. 2. : Code는 현재 초점을 맞춘 모듈로 나뉩니다. : 적절한 Python 패키지로 설치할 수 있습니다. 4. : /templates 디렉토리 5. : 모든 Docker 기능을 보존하십시오. 당신은 당신이 선호하는 어떤 방법에 있는 공구를 사용할 수 있습니다: 1. 직접 Run generator.py (원래 접근) 2.

개요(AI 번역)

OpenAPI 사양을 완전 기능 모델 Context Protocol (MCP) 서버로 자동 변환하는 Python 도구입니다. SSE/IO 통신 프로토콜, 인증 및 포괄적인 오류 처리 지원으로 Docker-ready 구현을 생성합니다.

열쇠 특징:

  • MCP 도구 / 자원 변환에 OpenAPI
  • 멀티 스테이지 빌드로 스코 도커-ready
  • 다중 인증 방법
  • A Async 가동 & 제한 비율
  • S SSE/IO 통신 프로토콜
  • 패키지 지원과 모듈식 코드 구조

모듈 코드 구조

발전기는 backward 호환성을 유지하면서 적절한 Python 패키지로 재구성되었습니다.

  1. ** Original Entry Point**: generator.py 스크립트는 이전에 정상적으로 작동한다.
  2. **모듈 **: Code는 현재 집중된 모듈로 나뉩니다.
  3. ** 포장 설치 **: 적절한 Python 패키지로 설치할 수 있습니다.
  4. Same Templates: /templates 디렉토리에 있는 정확한 동일한 템플릿을 사용합니다.
  5. **Docker 지원 **: 모든 도커 기능을 보존하십시오

당신은 당신이 선호하는 어떤 방법에 있는 공구를 사용할 수 있습니다:

  1. 실행 generator.py 직접 (원래 접근)
  2. 패키지로 설치 및 사용 mcp-generator 명령
  3. 명세.

이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요.

README

원문 README의 일부입니다. 원문 보기.

OpenAPI to MCP Server Generator

A Python tool that automatically converts OpenAPI specifications into fully functional Model Context Protocol (MCP) servers. Generates Docker-ready implementations with support for SSE/IO communication protocols, authentication, and comprehensive error handling.

Key features:

  • 🔄 OpenAPI to MCP tools/resources conversion
  • 🐳 Docker-ready with multi-stage builds
  • 🔐 Multiple authentication methods
  • ⚡ Async operations & rate limiting
  • 📡 SSE/IO communication protocols
  • 📦 Modular code structure with package support

Modular Code Structure

The generator has been refactored into a proper Python package while maintaining backward compatibility:

  1. Original Entry Point: The generator.py script still works exactly as before
  2. Modular Organization: Code is now split into focused modules
  3. Package Installation: Can be installed as a proper Python package
  4. Same Templates: Uses the exact same templates in the /templates directory
  5. Docker Support: Preserves all Docker functionality

You can use the tool in whatever way you prefer:

  1. Run generator.py directly (original approach)
  2. Install as a package and use mcp-generator command
  3. Use the module programmatically in your own Python code

For more details on the modular code structure, see MODULAR_REFACTORING.md.

Features

  • Convert OpenAPI specifications to MCP servers
  • Docker-ready implementation with multi-stage builds
  • Support for multiple authentication methods
  • Choice of SSE or IO communication protocols
  • Comprehensive error handling and logging
  • Built-in rate limiting and security features
  • Async operations for optimal performance
  • Extensive test suite with coverage reporting

Prerequisites

  • Python 3.10+
  • Docker (for running the generated server)
  • pip or uv (Python package manager)

Installation

From Source

# Clone the repository
git clone https://github.com/abutbul/openapi-mcp-generator.git
cd openapi-mcp-generator

# Install as a package (development mode)
pip install -e .

# Or using uv
uv venv
source .venv/bin/activate
uv pip install -e .

Using pip (once published)

pip install openapi-mcp-generator

Usage

# Using the original script (still works the same way)
python generator.py openapi.yaml --output-dir ./output --api-url https://api.example.com

# Using the new modular CLI tool after installation
mcp-generator openapi.yaml --output-dir ./output --api-url https://api.example.com

# Using the python module directly
python -m openapi_mcp_generator.cli openapi.yaml --output-dir ./output

Command Line Options

  • openapi_file: Path to the OpenAPI YAML file (required)
  • --output-dir: Output directory for the generated project (default: ‘.’)
  • --api-url: Base URL for the API
  • --auth-type: Authentication type (bearer, token, basic)
  • --api-token: API token for authentication
GitHub에서 전체 README 보기

설치

This server does not publish a one-line install command.

Open the repository installation guide MCP 초보자라면? mcpskill.org 가이드부터 시작하세요 →