AO

abutbul/openapi-mcp-generator

Developer tools

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る

28 stars 9 forks 品質 50 トレンド 11MIT

OpenAPI(Swagger、ETAPI)互換仕様を完全に機能するモデルコンテキストプロトコル(MCP)サーバーに自動変換するPythonツール.

概要

OpenAPI 仕様を完全に機能するモデルコンテキストプロトコル(MCP)サーバーに自動変換する Python ツール。 SSE/IO通信プロトコル、認証、包括的なエラー処理のサポートで Docker-ready の実装を生成します。 - MCP ツール/リソースの変換 - 複数のステージビルドで Mackerel の複数の認証方法 - ⚡ Async 操作とレートの制限 - Mackerel の SSE/IO 通信プロトコル - モジュラー コード構造とパッケージのサポート ジェネレータは、後方互換性を維持しながら、適切な Python パッケージに再構築されています。 1。 : ジェネレーター.py スクリプトはそのまま動作します。2. : コードはフォーカスされたモジュールに分割されます。3. : 適切な Python パッケージとしてインストールできます。4. : /templates ディレクトリで同じテンプレートを使用します。5. : すべての Docker 機能を保存します。 好きな方法でツールを使うことができます。1. Generator.py を直接実行します(元のアプローチ)2.

概要(AI 翻訳)

OpenAPI 仕様を完全に機能するモデルコンテキストプロトコル(MCP)サーバーに自動変換する Python ツール。 SSE/IO通信プロトコル、認証、包括的なエラー処理のサポートで Docker-ready の実装を生成します。

主な機能:

  • MCP ツール/リソース変換への オープンソース API
  • 複数の段階のビルドで docer-ready
  • 🔐 複数の認証方法
  • ⚡ 非同期操作とレート制限
  • SSE/IO通信プロトコル
  • パッケージサポートによるモジュラーコード構造

モジュラー コード構造

ジェネレータは、後方互換性を維持しながら、適切な Python パッケージに再構築されています。

1。 元のエントリ ポイント: [generator.py]]スクリプトは、前に正確に動作します 2.モーダル組織: コードが集中したモジュールに分割されるようになりました 3.パッケージのインストール: 適切な Python パッケージとしてインストールできます。 4。Same Templates:[/templatesディレクトリに同じテンプレートを使用する 5.Docker サポート:すべてのDockerの機能を維持します

あなたが好きな方法でツールを使うことができます:

  1. [generator.pyを直接実行(元のアプローチ)
  2. パッケージとしてインストールし、[[mcp-generator]コマンドを使用する

このページは 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 のガイドから始めましょう →