phi-guard-mcp 0.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- phi_guard_mcp-0.1.2/.github/ISSUE_TEMPLATE/benchmark_case.md +34 -0
- phi_guard_mcp-0.1.2/.github/ISSUE_TEMPLATE/bug_report.md +44 -0
- phi_guard_mcp-0.1.2/.github/ISSUE_TEMPLATE/feature_request.md +25 -0
- phi_guard_mcp-0.1.2/.github/ISSUE_TEMPLATE/security_or_privacy.md +34 -0
- phi_guard_mcp-0.1.2/.github/PULL_REQUEST_TEMPLATE.md +28 -0
- phi_guard_mcp-0.1.2/.github/workflows/ci.yml +43 -0
- phi_guard_mcp-0.1.2/.github/workflows/publish.yml +39 -0
- phi_guard_mcp-0.1.2/.gitignore +20 -0
- phi_guard_mcp-0.1.2/.phi-guard.toml +38 -0
- phi_guard_mcp-0.1.2/CODE_OF_CONDUCT.md +27 -0
- phi_guard_mcp-0.1.2/CONTRIBUTING.md +46 -0
- phi_guard_mcp-0.1.2/LICENSE +21 -0
- phi_guard_mcp-0.1.2/PKG-INFO +206 -0
- phi_guard_mcp-0.1.2/README.md +176 -0
- phi_guard_mcp-0.1.2/SECURITY.md +36 -0
- phi_guard_mcp-0.1.2/benchmarks/synthetic/cases/case_001.json +16 -0
- phi_guard_mcp-0.1.2/benchmarks/synthetic/cases/case_002.json +11 -0
- phi_guard_mcp-0.1.2/benchmarks/synthetic/cases/case_003.json +13 -0
- phi_guard_mcp-0.1.2/benchmarks/synthetic/cases/case_004.json +11 -0
- phi_guard_mcp-0.1.2/benchmarks/synthetic/cases/case_005.json +11 -0
- phi_guard_mcp-0.1.2/benchmarks/synthetic/cases/case_006.json +5 -0
- phi_guard_mcp-0.1.2/benchmarks/synthetic/cases/case_007.json +11 -0
- phi_guard_mcp-0.1.2/benchmarks/synthetic/cases/case_008.json +10 -0
- phi_guard_mcp-0.1.2/benchmarks/synthetic/cases/case_009.json +10 -0
- phi_guard_mcp-0.1.2/benchmarks/synthetic/cases/case_010.json +9 -0
- phi_guard_mcp-0.1.2/benchmarks/synthetic/cases/case_011.json +11 -0
- phi_guard_mcp-0.1.2/benchmarks/synthetic/cases/case_012.json +11 -0
- phi_guard_mcp-0.1.2/benchmarks/synthetic/cases/case_013.json +10 -0
- phi_guard_mcp-0.1.2/benchmarks/synthetic/cases/case_014.json +10 -0
- phi_guard_mcp-0.1.2/benchmarks/synthetic/cases/case_015.json +11 -0
- phi_guard_mcp-0.1.2/benchmarks/synthetic/cases/case_016.json +5 -0
- phi_guard_mcp-0.1.2/benchmarks/synthetic/cases/case_017.json +12 -0
- phi_guard_mcp-0.1.2/benchmarks/synthetic/cases/case_018.json +10 -0
- phi_guard_mcp-0.1.2/benchmarks/synthetic/cases/case_019.json +11 -0
- phi_guard_mcp-0.1.2/benchmarks/synthetic/cases/case_020.json +11 -0
- phi_guard_mcp-0.1.2/benchmarks/synthetic-report.json +345 -0
- phi_guard_mcp-0.1.2/docs/benchmark.md +43 -0
- phi_guard_mcp-0.1.2/docs/demo.md +105 -0
- phi_guard_mcp-0.1.2/docs/openai-oss-application.md +103 -0
- phi_guard_mcp-0.1.2/docs/outreach-drafts.md +44 -0
- phi_guard_mcp-0.1.2/docs/privacy-gate.md +22 -0
- phi_guard_mcp-0.1.2/docs/roadmap.md +26 -0
- phi_guard_mcp-0.1.2/docs/safety-scope.md +47 -0
- phi_guard_mcp-0.1.2/examples/synthetic_clean_note.txt +6 -0
- phi_guard_mcp-0.1.2/examples/synthetic_clinical_note.txt +17 -0
- phi_guard_mcp-0.1.2/pyproject.toml +61 -0
- phi_guard_mcp-0.1.2/src/phi_guard_mcp/__init__.py +32 -0
- phi_guard_mcp-0.1.2/src/phi_guard_mcp/benchmark.py +139 -0
- phi_guard_mcp-0.1.2/src/phi_guard_mcp/cli.py +124 -0
- phi_guard_mcp-0.1.2/src/phi_guard_mcp/engine.py +275 -0
- phi_guard_mcp-0.1.2/src/phi_guard_mcp/gate.py +110 -0
- phi_guard_mcp-0.1.2/src/phi_guard_mcp/models.py +140 -0
- phi_guard_mcp-0.1.2/src/phi_guard_mcp/server.py +144 -0
- phi_guard_mcp-0.1.2/tests/test_benchmark.py +76 -0
- phi_guard_mcp-0.1.2/tests/test_cli.py +102 -0
- phi_guard_mcp-0.1.2/tests/test_engine.py +101 -0
- phi_guard_mcp-0.1.2/tests/test_gate.py +48 -0
- phi_guard_mcp-0.1.2/tests/test_server.py +5 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Benchmark case
|
|
3
|
+
about: Propose a synthetic benchmark fixture or detector edge case
|
|
4
|
+
title: "Benchmark: "
|
|
5
|
+
labels: benchmark
|
|
6
|
+
assignees: ""
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Synthetic Input
|
|
10
|
+
|
|
11
|
+
Use synthetic data only.
|
|
12
|
+
|
|
13
|
+
```text
|
|
14
|
+
Paste a minimal synthetic clinical-style note here.
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Expected Findings
|
|
18
|
+
|
|
19
|
+
List exact category and text pairs.
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
[
|
|
23
|
+
{"category": "PHONE", "text": "555-010-2040"}
|
|
24
|
+
]
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Why This Matters
|
|
28
|
+
|
|
29
|
+
Explain the detector behavior this case should exercise.
|
|
30
|
+
|
|
31
|
+
## Privacy Check
|
|
32
|
+
|
|
33
|
+
- [ ] This benchmark proposal contains synthetic data only.
|
|
34
|
+
- [ ] This benchmark proposal does not include real PHI or private identifiers.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug report
|
|
3
|
+
about: Report a reproducible problem using synthetic data only
|
|
4
|
+
title: "Bug: "
|
|
5
|
+
labels: bug
|
|
6
|
+
assignees: ""
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Summary
|
|
10
|
+
|
|
11
|
+
Describe the problem.
|
|
12
|
+
|
|
13
|
+
## Reproduction
|
|
14
|
+
|
|
15
|
+
Use synthetic data only.
|
|
16
|
+
|
|
17
|
+
```text
|
|
18
|
+
Paste a minimal synthetic input here.
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Command or API call:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
phi-guard scan example.txt
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Expected Behavior
|
|
28
|
+
|
|
29
|
+
What should happen?
|
|
30
|
+
|
|
31
|
+
## Actual Behavior
|
|
32
|
+
|
|
33
|
+
What happened instead?
|
|
34
|
+
|
|
35
|
+
## Environment
|
|
36
|
+
|
|
37
|
+
- OS:
|
|
38
|
+
- Python version:
|
|
39
|
+
- `phi-guard-mcp` version:
|
|
40
|
+
|
|
41
|
+
## Privacy Check
|
|
42
|
+
|
|
43
|
+
- [ ] This report contains synthetic data only.
|
|
44
|
+
- [ ] This report does not include real PHI, credentials, private emails, private IPs, or account tokens.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature request
|
|
3
|
+
about: Suggest a scoped privacy, redaction, benchmark, CLI, or MCP improvement
|
|
4
|
+
title: "Feature: "
|
|
5
|
+
labels: enhancement
|
|
6
|
+
assignees: ""
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Summary
|
|
10
|
+
|
|
11
|
+
What should be added or improved?
|
|
12
|
+
|
|
13
|
+
## Use Case
|
|
14
|
+
|
|
15
|
+
Describe the developer or maintainer workflow this supports.
|
|
16
|
+
|
|
17
|
+
## Proposed Behavior
|
|
18
|
+
|
|
19
|
+
What should the project do?
|
|
20
|
+
|
|
21
|
+
## Safety Boundary
|
|
22
|
+
|
|
23
|
+
- [ ] This does not add diagnosis, treatment, triage, prognosis, medication, or clinical risk scoring.
|
|
24
|
+
- [ ] This does not claim HIPAA compliance, legal sufficiency, or Expert Determination.
|
|
25
|
+
- [ ] This can be developed and tested with synthetic data only.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Security or privacy concern
|
|
3
|
+
about: Report a security or privacy issue without exposing sensitive data
|
|
4
|
+
title: "Security/privacy: "
|
|
5
|
+
labels: security, privacy
|
|
6
|
+
assignees: ""
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Before Posting
|
|
10
|
+
|
|
11
|
+
Do not include real patient data, secrets, credentials, private infrastructure details, or exploit
|
|
12
|
+
details that would create risk if public.
|
|
13
|
+
|
|
14
|
+
If synthetic data is enough to explain the issue, continue below. If sensitive details are required,
|
|
15
|
+
contact the maintainer through GitHub and request a private reporting path first.
|
|
16
|
+
|
|
17
|
+
## Summary
|
|
18
|
+
|
|
19
|
+
Describe the concern using synthetic examples only.
|
|
20
|
+
|
|
21
|
+
## Impact
|
|
22
|
+
|
|
23
|
+
What could go wrong?
|
|
24
|
+
|
|
25
|
+
## Synthetic Reproduction
|
|
26
|
+
|
|
27
|
+
```text
|
|
28
|
+
Use synthetic data only.
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Privacy Check
|
|
32
|
+
|
|
33
|
+
- [ ] This report uses synthetic data only.
|
|
34
|
+
- [ ] This report does not include real PHI, credentials, private emails, private IPs, or account tokens.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
## Summary
|
|
2
|
+
|
|
3
|
+
Describe the change and why it is needed.
|
|
4
|
+
|
|
5
|
+
## Impact
|
|
6
|
+
|
|
7
|
+
- [ ] PHI detection rules
|
|
8
|
+
- [ ] Redaction output
|
|
9
|
+
- [ ] Audit or validation output
|
|
10
|
+
- [ ] CLI behavior
|
|
11
|
+
- [ ] MCP behavior
|
|
12
|
+
- [ ] Documentation only
|
|
13
|
+
|
|
14
|
+
## Tests
|
|
15
|
+
|
|
16
|
+
List the commands or checks run.
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
python -m pytest -q
|
|
20
|
+
ruff check .
|
|
21
|
+
phi-guard gate --config .phi-guard.toml
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Privacy and Safety
|
|
25
|
+
|
|
26
|
+
- [ ] This PR uses synthetic data only.
|
|
27
|
+
- [ ] This PR does not include real PHI, credentials, private emails, private IPs, or account tokens.
|
|
28
|
+
- [ ] This PR does not add diagnosis, treatment, triage, medication, clinical risk scoring, or HIPAA compliance claims.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
pull_request:
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
test:
|
|
9
|
+
name: Python ${{ matrix.python-version }} on ${{ matrix.os }}
|
|
10
|
+
runs-on: ${{ matrix.os }}
|
|
11
|
+
strategy:
|
|
12
|
+
fail-fast: false
|
|
13
|
+
matrix:
|
|
14
|
+
os: [ubuntu-latest, windows-latest]
|
|
15
|
+
python-version: ["3.12"]
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: ${{ matrix.python-version }}
|
|
23
|
+
|
|
24
|
+
- name: Install package
|
|
25
|
+
run: python -m pip install --upgrade pip && python -m pip install -e ".[dev]"
|
|
26
|
+
|
|
27
|
+
- name: Ruff
|
|
28
|
+
run: ruff check .
|
|
29
|
+
|
|
30
|
+
- name: Compile
|
|
31
|
+
run: python -m compileall -q src tests
|
|
32
|
+
|
|
33
|
+
- name: Tests
|
|
34
|
+
run: python -m pytest -q
|
|
35
|
+
|
|
36
|
+
- name: Privacy gate
|
|
37
|
+
run: phi-guard gate --config .phi-guard.toml
|
|
38
|
+
|
|
39
|
+
- name: Build
|
|
40
|
+
run: python -m build
|
|
41
|
+
|
|
42
|
+
- name: Twine check
|
|
43
|
+
run: twine check dist/*
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
publish:
|
|
13
|
+
name: Build and publish distribution
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
environment:
|
|
16
|
+
name: pypi
|
|
17
|
+
url: https://pypi.org/project/phi-guard-mcp/
|
|
18
|
+
permissions:
|
|
19
|
+
contents: read
|
|
20
|
+
id-token: write
|
|
21
|
+
|
|
22
|
+
steps:
|
|
23
|
+
- uses: actions/checkout@v4
|
|
24
|
+
|
|
25
|
+
- uses: actions/setup-python@v5
|
|
26
|
+
with:
|
|
27
|
+
python-version: "3.12"
|
|
28
|
+
|
|
29
|
+
- name: Install build tools
|
|
30
|
+
run: python -m pip install --upgrade pip build twine
|
|
31
|
+
|
|
32
|
+
- name: Build distributions
|
|
33
|
+
run: python -m build
|
|
34
|
+
|
|
35
|
+
- name: Check distributions
|
|
36
|
+
run: twine check dist/*
|
|
37
|
+
|
|
38
|
+
- name: Publish distributions
|
|
39
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
[gate]
|
|
2
|
+
include = [
|
|
3
|
+
"README.md",
|
|
4
|
+
"docs/**/*.md",
|
|
5
|
+
"src/**/*.py",
|
|
6
|
+
"pyproject.toml",
|
|
7
|
+
]
|
|
8
|
+
exclude = [
|
|
9
|
+
".git/**",
|
|
10
|
+
".venv/**",
|
|
11
|
+
"dist/**",
|
|
12
|
+
"build/**",
|
|
13
|
+
"examples/**",
|
|
14
|
+
"tests/**",
|
|
15
|
+
"benchmarks/**",
|
|
16
|
+
"__pycache__/**",
|
|
17
|
+
]
|
|
18
|
+
allow_text = [
|
|
19
|
+
"https://developers.openai.com/community/codex-for-oss",
|
|
20
|
+
"https://developers.openai.com/codex/codex-for-oss-terms",
|
|
21
|
+
"https://github.com/charlesree826/phi-guard-mcp",
|
|
22
|
+
"https://github.com/charlesree826/phi-guard-mcp/issues",
|
|
23
|
+
"https://github.com/charlesree826/phi-guard-mcp/actions/workflows/ci.yml",
|
|
24
|
+
"https://github.com/charlesree826/phi-guard-mcp/actions/workflows/ci.yml/badge.svg",
|
|
25
|
+
"https://github.com/charlesree826/phi-guard-mcp/releases",
|
|
26
|
+
"https://github.com/charlesree826/phi-guard-mcp/releases/tag/v0.1.2",
|
|
27
|
+
"https://github.com/charlesree826/phi-guard-mcp/releases/download/v0.1.2/phi_guard_mcp-0.1.2-py3-none-any.whl",
|
|
28
|
+
"https://img.shields.io/github/license/charlesree826/phi-guard-mcp.svg",
|
|
29
|
+
"https://img.shields.io/github/v/release/charlesree826/phi-guard-mcp.svg",
|
|
30
|
+
"https://img.shields.io/badge/python-3.12%2B-blue.svg",
|
|
31
|
+
"https://pypi.org/project/phi-guard-mcp/",
|
|
32
|
+
"https://www.hhs.gov/hipaa/for-professionals/special-topics/de-identification/index.html",
|
|
33
|
+
"https://www.fda.gov/regulatory-information/search-fda-guidance-documents/clinical-decision-support-software",
|
|
34
|
+
"https://www.fda.gov/medical-devices/digital-health-center-excellence/device-software-functions-including-mobile-medical-applications",
|
|
35
|
+
"Jordan Rivera",
|
|
36
|
+
"MRN-48291",
|
|
37
|
+
"48291",
|
|
38
|
+
]
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We want this project to be useful for developers working on healthcare AI privacy and safety. We
|
|
6
|
+
expect participation to be professional, respectful, and focused on improving the software.
|
|
7
|
+
|
|
8
|
+
## Expected Behavior
|
|
9
|
+
|
|
10
|
+
- Use welcoming and inclusive language.
|
|
11
|
+
- Keep discussions technical, specific, and evidence-based.
|
|
12
|
+
- Respect privacy boundaries; never post real patient data or private identifiers.
|
|
13
|
+
- Accept maintainer decisions about scope, especially around clinical decision support and
|
|
14
|
+
compliance claims.
|
|
15
|
+
|
|
16
|
+
## Unacceptable Behavior
|
|
17
|
+
|
|
18
|
+
- Harassment, insults, or personal attacks.
|
|
19
|
+
- Publishing private information without permission.
|
|
20
|
+
- Posting real PHI, credentials, or sensitive infrastructure details.
|
|
21
|
+
- Pressuring maintainers to add diagnosis, treatment, triage, or compliance claims outside the
|
|
22
|
+
project scope.
|
|
23
|
+
|
|
24
|
+
## Enforcement
|
|
25
|
+
|
|
26
|
+
Maintainers may edit, hide, or remove comments, issues, pull requests, or contributions that violate
|
|
27
|
+
this code of conduct. Serious or repeated violations may lead to blocking from the project.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Contributing to phi-guard-mcp
|
|
2
|
+
|
|
3
|
+
Thanks for helping improve `phi-guard-mcp`. This project is healthcare AI privacy infrastructure,
|
|
4
|
+
not a clinical decision support tool. Contributions should keep that boundary clear.
|
|
5
|
+
|
|
6
|
+
## Ground Rules
|
|
7
|
+
|
|
8
|
+
- Do not submit real patient records, real medical identifiers, or private account data.
|
|
9
|
+
- Use synthetic examples only.
|
|
10
|
+
- Do not add diagnosis, treatment, triage, prognosis, medication, or clinical risk-scoring features.
|
|
11
|
+
- Keep outputs deterministic and reviewable.
|
|
12
|
+
- Preserve the stable JSON shape used by the Python API, CLI, and MCP tools unless a change is
|
|
13
|
+
explicitly discussed first.
|
|
14
|
+
|
|
15
|
+
## Development
|
|
16
|
+
|
|
17
|
+
Use Python 3.12.
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
python -m pip install -e ".[dev]"
|
|
21
|
+
python -m compileall -q src tests
|
|
22
|
+
python -m pytest -q
|
|
23
|
+
ruff check .
|
|
24
|
+
phi-guard gate --config .phi-guard.toml
|
|
25
|
+
python -m build
|
|
26
|
+
twine check dist/*
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Pull Requests
|
|
30
|
+
|
|
31
|
+
Please include:
|
|
32
|
+
|
|
33
|
+
- What changed and why.
|
|
34
|
+
- Whether the change affects PHI detection, redaction, audit output, CLI, or MCP behavior.
|
|
35
|
+
- The synthetic fixtures or tests used.
|
|
36
|
+
- Confirmation that no real PHI or private identifiers were added.
|
|
37
|
+
|
|
38
|
+
## Benchmark Cases
|
|
39
|
+
|
|
40
|
+
Benchmark cases must be synthetic. Expected findings should use exact `category` and `text` pairs so
|
|
41
|
+
regressions are easy to review.
|
|
42
|
+
|
|
43
|
+
## Security and Privacy Reports
|
|
44
|
+
|
|
45
|
+
Do not open a public issue with real PHI, secrets, exploit details, or private infrastructure data.
|
|
46
|
+
Use the process in `SECURITY.md`.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Charles Ree
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: phi-guard-mcp
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: MCP server and CLI for detecting, redacting, and auditing PHI before medical text is sent to AI agents.
|
|
5
|
+
Project-URL: Homepage, https://github.com/charlesree826/phi-guard-mcp
|
|
6
|
+
Project-URL: Repository, https://github.com/charlesree826/phi-guard-mcp
|
|
7
|
+
Project-URL: Issues, https://github.com/charlesree826/phi-guard-mcp/issues
|
|
8
|
+
Author: Charles Ree
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: de-identification,hipaa,mcp,medical-ai,phi,privacy
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: Healthcare Industry
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Topic :: Security
|
|
19
|
+
Classifier: Topic :: Text Processing
|
|
20
|
+
Requires-Python: >=3.12
|
|
21
|
+
Requires-Dist: anyio>=4.3.0
|
|
22
|
+
Requires-Dist: mcp>=1.2.0
|
|
23
|
+
Requires-Dist: pydantic>=2.6.0
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: build>=1.2.2; extra == 'dev'
|
|
26
|
+
Requires-Dist: pytest>=8.3.0; extra == 'dev'
|
|
27
|
+
Requires-Dist: ruff>=0.8.0; extra == 'dev'
|
|
28
|
+
Requires-Dist: twine>=5.1.0; extra == 'dev'
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
|
|
31
|
+
# phi-guard-mcp
|
|
32
|
+
|
|
33
|
+
[](https://github.com/charlesree826/phi-guard-mcp/actions/workflows/ci.yml)
|
|
34
|
+
[](https://github.com/charlesree826/phi-guard-mcp/releases)
|
|
35
|
+
[](pyproject.toml)
|
|
36
|
+
[](LICENSE)
|
|
37
|
+
|
|
38
|
+
MCP server and CLI for detecting, redacting, and auditing PHI before medical text is sent to AI
|
|
39
|
+
agents.
|
|
40
|
+
|
|
41
|
+
`phi-guard-mcp` is healthcare AI safety infrastructure, not a clinical product. It is a local,
|
|
42
|
+
rule-based guardrail that helps developers identify PHI-like identifiers in plain text, redact them
|
|
43
|
+
with stable placeholders, and produce audit-friendly JSON before content reaches an AI agent or MCP
|
|
44
|
+
workflow.
|
|
45
|
+
|
|
46
|
+
Proof points for maintainers:
|
|
47
|
+
|
|
48
|
+
- Synthetic benchmark with exact-match PHI finding evaluation.
|
|
49
|
+
- Safe Harbor mapping audit fields for review workflows.
|
|
50
|
+
- CI privacy gate that blocks PHI-like identifiers in maintained source and docs.
|
|
51
|
+
- CLI, Python API, and MCP stdio tools sharing one stable JSON result model.
|
|
52
|
+
|
|
53
|
+
Important scope limits:
|
|
54
|
+
|
|
55
|
+
- Not for diagnosis, treatment, triage, medical advice, or medication recommendations.
|
|
56
|
+
- Not a HIPAA compliance guarantee and not a substitute for legal, privacy, or security review.
|
|
57
|
+
- Not an FDA-regulated clinical decision support or device software function.
|
|
58
|
+
- Do not test with real patient records. The examples in this repo are synthetic.
|
|
59
|
+
|
|
60
|
+
The project aligns its documentation vocabulary with HHS HIPAA de-identification concepts such as
|
|
61
|
+
Safe Harbor and Expert Determination, while intentionally avoiding clinical decision support scope.
|
|
62
|
+
See [HHS de-identification guidance](https://www.hhs.gov/hipaa/for-professionals/special-topics/de-identification/index.html),
|
|
63
|
+
[FDA CDS guidance](https://www.fda.gov/regulatory-information/search-fda-guidance-documents/clinical-decision-support-software),
|
|
64
|
+
and [FDA device software functions](https://www.fda.gov/medical-devices/digital-health-center-excellence/device-software-functions-including-mobile-medical-applications).
|
|
65
|
+
|
|
66
|
+
## Install
|
|
67
|
+
|
|
68
|
+
Install from the current GitHub release wheel:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
python -m pip install https://github.com/charlesree826/phi-guard-mcp/releases/download/v0.1.2/phi_guard_mcp-0.1.2-py3-none-any.whl
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
For local development:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
python -m pip install -e ".[dev]"
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
PyPI publishing is configured through GitHub Actions trusted publishing and will be enabled after
|
|
81
|
+
the PyPI package owner creates the matching pending publisher entry for this repository.
|
|
82
|
+
|
|
83
|
+
## Quickstart
|
|
84
|
+
|
|
85
|
+
Scan a synthetic note:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
phi-guard scan examples/synthetic_clinical_note.txt
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Redact PHI-like identifiers:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
phi-guard redact examples/synthetic_clinical_note.txt --out /tmp/synthetic_redacted.txt
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Audit a note:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
phi-guard audit examples/synthetic_clinical_note.txt
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Validate text before it enters an AI agent:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
phi-guard validate examples/synthetic_clean_note.txt
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Run the synthetic benchmark:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
phi-guard benchmark benchmarks/synthetic/cases --out benchmarks/synthetic-report.json
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Run the repository privacy gate:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
phi-guard gate --config .phi-guard.toml
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
All CLI commands output stable JSON for automation.
|
|
122
|
+
|
|
123
|
+
See [docs/demo.md](docs/demo.md) for a complete CLI and MCP transcript.
|
|
124
|
+
|
|
125
|
+
## MCP Server
|
|
126
|
+
|
|
127
|
+
Run the stdio MCP server:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
phi-guard-mcp
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Available tools:
|
|
134
|
+
|
|
135
|
+
- `scan_phi(text)`
|
|
136
|
+
- `redact_phi(text, mode="placeholder")`
|
|
137
|
+
- `audit_deidentification(text)`
|
|
138
|
+
- `validate_no_phi(text)`
|
|
139
|
+
|
|
140
|
+
MCP tools return the same finding schema as the CLI, including `safe_harbor_identifier`.
|
|
141
|
+
|
|
142
|
+
Example MCP client config:
|
|
143
|
+
|
|
144
|
+
```json
|
|
145
|
+
{
|
|
146
|
+
"mcpServers": {
|
|
147
|
+
"phi-guard": {
|
|
148
|
+
"command": "phi-guard-mcp"
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Python API
|
|
155
|
+
|
|
156
|
+
```python
|
|
157
|
+
from phi_guard_mcp import audit_text, evaluate_benchmark, redact_text, scan_text, validate_no_phi
|
|
158
|
+
|
|
159
|
+
result = scan_text("Patient Name: Jordan Rivera, MRN: MRN-48291")
|
|
160
|
+
redacted = redact_text("Patient Name: Jordan Rivera, MRN: MRN-48291")
|
|
161
|
+
audit = audit_text("Patient Name: Jordan Rivera, MRN: MRN-48291")
|
|
162
|
+
validation = validate_no_phi("No identifiers are present in this synthetic note.")
|
|
163
|
+
benchmark = evaluate_benchmark("benchmarks/synthetic/cases")
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## What It Detects
|
|
167
|
+
|
|
168
|
+
The first release focuses on plain text and common PHI-like identifiers:
|
|
169
|
+
|
|
170
|
+
- Names in clinical label contexts
|
|
171
|
+
- Dates
|
|
172
|
+
- Phone numbers
|
|
173
|
+
- Email addresses
|
|
174
|
+
- Address-like fragments
|
|
175
|
+
- Medical record numbers
|
|
176
|
+
- Social Security numbers
|
|
177
|
+
- URLs and IP addresses
|
|
178
|
+
- Medical facility names
|
|
179
|
+
- Account, member, policy, and patient ID tokens
|
|
180
|
+
|
|
181
|
+
This is a deterministic heuristic engine. It favors transparent behavior and repeatable JSON over
|
|
182
|
+
opaque model judgment.
|
|
183
|
+
|
|
184
|
+
Safe Harbor mapping is included as a review aid only. It does not make output HIPAA compliant and
|
|
185
|
+
does not replace Expert Determination or legal review.
|
|
186
|
+
|
|
187
|
+
## Project Docs
|
|
188
|
+
|
|
189
|
+
- [Demo](docs/demo.md)
|
|
190
|
+
- [Synthetic benchmark](docs/benchmark.md)
|
|
191
|
+
- [Privacy gate](docs/privacy-gate.md)
|
|
192
|
+
- [Safety scope](docs/safety-scope.md)
|
|
193
|
+
- [Roadmap](docs/roadmap.md)
|
|
194
|
+
- [Contributing](CONTRIBUTING.md)
|
|
195
|
+
- [Security policy](SECURITY.md)
|
|
196
|
+
|
|
197
|
+
## Development
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
python -m compileall -q src tests
|
|
201
|
+
python -m pytest -q
|
|
202
|
+
ruff check .
|
|
203
|
+
phi-guard gate --config .phi-guard.toml
|
|
204
|
+
python -m build
|
|
205
|
+
twine check dist/*
|
|
206
|
+
```
|