
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
概覽
一個本機 MCP 伺服器,讓助理對原始碼執行 PMD 靜態程式碼分析器及其重複程式碼偵測器。
- 可以做什麼
- 對原始碼檔案執行 PMD 靜態分析,利用內建規則集在 Java、Apex 及多種其他語言中找出未使用變數、空的 catch 區塊等常見程式設計缺陷。使用內建的複製貼上偵測器(CPD)在多種語言中找出重複程式碼。將規則違規與重複程式碼結果回傳給助理以便檢視。
- 適用情境
- 適合希望助理不必離開對話就能檢查程式碼庫中的常見缺陷或重複程式碼,尤其是 Java、Apex 或其他支援語言的專案。
- 執行需求
- 透過 npm 套件 @springsoftware/pmd-mcp 以 stdio 傳輸在使用者機器上作為本機程序執行。僅限桌面端,不支援網頁執行。未宣告驗證、環境變數或標頭。PMD 本身是以 Java 為基礎的分析器,通常需要可用的 Java 環境。
安裝
README
PMD - source code analyzer
[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:
There are plugins for Maven and Gradle as well as for various IDEs. See Tools / Integrations
ℹ️ How to get support?
- How do I? -- Ask a question on StackOverflow or on discussions.
- I got this error, why? -- Ask a question on StackOverflow or on discussions.
- I got this error and I'm sure it's a bug -- file an issue.
- I have an idea/request/question -- create a new discussion.
- I have a quick question -- ask in our Gitter room or our PMD Guru at Gurubase.
- Where's your documentation? -- https://docs.pmd-code.org/latest/
🤝️ 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
來源:README.md,提交 887f19a
工具
0版本歷史
1- v0.1.2最新Sep 16, 2026
評分
已滿足適用檢查項的 40%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分
請在儲存庫或註冊中心條目中宣告授權條款。