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
Release history Release notifications | RSS feed
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.0.tar.gz
(35.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file admin_gen_mcp-0.1.0.tar.gz.
File metadata
- Download URL: admin_gen_mcp-0.1.0.tar.gz
- Upload date:
- Size: 35.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b752e512c9aae3ba2ee07863b6f13438d5828c8cf918567b7625178625ad2b0c
|
|
| MD5 |
e9dbe280e575a72f5cb7d281b5521b0c
|
|
| BLAKE2b-256 |
83377ce4f7344eb916e79b3db1435ceb97ffdd65efc08a851a68a38aee1df686
|
File details
Details for the file admin_gen_mcp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: admin_gen_mcp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 45.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a010d711690547527fe0a7ac9c48d5c93fa237a6494c47668ff2caa73881af9
|
|
| MD5 |
4ea97ca403b837118b88f95ec53c982e
|
|
| BLAKE2b-256 |
9762ddf8d11af4a4cd90bb922d972eba5abeec861d491edc872332098a309e14
|