npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@damenluo/plantuml-mcp-server

v0.0.3

Published

MCP server for PlantUML diagram generation

Downloads

20

Readme

PlantUML MCP 服务器

一个封装了 PlantUML 功能的模型上下文协议(MCP)服务器,允许 AI 助手从文本描述生成 UML 图表。

功能特性

  • 生成图表:创建多种格式的图表(PNG、SVG、TXT、PDF 等)
  • 语法检查:验证 PlantUML 语法而无需生成图像
  • 源码提取:从 PNG/SVG 元数据中提取 PlantUML 源码
  • 深色模式支持:生成深色主题的图表
  • 版本信息:获取 PlantUML 和 Java 版本信息

前置要求

  • Node.js 18 或更高版本
  • Java 运行环境(JRE)
  • Graphviz(用于生成某些图表类型)

使用方法

作为 MCP 服务器

添加到你的 MCP 客户端配置(例如 Claude Desktop):

方式一:使用 npx(推荐)

{
  "mcpServers": {
    "plantuml": {
      "command": "npx",
      "args": ["-y", "@damenluo/plantuml-mcp-server"],
      "env": {
        "PLANTUML_JAR": "/path/to/plantuml.jar"
      }
    }
  }
}

方式二:本地开发

{
  "mcpServers": {
    "plantuml": {
      "command": "node",
      "args": ["/path/to/plantuml-mcp/dist/index.js"],
      "env": {
        "PLANTUML_JAR": "/path/to/plantuml.jar"
      }
    }
  }
}

可用工具

1. generate_diagram

从 PlantUML 源代码生成图表。

参数:

  • source(必需):PlantUML 源代码
  • format(可选):输出格式 - pngsvgtxtutxtepslatexpdf(默认:png
  • darkMode(可选):以深色模式渲染(默认:false

返回: Base64 编码的图表数据

示例:

{
  "source": "@startuml\nAlice -> Bob: Hello\n@enduml",
  "format": "svg",
  "darkMode": false
}

2. check_syntax

检查 PlantUML 图表语法而不生成图像。

参数:

  • source(必需):要验证的 PlantUML 源代码

返回: 验证结果或语法错误

示例:

{
  "source": "@startuml\nAlice -> Bob: Hello\n@enduml"
}

3. extract_source

从 PNG 或 SVG 元数据中提取嵌入的 PlantUML 源码。

参数:

  • filePath(必需):PNG 或 SVG 文件的路径

返回: 提取的 PlantUML 源代码

示例:

{
  "filePath": "/path/to/diagram.png"
}

4. get_plantuml_version

获取 PlantUML 和 Java 版本信息。

参数:

返回: 版本信息

PlantUML 语法示例

时序图

@startuml
Alice -> Bob: 认证请求
Bob --> Alice: 认证响应
@enduml

类图

@startuml
class User {
  +String name
  +String email
  +login()
  +logout()
}

class Admin {
  +manageUsers()
}

User <|-- Admin
@enduml

活动图

@startuml
start
:初始化;
if (检查条件?) then (是)
  :处理 A;
else (否)
  :处理 B;
endif
stop
@enduml

用例图

@startuml
left to right direction
actor 用户
actor 管理员

rectangle 系统 {
  用户 -- (登录)
  用户 -- (查看资料)
  管理员 -- (管理用户)
  管理员 -- (查看报告)
}
@enduml

开发

构建

npm run build

监听模式

npm run watch

环境变量

  • PLANTUML_JAR:PlantUML JAR 文件的路径(默认:/Users/userxxx/bin/plantuml.jar

支持的输出格式

  • png:PNG 图像(默认)
  • svg:SVG 矢量图形
  • txt:ASCII 艺术图表
  • utxt:使用 Unicode 字符的 ASCII 艺术
  • eps:封装的 PostScript
  • latex:LaTeX/TikZ 输出
  • pdf:PDF 文档

错误处理

服务器处理各种错误场景:

  • 无效的 PlantUML 语法
  • 缺失的 PlantUML JAR 文件
  • Java 运行时错误
  • 文件 I/O 错误

错误会返回描述性消息以帮助诊断问题。

许可证

MIT

资源