Announcing an open-source MCP server for PCI DSS

Published 7 min readBy

A hand holding a magnifying glass over the keyboard of a silver laptop
Photo: Agence Olloweb / Unsplash

Today I'm releasing version 1.0.0 of mcp-server-pci-dss-compliance-assistant. It's an open-source MCP server that gives an AI assistant two things it lacks when you ask about PCI DSS: the wording of the standard to cite, and static checks it can run on your code and configuration. It runs locally and offline, and it's licensed under Apache-2.0.

Independent project. It is not affiliated with, endorsed or certified by PCI Security Standards Council. It helps with technical readiness and is not a PCI DSS assessment, legal advice or a substitute for a Qualified Security Assessor (QSA).

Why build a PCI DSS MCP server?

The PCI DSS questions engineers ask me are usually short: "which requirement covers this?", "is this Dockerfile OK for the payment service?", "what will the assessor want to see?". AI assistants get the general shape of the answer right and the details wrong. They quote requirement numbers from memory, mix up v3.2.1 and v4.0 numbering, and can't reliably tell which controls were best practice until 31 March 2025. In compliance work a confident wrong ID is worse than no answer, because it gets copied into a ticket or an evidence folder.

The Model Context Protocol (MCP) is an open protocol that lets an assistant call tools exposed by a server, here one running on your machine. So instead of asking the model to remember the standard, I gave it a lookup it can cite and checks it can run.

Why do you build the dataset yourself?

PCI DSS is copyrighted by PCI SSC, and its license doesn't allow redistribution. Anyone can download v4.0.1 for free from the Document Library, but no repository or Docker image can include it. So the repository contains only the pipeline. You put your own copy of the PDF in data/raw/, and three scripts build the dataset on your machine in about 20 seconds:

  1. extract_pci.py parses the requirement tables for Requirements 1 to 12: 249 controls.
  2. enrich_pci.py adds metadata such as frequency, evidence types, affected components, related controls, and whether the control was one of the 46 in Requirements 1 to 12 that became mandatory on 31 March 2025. If you also download the Prioritized Approach workbook, it cross-checks every control ID against it; on my copy, all 249 matched.
  3. validate_dataset.py checks the result against a JSON Schema.

The PDF, the dataset, the embeddings and the model are all gitignored. CI runs against a synthetic fixture of paraphrased mock controls, so the tests never need the copyrighted text, and the issue and pull request templates ask contributors to confirm they added none.

What can it do?

The server has 11 read-only tools, 2 resources and 2 prompts. The tools fall into three groups:

Area Tools A question it answers
Look up the standard get_requirement_details, search_pci_controls, get_related_controls "What does 6.4.3 ask for, and which controls reference it?"
Prepare for an audit get_testing_and_evidence_guide, list_periodic_tasks, get_post_march_2025_requirements, generate_saq_checklist "Which tasks must we run every quarter?"
Check code and configuration scan_code_snippet_for_pci, audit_infrastructure_config, audit_payment_page_html, audit_directory "Is this Dockerfile OK for our payment service?"

You don't need to name the tools. You ask in plain language, and the assistant picks tools from their descriptions. If your assistant still answers from memory, the README has a one-line standing instruction that fixes it.

Terminal tour: install, build the local dataset, connect a client, ask questions and audit code
The quick tour from the README, in five steps: install with uv, build the dataset from your own PDF, start the server and connect a client, ask questions in plain language, and audit code. The tool results in the last two steps come from real calls to the server.

Search that knows what PAN means

search_pci_controls combines two rankings with Reciprocal Rank Fusion. One is BM25 keyword ranking over IDs, titles, requirement text, guidance and keywords. The other is semantic similarity from a small embedding model, all-MiniLM-L6-v2, which runs on the CPU. Acronyms such as PAN, SAD, SRI, CSP, HSM and MFA are expanded to the words the standard uses, and you can filter by requirement, component, frequency or effective date. The embeddings are optional: without them, search falls back to BM25 and reports "search_mode": "lexical", so you always know which mode you got.

Scanners that cite a requirement

The scanners are static pattern checks. Each finding is tied to a requirement ID and comes with a remediation step:

  • Code: card numbers that pass the Luhn check, card-number variables written to logs, CVV, PIN and track data handling, weak cryptography, hardcoded secrets, and SQL built from strings.
  • Infrastructure: Dockerfile, docker-compose, Kubernetes, nginx and Terraform for AWS. The checks cover root or privileged containers, exposed database and admin ports, weak TLS, missing security headers, public or unencrypted storage, open security groups and disabled audit logging.
  • Payment pages: Subresource Integrity, a script inventory and Content Security Policy checks for Requirements 6.4.3 and 11.6.1, the two I covered in the post on payment page scripts.
  • Whole projects: audit_directory walks a local folder read-only and returns one gap analysis, grouped by severity and requirement, with file paths and line numbers.

A finding from an nginx config looks like this:

{
  "severity": "high",
  "pci_requirement_id": "4.2.1",
  "issue_description": "Weak TLS/SSL protocols enabled: TLSv1.",
  "remediation_step": "Use 'ssl_protocols TLSv1.2 TLSv1.3;'.",
  "line": 4,
  "evidence": "<scanned_artifact>ssl_protocols TLSv1 TLSv1.2;</scanned_artifact>"
}

The pci_code_review_prompt prompt chains these steps: run the scanner, confirm each finding against the standard with get_requirement_details, review what a scanner can't see, and report a table ordered by severity.

Is it safe to point at a payment codebase?

