Repository navigation
How It Works
flowchart LR
subgraph build["Build once, on your machine"]
pdf["PCI DSS v4.0.1 PDF<br/>data/raw/"] --> extract["extract_pci.py"] --> enrich["enrich_pci.py"] --> validate["validate_dataset.py"]
xlsx["Prioritized Approach .xlsx"] -. cross-check .-> enrich
validate --> dataset[("pci_dss_v4_0_1.json")]
dataset --> embed["build_embeddings.py<br/>(optional)"] --> vectors[("embeddings.npy<br/>+ local model")]
end
subgraph server["pci-dss-mcp server: read-only, offline"]
tools["server.py<br/>11 tools, 2 resources, 2 prompts"]
loader["data_loader.py"] --> search["search_engine.py<br/>BM25 + embeddings, RRF"]
tools --> loader
tools --> scanners["scanners/<br/>code, infra, payment page,<br/>repository"]
tools --> security["security.py<br/>input caps, masking,<br/>untrusted tags, audit log"]
end
dataset --> loader
vectors --> search
client["MCP client"] <-- "stdio" --> tools
The build scripts turn your PDF into data/processed/pci_dss_v4_0_1.json, one record per control (249 for Requirements 1-12). The format is defined in data/processed/schema.json. Each record has:
| Field | What it holds |
|---|---|
id, parent_id, requirement_number
|
The control ID (e.g. 6.4.3), its parent (6.4) and principal requirement (6) |
requirement_title, section_title
|
The headings the control sits under |
defined_approach_requirement |
The requirement text |
customized_approach_objective, is_customized_approach_allowed
|
The customized-approach objective, if the control allows that approach |
effective_date_status |
immediate, or post_march_2025 for the 46 controls in Requirements 1-12 that were future-dated until 31 March 2025 |
applicability_notes, guidance
|
Notes and guidance from the standard |
testing_procedures |
Each procedure's ID, its action verb (Examine, Interview, Observe, Test) and text |
related_requirements |
Other control IDs the text refers to |
evidence_types, frequency, applicable_components, data_elements_in_scope, automation_potential, keywords, saq_applicability
|
Classification added by keyword rules: useful for search and triage, but approximate |
The extraction is checked against the PCI SSC Prioritized Approach workbook (all 249 IDs match), and validate_dataset.py checks the schema, duplicate IDs, completeness and leftover page headers or footers.
search_pci_controls ranks controls two ways and fuses the rankings with Reciprocal Rank Fusion before applying filters:
- BM25 over IDs, titles, requirement text, guidance, keywords and SAQ tags. Acronyms such as PAN, SAD, SRI, CSP, HSM, TLS, AES, MFA and WAF are expanded with the words the standard uses, at half weight so they never drown out your own terms.
-
Semantic similarity with
sentence-transformers/all-MiniLM-L6-v2(ONNX viafastembed, CPU only). Control embeddings are precomputed byscripts/build_embeddings.py; the server loads the model with downloads disabled.
If the embeddings are missing, or stale because the dataset changed, search falls back to BM25 and reports "search_mode": "lexical". The server is ready about 0.5 s after launch; the first semantic query loads the model (about 0.3 s), later ones take a few milliseconds.
- Read-only and offline. No file writes, network calls or subprocesses. Tests enforce this, including one that blocks sockets during semantic search.
- Input caps. Code, config and HTML up to 500,000 characters, directory paths 4,096, queries 500, other text parameters 100.
- No card data or secrets in output. Every result passes through a sanitizer that masks Luhn-valid card numbers (first 6 / last 4) and redacts track data and well-known secret formats. Scanners also hide secret values they find.
-
Untrusted content is marked. Anything quoted from scanned input is wrapped in
<scanned_artifact>tags, and look-alike tags inside it are neutralized, so a malicious comment cannot pose as instructions to the assistant. -
Contained directory audits.
audit_directoryresolves paths first, refuses system and home roots, never follows symlinks and opens files withO_NOFOLLOW. -
Opt-in audit log.
PCI_MCP_AUDIT_LOG=1writes one metadata-only JSON line per tool call to stderr (tool, status, latency, finding count; never inputs).
| Variable | Default | Purpose |
|---|---|---|
PCI_DSS_DATA_PATH |
data/processed/pci_dss_v4_0_1.json (Docker: /app/data/processed/pci_dss_v4_0_1.json) |
Dataset file to load |
PCI_MCP_AUDIT_LOG |
off |
1 turns on the audit log |
Independent community project, not affiliated with or endorsed by PCI Security Standards Council. A readiness aid, not a PCI DSS assessment. Code licensed under Apache-2.0.
PCI DSS Compliance Assistant
- Home
- Installation
- Connecting Clients
- Tools Reference
- Scanner Rules
- How It Works
- Troubleshooting and FAQ
- Roadmap
- Contributing
Links