uml2code-mcp-server

skurzyp/uml2code-mcp-server

3.1

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

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

  1. Create a PlantUML diagram (e.g., diagram.puml).
  2. Attach it to a Copilot prompt like:
    generate java code from this plant uml diagram.
    
  3. Accept permission to execute the MCP Server Tool.
  4. If the diagram is valid, Java code files will be returned.
  5. 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.