Skip to main content

Vue 3 + Element Plus + Spring Boot 全栈代码生成器 MCP Server

Project description

Admin Gen MCP

Vue 3 + Element Plus 前端 & Spring Boot + MyBatis-Plus 后端 全栈代码生成器,基于 MCP 协议。

功能

  • 前端生成:api.ts, options.ts, index.vue, form.vue
  • 后端生成:Entity, Controller, Service, ServiceImpl, Mapper, Mapper.xml
  • 全栈生成:一份 JSON 配置同时生成前端 + 后端(自动类型映射)
  • 支持主表 + 多子表
  • 支持字典配置
  • 调用阿里云 qwen3-max 模型生成代码

安装

pip install admin-gen-mcp

或从源码安装:

git clone https://github.com/yourname/admin-gen-mcp.git
cd admin-gen-mcp
pip install -e .

环境变量

使用前必须设置阿里云 DashScope API Key:

export DASHSCOPE_API_KEY="your-api-key"

Windows:

set DASHSCOPE_API_KEY=your-api-key

使用方式

1. Claude Code MCP

claude mcp add-json admin-gen '{"type":"stdio","command":"admin-gen-mcp","env":{"DASHSCOPE_API_KEY":"your-api-key"}}'

或使用 uvx(无需 pip install):

claude mcp add-json admin-gen '{"type":"stdio","command":"uvx","args":["admin-gen-mcp"],"env":{"DASHSCOPE_API_KEY":"your-api-key"}}'

2. Cursor / VS Code MCP

.cursor/mcp.json.vscode/settings.json 中配置:

{
  "mcpServers": {
    "admin-gen": {
      "command": "admin-gen-mcp",
      "env": {
        "DASHSCOPE_API_KEY": "your-api-key"
      }
    }
  }
}

3. 命令行工具

# 从 JSON 配置文件生成前端代码
admin-gen --config fields/example.json

# 交互模式
admin-gen -i

4. Python API

from admin_gen_mcp.generator import CodeGenerator

gen = CodeGenerator(api_key="your-api-key")
config = gen.load_config("fields/example.json")

# 全栈生成
results = gen.generate_fullstack(config)
print(results["frontend"])  # 前端 4 个文件
print(results["backend"])   # 后端 6~9 个文件

MCP 工具列表

工具 说明
generate_admin_page 前端代码生成(直接传字段参数)
generate_from_config 前端代码生成(JSON 配置文件路径)
generate_backend_code 后端代码生成(直接传字段参数)
generate_fullstack 前后端一体生成(JSON 配置文件路径)

配置文件格式

{
  "功能名称": "员工培训申请",
  "模块路径": "hr/trainApplication",
  "权限前缀": "hr_trainapplication",
  "输出目录": "src/views",

  "主表字段": [
    {
      "label": "培训主题",
      "key": "trainTitle",
      "type": "input",
      "required": true,
      "show": true,
      "alwaysHide": false,
      "smart": true,
      "width": "200"
    }
  ],

  "子表配置": [
    {
      "名称": "参训人员明细",
      "标识": "detail",
      "实体名称": "TrainApplicationDetail",
      "字段列表": [...]
    }
  ],

  "字典配置": [
    { "key": "trainType", "dict": "hr_train_type", "import": "/@/enums/dict" }
  ]
}

字段类型映射

前端 type 前端组件 Java 类型
input el-input String
textarea el-input[textarea] String
select el-select String
date el-date-picker LocalDate
datetime el-date-picker LocalDateTime
number microme-operator BigDecimal
upload upload-file String

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

admin_gen_mcp-0.1.1.tar.gz (34.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

admin_gen_mcp-0.1.1-py3-none-any.whl (45.7 kB view details)

Uploaded Python 3

File details

Details for the file admin_gen_mcp-0.1.1.tar.gz.

File metadata

  • Download URL: admin_gen_mcp-0.1.1.tar.gz
  • Upload date:
  • Size: 34.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for admin_gen_mcp-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c05cf3656ce6d6823048bb07e5d1d1a4a34294603d85529fbba7c39a96f8a543
MD5 2e5519b71de65df16c9bbea245db71c0
BLAKE2b-256 76abed0c54818878efaa18f8a44f61b18f873e8b60f606e97f41c1dc933c1c51

See more details on using hashes here.

File details

Details for the file admin_gen_mcp-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: admin_gen_mcp-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 45.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for admin_gen_mcp-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 319d008aea87471400bbe7d3fcc623c744c6ac810ab04d3a30523db8e3c04751
MD5 0e8a5fc6eac386c74fda16ca28eace27
BLAKE2b-256 4ce46caeb6416675b0efee6c7dcb1d2708ea1a2767cddd871f077e8b4f7fe9a8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page