HG

higress-group/openapi-to-mcpserver

API development

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

292 stars 59 forks 품질 55 트렌드 18Apache-2.0

higress-group/openapi-to-mcpserver는 [[T0]에서 가져온 MCP 서버 후보입니다.

개요

higress-group/openapi-to-mcpserver는 [[T0]에서 가져온 MCP 서버 후보입니다.

개요(AI 번역)

OpenAPI 사양을 MCP(모델 컨텍스트 프로토콜) 서버 구성으로 변환하는 도구입니다.

설치

사용

옵션

  • --input: OpenAPI 명세 파일(JSON 또는 YAML) (필수) 경로
  • --output: 출력 MCP 구성 파일(YAML) 경로 (필수)
  • --server-name: MCP 서버 이름 (기본값: “openapi-server”)
  • --tool-prefix: 공구 이름 접두사 (기본값: “”)
  • --format: 출력 형식 (yaml 또는 json) (기본값: “yaml”)
  • --validate: OpenAPI 명세 검증 (기본값: false)
  • --template: 출력을 패치하기 위한 템플릿 파일로 가는 경로 (기본값: “”)

예시

OpenAPI를 Higress REST-to-MCP 구성으로 변환하기

이 도구는 OpenAPI 명세를 Higress REST-to-MCP 구성으로 변환하는 데 사용할 수 있습니다. 전체 예제는 다음과 같습니다:

  1. OpenAPI 명세(petstore.json)부터 시작하세요:

  2. 이를 Higress REST-to-MCP 구성으로 변환합니다:

  3. 결과적으로 petstore-mcp.yaml 파일:

  4. 이 구성은 Higress 게이트웨이 구성에 추가하여 Higress와 함께 사용할 수 있습니다.

도구가 OpenAPI 명세서의 위치에 따라 각 매개변수에 대해 position 필드를 자동으로 설정하는 방식을 주목하세요:

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

README

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

OpenAPI to MCP Server

A tool to convert OpenAPI specifications to MCP (Model Context Protocol) server configurations.

Installation

go install github.com/higress-group/openapi-to-mcpserver/cmd/openapi-to-mcp@latest

Usage

openapi-to-mcp --input path/to/openapi.json --output path/to/mcp-server.yaml

Options

  • --input: Path to the OpenAPI specification file (JSON or YAML) (required)
  • --output: Path to the output MCP configuration file (YAML) (required)
  • --server-name: Name of the MCP server (default: “openapi-server”)
  • --tool-prefix: Prefix for tool names (default: “”)
  • --format: Output format (yaml or json) (default: “yaml”)
  • --validate: Validate the OpenAPI specification (default: false)
  • --template: Path to a template file to patch the output (default: “”)

Example

openapi-to-mcp --input petstore.json --output petstore-mcp.yaml --server-name petstore

Converting OpenAPI to Higress REST-to-MCP Configuration

This tool can be used to convert an OpenAPI specification to a Higress REST-to-MCP configuration. Here’s a complete example:

  1. Start with an OpenAPI specification (petstore.json):
{
  "openapi": "3.0.0",
  "info": {
    "version": "1.0.0",
    "title": "Swagger Petstore",
    "description": "A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification"
  },
  "servers": [
    {
      "url": "http://petstore.swagger.io/v1"
    }
  ],
  "paths": {
    "/pets": {
      "get": {
        "summary": "List all pets",
        "operationId": "listPets",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "description": "How many items to return at one time (max 100)",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A paged array of pets",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "pets": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "integer",
                            "description": "Unique identifier for the pet"
                          },
                          "name": {
                            "type": "string",
                            "description": "Name of the pet"
                          },
                          "tag": {
                            "type": "string",
                            "description": "Tag of the pet"
                          }
                        }
                      }
                    },
GitHub에서 전체 README 보기

설치

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

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