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