Ballerina MCP生成工具

一个Ballerina CLI工具,用于从OpenAPI/Swagger规范生成Ballerina MCP服务器项目。

  • by ballerina-platform
  • Java
  • 本地部署
  • 更新于
在 GitHub 查看 ballerina-platform/mcp-tools

使用说明

Ballerina MCP工具

Ballerina CLI工具,用于生成Ballerina MCP(模型上下文协议)服务器项目 来自OpenAPI/Swagger规范。

命令

bal mcp -i <openapi-contract> -o <output-dir> --contract-type openapi

选项

标志 描述 默认值
-i, --input OpenAPI/Swagger YAML或JSON合约的路径 (必填)
-o, --output 生成项目的输出目录 . (当前目录)
--contract-type 合同格式: openapi openapi

示例

bal mcp -i ./petstore.yaml -o ./output --contract-type openapi

生成的项目结构

petstore_mcp/
├── Ballerina.toml    # Project configuration
├── main.bal          # MCP service with remote functions per API endpoint
├── types.bal         # Ballerina record types from API schemas
└── README.md         # Project documentation

模块

模块 说明
mcp-core 核心解析和代码生成逻辑
mcp-cli Ballerina CLI集成(bal mcp 命令)
module-ballerina-mcp 可分销的Ballerina工具包(.bala)

建筑

./gradlew build

运行测试

./gradlew test