PMAT MCP
A Rust binary that doubles as an MCP server: complexity, tech debt, dead code and repository context for Claude Code and Cline.
- 170 ★ on the repository
- Last commit
- MIT
Extended access
Why this level
- Reads source and git history; `kaizen` and the hooks change the repository, and HTTP mode exposes the process's readable paths behind a token.
Install
- Works in
Manual install
cargo install pmatThe README command installs the `pmat` binary; Rust is required.
Access and checks
How we reviewExtended accessThe tool runs code or makes network calls and only reads external data.
- Reads source and git history; `kaizen` and the hooks change the repository, and HTTP mode exposes the process's readable paths behind a token.
This is third-party code. Review the repository files before installing.
What it does
PMAT (Pragmatic Multi-language Agent Toolkit) analyses a codebase in 20-plus languages and gives an agent checkable numbers instead of guesses. About 20 MCP tools measure complexity and Big-O, find dead code, unfinished spots (`analyze_satd`) and unreachable functions, build dependency graphs, look for similar code and assemble compressed project context. The console side adds technical-debt grades from A+ to F, mutation testing, a repository health score and search across git history. `pmat verify` runs the same steps as CI: formatting, complexity, SATD, clippy and tests. The agent edits code, runs `pmat verify --format json`, fixes red results and commits on green. One binary speaks three ways: an ordinary command, MCP over stdio (`pmat --mode mcp`) and MCP over HTTP with a token (`pmat serve --transport http`).
Who it is for. Developers on Rust, Python, TypeScript and Go whose agent writes code faster than the team can watch complexity and debt.
Good fit when
- A new repository is open in Claude Code and you want an architecture map and compact context before editing.
- An agent finished a refactor and you want the same checks CI runs before the commit.
- You need the most complex functions and dead code before a cleanup.
- A team tracks technical debt and blocks PRs when the grade drops.
- Tests are green yet trust is low, so quality is checked with mutation testing.
Not a fit when
- A small script: complexity and debt at that scale do not justify an install.
- One or two tools are enough: PMAT has about 20 MCP tools and over a hundred console commands.
- You plan to expose the server to a network without a token: HTTP mode requires a token of at least 16 characters and will not start without it.
Example request
Connect to pmat, find the five most complex functions in the project and the dead code, then propose a refactoring plan and run `pmat verify`.MCP
- Transport
- stdio, http
- Authentication
- not required
Environment variables
PMAT_MCP_HTTP_TOKENsecret- Token for HTTP mode, at least 16 characters; not needed for stdio.
Limitations
Built from source with `cargo install pmat`, Rust 1.91 or newer is required. HTTP mode answers on the root path `/` (not `/mcp`), there is no `/health` endpoint, and the `PMAT_MCP_HTTP_TOKEN` token is mandatory and at least 16 characters long. `--transport` values other than `http` are not implemented yet. The HTTP server can read any path the process can, so it listens on `127.0.0.1` unless `--host` is given. `pmat kaizen` and the hooks change the repository; start with `--dry-run`.
How to disable. Run `claude mcp remove pmat`, stop `pmat serve` if you started HTTP mode, and remove the hooks shown by `pmat hooks status`. `cargo uninstall pmat` removes the binary itself.
FAQ
How do I connect PMAT to Claude Code?
Run `cargo install pmat`, then `claude mcp add --scope user pmat -- pmat --mode mcp`. `claude mcp list` should show `pmat` as Connected.
How does stdio differ from HTTP?
Stdio starts pmat as a child process of the client, with no port and no token. HTTP is for one long-lived server serving several clients or another machine: run `pmat serve --transport http --port 8765` with a token in `PMAT_MCP_HTTP_TOKEN`.
How does the pre-commit check work?
`pmat verify --format json` runs formatting, complexity, SATD, clippy and tests and stops at the first failure. The agent reads the JSON result itself and fixes the red step.
Which languages are supported?
More than 20: Rust, TypeScript, Python, Go, Java, C and C++, Lua, Lean and others. The mutation-testing list is longer and includes Kotlin, Swift, PHP, SQL and Scala.
What does pmat kaizen do?
It scans the project, applies safe auto-fixes and commits them. Start with `pmat kaizen --dry-run`, which only reports findings, because `--push` sends changes to the remote.
Discussion
No questions or reviews yet.
Related
MCP serversA Rust binary for agents and the terminal that uses tree-sitter to find a symbol's definition, its calls and file dependencies
rust-analyzer MCP: Rust code navigation for agents
r3bl-rust-analyzer-mcp-server
A Rust MCP server on standard threads: the agent gets hover info, go to definition, references, formatting and compiler diagnostics from rust-analyzer
Three skills and a clippy config: an agent writes, reviews and ports idiomatic Rust, and CI enforces the checkable rules
An MCP server and CLI for code research: search and understand your project and all of GitHub with fewer tokens
A local code graph with version history: an MCP server that tells the agent who calls a function and what an edit breaks
A structural code search MCP server for agents: finds the right file by query intent and runs locally
Comparison with similar tools
Cards that share the main search query, and how they differ.
| Tool | Official | Authentication | Repository stars | Main difference |
|---|---|---|---|---|
| PMAT (this card) | no | not required | 170 | |
| Repomix | no | not required | 29,172 | packs a repository into one file for a model; PMAT measures complexity and debt and serves them as MCP tools |
| Code2Prompt | no | 7,746 | assembles a codebase into a prompt with a file tree; this adds debt grades, mutation tests and an MCP server |
README in short
The README splits into installation, three ways to run MCP and an overview of commands: context, debt, mutation tests, repository scoring, hooks and compliance checks. A separate block lists four non-obvious quirks of HTTP mode.