UNPKG

@yogeliu/mcp-server-yapi

Version:

Enhanced YAPI MCP server with multi-project support and enterprise features

49 lines 1.63 kB
import { MCPTool } from "mcp-framework"; import { yapiPost } from "../utils/yapi-request.js"; import { INTERFACE_ENDPOINTS } from "../constants/yapi-endpoints.js"; import { InterfaceSchema, ProjectNameSchema } from "../schemas/interface-schemas.js"; const SaveInterfaceSchema = InterfaceSchema.pick({ api_opened: true, catid: true, desc: true, method: true, path: true, // req_body_form: ? req_body_is_json_schema: true, req_body_other: true, req_body_type: true, req_headers: true, req_params: true, req_query: true, res_body: true, res_body_is_json_schema: true, res_body_type: true, status: true, switch_notice: true, tag: true, title: true, }).partial({ api_opened: true, desc: true, req_body_is_json_schema: true, req_body_other: true, req_body_type: true, req_headers: true, req_params: true, req_query: true, res_body: true, res_body_is_json_schema: true, res_body_type: true, tag: true, }).merge(ProjectNameSchema); class SaveInterface extends MCPTool { name = "save_interface"; description = "Add or update interface - Compared to AddInterface and UpdateInterface, this interface is more recommended. The path parameter is the unique data identifier, if it exists it will be updated, if not it will be added"; schema = SaveInterfaceSchema; async execute(input) { const { project_name, ...apiParams } = input; return await yapiPost(INTERFACE_ENDPOINTS.SAVE, apiParams, project_name); } } export default SaveInterface; //# sourceMappingURL=SaveInterface.js.map