GitUML MCP Server

GitUML MCP Server

Generate UML class diagrams, sequence diagrams, flowcharts, and component diagrams from any Java or Spring Boot repository via CLI or directly inside Claude Desktop.

Category
访问服务器

README

GitUML — Java / Spring Boot UML Generator + MCP Server

Generate UML class diagrams, sequence diagrams, flowcharts, and component diagrams from any Java or Spring Boot repository — via CLI or directly inside Claude Desktop as an MCP server.


Features

  • 5 MCP tools exposed to Claude Desktop: analyze_repo, generate_class_diagram, generate_sequence_diagram, generate_flowchart, generate_component_diagram
  • Works with GitHub/GitLab URLs (shallow clone) or local paths
  • Detects project type: pure_java, spring_boot, spring_mvc
  • Detects build system: maven, gradle, none
  • Annotation-aware Spring layer detection (Controller → Service → Repository → Model → Config → Messaging)
  • Output in Mermaid, PlantUML, or both
  • Test directories excluded by default

Project Structure

gituml/
├── server.py              ← MCP server (FastMCP, STDIO transport)
├── main.py                ← CLI entry point (argparse)
├── test_server.py         ← Quick smoke-test for server tools
├── requirements.txt
├── core/
│   ├── models.py          ← Data models: ClassMeta, MethodMeta, RepoMetadata, …
│   └── java_parser.py     ← javalang-based Java AST parser
└── diagrams/
    ├── class_diagram.py
    ├── sequence_diagram.py
    ├── flowchart.py
    └── component_diagram.py

Requirements

  • Python 3.10+
  • Git installed and available on PATH (needed for cloning remote repos)
pip install -r requirements.txt

requirements.txt installs:

Package Purpose
javalang Java AST parsing
gitpython Shallow-clone remote repositories
mcp[cli] FastMCP server / STDIO transport

Usage — CLI

# From a GitHub URL
python main.py --repo https://github.com/spring-projects/spring-petclinic

# From a local path
python main.py --repo /path/to/my-spring-app

# With sequence diagram entry point
python main.py --repo /path/to/my-app \
               --entry-class UserController \
               --entry-method createUser

# With method-level flowchart
python main.py --repo /path/to/my-app \
               --flow-class OrderService \
               --flow-method processOrder

# Custom output directory, Mermaid only
python main.py --repo /path/to/my-app --output-dir ./diagrams --format mermaid

# Include test directories
python main.py --repo /path/to/my-app --include-tests

# Limit class diagram to 30 classes
python main.py --repo /path/to/my-app --max-classes 30

CLI Arguments

Argument Short Default Description
--repo -r (required) GitHub URL or local path
--output-dir -o ./output Directory for output .md files
--entry-class -ec None Class for sequence diagram entry point
--entry-method -em None Method to trace in sequence diagram
--flow-class -fc None Class for method-level flowchart
--flow-method -fm None Method for method-level flowchart
--format both mermaid | plantuml | both
--max-classes 60 Max classes in class diagram
--include-tests False Include test source directories

Output Files

All written to ./output/ by default:

output/
├── class_diagram.md
├── component_diagram.md
├── sequence_diagram.md
└── flowchart.md

Preview .md files in VS Code with the Markdown Preview Enhanced extension (Ctrl+Shift+V / Cmd+Shift+V).


Usage — MCP Server (Claude Desktop)

Step 1 — Install Claude Desktop

Download from https://claude.ai/download

Step 2 — Locate the config file

OS Path
Windows %APPDATA%\Claude\claude_desktop_config.json
macOS ~/Library/Application Support/Claude/claude_desktop_config.json
Linux ~/.config/Claude/claude_desktop_config.json

Step 3 — Register GitUML

Open the config file and add the gituml entry:

Windows

{
  "mcpServers": {
    "gituml": {
      "command": "python",
      "args": ["C:\\Users\\YourName\\projects\\gituml\\server.py"]
    }
  }
}

macOS / Linux

{
  "mcpServers": {
    "gituml": {
      "command": "python3",
      "args": ["/home/yourname/projects/gituml/server.py"]
    }
  }
}

Windows note: Use double backslashes \\ in paths inside JSON.

Step 4 — Restart Claude Desktop

After saving the config, fully quit and relaunch Claude Desktop.

in the chat input bar — Ask for available tools and it should return the following:

  • analyze_repo
  • generate_class_diagram
  • generate_sequence_diagram
  • generate_flowchart
  • generate_component_diagram
  • generate_all

Step 5 — Talk to Claude

Analyse this repo: https://github.com/spring-projects/spring-petclinic

Generate a class diagram for C:/projects/my-spring-app

Show me the sequence diagram for UserController.createUser

Generate a flowchart for the processOrder method in OrderService

Show the component architecture of https://github.com/myorg/myrepo

Generate all diagrams for https://github.com/user/repo and save to ./output

MCP Tools Reference

analyze_repo

Returns a structured summary of the repository — no diagrams generated.

Parameter Type Required Description
repo str GitHub URL or local path

Returns: Project type, build system, package list, layer breakdown, dependency graph.


generate_class_diagram

Generates a UML class diagram showing classes, fields, methods, inheritance, and Spring layers.

Parameter Type Default Description
repo str (required) GitHub URL or local path
output_dir str "" Write to file if provided, else return as string
format str "both" mermaid | plantuml | both
package_filter str None Filter to classes in this package prefix
max_classes int 60 Max classes to include

generate_sequence_diagram

Traces the call chain from an entry point across Spring layers.

Parameter Type Default Description
repo str (required) GitHub URL or local path
output_dir str "" Write to file if provided
format str "both" Output format
entry_class str None Starting class (e.g. UserController)
entry_method str None Starting method (e.g. createUser)

generate_flowchart

Generates a control-flow diagram for a specific method, or a high-level architecture flowchart.

Parameter Type Default Description
repo str (required) GitHub URL or local path
output_dir str "" Write to file if provided
format str "both" Output format
target_class str None Class containing the target method
target_method str None Method to flowchart

generate_component_diagram

High-level architecture view — components grouped by Spring layer or package.

Parameter Type Default Description
repo str (required) GitHub URL or local path
output_dir str "" Write to file if provided
format str "both" Output format

generate_all

Generates all 4 diagrams and writes them to disk — equivalent to running main.py from the CLI.

Parameter Type Default Description
repo str (required) GitHub URL or local path
output_dir str "output" Directory to write all 4 .md files
format str "both" Output format
entry_class str "" Sequence diagram entry class
entry_method str "" Sequence diagram entry method
flow_class str "" Flowchart target class
flow_method str "" Flowchart target method
include_tests bool False Include test source directories
max_classes int 60 Max classes in class diagram

Supported

Category Detail
Languages Java (via javalang AST parser)
Frameworks Plain Java, Spring Boot, Spring MVC
Build tools Maven (pom.xml), Gradle (build.gradle)
Sources GitHub URLs, GitLab URLs, local paths
Output Mermaid, PlantUML, or both
Spring layers controller, service, repository, model, config, messaging, scheduler

Troubleshooting

No Java classes found — Confirm the path points to a Java project root. Check that .java files exist under src/.

Failed to clone repo — Verify git is on your PATH and the URL is accessible. Private repos require SSH key or credential setup.

gitpython not installed — Run pip install gitpython.

Claude Desktop tools not appearing — Check the JSON config for syntax errors (trailing commas, wrong path separators on Windows). Fully quit and relaunch Claude Desktop.

MCP server not starting — Test the server directly: python server.py — it should block silently (waiting on STDIO). Any Python import errors will surface here.


推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选