0nmcp 2.9.0 → 2.9.2

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.
@@ -0,0 +1,353 @@
1
+ /**
2
+ * 0nMCP — Universal Email Sequence Engine
3
+ * Replaces CRM workflow builder entirely. Every client gets automated
4
+ * sequences triggered by tags/events. Runs as code, not CRM workflows.
5
+ *
6
+ * Used by: SXO, 0nCore, 0nMCP, every future client
7
+ */
8
+
9
+ const CRM_BASE = 'https://services.leadconnectorhq.com'
10
+ const CRM_VERSION = '2021-07-28'
11
+
12
+ /**
13
+ * Sequence definitions — each has steps with delays and actions
14
+ */
15
+ export const SEQUENCES = {
16
+
17
+ // ── SXO FREE SCAN ─────────────────────────────────────
18
+ 'sxo-free-scan': {
19
+ name: 'SXO Free Scan Follow-Up',
20
+ trigger: 'tag:sxo-scan',
21
+ steps: [
22
+ {
23
+ delay: 60, // 1 minute
24
+ action: 'email',
25
+ subject: 'Your Free SXO Score Report — {{sxo_domain}}',
26
+ body: `Hi {{firstName}},
27
+
28
+ Your SXO score for {{sxo_domain}} is **{{sxo_score}}/100** (Grade: {{sxo_grade}}).
29
+
30
+ Here's what that means:
31
+ {{#if (gte sxo_score 80)}}Your site is in great shape for AI search. But there's always room to improve.{{/if}}
32
+ {{#if (and (gte sxo_score 50) (lt sxo_score 80))}}Your site has a solid foundation but is missing key AI optimization that could cost you 30-50% of future traffic.{{/if}}
33
+ {{#if (lt sxo_score 50)}}Your site is at serious risk of losing visibility as AI search grows. 94% of sites score under 50 — you need immediate action.{{/if}}
34
+
35
+ **View your full breakdown:** https://sxowebsite.com/my-reports
36
+
37
+ Want the complete report with exact fixes? Get your $8 SXO Living DOM Report:
38
+ **https://sxowebsite.com/get-sxo-rewrite**
39
+
40
+ — SXO Team`,
41
+ },
42
+ {
43
+ delay: 172800, // 2 days
44
+ action: 'email',
45
+ subject: 'Your site scored {{sxo_grade}} — here\'s the fix (just $8)',
46
+ body: `Hey {{firstName}},
47
+
48
+ Quick follow-up on your SXO scan for {{sxo_domain}}.
49
+
50
+ For $8, we'll generate a complete Living DOM report that tells you exactly what to change — with specific code snippets, schema markup, table traps, and mutation engine setup.
51
+
52
+ It's the same architecture powering sxowebsite.com (which scores 98/100).
53
+
54
+ **Get your $8 report now:** https://sxowebsite.com/get-sxo-rewrite
55
+
56
+ — SXO Team`,
57
+ },
58
+ {
59
+ delay: 432000, // 5 days
60
+ action: 'email',
61
+ subject: 'Last chance — your SXO report expires in 48 hours',
62
+ body: `{{firstName}},
63
+
64
+ Your SXO scan data for {{sxo_domain}} expires in 48 hours. After that, you'll need to scan again.
65
+
66
+ Get the full $8 report while your data is fresh:
67
+ **https://sxowebsite.com/get-sxo-rewrite**
68
+
69
+ After that, I'll stop emailing about this. Promise.
70
+
71
+ — SXO Team`,
72
+ },
73
+ ],
74
+ },
75
+
76
+ // ── SXO $8 REPORT PURCHASED ───────────────────────────
77
+ 'sxo-purchased-scan': {
78
+ name: 'SXO $8 Report Delivery',
79
+ trigger: 'tag:sxo-purchased-scan',
80
+ steps: [
81
+ {
82
+ delay: 5, // immediate
83
+ action: 'email',
84
+ subject: 'Your SXO Living DOM Report is Ready — {{sxo_domain}}',
85
+ body: `{{firstName}},
86
+
87
+ Your SXO Living DOM Report for {{sxo_domain}} is ready.
88
+
89
+ **Download your report:** {{report_download_url}}
90
+
91
+ What's inside:
92
+ - Complete breakdown of what your domain needs to rank
93
+ - BLUF architecture recommendations
94
+ - Table trap placements
95
+ - JSON-LD schema markup (ready to paste)
96
+ - Mutation engine setup instructions
97
+ - Dynamic freshness loop configuration
98
+ - AI search optimization checklist
99
+
100
+ **Next step:** Want the actual code snippets ready to install? Get the Full Optimization for $16.79:
101
+ https://sxowebsite.com/upgrade
102
+
103
+ — SXO Team`,
104
+ },
105
+ {
106
+ delay: 259200, // 3 days
107
+ action: 'email',
108
+ subject: 'Ready for the code? Full optimization is $16.79',
109
+ body: `Hey {{firstName}},
110
+
111
+ Hope you found the SXO report useful for {{sxo_domain}}.
112
+
113
+ The next step is the Full Optimization — you'll get every specific code snippet you need, plus exact instructions on where and how to install each one.
114
+
115
+ It's like having a senior developer write your SEO implementation for you.
116
+
117
+ **Get Full Optimization — $16.79:** https://sxowebsite.com/upgrade
118
+
119
+ — SXO Team`,
120
+ },
121
+ ],
122
+ },
123
+
124
+ // ── SXO FULL OPTIMIZATION PURCHASED ───────────────────
125
+ 'sxo-purchased-optimization': {
126
+ name: 'SXO Full Optimization Delivery + Referral',
127
+ trigger: 'tag:sxo-purchased-optimization',
128
+ steps: [
129
+ {
130
+ delay: 5,
131
+ action: 'email',
132
+ subject: 'Your Full SXO Optimization + Code Snippets — {{sxo_domain}}',
133
+ body: `{{firstName}},
134
+
135
+ Your Full SXO Optimization report for {{sxo_domain}} is ready.
136
+
137
+ **Download:** {{optimization_download_url}}
138
+
139
+ This includes every code snippet you need:
140
+ - Complete HTML restructuring with BLUF headers
141
+ - Schema.org JSON-LD markup (copy-paste ready)
142
+ - Mutation engine JavaScript
143
+ - Table trap HTML + CSS
144
+ - Meta tag optimizations
145
+ - llms.txt configuration
146
+ - Core Web Vitals fixes
147
+ - Installation guide for each snippet
148
+
149
+ Questions? Just reply to this email.
150
+
151
+ — SXO Team`,
152
+ },
153
+ {
154
+ delay: 86400, // 1 day
155
+ action: 'email',
156
+ subject: 'Earn money — refer others, get paid per referral',
157
+ body: `{{firstName}},
158
+
159
+ Now that you've seen what SXO optimization looks like, here's an opportunity:
160
+
161
+ **Earn a commission on every $8 scan you refer.**
162
+
163
+ Your referral link: https://sxowebsite.com/scan?ref={{referral_code}}
164
+
165
+ Share it on social media, send it to clients, put it on your website. Every paid scan = money in your pocket.
166
+
167
+ Pro tip: You can also scan ANOTHER domain for yourself for just $8 — use a different email if you want a fresh report.
168
+
169
+ **Start referring:** https://sxowebsite.com/dashboard/refer
170
+
171
+ — SXO Team`,
172
+ },
173
+ {
174
+ delay: 432000, // 5 days
175
+ action: 'email',
176
+ subject: 'Free AI Business Assessment — on us',
177
+ body: `{{firstName}},
178
+
179
+ As a thank you for being an SXO customer, we're offering you a free AI Business Assessment.
180
+
181
+ This goes beyond SEO — it evaluates your entire digital presence through the lens of AI agents, voice search, and conversational AI.
182
+
183
+ **Get your free assessment:** https://sxowebsite.com/ai-ready
184
+
185
+ — SXO Team`,
186
+ },
187
+ {
188
+ delay: 691200, // 8 days
189
+ action: 'email',
190
+ subject: 'Build your AI-powered website — 10% off with code WEB0N10',
191
+ body: `{{firstName}},
192
+
193
+ Last email in this series (promise).
194
+
195
+ If you want a website that's automatically optimized for both Google AND AI search — built from scratch with Living DOM architecture — we have web0n.
196
+
197
+ It's an automated website builder that creates AI-ready sites with everything we've been talking about built in from day one.
198
+
199
+ **Use code WEB0N10 for 10% off:** https://sxowebsite.com/upgrade?coupon=WEB0N10
200
+
201
+ — SXO Team`,
202
+ },
203
+ ],
204
+ },
205
+
206
+ // ── 0nCORE NEW CUSTOMER ───────────────────────────────
207
+ '0ncore-welcome': {
208
+ name: '0nCore Welcome Sequence',
209
+ trigger: 'tag:0ncore-signup',
210
+ steps: [
211
+ {
212
+ delay: 5,
213
+ action: 'email',
214
+ subject: 'Welcome to 0nCore — let\'s get you set up',
215
+ body: `Welcome {{firstName}},
216
+
217
+ You're in. Here's how to get started:
218
+
219
+ 1. **Connect your CRM** — Settings → Integrations → CRM
220
+ 2. **Install 0nMCP** — npx 0nmcp@latest
221
+ 3. **Import your API keys** — 0nmcp engine import
222
+ 4. **Try your first automation** — "Send a Slack message when a new contact is created"
223
+
224
+ Your dashboard: https://0ncore.com/dashboard
225
+
226
+ Questions? Reply to this email or chat with 0nAI in your dashboard.
227
+
228
+ — Mike @ RocketOpp`,
229
+ },
230
+ {
231
+ delay: 86400, // 1 day
232
+ action: 'email',
233
+ subject: 'Did you connect your first service?',
234
+ body: `Hey {{firstName}},
235
+
236
+ Just checking in — have you connected your first service to 0nCore yet?
237
+
238
+ Most people start with:
239
+ - **Slack** — get CRM notifications in your team chat
240
+ - **Stripe** — track payments in your CRM
241
+ - **Gmail** — auto-log email conversations
242
+
243
+ **Connect now:** https://0ncore.com/dashboard/downloads
244
+
245
+ If you need help, just reply to this email.
246
+
247
+ — Mike`,
248
+ },
249
+ {
250
+ delay: 259200, // 3 days
251
+ action: 'email',
252
+ subject: 'Your first automation idea (takes 2 minutes)',
253
+ body: `{{firstName}},
254
+
255
+ Here's a quick win you can set up in 2 minutes:
256
+
257
+ **"When someone fills out a form, score them with AI and notify Slack"**
258
+
259
+ 1. Go to your Automations page
260
+ 2. Describe it in plain English
261
+ 3. 0nAI generates the .0n SWITCH file
262
+ 4. Click "Run" — it's live
263
+
264
+ **Try it:** https://0ncore.com/dashboard/automations
265
+
266
+ This is what 0nCore does — replaces hours of manual setup with one sentence.
267
+
268
+ — Mike`,
269
+ },
270
+ ],
271
+ },
272
+ }
273
+
274
+ /**
275
+ * Execute a sequence step — sends email via CRM API
276
+ */
277
+ export async function sendSequenceEmail(params) {
278
+ const { contactId, locationId, subject, body, pit } = params
279
+
280
+ const res = await fetch(`${CRM_BASE}/conversations/messages`, {
281
+ method: 'POST',
282
+ headers: {
283
+ Authorization: `Bearer ${pit}`,
284
+ Version: CRM_VERSION,
285
+ 'Content-Type': 'application/json',
286
+ },
287
+ body: JSON.stringify({
288
+ type: 'Email',
289
+ contactId,
290
+ subject,
291
+ body,
292
+ emailFrom: 'noreply@0nmcp.com',
293
+ }),
294
+ })
295
+
296
+ return { success: res.ok, status: res.status }
297
+ }
298
+
299
+ /**
300
+ * Resolve template variables in email body
301
+ */
302
+ export function resolveTemplate(template, contact) {
303
+ let resolved = template
304
+ const fields = {
305
+ firstName: contact.firstName || contact.name?.split(' ')[0] || 'there',
306
+ lastName: contact.lastName || '',
307
+ email: contact.email || '',
308
+ sxo_score: contact.customFields?.sxo_score || contact.sxo_score || '0',
309
+ sxo_grade: contact.customFields?.sxo_grade || contact.sxo_grade || 'Unknown',
310
+ sxo_domain: contact.customFields?.sxo_domain || contact.sxo_domain || 'your domain',
311
+ report_download_url: contact.customFields?.report_download_url || '#',
312
+ optimization_download_url: contact.customFields?.optimization_download_url || '#',
313
+ referral_code: contact.customFields?.referral_code || contact.referral_code || 'sxo',
314
+ }
315
+
316
+ for (const [key, value] of Object.entries(fields)) {
317
+ resolved = resolved.replace(new RegExp(`\\{\\{${key}\\}\\}`, 'g'), value)
318
+ }
319
+
320
+ // Handle conditionals (simplified)
321
+ resolved = resolved.replace(/\{\{#if.*?\}\}([\s\S]*?)\{\{\/if\}\}/g, '$1')
322
+
323
+ return resolved
324
+ }
325
+
326
+ /**
327
+ * Schedule a sequence for a contact
328
+ * Called when a tag is added. Stores schedule in Supabase.
329
+ */
330
+ export async function scheduleSequence(params) {
331
+ const { sequenceId, contactId, locationId, contact, supabase } = params
332
+ const sequence = SEQUENCES[sequenceId]
333
+ if (!sequence) throw new Error(`Unknown sequence: ${sequenceId}`)
334
+
335
+ const now = Date.now()
336
+ const scheduledSteps = sequence.steps.map((step, index) => ({
337
+ sequence_id: sequenceId,
338
+ contact_id: contactId,
339
+ location_id: locationId,
340
+ step_index: index,
341
+ action: step.action,
342
+ subject: resolveTemplate(step.subject, contact),
343
+ body: resolveTemplate(step.body, contact),
344
+ scheduled_at: new Date(now + step.delay * 1000).toISOString(),
345
+ status: 'pending',
346
+ }))
347
+
348
+ if (supabase) {
349
+ await supabase.from('email_sequence_queue').insert(scheduledSteps)
350
+ }
351
+
352
+ return { sequence: sequenceId, stepsScheduled: scheduledSteps.length }
353
+ }
package/lib/stats.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "generated": "2026-03-28T07:55:13.555Z",
2
+ "generated": "2026-03-29T20:40:55.698Z",
3
3
  "catalogVersion": "2.2.0",
4
4
  "services": 48,
5
5
  "tools": 545,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "0nmcp",
3
- "version": "2.9.0",
3
+ "version": "2.9.2",
4
4
  "mcpName": "io.github.0nork/0nMCP",
5
5
  "description": "Universal AI API Orchestrator — 819 tools, 48 services, portable AI Brain bundles + machine-bound vault encryption + Application Engine. The most comprehensive MCP server available. Free and open source from 0nORK.",
6
6
  "type": "module",
@@ -103,111 +103,34 @@
103
103
  },
104
104
  "keywords": [
105
105
  "mcp",
106
- "model-context-protocol",
107
- "ai",
108
- "orchestration",
109
- "automation",
110
- "api",
111
106
  "mcp-server",
112
- "ai-tools",
113
- "api-orchestration",
114
- "natural-language",
115
- "claude",
107
+ "model-context-protocol",
108
+ "ai-orchestrator",
109
+ "api-integration",
110
+ "workflow-automation",
116
111
  "stripe",
112
+ "crm",
117
113
  "slack",
118
- "discord",
119
- "openai",
120
- "anthropic",
121
- "twilio",
122
- "sendgrid",
123
- "airtable",
124
- "notion",
125
114
  "github",
126
- "hubspot",
127
- "shopify",
128
115
  "supabase",
129
- "crm",
130
- "invoicing",
131
- "payments",
132
- "contacts",
133
- "calendars",
134
- "social-media",
135
- "webhooks",
136
- "rate-limiting",
137
- "gmail",
138
- "google-sheets",
139
- "google-drive",
140
- "jira",
141
- "zendesk",
142
- "mailchimp",
143
- "zoom",
144
- "microsoft-365",
145
- "outlook",
146
- "teams",
147
- "onedrive",
148
- "mongodb",
116
+ "figma",
117
+ "sendgrid",
118
+ "twilio",
119
+ "shopify",
120
+ "openai",
121
+ "anthropic",
122
+ "ai-agent",
123
+ "ai-tools",
124
+ "universal-api",
125
+ "no-code",
126
+ "automation",
127
+ "saas",
128
+ "api-connector",
149
129
  "vault",
150
130
  "encryption",
151
- "machine-bound",
152
- "credential-storage",
153
- "portable-bundle",
154
- "ai-brain",
155
- "credential-import",
156
- "platform-config",
157
- "0nvault",
158
- "semantic-layers",
159
- "escrow",
160
- "seal-of-truth",
161
- "ed25519",
162
- "x25519",
163
- "sha3",
164
- "argon2",
165
- "digital-asset-transfer",
166
- "business-deed-transfer",
167
- "workflow-runtime",
168
- "http-server",
169
- "cli",
170
- "application-engine",
171
- "container",
172
- "mcp-registry",
173
- "quickbooks",
174
- "asana",
175
- "intercom",
176
- "dropbox",
177
- "whatsapp",
178
- "instagram",
179
- "twitter",
180
- "x-ads",
181
- "tiktok",
182
- "google-ads",
183
- "facebook-ads",
184
- "plaid",
185
- "square",
186
- "tiktok-ads",
187
- "linkedin-ads",
188
- "instagram-ads",
189
- "smartlead",
190
- "zapier",
191
- "mulesoft",
192
- "azure",
193
- "pipedrive",
194
- "linkedin",
195
- "advertising",
196
- "cold-email",
197
- "finance",
198
- "accounting",
199
- "multi-ai-council",
200
- "training-pipeline",
201
- "workflow-engine",
202
- "ai-employee",
203
- "capability-proxy",
204
- "zero-knowledge",
205
- "cursor",
206
- "windsurf",
207
- "gemini",
208
- "0n",
209
- "0nork",
210
- "0nmcp"
131
+ "aes-256",
132
+ "capability-routing",
133
+ "portable-workflows"
211
134
  ],
212
135
  "author": {
213
136
  "name": "0nORK",
@@ -282,6 +205,6 @@
282
205
  "triggers": 155,
283
206
  "totalCapabilities": 1078,
284
207
  "categories": 21,
285
- "lastUpdated": "2026-03-28T07:55:13.555Z"
208
+ "lastUpdated": "2026-03-29T20:40:55.698Z"
286
209
  }
287
210
  }
package/tools.js CHANGED
@@ -7,6 +7,7 @@
7
7
 
8
8
  import { z } from "zod";
9
9
  import { SERVICE_CATALOG, listServices, getService } from "./catalog.js";
10
+ import { registerRedditTools } from "./reddit.js";
10
11
 
11
12
  /**
12
13
  * Register all universal + workflow tools on an MCP server instance.
@@ -383,4 +384,7 @@ Examples:
383
384
  }
384
385
  );
385
386
  }
387
+
388
+ // ─── Reddit ────────────────────────────────────────────
389
+ registerRedditTools(server, z, connections);
386
390
  }
package/workflow.js CHANGED
@@ -141,11 +141,22 @@ function evaluateComputeExpression(expr) {
141
141
  // Only allow numbers, operators, spaces, parens, and decimal points
142
142
  if (/^[\d\s+\-*/().]+$/.test(mathStr)) {
143
143
  try {
144
- // Safe evaluation using Function constructor with no scope access
145
- // Only processes pre-validated strings containing only math chars
146
- const fn = new Function(`return (${mathStr});`);
147
- const val = fn();
148
- if (typeof val === 'number' && isFinite(val)) return val;
144
+ // Safe math parser — no eval/Function, just tokenize and calculate
145
+ const tokens = mathStr.match(/(\d+\.?\d*|[+\-*/()])/g);
146
+ if (tokens) {
147
+ const output = [], ops = [];
148
+ const prec = { '+': 1, '-': 1, '*': 2, '/': 2 };
149
+ const calc = (a, op, b) => op === '+' ? a + b : op === '-' ? a - b : op === '*' ? a * b : op === '/' ? (b !== 0 ? a / b : NaN) : NaN;
150
+ for (const t of tokens) {
151
+ if (/^\d/.test(t)) { output.push(parseFloat(t)); }
152
+ else if (t === '(') { ops.push(t); }
153
+ else if (t === ')') { while (ops.length && ops[ops.length - 1] !== '(') { const op = ops.pop(); const b = output.pop(), a = output.pop(); output.push(calc(a, op, b)); } ops.pop(); }
154
+ else { while (ops.length && ops[ops.length - 1] !== '(' && (prec[ops[ops.length - 1]] || 0) >= (prec[t] || 0)) { const op = ops.pop(); const b = output.pop(), a = output.pop(); output.push(calc(a, op, b)); } ops.push(t); }
155
+ }
156
+ while (ops.length) { const op = ops.pop(); const b = output.pop(), a = output.pop(); output.push(calc(a, op, b)); }
157
+ const val = output[0];
158
+ if (typeof val === 'number' && isFinite(val)) return val;
159
+ }
149
160
  } catch {
150
161
  // Fall through
151
162
  }