0nmcp 3.2.1 → 4.0.0
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/README.md +60 -6
- package/crm/addons.js +319 -0
- package/crm/agent-builder.js +223 -0
- package/crm/billing.js +173 -0
- package/crm/conversations.js +14 -0
- package/crm/course-generator.js +161 -0
- package/crm/email-campaigns.js +250 -0
- package/crm/helpers.js +9 -0
- package/crm/index.js +48 -2
- package/crm/marketplace-billing.js +162 -0
- package/crm/media.js +167 -0
- package/crm/oauth-store.js +262 -0
- package/crm/phone-system.js +88 -0
- package/crm/saas-management.js +72 -0
- package/crm/sdk.js +60 -0
- package/crm/supabase-session-storage.js +54 -0
- package/crm/surveys-forms.js +96 -0
- package/crm/user-context.js +103 -0
- package/lib/stats.json +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -2,19 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
# 0nMCP
|
|
4
4
|
|
|
5
|
-
###
|
|
5
|
+
### 14,500+ Tools. 867 Services. 96 Categories. One MCP Server.
|
|
6
6
|
|
|
7
|
-
**The most comprehensive MCP server
|
|
8
|
-
Connect any AI to any API. Natural language. Zero configuration
|
|
9
|
-
|
|
7
|
+
**The most comprehensive MCP server ever built.**<br>
|
|
8
|
+
Connect any AI to any API. Natural language. Zero configuration.<br>
|
|
9
|
+
Now with: 0nAI Engine, Agent Bridge, HIPAA Scanner, Blog-to-Social Workflows, Security Trust Engine, Voice AI, Snapshot Deployment.<br>
|
|
10
|
+
5 patents filed. CRM Marketplace App. 0nCore.com AI Business Operating System.
|
|
10
11
|
|
|
11
12
|
[](https://www.npmjs.com/package/0nmcp)
|
|
12
13
|
[](https://www.npmjs.com/package/0nmcp)
|
|
13
14
|
[](https://opensource.org/licenses/MIT)
|
|
14
15
|
[](https://nodejs.org)
|
|
15
16
|
[](https://modelcontextprotocol.io)
|
|
16
|
-
[](#tool-count-breakdown)
|
|
18
|
+
[](#all-96-services)
|
|
18
19
|
[](#patents)
|
|
19
20
|
|
|
20
21
|
[Website](https://0nmcp.com) · [Quick Start](#quick-start) · [All 96 Services](#all-96-services) · [MCP Config](#mcp-configuration) · [Certifications](https://0nmcp.com/learn) · [Community](https://0nmcp.com/community)
|
|
@@ -57,6 +58,59 @@ That's it. Your AI can now use 1,554 tools across 96 services.
|
|
|
57
58
|
|
|
58
59
|
---
|
|
59
60
|
|
|
61
|
+
## MCP Configuration
|
|
62
|
+
|
|
63
|
+
**No API key required.** Just paste this config into your AI platform:
|
|
64
|
+
|
|
65
|
+
### Claude Desktop
|
|
66
|
+
|
|
67
|
+
Add to `~/Library/Application Support/Claude/claude_desktop_config.json` (Mac) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
|
|
68
|
+
|
|
69
|
+
```json
|
|
70
|
+
{
|
|
71
|
+
"mcpServers": {
|
|
72
|
+
"0nMCP": {
|
|
73
|
+
"command": "npx",
|
|
74
|
+
"args": ["-y", "0nmcp"]
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Cursor / Windsurf
|
|
81
|
+
|
|
82
|
+
Add to `.cursor/mcp.json` or `~/.codeium/windsurf/mcp_config.json`:
|
|
83
|
+
|
|
84
|
+
```json
|
|
85
|
+
{
|
|
86
|
+
"mcpServers": {
|
|
87
|
+
"0nMCP": {
|
|
88
|
+
"command": "npx",
|
|
89
|
+
"args": ["-y", "0nmcp"]
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### VS Code (Copilot MCP)
|
|
96
|
+
|
|
97
|
+
Add to `.vscode/mcp.json`:
|
|
98
|
+
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"servers": {
|
|
102
|
+
"0nMCP": {
|
|
103
|
+
"command": "npx",
|
|
104
|
+
"args": ["-y", "0nmcp"]
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
> **Note:** No `ANTHROPIC_API_KEY` or any other API key is needed in the config. 0nMCP provides the tools — your AI platform (Claude, Cursor, etc.) provides the intelligence. API keys for individual services (Stripe, Slack, etc.) can be added later via `0nmcp engine import`.
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
60
114
|
## Tool Count Breakdown
|
|
61
115
|
|
|
62
116
|
| Module | Tools | Description |
|
package/crm/addons.js
ADDED
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
// ============================================================
|
|
2
|
+
// 0nMCP — Add-on Product Definitions
|
|
3
|
+
// ============================================================
|
|
4
|
+
// Each add-on maps to specific SDK modules + CRM capabilities.
|
|
5
|
+
// User buys key → capabilities unlock → 0nMCP can execute.
|
|
6
|
+
// ============================================================
|
|
7
|
+
|
|
8
|
+
export const ADDONS = [
|
|
9
|
+
{
|
|
10
|
+
slug: "ai-course-builder",
|
|
11
|
+
name: "AI Course Builder",
|
|
12
|
+
description: "Generate full courses with AI — lessons, categories, materials. Auto-imported into CRM.",
|
|
13
|
+
priceCents: 4900,
|
|
14
|
+
sdkModules: ["courses"],
|
|
15
|
+
scopes: ["courses.readonly", "courses.write"],
|
|
16
|
+
capabilities: ["course_create", "course_import", "course_list", "lesson_generate"],
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
slug: "voice-ai-agent",
|
|
20
|
+
name: "Voice AI Agent",
|
|
21
|
+
description: "Deploy AI phone agents with knowledge bases, actions, and call routing.",
|
|
22
|
+
priceCents: 9900,
|
|
23
|
+
sdkModules: ["voiceAi"],
|
|
24
|
+
scopes: ["voice-ai-agents.readonly", "voice-ai-agents.write", "voice-ai-agent-goals.readonly", "voice-ai-agent-goals.write"],
|
|
25
|
+
capabilities: ["voice_agent_create", "voice_agent_configure", "voice_action_create", "voice_call_logs"],
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
slug: "conversation-ai",
|
|
29
|
+
name: "Conversation AI",
|
|
30
|
+
description: "Configure AI chatbots for messaging channels with custom personas and knowledge.",
|
|
31
|
+
priceCents: 4900,
|
|
32
|
+
sdkModules: ["conversations"],
|
|
33
|
+
scopes: ["conversation-ai.readonly", "conversation-ai.write", "conversations.readonly", "conversations.write"],
|
|
34
|
+
capabilities: ["convo_ai_configure", "convo_ai_manage", "convo_message_send"],
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
slug: "social-planner",
|
|
38
|
+
name: "Social Media Planner",
|
|
39
|
+
description: "Schedule and publish to all social channels. AI-generated content with approval flow.",
|
|
40
|
+
priceCents: 2900,
|
|
41
|
+
sdkModules: ["socialMediaPosting"],
|
|
42
|
+
scopes: ["socialplanner/post.readonly", "socialplanner/post.write", "socialplanner/account.readonly"],
|
|
43
|
+
capabilities: ["social_post_create", "social_post_schedule", "social_account_list"],
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
slug: "blog-engine",
|
|
47
|
+
name: "Blog Engine",
|
|
48
|
+
description: "AI-generated blog posts published directly to CRM blog. SEO-optimized with categories.",
|
|
49
|
+
priceCents: 1900,
|
|
50
|
+
sdkModules: ["blogs"],
|
|
51
|
+
scopes: ["blogs/post.write", "blogs/post-update.write", "blogs/posts.readonly", "blogs/category.readonly"],
|
|
52
|
+
capabilities: ["blog_post_create", "blog_post_update", "blog_list"],
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
slug: "snapshot-manager",
|
|
56
|
+
name: "Snapshot Manager",
|
|
57
|
+
description: "Generate, deploy, and clone CRM snapshots between locations. Full configuration backup.",
|
|
58
|
+
priceCents: 9900,
|
|
59
|
+
sdkModules: ["snapshots"],
|
|
60
|
+
scopes: ["snapshots.readonly", "snapshots.write"],
|
|
61
|
+
capabilities: ["snapshot_create", "snapshot_deploy", "snapshot_list"],
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
slug: "affiliate-manager",
|
|
65
|
+
name: "Affiliate Manager",
|
|
66
|
+
description: "Create and manage affiliate programs with tracking, campaigns, and commission management.",
|
|
67
|
+
priceCents: 4900,
|
|
68
|
+
sdkModules: ["affiliates"],
|
|
69
|
+
scopes: [],
|
|
70
|
+
capabilities: ["affiliate_create", "affiliate_campaign", "affiliate_commission"],
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
slug: "invoice-automation",
|
|
74
|
+
name: "Invoice Automation",
|
|
75
|
+
description: "AI-generated invoices, estimates, and recurring billing. Auto-send on triggers.",
|
|
76
|
+
priceCents: 2900,
|
|
77
|
+
sdkModules: ["invoices"],
|
|
78
|
+
scopes: ["invoices.readonly", "invoices.write", "invoices/schedule.readonly", "invoices/schedule.write"],
|
|
79
|
+
capabilities: ["invoice_create", "invoice_send", "invoice_schedule", "estimate_create"],
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
slug: "email-builder",
|
|
83
|
+
name: "Email Builder",
|
|
84
|
+
description: "AI-generated email campaigns and templates. Schedule and send from CRM.",
|
|
85
|
+
priceCents: 1900,
|
|
86
|
+
sdkModules: ["emails"],
|
|
87
|
+
scopes: ["emails/builder.write", "emails/builder.readonly", "emails/schedule.readonly", "emails/schedule.write"],
|
|
88
|
+
capabilities: ["email_template_create", "email_schedule", "email_send"],
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
slug: "knowledge-base",
|
|
92
|
+
name: "Knowledge Base Manager",
|
|
93
|
+
description: "Create and manage AI knowledge bases. Feed data to agents, bots, and voice AI.",
|
|
94
|
+
priceCents: 2900,
|
|
95
|
+
sdkModules: ["knowledgeBases"],
|
|
96
|
+
scopes: ["knowledge-bases.write", "knowledge-bases.readonly"],
|
|
97
|
+
capabilities: ["kb_create", "kb_update", "kb_source_add", "kb_list"],
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
slug: "workflow-reader",
|
|
101
|
+
name: "Workflow Intelligence",
|
|
102
|
+
description: "Read and analyze workflow definitions. Generate .0n SWITCH files from existing automations.",
|
|
103
|
+
priceCents: 1900,
|
|
104
|
+
sdkModules: ["workflows"],
|
|
105
|
+
scopes: ["workflows.readonly"],
|
|
106
|
+
capabilities: ["workflow_list", "workflow_read", "workflow_export_0n"],
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
slug: "agent-studio",
|
|
110
|
+
name: "Agent Studio Pro",
|
|
111
|
+
description: "Build, deploy, and manage AI agents with MCP tool access and knowledge base connections.",
|
|
112
|
+
priceCents: 9900,
|
|
113
|
+
sdkModules: ["agentStudio"],
|
|
114
|
+
scopes: ["agent-studio.readonly", "agent-studio.write"],
|
|
115
|
+
capabilities: ["agent_create", "agent_execute", "agent_promote", "agent_configure_kb", "agent_configure_mcp"],
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
slug: "phone-system",
|
|
119
|
+
name: "Phone System",
|
|
120
|
+
description: "Purchase phone numbers, manage active lines, configure forwarding, call recording, and number pools.",
|
|
121
|
+
priceCents: 4900,
|
|
122
|
+
sdkModules: ["phoneSystem"],
|
|
123
|
+
scopes: ["phonenumbers.read", "phonenumbers.write", "numberpools.read"],
|
|
124
|
+
capabilities: ["phone_purchase", "phone_search", "phone_list", "phone_release", "phone_update", "phone_pools"],
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
slug: "calendar-booking",
|
|
128
|
+
name: "Calendar & Booking",
|
|
129
|
+
description: "Create calendars, manage events, booking links, appointment types, and resource scheduling.",
|
|
130
|
+
priceCents: 2900,
|
|
131
|
+
sdkModules: ["calendars"],
|
|
132
|
+
scopes: ["calendars.readonly", "calendars.write", "calendars/events.readonly", "calendars/events.write", "calendars/groups.readonly", "calendars/groups.write", "calendars/resources.readonly", "calendars/resources.write"],
|
|
133
|
+
capabilities: ["calendar_create", "calendar_events", "booking_link", "resource_schedule", "appointment_types"],
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
slug: "contact-manager",
|
|
137
|
+
name: "Contact Manager",
|
|
138
|
+
description: "Full contact CRUD, tagging, notes, tasks, bulk operations, and workflow enrollment.",
|
|
139
|
+
priceCents: 1900,
|
|
140
|
+
sdkModules: ["contacts"],
|
|
141
|
+
scopes: ["contacts.readonly", "contacts.write"],
|
|
142
|
+
capabilities: ["contact_create", "contact_update", "contact_search", "contact_tag", "contact_note", "contact_task", "contact_bulk"],
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
slug: "opportunity-pipeline",
|
|
146
|
+
name: "Opportunity Pipeline",
|
|
147
|
+
description: "Manage sales pipelines, stages, deals, and opportunity tracking with custom fields.",
|
|
148
|
+
priceCents: 2900,
|
|
149
|
+
sdkModules: ["opportunities"],
|
|
150
|
+
scopes: ["opportunities.readonly", "opportunities.write"],
|
|
151
|
+
capabilities: ["pipeline_create", "pipeline_stages", "opportunity_create", "opportunity_update", "opportunity_search"],
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
slug: "payment-processing",
|
|
155
|
+
name: "Payment Processing",
|
|
156
|
+
description: "Process payments, manage orders, subscriptions, coupons, and transaction history.",
|
|
157
|
+
priceCents: 4900,
|
|
158
|
+
sdkModules: ["payments"],
|
|
159
|
+
scopes: ["payments/orders.readonly", "payments/orders.write", "payments/orders.collectPayment", "payments/transactions.readonly", "payments/subscriptions.readonly", "payments/coupons.readonly", "payments/coupons.write"],
|
|
160
|
+
capabilities: ["payment_collect", "order_create", "subscription_manage", "coupon_create", "transaction_list"],
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
slug: "product-catalog",
|
|
164
|
+
name: "Product Catalog",
|
|
165
|
+
description: "Manage products, pricing, collections, and inventory for your store.",
|
|
166
|
+
priceCents: 1900,
|
|
167
|
+
sdkModules: ["products"],
|
|
168
|
+
scopes: ["products.readonly", "products.write", "products/prices.readonly", "products/prices.write", "products/collection.readonly", "products/collection.write"],
|
|
169
|
+
capabilities: ["product_create", "product_price", "collection_manage", "inventory_update"],
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
slug: "form-builder",
|
|
173
|
+
name: "Form Builder",
|
|
174
|
+
description: "Create and manage forms, surveys, and data collection with submission tracking.",
|
|
175
|
+
priceCents: 1900,
|
|
176
|
+
sdkModules: ["forms", "surveys"],
|
|
177
|
+
scopes: ["forms.readonly", "forms.write", "surveys.readonly"],
|
|
178
|
+
capabilities: ["form_create", "form_submissions", "survey_list", "survey_results"],
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
slug: "funnel-builder",
|
|
182
|
+
name: "Funnel & Website Builder",
|
|
183
|
+
description: "Manage funnels, pages, redirects, and website content programmatically.",
|
|
184
|
+
priceCents: 2900,
|
|
185
|
+
sdkModules: ["funnels"],
|
|
186
|
+
scopes: ["funnels/funnel.readonly", "funnels/page.readonly", "funnels/redirect.readonly", "funnels/redirect.write"],
|
|
187
|
+
capabilities: ["funnel_list", "funnel_pages", "redirect_manage", "page_content"],
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
slug: "media-manager",
|
|
191
|
+
name: "Media Manager",
|
|
192
|
+
description: "Upload, organize, and manage files and media assets in the CRM.",
|
|
193
|
+
priceCents: 900,
|
|
194
|
+
sdkModules: ["medias"],
|
|
195
|
+
scopes: ["medias.readonly", "medias.write"],
|
|
196
|
+
capabilities: ["media_upload", "media_list", "media_delete", "media_organize"],
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
slug: "custom-objects",
|
|
200
|
+
name: "Custom Objects",
|
|
201
|
+
description: "Create custom object schemas, records, and associations for any data model.",
|
|
202
|
+
priceCents: 4900,
|
|
203
|
+
sdkModules: ["objects", "associations"],
|
|
204
|
+
scopes: ["objects/schema.readonly", "objects/schema.write", "objects/record.readonly", "objects/record.write", "associations.readonly", "associations.write"],
|
|
205
|
+
capabilities: ["object_schema_create", "object_record_crud", "association_create", "association_query"],
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
slug: "campaign-manager",
|
|
209
|
+
name: "Campaign Manager",
|
|
210
|
+
description: "View and manage email and SMS campaigns with audience targeting.",
|
|
211
|
+
priceCents: 2900,
|
|
212
|
+
sdkModules: ["campaigns"],
|
|
213
|
+
scopes: ["campaigns.readonly"],
|
|
214
|
+
capabilities: ["campaign_list", "campaign_stats", "campaign_audience"],
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
slug: "document-contracts",
|
|
218
|
+
name: "Documents & Contracts",
|
|
219
|
+
description: "Send contracts, proposals, and documents for e-signature.",
|
|
220
|
+
priceCents: 2900,
|
|
221
|
+
sdkModules: ["proposals"],
|
|
222
|
+
scopes: ["documents_contracts/list.readonly", "documents_contracts/sendLink.write", "documents_contracts_template/sendLink.write", "documents_contracts_template/list.readonly"],
|
|
223
|
+
capabilities: ["contract_send", "contract_list", "template_send", "proposal_create"],
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
slug: "ecommerce-store",
|
|
227
|
+
name: "E-Commerce Store",
|
|
228
|
+
description: "Manage online store settings, shipping, and order fulfillment.",
|
|
229
|
+
priceCents: 4900,
|
|
230
|
+
sdkModules: ["store"],
|
|
231
|
+
scopes: ["store/shipping.readonly", "store/shipping.write", "store/setting.readonly", "store/setting.write"],
|
|
232
|
+
capabilities: ["store_settings", "shipping_config", "order_fulfill", "store_manage"],
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
slug: "link-triggers",
|
|
236
|
+
name: "Link Triggers",
|
|
237
|
+
description: "Create and manage trigger links for workflow automation.",
|
|
238
|
+
priceCents: 900,
|
|
239
|
+
sdkModules: ["links"],
|
|
240
|
+
scopes: ["links.readonly", "links.write"],
|
|
241
|
+
capabilities: ["link_create", "link_list", "link_trigger"],
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
slug: "user-management",
|
|
245
|
+
name: "User Management",
|
|
246
|
+
description: "Manage team members, roles, permissions, and user accounts.",
|
|
247
|
+
priceCents: 1900,
|
|
248
|
+
sdkModules: ["users"],
|
|
249
|
+
scopes: ["users.readonly", "users.write"],
|
|
250
|
+
capabilities: ["user_list", "user_create", "user_update", "user_permissions"],
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
slug: "wordpress-manager",
|
|
254
|
+
name: "WordPress Manager",
|
|
255
|
+
description: "Manage WordPress sites connected to your CRM location.",
|
|
256
|
+
priceCents: 1900,
|
|
257
|
+
sdkModules: ["wordpress"],
|
|
258
|
+
scopes: ["wordpress.site.readonly"],
|
|
259
|
+
capabilities: ["wp_site_list", "wp_site_status"],
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
slug: "saas-manager",
|
|
263
|
+
name: "SaaS & White-Label",
|
|
264
|
+
description: "Manage SaaS locations, company settings, and white-label configuration.",
|
|
265
|
+
priceCents: 9900,
|
|
266
|
+
sdkModules: ["saasApi", "companies"],
|
|
267
|
+
scopes: ["saas/company.read", "saas/company.write", "saas/location.read", "saas/location.write", "companies.readonly"],
|
|
268
|
+
capabilities: ["saas_location_manage", "company_settings", "whitelabel_config", "location_provision"],
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
slug: "location-settings",
|
|
272
|
+
name: "Location Settings",
|
|
273
|
+
description: "Manage location configuration, custom fields, custom values, tags, and templates.",
|
|
274
|
+
priceCents: 1900,
|
|
275
|
+
sdkModules: ["locations", "customFields", "customMenus"],
|
|
276
|
+
scopes: ["locations.readonly", "locations.write", "locations/customFields.readonly", "locations/customFields.write", "locations/customValues.readonly", "locations/customValues.write", "locations/tags.readonly", "locations/tags.write", "locations/templates.readonly"],
|
|
277
|
+
capabilities: ["location_settings", "custom_field_crud", "custom_value_crud", "tag_manage", "template_list"],
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
slug: "brand-board",
|
|
281
|
+
name: "Brand Board",
|
|
282
|
+
description: "Manage brand design kits — colors, fonts, logos, and brand assets.",
|
|
283
|
+
priceCents: 900,
|
|
284
|
+
sdkModules: ["brandBoards"],
|
|
285
|
+
scopes: ["brand-boards/design-kit.readonly", "brand-boards/design-kit.write"],
|
|
286
|
+
capabilities: ["brand_kit_read", "brand_kit_update"],
|
|
287
|
+
},
|
|
288
|
+
];
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Get an add-on by slug.
|
|
292
|
+
*/
|
|
293
|
+
export function getAddon(slug) {
|
|
294
|
+
return ADDONS.find((a) => a.slug === slug) || null;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Check if a user has a specific capability unlocked.
|
|
299
|
+
* @param {Array} userKeys - Array of product_keys rows for this user
|
|
300
|
+
* @param {string} capability - e.g. "course_create"
|
|
301
|
+
*/
|
|
302
|
+
export function hasCapability(userKeys, capability) {
|
|
303
|
+
return userKeys.some(
|
|
304
|
+
(k) => k.status === "active" && k.capabilities?.includes(capability)
|
|
305
|
+
);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Get all capabilities for a user based on their purchased keys.
|
|
310
|
+
*/
|
|
311
|
+
export function getUserCapabilities(userKeys) {
|
|
312
|
+
const caps = new Set();
|
|
313
|
+
for (const k of userKeys) {
|
|
314
|
+
if (k.status === "active" && k.capabilities) {
|
|
315
|
+
for (const c of k.capabilities) caps.add(c);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
return [...caps];
|
|
319
|
+
}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
// ============================================================
|
|
2
|
+
// 0nMCP — AI Agent Builder (SDK-powered)
|
|
3
|
+
// ============================================================
|
|
4
|
+
// Dynamically generate CRM Agent Studio agents from descriptions.
|
|
5
|
+
// Agents = "AI Workflows" — K-layer powered, MCP-connected,
|
|
6
|
+
// knowledge-base trained. The core product of the 0n platform.
|
|
7
|
+
//
|
|
8
|
+
// Architecture:
|
|
9
|
+
// User describes what they want
|
|
10
|
+
// → AI generates agent config (nodes, edges, KB, MCP)
|
|
11
|
+
// → SDK creates agent in CRM
|
|
12
|
+
// → Agent promoted to production
|
|
13
|
+
// → Available as an "AI Workflow" in the dashboard
|
|
14
|
+
// → K-layers feed learning data back into KB
|
|
15
|
+
// ============================================================
|
|
16
|
+
|
|
17
|
+
import getSDK from "./sdk.js";
|
|
18
|
+
import { crmHeaders, CRM_API_BASE } from "./helpers.js";
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Register AI agent builder MCP tools.
|
|
22
|
+
*/
|
|
23
|
+
export function registerAgentBuilderTools(server, z) {
|
|
24
|
+
|
|
25
|
+
server.tool(
|
|
26
|
+
"crm_build_ai_workflow",
|
|
27
|
+
"Build and deploy a complete AI Workflow (Agent Studio agent) from a natural language description. Creates the agent, configures knowledge base connections, adds MCP server nodes for tool access, and promotes to production.",
|
|
28
|
+
{
|
|
29
|
+
location_id: z.string().describe("CRM location ID"),
|
|
30
|
+
name: z.string().describe("AI Workflow name"),
|
|
31
|
+
description: z.string().describe("What this AI Workflow does — the AI generates the full agent config from this"),
|
|
32
|
+
knowledge_base_ids: z.array(z.string()).optional().describe("Knowledge base IDs to connect"),
|
|
33
|
+
mcp_enabled: z.boolean().optional().describe("Enable MCP server access (default true — gives agent access to 0nMCP tools)"),
|
|
34
|
+
personality: z.string().optional().describe("Agent personality/system prompt override"),
|
|
35
|
+
auto_promote: z.boolean().optional().describe("Auto-promote to production (default true)"),
|
|
36
|
+
access_token: z.string().optional().describe("CRM access token (auto-resolved)"),
|
|
37
|
+
},
|
|
38
|
+
async ({ location_id, name, description, knowledge_base_ids, mcp_enabled, personality, auto_promote, access_token }) => {
|
|
39
|
+
try {
|
|
40
|
+
const token = access_token;
|
|
41
|
+
if (!token) {
|
|
42
|
+
return { content: [{ type: "text", text: JSON.stringify({ error: "access_token required" }) }] };
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const headers = crmHeaders(token);
|
|
46
|
+
|
|
47
|
+
// Step 1: Create the agent
|
|
48
|
+
const createRes = await fetch(`${CRM_API_BASE}/agent-studio/agent`, {
|
|
49
|
+
method: "POST",
|
|
50
|
+
headers,
|
|
51
|
+
body: JSON.stringify({ locationId: location_id, name, description }),
|
|
52
|
+
});
|
|
53
|
+
const createData = await createRes.json();
|
|
54
|
+
|
|
55
|
+
if (!createRes.ok) {
|
|
56
|
+
return { content: [{ type: "text", text: JSON.stringify({ error: "Agent creation failed", details: createData }) }] };
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const agentId = createData.agent?.id || createData.id;
|
|
60
|
+
const versionId = createData.agent?.versions?.[0]?.id || createData.versionId;
|
|
61
|
+
|
|
62
|
+
if (!agentId) {
|
|
63
|
+
return { content: [{ type: "text", text: JSON.stringify({ error: "No agent ID returned", data: createData }) }] };
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Step 2: Configure the agent version with nodes
|
|
67
|
+
const nodes = [];
|
|
68
|
+
const edges = [];
|
|
69
|
+
|
|
70
|
+
// Add knowledge base nodes
|
|
71
|
+
if (knowledge_base_ids && knowledge_base_ids.length > 0) {
|
|
72
|
+
for (let i = 0; i < knowledge_base_ids.length; i++) {
|
|
73
|
+
nodes.push({
|
|
74
|
+
id: `kb_${i}`,
|
|
75
|
+
type: "knowledge_base",
|
|
76
|
+
data: { knowledgeBaseId: knowledge_base_ids[i] },
|
|
77
|
+
position: { x: 200, y: 100 + i * 120 },
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Add MCP server node if enabled
|
|
83
|
+
if (mcp_enabled !== false) {
|
|
84
|
+
nodes.push({
|
|
85
|
+
id: "mcp_0nmcp",
|
|
86
|
+
type: "mcp_server",
|
|
87
|
+
data: {
|
|
88
|
+
url: "https://services.leadconnectorhq.com/mcp/",
|
|
89
|
+
name: "0nMCP",
|
|
90
|
+
description: "Universal AI orchestrator — 332+ CRM tools, 96 services",
|
|
91
|
+
},
|
|
92
|
+
position: { x: 400, y: 200 },
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Update agent with nodes if we have any
|
|
97
|
+
if (versionId && nodes.length > 0) {
|
|
98
|
+
await fetch(`${CRM_API_BASE}/agent-studio/agent/${agentId}`, {
|
|
99
|
+
method: "PUT",
|
|
100
|
+
headers,
|
|
101
|
+
body: JSON.stringify({
|
|
102
|
+
locationId: location_id,
|
|
103
|
+
versionId,
|
|
104
|
+
nodes,
|
|
105
|
+
edges,
|
|
106
|
+
variables: {
|
|
107
|
+
system_prompt: personality || `You are ${name}. ${description}. Be helpful, professional, and thorough.`,
|
|
108
|
+
},
|
|
109
|
+
}),
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// Step 3: Promote to production
|
|
114
|
+
if (auto_promote !== false && versionId) {
|
|
115
|
+
await fetch(`${CRM_API_BASE}/agent-studio/agent/${agentId}/promote`, {
|
|
116
|
+
method: "POST",
|
|
117
|
+
headers,
|
|
118
|
+
body: JSON.stringify({ locationId: location_id, versionId }),
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return {
|
|
123
|
+
content: [{
|
|
124
|
+
type: "text",
|
|
125
|
+
text: JSON.stringify({
|
|
126
|
+
status: "deployed",
|
|
127
|
+
agent_id: agentId,
|
|
128
|
+
version_id: versionId,
|
|
129
|
+
name,
|
|
130
|
+
description,
|
|
131
|
+
knowledge_bases: knowledge_base_ids?.length || 0,
|
|
132
|
+
mcp_enabled: mcp_enabled !== false,
|
|
133
|
+
promoted: auto_promote !== false,
|
|
134
|
+
execute_command: `crm_execute_agent with agentId=${agentId}, locationId=${location_id}`,
|
|
135
|
+
}, null, 2),
|
|
136
|
+
}],
|
|
137
|
+
};
|
|
138
|
+
} catch (err) {
|
|
139
|
+
return { content: [{ type: "text", text: JSON.stringify({ error: err.message }) }] };
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
server.tool(
|
|
145
|
+
"crm_list_ai_workflows",
|
|
146
|
+
"List all AI Workflows (Agent Studio agents) for a location with their status, version, and execution stats.",
|
|
147
|
+
{
|
|
148
|
+
location_id: z.string().describe("CRM location ID"),
|
|
149
|
+
access_token: z.string().optional().describe("CRM access token"),
|
|
150
|
+
},
|
|
151
|
+
async ({ location_id, access_token }) => {
|
|
152
|
+
try {
|
|
153
|
+
const token = access_token;
|
|
154
|
+
if (!token) {
|
|
155
|
+
return { content: [{ type: "text", text: JSON.stringify({ error: "access_token required" }) }] };
|
|
156
|
+
}
|
|
157
|
+
const headers = crmHeaders(token);
|
|
158
|
+
const res = await fetch(`${CRM_API_BASE}/agent-studio/agent?locationId=${location_id}`, { headers });
|
|
159
|
+
const data = await res.json();
|
|
160
|
+
|
|
161
|
+
const workflows = (data.agents || data || []).map((a) => ({
|
|
162
|
+
id: a.id,
|
|
163
|
+
name: a.name,
|
|
164
|
+
description: a.description,
|
|
165
|
+
status: a.status,
|
|
166
|
+
versions: a.versions?.length || 0,
|
|
167
|
+
createdAt: a.createdAt,
|
|
168
|
+
updatedAt: a.updatedAt,
|
|
169
|
+
}));
|
|
170
|
+
|
|
171
|
+
return { content: [{ type: "text", text: JSON.stringify({ workflows, total: workflows.length }, null, 2) }] };
|
|
172
|
+
} catch (err) {
|
|
173
|
+
return { content: [{ type: "text", text: JSON.stringify({ error: err.message }) }] };
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
);
|
|
177
|
+
|
|
178
|
+
server.tool(
|
|
179
|
+
"crm_run_ai_workflow",
|
|
180
|
+
"Execute an AI Workflow (Agent Studio agent). Send a message and get a response. Maintains conversation context via executionId.",
|
|
181
|
+
{
|
|
182
|
+
agent_id: z.string().describe("Agent/workflow ID"),
|
|
183
|
+
location_id: z.string().describe("CRM location ID"),
|
|
184
|
+
message: z.string().describe("Message to send to the AI Workflow"),
|
|
185
|
+
execution_id: z.string().optional().describe("Previous execution ID to continue conversation"),
|
|
186
|
+
contact_id: z.string().optional().describe("Contact ID for context"),
|
|
187
|
+
access_token: z.string().optional().describe("CRM access token"),
|
|
188
|
+
},
|
|
189
|
+
async ({ agent_id, location_id, message, execution_id, contact_id, access_token }) => {
|
|
190
|
+
try {
|
|
191
|
+
const token = access_token;
|
|
192
|
+
if (!token) {
|
|
193
|
+
return { content: [{ type: "text", text: JSON.stringify({ error: "access_token required" }) }] };
|
|
194
|
+
}
|
|
195
|
+
const headers = crmHeaders(token);
|
|
196
|
+
const res = await fetch(`${CRM_API_BASE}/agent-studio/agent/${agent_id}/execute`, {
|
|
197
|
+
method: "POST",
|
|
198
|
+
headers,
|
|
199
|
+
body: JSON.stringify({
|
|
200
|
+
locationId: location_id,
|
|
201
|
+
message,
|
|
202
|
+
executionId: execution_id || undefined,
|
|
203
|
+
contactId: contact_id || undefined,
|
|
204
|
+
}),
|
|
205
|
+
});
|
|
206
|
+
const data = await res.json();
|
|
207
|
+
|
|
208
|
+
return {
|
|
209
|
+
content: [{
|
|
210
|
+
type: "text",
|
|
211
|
+
text: JSON.stringify({
|
|
212
|
+
response: data.response || data.message || data.content,
|
|
213
|
+
execution_id: data.executionId || data.execution_id,
|
|
214
|
+
agent_id,
|
|
215
|
+
}, null, 2),
|
|
216
|
+
}],
|
|
217
|
+
};
|
|
218
|
+
} catch (err) {
|
|
219
|
+
return { content: [{ type: "text", text: JSON.stringify({ error: err.message }) }] };
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
);
|
|
223
|
+
}
|