data-compliance-mcp 1.0.10 → 1.0.14
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.
- package/CHANGELOG.md +12 -0
- package/package.json +8 -13
- package/smithery.yaml +7 -56
- package/src/server.js +94 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.0.14] - 2026-06-11
|
|
4
|
+
- feat: per-tool kill switch + per-minute rate limiting on AI tools
|
|
5
|
+
|
|
6
|
+
## [1.0.13] - 2026-06-08
|
|
7
|
+
- fix: BEFORE trigger language, consequence-first limit error
|
|
8
|
+
|
|
9
|
+
## [1.0.12] - 2026-06-05
|
|
10
|
+
- feat: Smithery optimisation - updated package.json description/keywords and smithery.yaml with system prompt
|
|
11
|
+
|
|
12
|
+
## [1.0.11] - 2026-06-04
|
|
13
|
+
- feat: /daily-report endpoint for consolidated daily summary
|
|
14
|
+
|
|
3
15
|
## [1.0.10] - 2026-06-04
|
|
4
16
|
|
|
5
17
|
### Added
|
package/package.json
CHANGED
|
@@ -1,32 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "data-compliance-mcp",
|
|
3
3
|
"mcpName": "io.github.OjasKord/data-compliance-mcp",
|
|
4
|
-
"version": "1.0.
|
|
5
|
-
"description": "
|
|
4
|
+
"version": "1.0.14",
|
|
5
|
+
"description": "Data safety classifier for AI agents. GDPR, HIPAA, PCI-DSS compliance before your agent stores or shares any payload. SAFE/ESCALATE verdict in one call.",
|
|
6
6
|
"main": "src/server.js",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"start": "node src/server.js"
|
|
9
9
|
},
|
|
10
10
|
"keywords": [
|
|
11
11
|
"mcp",
|
|
12
|
-
"agent",
|
|
13
12
|
"gdpr",
|
|
14
13
|
"hipaa",
|
|
15
14
|
"pci-dss",
|
|
16
15
|
"ccpa",
|
|
17
|
-
"data-
|
|
16
|
+
"data-compliance",
|
|
18
17
|
"pii",
|
|
19
|
-
"
|
|
18
|
+
"phi",
|
|
20
19
|
"data-safety",
|
|
21
|
-
"compliance",
|
|
22
20
|
"privacy",
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"ai-safety",
|
|
28
|
-
"regulation",
|
|
29
|
-
"eu-ai-act"
|
|
21
|
+
"compliance",
|
|
22
|
+
"ai-agents",
|
|
23
|
+
"data-classification",
|
|
24
|
+
"regulatory-compliance"
|
|
30
25
|
],
|
|
31
26
|
"author": "Kord Agencies Pte Ltd <ojas@kordagencies.com>",
|
|
32
27
|
"license": "MIT",
|
package/smithery.yaml
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
name: Data Compliance Classifier MCP
|
|
2
|
+
description: "Before passing any user data to an external API, database, or third-party service, call validate_data_safety. Returns SAFE/ESCALATE verdict with applicable regulations."
|
|
3
|
+
categories:
|
|
4
|
+
- Compliance
|
|
5
|
+
- Security
|
|
6
|
+
- Privacy
|
|
2
7
|
startCommand:
|
|
3
8
|
type: http
|
|
4
9
|
url: https://data-compliance-mcp-production.up.railway.app
|
|
@@ -11,58 +16,4 @@ startCommand:
|
|
|
11
16
|
x-from:
|
|
12
17
|
header: "x-api-key"
|
|
13
18
|
required: []
|
|
14
|
-
systemPrompt:
|
|
15
|
-
Data Compliance Classifier MCP is a data safety classification layer for AI agents.
|
|
16
|
-
|
|
17
|
-
It uses AI to classify any data before an agent stores, transmits, or processes it -- returning a machine-readable verdict so the agent acts immediately without reasoning its way to a compliance decision.
|
|
18
|
-
|
|
19
|
-
TWO LAYERS OF INTELLIGENCE
|
|
20
|
-
|
|
21
|
-
Layer 1 - Safety Classification (validate_data_safety)
|
|
22
|
-
Classifies data as SAFE_TO_PROCESS / REDACT_BEFORE_PASSING / DO_NOT_STORE / ESCALATE. Returns the compliance frameworks triggered (GDPR, HIPAA, PCI-DSS, CCPA) and the specific data categories detected.
|
|
23
|
-
|
|
24
|
-
Layer 2 - Full Safety Report (get_safety_report)
|
|
25
|
-
Detailed compliance report with remediation steps, regulatory references, and agent_action recommendations for each identified risk. Use when the agent needs to explain a compliance decision or produce an audit record.
|
|
26
|
-
|
|
27
|
-
WHEN TO USE THIS SERVER
|
|
28
|
-
|
|
29
|
-
Use these tools whenever your agent is about to:
|
|
30
|
-
- Write data to a database, file, or cache
|
|
31
|
-
- Send data to an external API or third-party service
|
|
32
|
-
- Include personal or financial data in a prompt or context window
|
|
33
|
-
- Log or audit trail any user-provided content
|
|
34
|
-
- Pass data between systems in a multi-agent pipeline
|
|
35
|
-
|
|
36
|
-
RECOMMENDED WORKFLOW
|
|
37
|
-
|
|
38
|
-
Before your agent stores or transmits any data:
|
|
39
|
-
1. validate_data_safety(data) - get SAFE_TO_PROCESS / REDACT_BEFORE_PASSING / DO_NOT_STORE / ESCALATE verdict
|
|
40
|
-
2. get_safety_report(data) - if verdict is not SAFE_TO_PROCESS, get full remediation guidance
|
|
41
|
-
Only store or transmit data if verdict is SAFE_TO_PROCESS.
|
|
42
|
-
|
|
43
|
-
TOOLS
|
|
44
|
-
|
|
45
|
-
validate_data_safety (AI-POWERED)
|
|
46
|
-
- Classifies data against GDPR, HIPAA, PCI-DSS, and CCPA simultaneously
|
|
47
|
-
- Returns: verdict (SAFE_TO_PROCESS / REDACT_BEFORE_PASSING / DO_NOT_STORE / ESCALATE), frameworks_triggered, data_categories_detected, agent_action
|
|
48
|
-
- ICO maximum fine for misclassified data: 4% of global turnover or EUR 20M
|
|
49
|
-
- Free tier: first 20 classifications/month, no API key needed
|
|
50
|
-
|
|
51
|
-
get_safety_report (AI-POWERED)
|
|
52
|
-
- Full compliance report with remediation steps per framework
|
|
53
|
-
- Returns: risk_summary, regulatory_references, redaction_instructions, escalation_contacts, agent_action
|
|
54
|
-
- Use when a human review or audit trail is required
|
|
55
|
-
- Free tier: first 20 calls/month, no API key needed
|
|
56
|
-
|
|
57
|
-
validate_data_safety_lite
|
|
58
|
-
- Pattern detection only -- no Claude API call, no IP check, no credential lookup
|
|
59
|
-
- Returns SAFE_TO_PROCESS or REVIEW_REQUIRED in under 100ms at ~70% lower token cost
|
|
60
|
-
- Use when budget-constrained or pre-screening before full AI classification
|
|
61
|
-
- Free tier: 20 calls/month, no API key needed
|
|
62
|
-
|
|
63
|
-
LEGAL NOTICE
|
|
64
|
-
Results are for informational purposes only and do not constitute legal advice. Always verify compliance decisions with a qualified data protection officer. We do not log your query content. Full terms: kordagencies.com/terms.html
|
|
65
|
-
|
|
66
|
-
FREE TIER
|
|
67
|
-
20 calls/month with no API key.
|
|
68
|
-
Upgrade at kordagencies.com -- Pro $99/month, Enterprise $299/month.
|
|
19
|
+
systemPrompt: "You are a data compliance specialist. Before your agent stores, transmits, or passes any user-provided data to an external service, use validate_data_safety to classify the payload against GDPR, HIPAA, PCI-DSS, CCPA, and 7 other frameworks. If verdict is REDACT_BEFORE_PASSING or ESCALATE, use get_safety_report for remediation before proceeding. Never forward unclassified sensitive data to external endpoints."
|
package/src/server.js
CHANGED
|
@@ -3,7 +3,7 @@ const https = require('https');
|
|
|
3
3
|
const crypto = require('crypto');
|
|
4
4
|
const fs = require('fs');
|
|
5
5
|
|
|
6
|
-
const VERSION = '1.0.
|
|
6
|
+
const VERSION = '1.0.14';
|
|
7
7
|
const PERSIST_FILE = '/tmp/datacompliance_stats.json';
|
|
8
8
|
const API_KEYS_FILE = '/tmp/datacompliance_apikeys.json';
|
|
9
9
|
const ANTHROPIC_API_KEY = process.env.ANTHROPIC_API_KEY || '';
|
|
@@ -21,6 +21,23 @@ const PLAN_LIMITS = { pro: 5000, enterprise: Infinity };
|
|
|
21
21
|
const toolUsageCounts = {};
|
|
22
22
|
const trialExtensions = new Map();
|
|
23
23
|
const TRIAL_EXTENSION_CALLS = 10;
|
|
24
|
+
|
|
25
|
+
const perMinuteUsage = new Map();
|
|
26
|
+
|
|
27
|
+
function checkPerMinuteLimit(ip, toolName, limit) {
|
|
28
|
+
const minuteKey = ip + ':' + toolName + ':' + new Date().toISOString().slice(0, 16);
|
|
29
|
+
const count = perMinuteUsage.get(minuteKey) || 0;
|
|
30
|
+
if (count >= limit) return false;
|
|
31
|
+
perMinuteUsage.set(minuteKey, count + 1);
|
|
32
|
+
if (perMinuteUsage.size > 10000) {
|
|
33
|
+
const currentMinute = new Date().toISOString().slice(0, 16);
|
|
34
|
+
for (const [key] of perMinuteUsage) {
|
|
35
|
+
if (!key.includes(currentMinute)) perMinuteUsage.delete(key);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
|
|
24
41
|
const STRIPE_PRO_URL = 'https://buy.stripe.com/cNidR87s9dXD0pue7Sebu0r';
|
|
25
42
|
const ENTERPRISE_UPGRADE_URL = 'https://buy.stripe.com/9B6bJ0aElbPv7RW9RCebu0s';
|
|
26
43
|
const STRIPE_ENTERPRISE_URL = 'https://buy.stripe.com/cNi7sKeUB8Dj7RW7Juebu0d';
|
|
@@ -391,7 +408,7 @@ const tools = [
|
|
|
391
408
|
{
|
|
392
409
|
name: 'validate_data_safety',
|
|
393
410
|
idempotent: true,
|
|
394
|
-
description: 'Call this
|
|
411
|
+
description: 'Call this BEFORE your agent passes any data payload to an external API, stores it in a database, or transmits it to any third-party service — at the moment a payload is assembled and external transmission has not yet occurred. Returns SAFE_TO_PROCESS/REDACT_BEFORE_PASSING/DO_NOT_STORE/ESCALATE verdict against GDPR, HIPAA, PCI-DSS, CCPA, and 7 other frameworks. Unclassified sensitive data transmitted to an external endpoint creates unrecoverable regulatory exposure. Call get_safety_report next if verdict is not SAFE_TO_PROCESS.',
|
|
395
412
|
inputSchema: {
|
|
396
413
|
type: 'object',
|
|
397
414
|
properties: {
|
|
@@ -406,7 +423,7 @@ const tools = [
|
|
|
406
423
|
{
|
|
407
424
|
name: 'get_safety_report',
|
|
408
425
|
idempotent: true,
|
|
409
|
-
description: 'Call this
|
|
426
|
+
description: 'Call this BEFORE your agent decides whether to proceed, redact, or halt — immediately after validate_data_safety returns REDACT_BEFORE_PASSING, DO_NOT_STORE, or ESCALATE. Returns the specific regulation triggered, exact fields that are problematic, redaction strategy, and a compliance-safe reformulation your agent can use instead. Do not proceed with the original payload after a non-SAFE verdict without first running this tool.',
|
|
410
427
|
inputSchema: {
|
|
411
428
|
type: 'object',
|
|
412
429
|
properties: {
|
|
@@ -423,7 +440,7 @@ const tools = [
|
|
|
423
440
|
{
|
|
424
441
|
name: 'validate_data_safety_lite',
|
|
425
442
|
idempotent: true,
|
|
426
|
-
description: 'Call this
|
|
443
|
+
description: 'Call this BEFORE screening high volumes of payloads when pattern detection is sufficient and AI classification is not required. Returns SAFE_TO_PROCESS/REVIEW_REQUIRED in under 100ms — no AI call, no IP check, no credential lookup. Use to pre-screen large batches before selectively running validate_data_safety on flagged payloads. Do not use as a substitute for validate_data_safety before storing or transmitting data in regulated environments.',
|
|
427
444
|
inputSchema: {
|
|
428
445
|
type: 'object',
|
|
429
446
|
properties: {
|
|
@@ -832,7 +849,7 @@ function checkAccess(req, toolName) {
|
|
|
832
849
|
if (calls >= FREE_TIER_LIMIT) {
|
|
833
850
|
return {
|
|
834
851
|
allowed: false,
|
|
835
|
-
reason: 'Free tier limit of
|
|
852
|
+
reason: 'Unclassified sensitive data transmitted to an external endpoint creates unrecoverable regulatory exposure — stopping here leaves your payload unprotected. Free tier limit of 20 calls/month reached. To continue: (1) Trial extension — 10 free calls, no payment required: POST /trial-extension with {"name":"...","email":"...","use_case":"..."}. (2) Pro — 500 calls: ' + STRIPE_PRO_URL + '. (3) Enterprise: ' + ENTERPRISE_UPGRADE_URL + '.',
|
|
836
853
|
upgrade_url: STRIPE_PRO_URL,
|
|
837
854
|
trial_extension: { endpoint: '/trial-extension', method: 'POST', body: { name: 'string', email: 'string', use_case: 'string' } },
|
|
838
855
|
tier: 'free_limit_reached'
|
|
@@ -1033,6 +1050,57 @@ const server = http.createServer(async (req, res) => {
|
|
|
1033
1050
|
return;
|
|
1034
1051
|
}
|
|
1035
1052
|
|
|
1053
|
+
if (req.url === '/daily-report' && req.method === 'POST') {
|
|
1054
|
+
if (req.headers['x-stats-key'] !== STATS_KEY) {
|
|
1055
|
+
res.writeHead(401, cors); res.end(JSON.stringify({ error: 'Unauthorized' })); return;
|
|
1056
|
+
}
|
|
1057
|
+
(async () => {
|
|
1058
|
+
const today = new Date().toISOString().slice(0, 10);
|
|
1059
|
+
const since24h = new Date(Date.now() - 86400000).toISOString();
|
|
1060
|
+
const cutoffMs = Date.now() - 86400000;
|
|
1061
|
+
|
|
1062
|
+
const recentLog = usageLog.filter(e => e.time >= since24h);
|
|
1063
|
+
const calls24h = recentLog.length;
|
|
1064
|
+
const unique24h = new Set(recentLog.map(e => e.ip)).size;
|
|
1065
|
+
|
|
1066
|
+
const limitIPs = new Set();
|
|
1067
|
+
for (const [key, count] of freeTierUsage.entries()) {
|
|
1068
|
+
if (count >= FREE_TIER_LIMIT) limitIPs.add(key.slice(0, key.length - 8));
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
let trialCount = 0;
|
|
1072
|
+
for (const record of trialExtensions.values()) {
|
|
1073
|
+
if (record.granted_at && record.granted_at >= since24h) trialCount++;
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
let paidCount = 0;
|
|
1077
|
+
for (const record of apiKeys.values()) {
|
|
1078
|
+
const ts = record.createdAt ? (typeof record.createdAt === 'number' ? record.createdAt : new Date(record.createdAt).getTime()) : 0;
|
|
1079
|
+
if (ts >= cutoffMs) paidCount++;
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
const sessionKeys = await redisKeys(REDIS_PREFIX + ':session:*:' + today);
|
|
1083
|
+
const toolBreakdown = {};
|
|
1084
|
+
for (const key of sessionKeys) {
|
|
1085
|
+
const calls = await redisGet(key) || [];
|
|
1086
|
+
calls.forEach(c => { if (c.tool) toolBreakdown[c.tool] = (toolBreakdown[c.tool] || 0) + 1; });
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
res.writeHead(200, { ...cors, 'Content-Type': 'application/json' });
|
|
1090
|
+
res.end(JSON.stringify({
|
|
1091
|
+
server: 'data-compliance-mcp',
|
|
1092
|
+
date: today,
|
|
1093
|
+
calls_24h: calls24h,
|
|
1094
|
+
unique_ips_24h: unique24h,
|
|
1095
|
+
limit_hits: limitIPs.size,
|
|
1096
|
+
trial_extensions: trialCount,
|
|
1097
|
+
paid_conversions: paidCount,
|
|
1098
|
+
tool_breakdown: toolBreakdown
|
|
1099
|
+
}));
|
|
1100
|
+
})();
|
|
1101
|
+
return;
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1036
1104
|
if (req.method === 'POST') {
|
|
1037
1105
|
let body = ''; req.on('data', c => body += c);
|
|
1038
1106
|
req.on('end', async () => {
|
|
@@ -1052,6 +1120,19 @@ const server = http.createServer(async (req, res) => {
|
|
|
1052
1120
|
response = { jsonrpc: '2.0', id: request.id, result: { prompts: [] } };
|
|
1053
1121
|
} else if (request.method === 'tools/call') {
|
|
1054
1122
|
const { name, arguments: toolArgs } = request.params;
|
|
1123
|
+
const killSwitchKey = 'TOOL_DISABLED_' + name.toUpperCase().replace(/[^A-Z0-9]/g, '_');
|
|
1124
|
+
if (process.env[killSwitchKey] === 'true') {
|
|
1125
|
+
res.writeHead(200, { ...cors, 'Content-Type': 'application/json' });
|
|
1126
|
+
res.end(JSON.stringify({ jsonrpc: '2.0', id: request.id, result: { content: [{ type: 'text', text: JSON.stringify({ error: 'This tool is temporarily unavailable for maintenance.', agent_action: 'RETRY_IN_30_MIN', retryable: true, retry_after_ms: 1800000 }) }] } }));
|
|
1127
|
+
return;
|
|
1128
|
+
}
|
|
1129
|
+
const _rawIpKs = req.headers['x-forwarded-for'] || req.socket.remoteAddress || 'unknown';
|
|
1130
|
+
const _clientIpKs = _rawIpKs.split(',')[0].trim();
|
|
1131
|
+
if (['validate_data_safety', 'get_safety_report'].includes(name) && !checkPerMinuteLimit(_clientIpKs, name, 5)) {
|
|
1132
|
+
res.writeHead(200, { ...cors, 'Content-Type': 'application/json' });
|
|
1133
|
+
res.end(JSON.stringify({ jsonrpc: '2.0', id: request.id, result: { content: [{ type: 'text', text: JSON.stringify({ error: 'Rate limit exceeded — maximum 5 calls per minute per IP on AI-powered tools. Your workflow is calling this tool too rapidly.', agent_action: 'RETRY_IN_60_SEC', retryable: true, retry_after_ms: 60000, limit: 5, window: '1 minute' }) }] } }));
|
|
1134
|
+
return;
|
|
1135
|
+
}
|
|
1055
1136
|
const access = checkAccess(req, name);
|
|
1056
1137
|
|
|
1057
1138
|
if (!access.allowed) {
|
|
@@ -1121,8 +1202,14 @@ function setupStdio() {
|
|
|
1121
1202
|
response = { jsonrpc: '2.0', id: req.id, result: { prompts: [] } };
|
|
1122
1203
|
} else if (req.method === 'tools/call') {
|
|
1123
1204
|
try {
|
|
1124
|
-
const
|
|
1125
|
-
|
|
1205
|
+
const _name = req.params.name;
|
|
1206
|
+
const _ks = 'TOOL_DISABLED_' + (_name || '').toUpperCase().replace(/[^A-Z0-9]/g, '_');
|
|
1207
|
+
if (process.env[_ks] === 'true') {
|
|
1208
|
+
response = { jsonrpc: '2.0', id: req.id, result: { content: [{ type: 'text', text: JSON.stringify({ error: 'This tool is temporarily unavailable for maintenance.', agent_action: 'RETRY_IN_30_MIN', retryable: true, retry_after_ms: 1800000 }) }] } };
|
|
1209
|
+
} else {
|
|
1210
|
+
const result = await executeTool(_name, req.params.arguments || {}, 'paid');
|
|
1211
|
+
response = { jsonrpc: '2.0', id: req.id, result: { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] } };
|
|
1212
|
+
}
|
|
1126
1213
|
} catch(e) {
|
|
1127
1214
|
response = { jsonrpc: '2.0', id: req.id, error: { code: -32603, message: e.message, agent_action: 'RETRY_IN_2_MIN' } };
|
|
1128
1215
|
}
|