gitleaks-mcp
Scans Git repositories for hardcoded secrets: inspects the staged index (what git commit would record), walks repository/commit history with optional log options such as @{upstream}..HEAD, and can also scan plain files or directories outside of Git. Findings are reported by rule, file, line and commit with secret values redacted.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
gitleaks-mcp
An MCP server that lets an AI agent scan code, staged changes and text snippets for hardcoded secrets using gitleaks.
Secrets never reach the model. Every scan runs with --redact, and the Match/Secret fields are dropped before results are returned. The agent only sees rule, file, line, commit and fingerprint.
Status of the engine: gitleaks is feature-complete and in security-patch-only mode; its author is now building Betterleaks. The scanner sits behind a small
Engineinterface (src/gitleaks.ts) so a Betterleaks backend can be added once v2 is stable without changing the tool contract.
Tools
Tool | What it does |
| Scan only what is staged (what |
| Scan a repo's history. Optional |
| Scan a file or directory without git. |
| Scan a string (a snippet or config you're about to write or share). |
All tools are read-only and take max_findings (default 50); the total count is always reported.
Also provided: resource gitleaks://about (engine version and guarantees) and prompt pre-push-check.
Related MCP server: secret-scanner
Example
Ask your agent "scan this snippet for secrets" (or call scan_text). The token is reported by rule and line, never by value:
{
"summary": "1 potential secret(s) found. Values are redacted.",
"findingsCount": 1,
"truncated": false,
"findings": [
{
"rule": "github-pat",
"description": "Uncovered a GitHub Personal Access Token, ...",
"file": "",
"startLine": 1,
"endLine": 1,
"fingerprint": ":github-pat:1"
}
]
}Typical prompts: "scan my staged changes before I commit", "check the commits I'm about to push", "does this config file contain secrets?"
Requirements
Node >= 20
gitleakson your PATH (brew install gitleaks), or setGITLEAKS_BIN
Use it
git clone https://github.com/matiasburni/gitleaks-mcp && cd gitleaks-mcp
npm install && npm run build
claude mcp add gitleaks -- node "$(pwd)/dist/src/index.js"Then ask: "scan my staged changes for secrets" or run the pre-push-check prompt.
Try it interactively with the MCP Inspector: npm run inspect.
How it works (MCP in 60 seconds)
Transport: stdio. The client launches
node dist/src/index.jsand exchanges JSON-RPC over stdin/stdout, so the server never writes logs to stdout (only stderr).Tools are actions the model calls, declared with a zod input schema and
readOnlyHintannotations (src/server.ts).Resources are read-only data the client can attach; prompts are reusable templates the user invokes.
Safety: no shell (
execFilewith an args array), redaction forced on, secret fields dropped, temp report deleted after each scan.
Develop
npm test # builds, then runs MCP-client end-to-end tests against real gitleaksTest secrets are assembled at runtime so no secret-shaped literal is committed.
Security
See SECURITY.md for the threat model, hardening and known limits (notably: only scan repositories you trust).
License
MIT - see LICENSE. Permissive on purpose, so you can reuse, fork and learn from it.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Security scanner for AI agents: prompt injection, leaked secrets, PII, and SSRF-risk URL detection.
Find and redact leaked secrets, wallet keys and PII before an AI agent sends text.
Lets coding agents check their own code for leaked secrets, risky dependencies and AI-code mistakes
Secrets for developers and agents—secure context and workflows without exposing secret values.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to scan projects for leaked secrets and manage security incidents using GitGuardian's comprehensive API. It supports automated secret detection, honeytoken creation, and remediation workflows to secure codebases without context switching.43MIT
- AlicenseAqualityBmaintenanceEnables scanning diffs or code blobs for leaked secrets, returning a verdict with severity and masked findings, all processed locally with no data sent externally.1MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to scan source code for secrets like API keys and passwords locally without network requests.2Apache 2.0
- AlicenseAqualityCmaintenanceScans code strings for hardcoded secrets (AWS keys, tokens, private keys, etc.) and returns redacted findings, helping AI coding agents catch secrets before writing or committing code.1MIT