worsoft-frontend-codegen-local-mcp
v0.1.84
Published
Worsoft frontend local-template code generation MCP server.
Readme
Worsoft Frontend Codegen Local MCP
This MCP generates Worsoft frontend files from structured JSON metadata.
Scope
- structured JSON input
- style-based template selection
- local template rendering
- single-table runtime generation
- master-child runtime generation with explicit
children[] - optional write-to-disk
Current Inputs
featureTitletableNametableCommentapiPathstylefieldschildrenlevelsfrontendPathmoduleNamewriteToDiskoverwritewriteSupportFilesmergeI18nZh
frontendPath must point to the frontend project root such as E:/own-worker-platform/trunk/worsoft-ui.
If the caller accidentally passes the src directory, MCP will normalize it back to the project root before rendering files.
Recommended MCP Arguments
Single table:
{
"featureTitle": "劳务公司管理",
"tableName": "iwm_out_labor_company",
"tableComment": "劳务公司信息表",
"apiPath": "iwmOutLaborCompany",
"style": "single_table_dialog",
"fields": [
{ "fieldName": "id", "label": "主键", "type": "Long", "show": false },
{ "fieldName": "companyName", "label": "劳务公司名称", "type": "String", "required": true, "length": 120 },
{ "fieldName": "status", "label": "状态", "type": "String", "dictType": "labor_company_status", "length": 32 }
],
"children": [],
"frontendPath": "E:/own-worker-platform/trunk/worsoft-ui",
"moduleName": "admin/test",
"writeToDisk": false
}Master-child:
{
"featureTitle": "外包人员登记",
"tableName": "iwm_emp_outsource_person",
"tableComment": "外包人员登记表",
"apiPath": "iwmEmpOutsourcePerson",
"style": "master_child_jump",
"fields": [
{ "fieldName": "id", "label": "主键", "type": "Long", "show": false },
{ "fieldName": "name", "label": "姓名", "type": "String", "required": true, "length": 30 },
{ "fieldName": "employeeStatus", "label": "人员状态", "type": "String", "dictType": "employee_status", "length": 32 }
],
"children": [
{
"childTableName": "iwm_emp_outsource_person_certificate",
"childTableComment": "外包人员证书表",
"payloadField": "certificateList",
"mainField": "id",
"childField": "outsourcePersonId",
"relationType": "1:N",
"fields": [
{ "fieldName": "id", "label": "主键", "type": "Long", "show": false },
{ "fieldName": "certificateId", "label": "证件名称ID", "type": "Long", "required": true }
]
}
],
"frontendPath": "E:/own-worker-platform/trunk/worsoft-ui",
"moduleName": "admin/test",
"writeToDisk": false
}Smoke Test
PowerShell:
powershell -ExecutionPolicy Bypass -File plugins/worsoft-codegen-local/smoke_test_mcp.ps1 -Scenario single
powershell -ExecutionPolicy Bypass -File plugins/worsoft-codegen-local/smoke_test_mcp.ps1 -Scenario single_dialog
powershell -ExecutionPolicy Bypass -File plugins/worsoft-codegen-local/smoke_test_mcp.ps1 -Scenario master
powershell -ExecutionPolicy Bypass -File plugins/worsoft-codegen-local/smoke_test_mcp.ps1 -Scenario multiNode:
node plugins/worsoft-codegen-local/smoke_test_mcp.js --scenario single
node plugins/worsoft-codegen-local/smoke_test_mcp.js --scenario single_dialog
node plugins/worsoft-codegen-local/smoke_test_mcp.js --scenario dict_single
node plugins/worsoft-codegen-local/smoke_test_mcp.js --scenario master
node plugins/worsoft-codegen-local/smoke_test_mcp.js --scenario dict_multiOptional overrides:
--table-name--table-comment--feature-title--api-path--style--frontend-path--write-to-disk
Side-Effect Controls
writeSupportFiles=true: MCP may writesrc/enums/dict-registry.tsandsrc/utils/crudSchema.tswriteSupportFiles=false: MCP does not write support files. Generated code still expects those helpers to already exist in the target projectmergeI18nZh=true: MCP reads an existingzh-cn.tsand merges missing keysmergeI18nZh=false: MCP renderszh-cn.tsfrom current metadata only and does not parse the existing file
Master-Child Contract
For master_child_jump, MCP does not infer relations.
The caller must provide explicit children[], and each child must include:
childTableNamechildTableCommentpayloadFieldmainFieldchildFieldfields
If these fields are missing, MCP returns a structured validation error.
Multi-Level Dictionary Contract
For multi_level_dict, MCP does not infer hierarchy.
The caller must provide explicit levels[]. Each level must include:
levelIndexmodules
Each module must include:
tableNameapiPathfields
Current Outputs
src/views/<module>/<function>/index.vuesrc/views/<module>/<function>/form.vuesrc/views/<module>/<function>/options.tssrc/api/<module>/<function>.tssrc/i18n/biz/<module>/<function>.zh-cn.tsmenu/<function>_menu.sql
Style Catalog
- Human guide:
STYLE_TEMPLATE_GUIDE.md - Machine source:
assets/style-catalog.json
Declared styles:
single_table_jumpsingle_table_dialogmaster_child_jumpmulti_level_dict
Notes
- Plugin-local runtime assets live under
assets/templates - MCP does not parse PRD, API, Markdown, or SQL design documents
- Upstream caller-side skills are responsible for turning documents into structured JSON metadata
- Support-file writes and zh-cn merge behavior can be controlled through
writeSupportFilesandmergeI18nZh - Menu SQL is emitted to
frontendPath/menu/
IDE Guide
IDE_MCP_SETUP.md
