Hospital WAF MCP
Click on "Deploy 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., "@Hospital WAF MCP check this HTTP request for SQL injection attempts"
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.
Hospital WAF Management System MCP Server
English | 中文
Hospital Web Application Firewall MCP server, providing WAF rule detection capabilities for AI assistants. It supports SQL injection, XSS, command injection, and path traversal detection, with built-in specialized rules for hospital scenarios.
✨ Features
🔒 SQL Injection Detection — Identifies common SQLi attack patterns (UNION injection, Boolean-based blind, Time-based blind, Error-based injection)
🎯 XSS Cross-Site Scripting Detection — Detects reflected/stored XSS (script tags, event handlers, JS URI)
⚡ Command Injection Detection — Identifies Unix/Windows system command execution attacks
📁 Path Traversal Detection — Detects directory traversal attacks and encoding bypasses
🏥 Hospital-Specific Rules — Covers common vulnerability patterns in HIS/PACS/LIS/RIS
🔄 Hot-Reload Rules — No service restart required after modifying rules
🧪 Self-Test — Built-in attack samples to verify engine capabilities
⚡ Lightweight Execution — Pure Python regex engine, no external dependencies
Related MCP server: Smart EHR MCP Server
🚀 Quick Start
1. Installation
# 克隆仓库
git clone https://github.com/12211725-star/hospital-waf-mcp.git
cd hospital-waf-mcp
# 安装依赖
pip install -r requirements-mcp.txt2. Integration into MCP Client
Add the following to your MCP client configuration file:
{
"mcpServers": {
"hospital-waf-mcp": {
"command": "python",
"args": ["-m", "waf_mcp"],
"env": {
"WAF_MCP_LOG_LEVEL": "INFO"
}
}
}
}Docker Method
{
"mcpServers": {
"hospital-waf-mcp": {
"command": "docker",
"args": ["run", "--rm", "-i", "hospital-waf-mcp"],
"env": {
"WAF_MCP_LOG_LEVEL": "INFO"
}
}
}
}Streamable HTTP Remote Deployment
export WAF_MCP_TRANSPORT=http
export WAF_MCP_HOST=0.0.0.0
export WAF_MCP_PORT=8000
python -m waf_mcpMCP Endpoint: http://<host>:8000/mcp
Health Check: GET /health
📖 Usage
Detect SQL Injection
In Claude / Cursor / other MCP clients:
请帮我检测这个请求是否有安全问题:
URL: https://example.com/search?q=1' OR '1'='1The AI will call the waf_check_request tool and return:
[
{
"rule_id": "sqli-001",
"category": "SQL Injection",
"severity": "high",
"matched": "1' OR '1'='1",
"description": "检测到 SQL 注入特征"
}
]Detect XSS Attacks
检测这个 POST 请求的 body:
<script>alert('xss')</script>View Rule Statistics
当前 WAF 引擎加载了多少规则?🎯 Prompt Guide
Security Assessment Scenarios
我需要对一个请求进行安全检测,
URL 是 https://hospital.example.com/api/patient?id=1 UNION SELECT,
请帮我分析是否存在攻击特征。Rule Maintenance Scenarios
我刚刚更新了 WAF 规则文件,
请帮我重新加载规则并确认加载成功。Engine Verification Scenarios
请运行 WAF 引擎自检测试,
确认 SQL 注入和 XSS 检测功能正常。Log Analysis Scenarios
帮我检测这个可疑请求的完整参数:
URL: https://api.hospital.com/query
Method: POST
Body: {"filter": "'; DROP TABLE users; --"}
Headers: {"Content-Type": "application/json"}🛠️ Tool List
Tool | Description | Parameters |
| WAF request detection |
|
| Rule statistics | None |
| Hot-reload rules | None |
| Self-test | None |
📖 Environment Variables
Variable | Description | Default Value |
| Transport protocol (stdio/http/sse) |
|
| HTTP listen address |
|
| HTTP listen port |
|
| Log level |
|
| Rules file path |
|
📋 Detection Capabilities
SQL Injection Detection
Risk Type | Severity | Detection Condition |
UNION Injection | High | UNION SELECT, etc. |
Boolean Blind | High | AND/OR Boolean expressions |
Time-based Blind | High | SLEEP/BENCHMARK, etc. |
Error-based | High | EXTRACTVALUE/UPDATEXML, etc. |
Stacked Queries | High | Multiple SQL statements separated by semicolons |
XSS Detection
Risk Type | Severity | Detection Condition |
script tag | High |
|
Event handlers | High | onclick/onerror, etc. |
JavaScript URI | Medium |
|
SVG injection | Medium |
|
Command Injection Detection
Risk Type | Severity | Detection Condition | |
Unix Command Injection | Critical | ; | & $ ` pipe connections |
Windows Command Injection | Critical | & | ^ command connections |
Dangerous Commands | Critical | cat/ls/wget/curl, etc. |
Path Traversal Detection
Risk Type | Severity | Detection Condition |
Directory Traversal | High |
|
URL Encoding Bypass | High |
|
Double Encoding Bypass | High |
|
Hospital-Specific Scenarios
System Type | Keywords |
HIS | Hospital Information System, Outpatient, Inpatient, Registration |
PACS | Imaging, DICOM, Radiology |
LIS | Laboratory, Lab, Biochemical |
RIS | Radiology Information System, Diagnostic Imaging |
EMR | Electronic Medical Record, Progress Notes |
🔧 Development
git clone https://github.com/12211725-star/hospital-waf-mcp.git
cd hospital-waf-mcp
pip install -e .
# 运行测试
python scripts/run_functional_tests.py
# 本地运行
python -m waf_mcp📁 Project Structure
hospital-waf-mcp/
├── waf_mcp/ # MCP 服务包
│ ├── __init__.py
│ ├── __main__.py
│ ├── config.py
│ ├── server.py
│ ├── version.py
│ ├── waf_engine.py
│ └── rules/
│ └── waf_rules.mcp.json
├── scripts/ # 脚本工具
├── modelscope.yaml # 魔搭配置
├── mcp.json # MCP 元数据
├── mcp_config.json # MCP 客户端配置
├── pyproject.toml # Python 项目配置
└── README.md📄 License
MIT License
🔗 Links
Issues: https://github.com/12211725-star/hospital-waf-mcp/issues
ModelScope MCP Plaza: https://modelscope.cn/mcp/servers
Available Tools
4 toolswaf_check_requestB
对 HTTP 请求做 WAF 规则检测,返回命中的告警列表(无命中则为空列表)。url 建议包含完整查询串。
Inputs: url, method, headers, body, +1 more. Returns: result
waf_reload_rulesA
重新从磁盘加载 WAF_RULES_FILE(或默认 rules/waf_rules.mcp.json)并编译。用于修改规则文件后无需重启 MCP。
Inputs: no named parameters. Returns: object
waf_rule_statsA
返回当前已加载规则的统计:含 rules_file、compiled_rules、compile_failed、compile_errors(截断)及分类计数。
Inputs: no named parameters. Returns: object
waf_run_self_testsA
运行内置 SQLi/XSS/命令注入/路径遍历样例,用于快速验证引擎是否检出攻击。
Inputs: no named parameters. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool has a clearly distinct purpose: checking requests, reloading rules, viewing statistics, and running self-tests. No two tools overlap in functionality.
All tool names follow a consistent 'waf_verb_noun' pattern using snake_case, with clear and descriptive verbs (check, reload, rule_stats, run_self_tests).
With 4 tools, the set is well-scoped for a WAF server, covering essential operations without being unnecessarily large or too minimal.
The tools cover the main use cases (request checking, rule management, statistics, testing). Minor gaps exist, such as no tool for individually viewing or modifying specific rules, but core workflows are supported.
Maintenance
Related MCP Connectors
A Model Context Protocol server for Wix AI tools
Real-time MCP & A2A prompt-injection, jailbreak, and tool-schema poisoning firewall for AI agents.
MCP server for secureFlows: token-free URL builders and integration-linting tools for AI agents.
Hosted MCP server exposing US hospital procedure cost data to AI assistants
Related MCP Servers
- AlicenseNot gradedqualityFmaintenanceA Model Context Protocol server that enables AI assistants to perform YARA rule-based threat analysis on files and URLs, supporting comprehensive rule management and detailed scanning results.23MIT
- AlicenseNot gradedqualityFmaintenanceA Model Context Protocol server that connects AI tools to Electronic Health Records using SMART on FHIR, allowing secure searching, querying, and analysis of patient data from compatible EHRs.88MIT
- AlicenseNot gradedqualityDmaintenanceMCP server for AI agent security guardrails. Provides input validation, prompt injection detection, PII redaction, output filtering, policy enforcement, rate limiting, and comprehensive audit logging.111 npm1MIT
- FlicenseNot gradedqualityDmaintenanceA Model Context Protocol server for LLM fuzzing and testing, providing secure access to multiple AI providers through a standardized interface.-