StarUML MCP Server
Generates UML diagrams (class, sequence, flowchart, ER, mindmap, etc.) in StarUML from Mermaid diagram definitions.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@StarUML MCP ServerDraw a class diagram for an online bookstore"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
StarUML MCP Server
通过 MCP 协议或 REST API 远程控制 StarUML,让 AI 自动生成各种 UML 图表(用例图、类图、时序图、ER 图等)。
Architecture
AI Client (Claude/Hermes/Cursor)
│ MCP Protocol (stdio)
▼
Python MCP Server (server.py)
│ HTTP REST API
▼
staruml-controller Extension (runs inside StarUML)
│
▼
StarUML — renders diagramsPrerequisites
Requirement | Version | Note |
StarUML | v6.0.0+ | |
Python | 3.10+ | |
staruml-controller | latest | StarUML 扩展,提供 REST API |
Quick Start
1. Install staruml-controller extension
Clone into StarUML's extensions directory:
# Windows (%APPDATA% = C:\Users\<用户名>\AppData\Roaming)
cd %APPDATA%\StarUML\extensions\user
git clone https://github.com/pontasan/staruml-controller.git
# macOS
cd ~/Library/Application\ Support/StarUML/extensions/user
git clone https://github.com/pontasan/staruml-controller.git
# Linux
cd ~/.config/StarUML/extensions/user
git clone https://github.com/pontasan/staruml-controller.git2. Install Python dependencies
cd staruml-mcp
pip install -r requirements.txtOr run the setup script:
scripts\setup.bat3. Start StarUML
Launch StarUML — the extension auto-starts and listens on port 12345.
4. Start MCP Server
python server.pyConfigure AI Clients
Proma / Claude Desktop
Edit claude_desktop_config.json (or Proma's mcp.json):
{
"mcpServers": {
"staruml": {
"command": "python",
"args": ["D:/path/to/staruml-mcp/server.py"],
"timeout": 60
}
}
}Hermes Agent
Edit ~/.hermes/config.yaml:
mcp_servers:
staruml:
command: "python"
args: ["D:/path/to/staruml-mcp/server.py"]
timeout: 60Cursor
Edit .cursor/mcp.json:
{
"mcpServers": {
"staruml": {
"command": "python",
"args": ["D:/path/to/staruml-mcp/server.py"]
}
}
}Custom Port
If the staruml-controller uses a different port:
python server.py --api-port 56789MCP Tools Reference
Diagram Generation (via Mermaid)
Tool | Description | Supported Types |
| Import any Mermaid code | classDiagram, sequenceDiagram, flowchart, erDiagram, mindmap, requirementDiagram, stateDiagram |
Structured Diagram Builders
Tool | Description |
| 类图 — classes, attributes, methods, relationships |
| 时序图 — participants, messages |
| 用例图 — actors, use cases, relationships |
| 活动图 — nodes, flows |
| 状态图 — states, transitions |
| ER 图 — entities, attributes, relationships |
| 流程图 — nodes, connections |
| 思维导图 — root, branches |
Utility Tools
Tool | Description |
| 检查与 StarUML 的连接状态 |
| 获取当前项目所有图表信息 |
| 获取当前图表详情 |
| 导出图表为 PNG 图片(base64) |
AI Prompt Examples
In your AI chat, just say:
"用 staruml 画一个电商系统的用例图,有顾客、商家和管理员三个角色"
"画一个图书管理系统的类图,包含 Book、User、BorrowRecord"
"画一个用户登录的时序图"
"画一个订单处理的状态图"
"画一个数据库设计的 ER 图"
Direct REST API Usage
The scripts/ directory contains standalone Python scripts that call the REST API directly (no MCP client needed).
Create Use Case Diagram
python create_usecase.pyLayout / Reposition Elements
If diagram elements overlap, run the layout script:
python layout_usecase.pyNote: staruml-controller's auto-layout skips use case diagrams, so layout is done by manually positioning views via
PUT /api/views/:id.
API Endpoints
staruml-controller provides full CRUD REST API for all diagram families:
Family | Prefix | Examples |
Use Case |
| actors, use-cases, subjects, associations, includes, extends |
Class |
| classes, interfaces, attributes, methods, associations |
Sequence |
| lifelines, messages, combined-fragments |
Activity |
| actions, decisions, forks |
State Machine |
| states, transitions |
ERD |
| entities, columns, relationships |
Flowchart |
| nodes, connections |
MindMap |
| nodes |
BPMN |
| pools, lanes, tasks, gateways |
C4 |
| containers, components, relationships |
AWS / Azure / GCP |
| architecture diagrams |
Each family supports: GET/POST /api/{family}/{resource}, GET/PUT/DELETE /api/{family}/{resource}/:id
Project Structure
staruml-mcp/
├── server.py # MCP Server (Python / FastMCP)
├── requirements.txt # Python dependencies
├── README.md # This file
├── .gitignore
│
├── create_usecase.py # Standalone: create a use case diagram via REST API
├── layout_usecase.py # Standalone: reposition diagram elements
│
├── scripts/
│ ├── setup.bat # Windows setup script
│ └── test_connection.bat # Connection test script
│
└── examples/
├── class_library.json # Class diagram example data
├── sequence_login.json # Sequence diagram example data
└── use_case_ecommerce.json # Use case diagram example dataTroubleshooting
"Cannot connect to StarUML Controller"
Ensure StarUML is running
Check staruml-controller is installed at
%APPDATA%\StarUML\extensions\user\staruml-controllerRestart StarUML (extension auto-starts on port 12345)
Run
scripts\test_connection.batto verify
Mermaid Import Fails
Only these Mermaid types are supported: classDiagram, sequenceDiagram, flowchart, erDiagram, mindmap, requirementDiagram, stateDiagram. Use case diagrams use the REST API directly instead.
Port Conflict
If port 12345 is in use, modify server.py's DEFAULT_API_PORT or pass --api-port flag.
Diagram Elements Overlap
Run python layout_usecase.py to reposition use case diagram elements. For other diagram types, use POST /api/diagrams/{id}/layout with direction (TB/BT/LR/RL).
License
MIT
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/StoneSho/StarUML_MCP'
If you have feedback or need assistance with the MCP directory API, please join our Discord server