UML-MCP Server is a UML diagram generation tool based on MCP (Model Context Protocol), which can help users generate various types of UML diagrams through natural language description or directly writing PlantUML code.
To install UML Diagram Generation Tool for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @Swayingleaves/uml-mcp-server --client claude
git clone https://github.com/yourusername/UML-MCP-Server.git
cd UML-MCP-Server
python -m venv uml-mcp-venv
source uml-mcp-venv/bin/activate # Linux/Mac
# Or
uml-mcp-venv\Scripts\activate # Windows
pip install -r requirements.txt
from fix_plantuml import generate_uml
# Create UML code
uml_code = """
@startuml
Title: Simple Class Diagram
class User {
-String name
-String email
+login()
+logout()
}
class Order {
-int id
-Date date
+process()
}
User "1" -- "many" Order: places
@enduml
"""
# Generate URLs, code, and local paths for UML diagrams
result = generate_uml(uml_code)
# Output result
print("PlantUML code: ")
print(result["code"])
print("\nPlantUML URL:")
print(result["url"])
print("\nLocal file path: ")
print(result["local_path"])
The Cursor supports MCP (Model Context Protocol) servers, allowing you to directly generate UML diagrams using UML-MCP Server in the Cursor. The configuration steps are as follows:
Ensure that the latest version of Cursor IDE (which supports MCP functionality) is installed.
Open the configuration file of Cursor:
~/Library/Application Support/Cursor/config.json
%APPDATA%\Cursor\config.json
~/.config/Cursor/config.json
{
"mcpServers": {
"UML-MCP-Server": {
"command": "uv",
"args": [
"--directory",
"/Users/yourpath/UML-MCP-Server",
"run",
"uml_mcp_server.py"
],
"output_dir": "/Users/yourpath/uml-output"
}
}
}
Configuration Description:
args
:
run
: Run the commandoutput_dir
: Specify the output directory for UML imagesPlease modify the following path according to your actual situation:
Save the configuration file and restart the Cursor.
Use UML-MCP Server in Cursor:
In the Cursor, you can input:
For example:
1. Understand the certification process of the project
2. Generate UML code for the authentication process and generate a flowchart through UML-MCP Server
3. Attention: "output_dir": "/Users/edy/vs-code/bjwa-task-project/uml-output"
Regardless of how UML tools are used, Cursor will call UML-MCP-Server and return the following:
For example:
Class diagram generated:
PlantUML code:
@startuml
Title: User and Order System
class User {
-String name
-String email
+login()
+logout()
}
class Order {
-int id
-Date date
+process()
}
User "1" -- "many" Order: places
@enduml
PlantUML URL:
http://www.plantuml.com/plantuml/png/~1UDgCqB5Bn0G1k1zYWM_EfPYQYY0Qd9oQc9oQaPcKYYcKc9gMYaiKc9gK...
Local file path:
/Users/username/projects/UML-MCP-Server/output/class_diagram_12345.png
You can view the generated UML diagram in the following ways:
If you encounter problems while using UML-MCP Server, you can try the following steps:
Common problems and solutions:
Welcome to contribute code, report issues, or provide improvement suggestions! Please participate in project development through GitHub Issues or Pull Requests.
This project adopts the MIT license. Please refer to the LICENSE document for details.
Seamless access to top MCP servers powering the future of AI integration.