phi-guard-mcp
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@phi-guard-mcpscan this note for PHI"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
phi-guard-mcp
MCP server and CLI for detecting, redacting, and auditing PHI before medical text is sent to AI agents.
phi-guard-mcp is healthcare AI safety infrastructure, not a clinical product. It is a local,
rule-based guardrail that helps developers identify PHI-like identifiers in plain text, redact them
with stable placeholders, and produce audit-friendly JSON before content reaches an AI agent or MCP
workflow.
Proof points for maintainers:
Synthetic benchmark with exact-match PHI finding evaluation.
Safe Harbor mapping audit fields for review workflows.
CI privacy gate that blocks PHI-like identifiers in maintained source and docs.
CLI, Python API, and MCP stdio tools sharing one stable JSON result model.
Important scope limits:
Not for diagnosis, treatment, triage, medical advice, or medication recommendations.
Not a HIPAA compliance guarantee and not a substitute for legal, privacy, or security review.
Not an FDA-regulated clinical decision support or device software function.
Do not test with real patient records. The examples in this repo are synthetic.
The project aligns its documentation vocabulary with HHS HIPAA de-identification concepts such as Safe Harbor and Expert Determination, while intentionally avoiding clinical decision support scope. See HHS de-identification guidance, FDA CDS guidance, and FDA device software functions.
Install
python -m pip install phi-guard-mcpFor local development:
python -m pip install -e ".[dev]"Related MCP server: phi-redact-mcp
Quickstart
Scan a synthetic note:
phi-guard scan examples/synthetic_clinical_note.txtRedact PHI-like identifiers:
phi-guard redact examples/synthetic_clinical_note.txt --out /tmp/synthetic_redacted.txtAudit a note:
phi-guard audit examples/synthetic_clinical_note.txtValidate text before it enters an AI agent:
phi-guard validate examples/synthetic_clean_note.txtRun the synthetic benchmark:
phi-guard benchmark benchmarks/synthetic/cases --out benchmarks/synthetic-report.jsonRun the repository privacy gate:
phi-guard gate --config .phi-guard.tomlAll CLI commands output stable JSON for automation.
See docs/demo.md for a complete CLI and MCP transcript.
MCP Server
Run the stdio MCP server:
phi-guard-mcpAvailable tools:
scan_phi(text)redact_phi(text, mode="placeholder")audit_deidentification(text)validate_no_phi(text)
MCP tools return the same finding schema as the CLI, including safe_harbor_identifier.
Example MCP client config:
{
"mcpServers": {
"phi-guard": {
"command": "phi-guard-mcp"
}
}
}Python API
from phi_guard_mcp import audit_text, evaluate_benchmark, redact_text, scan_text, validate_no_phi
result = scan_text("Patient Name: Jordan Rivera, MRN: MRN-48291")
redacted = redact_text("Patient Name: Jordan Rivera, MRN: MRN-48291")
audit = audit_text("Patient Name: Jordan Rivera, MRN: MRN-48291")
validation = validate_no_phi("No identifiers are present in this synthetic note.")
benchmark = evaluate_benchmark("benchmarks/synthetic/cases")What It Detects
The first release focuses on plain text and common PHI-like identifiers:
Names in clinical label contexts
Dates
Phone numbers
Email addresses
Address-like fragments
Medical record numbers
Social Security numbers
URLs and IP addresses
Medical facility names
Account, member, policy, and patient ID tokens
This is a deterministic heuristic engine. It favors transparent behavior and repeatable JSON over opaque model judgment.
Safe Harbor mapping is included as a review aid only. It does not make output HIPAA compliant and does not replace Expert Determination or legal review.
Project Docs
Development
python -m compileall -q src tests
python -m pytest -q
ruff check .
phi-guard gate --config .phi-guard.toml
python -m build
twine check dist/*Available Tools
4 toolsaudit_deidentificationB
Return an audit-oriented summary of PHI-like identifiers and limitations.
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | Plain text to inspect. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description must disclose behavioral traits. It states 'audit-oriented summary,' hinting at a read-only operation, but fails to detail whether it modifies data, requires special permissions, or returns paginated results.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, well-structured sentence that is concise. However, it could be slightly longer to cover key details without becoming verbose.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the lack of output schema, the description should explain what the summary contains more precisely. Currently, it vaguely mentions 'PHI-like identifiers and limitations,' which is insufficient for an agent to anticipate the output.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, and the parameter 'text' is described in the schema as 'Plain text to inspect.' The tool description adds no additional meaning beyond this.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb 'return' and resource 'audit-oriented summary of PHI-like identifiers and limitations,' which differentiates it from sibling tools like 'redact_phi' (modification) and 'scan_phi' (detection). However, it does not explicitly contrast with 'validate_no_phi'.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage for auditing (e.g., compliance review) but does not specify when to prefer this tool over alternatives or provide exclusions. Sibling names offer some context, but no explicit guidance.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
redact_phiB
Detect and redact PHI-like identifiers with placeholders.
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | Redaction mode. | placeholder |
| text | Yes | Plain text to inspect. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description bears full burden but only states 'detect and redact with placeholders.' It does not disclose how detection works, what patterns are matched, whether the operation is destructive, or the format of the output.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single concise sentence. It is front-loaded but could be slightly expanded to include behavioral details without losing conciseness.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a tool that modifies data with no annotations or output schema, the description lacks completeness. It does not explain the redaction process, return value, or constraints. With three siblings, more context is needed.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema covers 100% of parameters. The description adds no information beyond the schema; the parameters 'text' and 'mode' are already described adequately in the input schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool redacts PHI-like identifiers with placeholders. This distinguishes it from siblings: audit_deidentification (auditing), scan_phi (scanning), and validate_no_phi (validating absence).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No explicit guidance on when to use this tool versus alternatives. The description does not mention prerequisites, preferred scenarios, or when not to use it.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
scan_phiB
Detect PHI-like identifiers and return structured findings.
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | Plain text to inspect. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, and the description only states the tool's function without disclosing behavioral traits. It does not explicitly state that the tool is read-only or non-destructive, nor does it describe any side effects, limitations, or security considerations.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single sentence with no superfluous words. It is appropriately concise and front-loaded with the core functionality.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple tool with one parameter and no output schema, the description lacks critical context. It does not describe what 'structured findings' look like, the types of PHI identifiers detected, or any constraints on the input text length or format.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100% since the single parameter 'text' is described in the schema ('Plain text to inspect.'). The description adds no additional meaning beyond the schema, achieving the baseline score.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description 'Detect PHI-like identifiers and return structured findings' clearly states the tool's action (detect) and resource (PHI-like identifiers), and distinguishes it from siblings like 'redact_phi' (redact) and 'validate_no_phi' (validate absence). The verb 'scan' in the name is supported.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No usage guidelines are provided. The description does not mention when to use this tool vs alternatives (audit_deidentification, redact_phi, validate_no_phi), nor does it specify prerequisites or context.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
validate_no_phiB
Validate whether text has no detected PHI-like identifiers.
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | Plain text to inspect. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description adds some value by indicating the tool checks for PHI-like identifiers but does not specify the output format (e.g., boolean, report) or behavior upon detection, limiting transparency.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single sentence with no waste, but it could be slightly more informative without losing conciseness.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given no output schema, the description fails to explain what the call returns. It also does not address when to use this validation versus scanning (scan_phi) for finding specific PHI items.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage for parameters is 100% with clear descriptions; the tool's description does not add meaning beyond the schema, so baseline score of 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool validates whether text has no detected PHI-like identifiers, using a specific verb and resource. This distinguishes it from siblings like audit_deidentification, redact_phi, and scan_phi.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance on when to use this tool versus alternatives. The description does not mention conditions for use, exclusions, or comparison to siblings.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
4 tool updates
v0.1.1- First observed
audit_deidentification - First observed
redact_phi - First observed
scan_phi - First observed
validate_no_phi
TDQS
Each tool serves a distinct purpose: scanning, redacting, validating absence, and auditing. There is no overlap in function.
Tools follow a verb_phi or verb_deidentification pattern, but 'audit_deidentification' uses a different noun than the others ('phi'), causing slight inconsistency.
Four tools is appropriate for a focused PHI detection/redaction server. It covers key operations without excess.
The set covers detection, redaction, validation, and audit. A minor gap is the lack of a tool to manage or customize identifier patterns, but the core workflow is complete.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
MCP server for detecting and redacting PII (Personally Identifiable Information) in PDF documents.
HealthGuard - 12-tool health/medical AI safety MCP: PII redaction, HIPAA, GDPR Art.9.
Security & DLP proxy for MCP: tool-poisoning scans, PII redaction on tool args/results. Beta.
Security scanner for MCP servers. Detect vulnerabilities, prompt injection, and tool poisoning.
Related MCP Servers
- AlicenseAqualityAmaintenanceMCP server and CLI for detecting, redacting, and auditing PHI in medical text before it reaches AI agents.4MIT
- AlicenseAqualityAmaintenanceAn MCP server that redacts PII/PHI from text before it ever reaches an LLM — self-hosted, fail-closed, and HIPAA-aware.3MIT
- AlicenseAqualityAmaintenanceOpen-source guardrails between AI agents and FHIR clinical data — PHI redaction, immutable audit, step-up auth, tenant isolation. MCP server + OpenAI/Gemini adapters. A healthclaw.io project.2930MIT
- AlicenseAqualityBmaintenanceMCP server providing on-prem PII detection and anonymization tools (scan and is_sensitive) for AI agents, ensuring data stays local.4MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/dcl632/phi-guard-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server