Pmd

io.github.roeiba由 GitHub 账号 roeiba 发布v0.1.2更新于 Oct 25, 2026

MCP server for PMD static code analyzer - run code analysis and detect duplicates

已验证STDIO仅桌面开发者工具

概览

AI 生成的概览

一个本地 MCP 服务器,让助手对源代码运行 PMD 静态代码分析器及其重复代码检测器。

可以做什么
对源文件运行 PMD 静态分析,利用内置规则集在 Java、Apex 及多种其他语言中查找未使用变量、空 catch 块等常见编程缺陷。使用内置的复制粘贴检测器(CPD)在多种语言中查找重复代码。将规则违规和重复代码结果返回给助手以便审阅。
适用场景
适合希望助手在不离开对话的情况下检查代码库中的常见缺陷或重复代码,尤其是 Java、Apex 或其他受支持语言的项目。
运行要求
通过 npm 包 @springsoftware/pmd-mcp 以 stdio 传输在用户机器上作为本地进程运行。仅限桌面端,不支持网页执行。未声明认证、环境变量或请求头。PMD 本身是基于 Java 的分析器,通常需要可用的 Java 环境。
安装前请注意
分析会读取你的源文件并把结果发送给助手,因此不要指向无法与模型提供方共享的代码。未声明任何凭据或写入操作。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Pmd,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

PMD - source code analyzer

[PMD Logo]

[Join the chat] [Build Snapshot] [Maven Central] [Reproducible Builds] [Coverage Status] [Codacy Badge] [Contributor Covenant] [Documentation (latest)] [Gurubase] [Docker Image Version]

PMD is an extensible multilanguage static code analyzer. It finds common programming flaws like unused variables, empty catch blocks, unnecessary object creation, and so forth. It's mainly concerned with Java and Apex, but supports 16 other languages. It comes with 400+ built-in rules. It can be extended with custom rules. It uses JavaCC and Antlr to parse source files into abstract syntax trees (AST) and runs rules against them to find violations. Rules can be written in Java or using a XPath query.

Currently, PMD supports Java, JavaScript, Salesforce.com Apex and Visualforce, Kotlin, Swift, Modelica, PL/SQL, Apache Velocity, JSP, WSDL, Maven POM, HTML, XML and XSL. Scala is supported, but there are currently no Scala rules available.

Additionally, it includes CPD, the copy-paste-detector. CPD finds duplicated code in Coco, C/C++, C#, CSS, Dart, Fortran, Gherkin, Go, Groovy, HTML, Java, JavaScript, JSP, Julia, Kotlin, Lua, Matlab, Modelica, Objective-C, Perl, PHP, PL/SQL, Python, Ruby, Salesforce.com Apex and Visualforce, Scala, Swift, T-SQL, Typescript, Apache Velocity, WSDL, XML and XSL.

🚀️ Installation and Usage

Download the latest binary zip from the releases and extract it somewhere.

Execute bin/pmd check or bin\pmd.bat check.

See also Getting Started

Demo:

This shows how PMD analyses openjdk:

[Demo]

There are plugins for Maven and Gradle as well as for various IDEs. See Tools / Integrations

ℹ️ How to get support?

🤝️ Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Our latest source of PMD can be found on GitHub. Fork us!

For details, see How to contribute to PMD.

The rule designer is developed over at pmd/pmd-designer. Please see its README for developer documentation.

💵️ Financial Contributors

Become a financial contributor and help us sustain our community. Contribute

✨️ Contributors

This project follows the all-contributors specification. Contributions of any kind welcome!

See credits for the complete list.

📝️ License

BSD Style

来源:README.md,提交 887f19a

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.1.2最新Sep 16, 2026

评分

已满足适用检查项的 40%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分

    请在仓库或注册中心条目中声明许可证。