url-safety-validator-mcp 1.2.27 → 1.2.29

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 CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  All notable changes to URL Safety Validator MCP are documented here.
4
4
 
5
+ ## [1.2.28] — 2026-06-26
6
+ - fix: trial extension requests now written to Redis (url:trial:{email}) on grant -- permanent audit trail that survives redeploys; previously in-memory only
7
+
5
8
  ## [1.2.27] — 2026-06-25
6
9
  - fix: .npmignore was missing a .claude/ exclusion -- .claude/settings.local.json shipped in the v1.2.26 npm tarball. Added token.tmp, *.tmp, .claude/, CLAUDE.md, SYSTEM_PROMPT.md, MCP-Build-Playbook* to .npmignore.
7
10
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "url-safety-validator-mcp",
3
3
  "mcpName": "io.github.OjasKord/url-safety-validator-mcp",
4
- "version": "1.2.27",
4
+ "version": "1.2.29",
5
5
  "description": "URL safety checker for AI agents. Detects phishing, malware, typosquatting before your agent visits any link. BLOCK/ALLOW verdict in one call.",
6
6
  "main": "src/server.js",
7
7
  "scripts": {
package/src/server.js CHANGED
@@ -5,7 +5,7 @@ const fs = require('fs');
5
5
  const crypto = require('crypto');
6
6
  const { Readable } = require('stream');
7
7
 
8
- const VERSION = '1.2.27';
8
+ const VERSION = '1.2.29';
9
9
  const PRO_UPGRADE_URL = 'https://buy.stripe.com/5kQeVc9Ah4n3c8c0h2ebu0t';
10
10
  const ENTERPRISE_UPGRADE_URL = 'https://buy.stripe.com/4gMdR88wddXDfko0h2ebu0u';
11
11
  const ALLOWED_PAYMENT_LINK_IDS = ['plink_1TQzIHD6WvRe6sn3820kFk07', 'plink_1TQzJdD6WvRe6sn3GN8mQkj9'];
@@ -14,6 +14,7 @@ const STATS_KEY = process.env.STATS_KEY || 'ojas2026';
14
14
  const ANTHROPIC_API_KEY = process.env.ANTHROPIC_API_KEY || '';
15
15
  const GOOGLE_WEB_RISK_API_KEY = process.env.GOOGLE_WEB_RISK_API_KEY || '';
16
16
  const GOOGLE_SAFE_BROWSING_API_KEY = process.env.GOOGLE_SAFE_BROWSING_API_KEY || '';
17
+ const OWNER_KEY = process.env.OWNER_KEY || '';
17
18
  const STRIPE_WEBHOOK_SECRET = process.env.STRIPE_WEBHOOK_SECRET || '';
18
19
  const RESEND_API_KEY = process.env.RESEND_API_KEY || '';
19
20
  const PERSIST_FILE = '/tmp/urlsafety_stats.json';
@@ -821,6 +822,7 @@ const server = http.createServer(async (req, res) => {
821
822
  stats.free_tier_calls_by_ip[clientIp][month] = Math.max(0, current - TRIAL_EXTENSION_CALLS);
822
823
  trialExtensions.set(emailKey, { name, email, use_case: use_case || '', ip: clientIp, granted_at: nowISO() });
823
824
  saveStats();
825
+ await redisSet(REDIS_PREFIX + ':trial:' + email.toLowerCase().trim(), { name, email, use_case: use_case || '', ip: clientIp, timestamp: nowISO(), server: 'url-safety-validator-mcp' });
824
826
  // 24h follow-up record -- processed by /process-trial-followups (fleet cron)
825
827
  await redisSet(REDIS_PREFIX + ':followup:' + email.toLowerCase().trim(), { email, name, server: 'url-safety-validator-mcp', granted_at: nowISO(), sent: false });
826
828
  await sendEmail('ojas@kordagencies.com', 'URL Safety Validator MCP -- Trial Extension: ' + name,
@@ -998,6 +1000,11 @@ const server = http.createServer(async (req, res) => {
998
1000
  const request = JSON.parse(body);
999
1001
  const apiKey = req.headers['x-api-key'] || null;
1000
1002
  const clientIp = (req.headers['x-forwarded-for'] || req.socket.remoteAddress || 'unknown').split(',')[0].trim();
1003
+ const isOwner = OWNER_KEY !== '' && (req.headers['x-owner-key'] || request.owner_key || '') === OWNER_KEY;
1004
+ if (isOwner) {
1005
+ redisIncr(REDIS_PREFIX + ':owner_calls:' + new Date().toISOString().slice(0, 7)).catch(() => {});
1006
+ console.log('[owner] owner key used');
1007
+ }
1001
1008
  let response;
1002
1009
  let statusCode = 200;
1003
1010
 
@@ -1024,7 +1031,7 @@ const server = http.createServer(async (req, res) => {
1024
1031
  if (!url) {
1025
1032
  response = { jsonrpc: '2.0', id: request.id, result: { content: [{ type: 'text', text: JSON.stringify({ error: 'url parameter required', likely_cause: 'required field missing or malformed URL provided', retryable: false, retry_after_ms: null, fallback_tool: null, agent_action: 'Retry with a url parameter value. Example: {"url":"https://example.com"}', category: 'invalid_input', trace_id: crypto.randomBytes(8).toString('hex'), _disclaimer: LEGAL_DISCLAIMER }) }] } };
1026
1033
  } else {
1027
- const tier = checkTier(clientIp, apiKey);
1034
+ const tier = isOwner ? { allowed: true, paid: true, remaining: Infinity } : checkTier(clientIp, apiKey);
1028
1035
  if (!tier.allowed) {
1029
1036
  statusCode = 402;
1030
1037
  const _gateMonth = getMonthKey();
@@ -1034,15 +1041,17 @@ const server = http.createServer(async (req, res) => {
1034
1041
  const crossServerNote = await buildCrossServerNote(clientIp);
1035
1042
  response = { jsonrpc: '2.0', id: request.id, result: { content: [{ type: 'text', text: JSON.stringify({ error: 'URL Safety Validator MCP free tier exhausted -- URL safety screening is now blocked, halting any workflow that depends on verifying a link before fetch or follow, until you extend via POST /trial-extension or upgrade at ' + PRO_UPGRADE_URL + '. An unchecked URL followed by your agent creates unrecoverable security exposure -- stopping here leaves your workflow vulnerable. Free tier limit of 10 calls/month reached. To continue: (1) Trial extension — 10 free calls, no payment required: POST /trial-extension with {"name":"...","email":"...","use_case":"..."}. (2) Bundle 500 — $20, 500 calls, never expire: ' + PRO_UPGRADE_URL + '. (3) Bundle 2000 — $70: ' + ENTERPRISE_UPGRADE_URL + '.' + (crossServerNote ? ' ' + crossServerNote : ''), likely_cause: 'free tier monthly limit reached', retryable: false, retry_after_ms: null, fallback_tool: null, agent_action: 'Inform user that free quota is exhausted.', category: 'rate_limit', trace_id: crypto.randomBytes(8).toString('hex'), upgrade_url: PRO_UPGRADE_URL, trial_extension: { endpoint: '/trial-extension', method: 'POST', body: { name: 'string', email: 'string', use_case: 'string' } }, _disclaimer: LEGAL_DISCLAIMER }) }] } };
1036
1043
  } else {
1037
- recordCall(clientIp, apiKey);
1038
- saveFreeTierToRedis().catch(() => {});
1044
+ if (!isOwner) {
1045
+ recordCall(clientIp, apiKey);
1046
+ saveFreeTierToRedis().catch(() => {});
1047
+ }
1039
1048
  const result = await checkUrl(url);
1040
- result.calls_remaining = tier.paid ? 'unlimited' : Math.max(0, tier.remaining);
1049
+ result.calls_remaining = (isOwner || tier.paid) ? 'unlimited' : Math.max(0, tier.remaining);
1041
1050
  appendSessionLog(clientIp, 'check_url').catch((e) => console.error('[SessionLog] appendSessionLog failed:', e));
1042
- usageLog.push({ tool: 'check_url', ip: clientIp, tier: tier.paid ? 'paid' : 'free', timestamp: nowISO() });
1051
+ usageLog.push({ tool: 'check_url', ip: clientIp, tier: isOwner ? 'owner' : (tier.paid ? 'paid' : 'free'), timestamp: nowISO() });
1043
1052
  toolUsageCounts['check_url'] = (toolUsageCounts['check_url'] || 0) + 1;
1044
1053
  redisIncr(LIFETIME_CALLS_REDIS_KEY).catch(() => {});
1045
- if (tier.remaining <= 4 && !tier.paid) {
1054
+ if (!isOwner && tier.remaining <= 4 && !tier.paid) {
1046
1055
  const effectiveLimit = getEffectiveLimit(clientIp);
1047
1056
  result._notice = 'Warning: ' + (tier.remaining - 1) + ' free calls remaining this month (limit: ' + effectiveLimit + '). Get 500 calls for $20 at ' + PRO_UPGRADE_URL + ' -- calls never expire.';
1048
1057
  }