skurzyp/uml2code-mcp-server
If you are the rightful owner of uml2code-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
The UML2Code MCP Server is a tool designed to convert PlantUML diagrams into Java code using a Model Code Prompting server backed by OpenAI's GPT models.
๐ UML2Code MCP Server
Convert PlantUML diagrams into Java code using an MCP (Model Code Prompting) server backed by OpenAI's GPT models.
๐ Prerequisites & Setup
1. Clone the Repository
git clone https://github.com/skurzyp/uml2code-mcp-server
cd uml2code-mcp-server
2. Requirements
- Node.js v23.3
- pnpm
- OpenAI API Key (with access to
gpt-4o-mini
)
Get your key from: https://openai.com/api
3. Configure Environment
cp .env.example .env
# Paste your OpenAI API key into the .env file
4. Install Dependencies
pnpm install
๐งช Running the App
Option 1: Development Mode
pnpm run dev
Option 2: Build & Run
pnpm build
pnpm start
๐ VSCode Integration
1. Configure settings.json
Open VSCode settings and add your MCP server configuration:
{
"mcp": {
"inputs": [],
"servers": {
"mcp-server-remote": {
"type": "sse",
"url": "http://localhost:3000/mcp"
},
"mcp-server-local": {
"command": "node",
"args": [
"D:\\<PATH TO YOUR PROJECT>\\uml2code-mcp-server\\build\\index.js"
],
"env": {
"CHAT_OPENAI_API_KEY": "sk-<your-api-key-here>"
}
}
}
},
"workbench.colorTheme": "Andromeda Bordered",
"files.autoSave": "afterDelay",
"window.zoomLevel": 2,
"liveServer.settings.donotShowInfoMsg": true,
"liveServer.settings.CustomBrowser": "chrome",
"workbench.editorAssociations": {
"*.ipynb": "jupyter.notebook.ipynb"
}
}
2. Start the MCP Server
- Open the VSCode command palette and click "Start" next to your selected server.
๐ How to Use
- Create a
PlantUML
diagram (e.g.,diagram.puml
). - Attach it to a Copilot prompt like:
generate java code from this plant uml diagram.
- Accept permission to execute the MCP Server Tool.
- If the diagram is valid, Java code files will be returned.
- If not, youโll receive suggested fixes from the server.
๐งช Local Testing
Use the following PowerShell commands to test the tool:
# Test calculate_sum tool
Invoke-RestMethod -Uri http://localhost:3000/test-tool `
-Method Post `
-Headers @{ "Content-Type" = "application/json" } `
-Body '{"name":"calculate_sum","arguments":{"a":123,"b":124}}'
# Test UML to code conversion
Invoke-RestMethod -Uri http://localhost:3000/test-tool `
-Method Post `
-Headers @{ "Content-Type" = "application/json" } `
-Body '{"name":"uml2code","arguments":{"plantUml":"@startuml\nclass User {\n +name: String\n}\n@enduml"}}'
๐ฆ Project Structure
โโโ build/ # Compiled output
โโโ src/ # Source files
โโโ .env.example # Environment template
โโโ README.md # You're here!
๐ง Notes
- The MCP server uses SSE (Server-Sent Events) for communication.
- You can run the server locally or point VSCode to a remote instance.
- Ensure your API key has access to GPT-4o Mini (
gpt-4o-mini
). - This project was developed on Windows but should be easy to set up on Linux in similar manner
๐ License
This project is licensed under the MIT License.
You are free to use, modify, and distribute this software under the terms of the license.
ยฉ 2025 UML2Code MCP Server contributors. Open source, open innovation.