
higress-group/openapi-to-mcpserver
API developmentこのページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る
higress-group/openapi-to-mcpserverは、https://github.com/higress-group/openapi-to-mcpserver.からインポートされたMCPサーバー候補です。
概要
higress-group/openapi-to-mcpserverは、https://github.com/higress-group/openapi-to-mcpserver.からインポートされた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構成に変換するために使用できます。以下は完全な例です:
-
OpenAPI仕様(petstore.json)から始める:
-
それをHigress RESTからMCPへの構成に変換する:
-
得られるpetstore-mcp.yamlファイル:
-
この構成は、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:
- 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"
}
}
}
},
インストール
This server does not publish a one-line install command.
Open the repository installation guide MCP 初心者?mcpskill.org のガイドから始めましょう →