
Pmd
io.github.roeibaPublished by GitHub account roeibav0.1.2Updated Oct 25, 2026
MCP server for PMD static code analyzer - run code analysis and detect duplicates
Overview
A local MCP server that lets an assistant run the PMD static code analyzer and its copy-paste detector on source code.
- What you can do
- Run PMD static analysis over source files to find programming flaws such as unused variables or empty catch blocks, using its built-in rule set across Java, Apex and many other languages. Detect duplicated code with the bundled copy-paste detector (CPD) across a wide range of languages. Report rule violations and duplication findings back to the assistant for review.
- When to use it
- Useful when you want an assistant to check a codebase for common defects or duplicated code without leaving the conversation, especially for Java, Apex or other supported languages.
- Requirements
- Runs as a local process on the user's machine via the npm package @springsoftware/pmd-mcp (stdio transport). Desktop only; no web execution. No authentication, environment variables or headers are declared. PMD itself is a Java-based analyzer, so a working Java setup is likely needed.
Installation
In SourceWeft
- Open Pmd in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
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
Source: README.md at commit 887f19a
Tools
0Version history
1- v0.1.2LatestSep 16, 2026
Score
40% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts
Declare a license in the repository or the registry entry.