Skip to main content
Glama
README.md
# mcp-server-pci-dss-compliance-assistant

An **independent, community-maintained open-source [MCP](https://modelcontextprotocol.io) server** that helps developers check code and configuration for PCI DSS v4.0.1 readiness, and query a PCI DSS knowledge base that **you build locally** from your own copy of the standard.

> **⚠️ Disclaimer & Legal Notice**
>
> * **Experimental Release:** This tool is currently released as an **experimental, community-maintained open-source project**. It is provided *"as-is"* without warranties of any kind and is under active development.
> * **Basis of Implementation:** The parsing logic, rule mappings, and helper tools in this repository are structured around the **PCI DSS v4.0.1** standard documents. However, this repository does **not** redistribute any copyrighted PCI SSC documents; users must obtain official files directly from the PCI Security Standards Council.
> * **No Official Affiliation:** *PCI DSS* and *PCI Security Standards Council* are registered trademarks of PCI Security Standards Council, LLC. This project is an independent developer utility and is **not** affiliated with, endorsed, sponsored, or certified by PCI SSC.
> * **Not a Formal Assessment:** This tool is intended solely to assist developers and security teams with technical readiness and code/configuration hygiene. It does **not** constitute legal/compliance advice and does **not** replace a formal assessment by a Qualified Security Assessor (QSA) or official SAQ/ROC validation.

## Status

Phase 2: the MCP server is available, with requirement lookup tools and static PCI checks for code, infrastructure config and payment pages.

## Local setup

Requires Python 3.11+ and [uv](https://docs.astral.sh/uv/) (or pip).

```bash
uv sync --all-extras                    # or: pip install -e ".[dev]"
uv run python scripts/preflight_check.py
```

Then build your local knowledge base in two steps:

1. **Download the standard.** Get the free PCI DSS v4.0.1 PDF from the PCI SSC Document Library and save it as `data/raw/PCI-DSS-v4_0_1.pdf`. See [data/raw/README.md](data/raw/README.md) for the link and optional files.
2. **Build the dataset.**

   ```bash
   uv run python scripts/extract_pci.py      # parse the Requirement 1-12 tables from the PDF
   uv run python scripts/enrich_pci.py       # add metadata, cross-check the workbook, write the report
   uv run python scripts/validate_dataset.py # check the dataset against data/processed/schema.json
   ```

   This writes `data/processed/pci_dss_v4_0_1.json` (one record per requirement, format in [schema.json](data/processed/schema.json)) and `data/processed/extraction_report.md`.

Fields such as `frequency`, `automation_potential`, `keywords` and `saq_applicability` come from keyword rules. They help with search and triage, but they are approximations, not PCI SSC guidance. Appendix A (A1-A3) is not included yet.

The PDFs and the extracted JSON stay on your machine. `.gitignore` keeps them out of Git, and `scripts/preflight_check.py` verifies that.

## Run the MCP server

```bash
uv run pci-dss-mcp
```

The server talks MCP over stdio and reads `data/processed/pci_dss_v4_0_1.json`. To use another dataset file, set `PCI_DSS_DATA_PATH`. If no dataset is found, the server stops and explains how to build one.

Add it to your MCP client's configuration (the exact file depends on the client):

```json
{
  "mcpServers": {
    "pci-dss": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/mcp-server-pci-dss-compliance-assistant", "pci-dss-mcp"]
    }
  }
}
```

### Tools

| Tool | What it does |
|---|---|
| `get_requirement_details` | Full record for a control (`6.4.3`), or the controls under a section (`6.4`) or requirement (`6`) |
| `search_pci_controls` | Keyword search with filters for requirement, component, frequency and effective date |
| `get_testing_and_evidence_guide` | Testing procedures grouped by Examine / Interview / Observe / Test, plus evidence types |
| `generate_saq_checklist` | Markdown checklist for SAQ-A, SAQ-A-EP or SAQ-D (approximate mapping) |
| `get_related_controls` | Controls a requirement references, and controls that reference it |
| `list_periodic_tasks` | Controls by schedule: Continuous, Upon change, Quarterly, Semi-annually, Annually |
| `get_post_march_2025_requirements` | The controls that became mandatory on 31 March 2025 |
| `scan_code_snippet_for_pci` | PANs, CVV/PIN/track data handling, weak crypto, hardcoded secrets, SQL built from strings |
| `audit_infrastructure_config` | Dockerfile, docker-compose, Kubernetes, nginx and Terraform misconfigurations |
| `audit_payment_page_html` | Script integrity (SRI), script inventory and Content-Security-Policy checks for 6.4.3 / 11.6.1 |

Resources: `pci://requirements/overview` and `pci://requirement/{id}`. Prompts: `pci_code_review_prompt` and `pci_architecture_audit_prompt`.

The server is read-only: no file writes, network calls or subprocesses. Scanner output masks PANs (first 6 / last 4) and hides detected secret values. Every finding has a severity, a PCI DSS requirement ID, a description and a remediation step. The scanners are heuristics and can miss issues or flag false positives.

## Development

Tests use a small synthetic fixture ([tests/fixtures/mock_pci_sample.json](tests/fixtures/mock_pci_sample.json)) with paraphrased mock controls, so CI never needs the copyrighted PDF.

```bash
uv run pytest                                                            # local dataset, or the fixture if none is built
PCI_DSS_DATA_PATH=tests/fixtures/mock_pci_sample.json uv run pytest      # what CI runs
uv run ruff check .
```

## License

The code in this repository is released under the [MIT License](LICENSE). The license does not cover PCI SSC documents or any text extracted from them, which remain the property of PCI Security Standards Council, LLC.