A tool that reads payment code must not leak card data or become a way in for prompt injection. These are the rules the server follows:

  • Read-only and offline. The server writes no files, makes no network calls and starts no subprocesses. One test fails if server code imports networking or subprocess modules, and another blocks sockets while semantic search runs.
  • No card data or secrets in output. Every tool result passes through a sanitizer that masks Luhn-valid card numbers to the first six and last four digits, and redacts track data and common secret formats such as AWS, GitHub, Stripe, Slack and Google keys and private key headers.
  • Scanned content is marked as untrusted. Anything quoted from scanned input is wrapped in <scanned_artifact> tags, with tag look-alikes inside neutralized. Descriptions and remediation steps are fixed templates. A comment in scanned code that says "ignore previous instructions" stays inside the tags as data.
  • Directory audits stay inside the folder. audit_directory refuses filesystem roots, system directories and your home folder itself. It never follows symlinks, skips .git, node_modules, binaries and files over 500 KB, and stops at a file limit.
  • A locked-down container. The Docker image contains only the code, runs as a non-root user and works with --network none --read-only --cap-drop ALL. You mount your dataset and the project to scan read-only.

How do I try it?

You need git and uv, which installs Python 3.11 or newer if you don't have it. Download PCI-DSS-v4_0_1.pdf from the Document Library into data/raw/ first, then run:

git clone https://github.com/itssaeedyari/mcp-server-pci-dss-compliance-assistant.git
cd mcp-server-pci-dss-compliance-assistant
uv sync --all-extras
uv run python scripts/preflight_check.py   # checks Python, the PDF and the gitignore rules

uv run python scripts/extract_pci.py
uv run python scripts/enrich_pci.py
uv run python scripts/validate_dataset.py
uv run python scripts/build_embeddings.py  # optional: downloads a ~90 MB model once

uv run pci-dss-mcp

Then copy a client config from examples/: there are ready-made files for Claude Desktop, Cursor, VS Code and Docker. To call the tools by hand, run npx @modelcontextprotocol/inspector uv run pci-dss-mcp and use the MCP Inspector. The README and the wiki cover configuration, Docker and troubleshooting.

What it is not

  • Not an assessment. Most of PCI DSS is process: training, code review rules, targeted risk analyses, change management, physical security. A static scanner sees none of it. The overview of PCI DSS 4.0.1 for engineers shows how much sits outside the code.
  • Not complete. Pattern matching has false positives and misses. Live testing before the release found two gaps in v1.0.0: a card-number variable passed to a logger was not flagged, and the MD5 finding suggested SHA-256 where card numbers need a keyed hash or tokenization. Both are fixed in v1.0.1.
  • Not the whole standard. The dataset covers Requirements 1 to 12 without Appendix A, and the SAQ checklists use an approximate mapping, not one parsed from the official SAQ documents.

What's next?

The roadmap has three releases planned:

  • v1.1, CI/CD and precision: syntax-tree analysis with tree-sitter for Python, JavaScript, TypeScript and Go to cut false positives, SARIF v2.1.0 export from audit_directory for GitHub code scanning, and exact SAQ checklists built from the requirement IDs in the official SAQ PDFs you download (SAQ A, A-EP and both SAQ D versions), with the approximate mapping as a fallback.
  • v1.2, cross-framework mappings and CDE scoping: mappings from PCI DSS v4.0.1 controls to OWASP ASVS (the subject of my ASVS-to-Requirement 6 mapping), NIST SP 800-53 and ISO/IEC 27001, a scope and segmentation analyzer for docker-compose and Terraform topologies, and a template generator for the customized approach controls matrix.
  • v1.3, a shared team server: Streamable HTTP transport with optional API key or OAuth authentication for self-hosted, internal-only team deployments, where each organization supplies its own locally extracted dataset, and multi-architecture Docker images published to GitHub Container Registry on each release. Contributions are welcome. CONTRIBUTING.md explains how to add a scanner rule. The one rule every change must follow: no PCI SSC text, real card data or secrets in the repository. The issues I most want are false positives and misses from real projects, with the code reduced to a sanitized example. If the server saves you a trip through a 397-page PDF, a star on GitHub helps others find it.

FAQ

Does the server send my code anywhere?

The server itself makes no network calls. Your MCP client still passes the code and the tool results to the assistant's model, as it does with any tool, so your model provider's data terms apply. Card numbers and known secret formats are masked in tool results, but code you paste into the chat reaches the model as you pasted it.

Do I have to buy the PCI DSS standard?

No. PCI SSC publishes PCI DSS v4.0.1 in its Document Library as a free download, under its own license terms. You keep that copy on your machine and build the dataset from it.

Which MCP clients does it work with?

Any client that runs a local MCP server over stdio. The repository has ready-made configs for Claude Desktop, Cursor, VS Code and Docker, and I tested v1.0.0 in Claude Desktop and Cursor before the release.

Can it tell me whether we are PCI DSS compliant?

No. It finds technical issues and points to the requirements they relate to. Compliance covers processes, people and physical controls that no scanner can see, and only your assessment decides it.

References

  1. mcp-server-pci-dss-compliance-assistant · GitHub
  2. Release v1.0.0 · GitHub
  3. Release v1.0.1 · GitHub
  4. Model Context Protocol · Model Context Protocol
  5. PCI DSS v4.0.1 (Document Library) · PCI Security Standards Council
  6. Just Published: PCI DSS v4.0.1 · PCI Security Standards Council
  7. sentence-transformers/all-MiniLM-L6-v2 · Hugging Face
  8. MCP Inspector · Model Context Protocol

About the author

Saeed Yari

Senior software engineer with 8 years of experience, most of it in payments and fintech. I write about turning PCI DSS and OWASP ASVS requirements into working systems.