@velaro/mcp-server 2.0.15 → 2.0.17
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/package.json +1 -1
- package/parity/deal.customer.js +93 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@velaro/mcp-server",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.17",
|
|
4
4
|
"description": "Velaro MCP server — connect Claude and other AI agents directly to your Velaro account: KB, workflows, bots, conversations, contacts, routing, and more.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// MCP parity for `velaro deal` (cli/lib/commands/deal.js). Backend: velaro-messaging DealQuotesController (QUOTE-1)
|
|
2
|
+
// and CrmForecastController (FCST-1). Native CRM feature. Site from the credential only; no tool takes a site id.
|
|
3
|
+
|
|
4
|
+
const data = (r) => (r && typeof r === 'object' && 'data' in r ? r.data : r);
|
|
5
|
+
|
|
6
|
+
const quoteFields = {
|
|
7
|
+
discountPercent: { type: 'number' },
|
|
8
|
+
taxPercent: { type: 'number' },
|
|
9
|
+
terms: { type: 'string' },
|
|
10
|
+
notes: { type: 'string' },
|
|
11
|
+
validUntil: { type: 'string', description: 'ISO date' },
|
|
12
|
+
contactId: { type: 'number', description: 'Buyer contact; defaults to the deal contact' },
|
|
13
|
+
refreshLineItems: { type: 'boolean', description: "Re-copy the deal's line items" },
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const pickQuote = (a) => {
|
|
17
|
+
const b = {};
|
|
18
|
+
for (const k of Object.keys(quoteFields)) if (a[k] !== undefined) b[k] = a[k];
|
|
19
|
+
return b;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const tools = [
|
|
23
|
+
{
|
|
24
|
+
name: 'deal_quote_list',
|
|
25
|
+
description: 'List the quotes on a native CRM deal (number, status, total, share link).',
|
|
26
|
+
inputSchema: { type: 'object', properties: { dealId: { type: 'number' } }, required: ['dealId'] },
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'deal_quote_get',
|
|
30
|
+
description: 'Get one quote with its lines, totals, status and share link.',
|
|
31
|
+
inputSchema: { type: 'object', properties: { quoteId: { type: 'number' } }, required: ['quoteId'] },
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: 'deal_quote_create',
|
|
35
|
+
description: "Create a draft quote from a deal's line items, with optional discount, tax, terms and expiry.",
|
|
36
|
+
inputSchema: { type: 'object', properties: { dealId: { type: 'number' }, ...quoteFields }, required: ['dealId'] },
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: 'deal_quote_update',
|
|
40
|
+
description: 'Edit a draft quote (discount, tax, terms, notes, expiry, buyer, refresh lines).',
|
|
41
|
+
inputSchema: { type: 'object', properties: { quoteId: { type: 'number' }, ...quoteFields }, required: ['quoteId'] },
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: 'deal_quote_delete',
|
|
45
|
+
description: 'Delete a quote.',
|
|
46
|
+
inputSchema: { type: 'object', properties: { quoteId: { type: 'number' } }, required: ['quoteId'] },
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: 'deal_quote_send',
|
|
50
|
+
description: 'Mark a quote Sent, email the buyer (or the given address) and return the share link where the buyer accepts or declines.',
|
|
51
|
+
inputSchema: { type: 'object', properties: { quoteId: { type: 'number' }, email: { type: 'string' } }, required: ['quoteId'] },
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: 'deal_forecast_get',
|
|
55
|
+
description: 'Forecast for a month by rep: quota, closed won, commit, best case, pipeline, weighted, submitted amount. Agents see only their own row.',
|
|
56
|
+
inputSchema: { type: 'object', properties: { period: { type: 'string', description: 'yyyy-MM; default this month' }, ownerUserId: { type: 'number' } } },
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: 'deal_forecast_submit',
|
|
60
|
+
description: "Submit the caller's forecast amount for a month.",
|
|
61
|
+
inputSchema: {
|
|
62
|
+
type: 'object',
|
|
63
|
+
properties: { period: { type: 'string', description: 'yyyy-MM' }, amount: { type: 'number' }, note: { type: 'string' } },
|
|
64
|
+
required: ['period', 'amount'],
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: 'deal_forecast_set_category',
|
|
69
|
+
description: 'Set the forecast category of a deal.',
|
|
70
|
+
inputSchema: {
|
|
71
|
+
type: 'object',
|
|
72
|
+
properties: { dealId: { type: 'number' }, category: { type: 'string', enum: ['Pipeline', 'BestCase', 'Commit', 'Closed', 'Omitted'] } },
|
|
73
|
+
required: ['dealId', 'category'],
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
];
|
|
77
|
+
|
|
78
|
+
export const handlers = {
|
|
79
|
+
deal_quote_list: async (a, ctx) => data(await ctx.messagingGet(`/api/v1/deals/${Number(a.dealId)}/quotes`)),
|
|
80
|
+
deal_quote_get: async (a, ctx) => data(await ctx.messagingGet(`/api/v1/quotes/${Number(a.quoteId)}`)),
|
|
81
|
+
deal_quote_create: async (a, ctx) => data(await ctx.messagingPost(`/api/v1/deals/${Number(a.dealId)}/quotes`, pickQuote(a))),
|
|
82
|
+
deal_quote_update: async (a, ctx) => data(await ctx.messagingPut(`/api/v1/quotes/${Number(a.quoteId)}`, pickQuote(a))),
|
|
83
|
+
deal_quote_delete: async (a, ctx) => data(await ctx.messagingDel(`/api/v1/quotes/${Number(a.quoteId)}`)),
|
|
84
|
+
deal_quote_send: async (a, ctx) => data(await ctx.messagingPost(`/api/v1/quotes/${Number(a.quoteId)}/send`, a.email ? { email: a.email } : {})),
|
|
85
|
+
deal_forecast_get: async (a, ctx) => {
|
|
86
|
+
const qs = new URLSearchParams();
|
|
87
|
+
if (a.period) qs.set('period', a.period);
|
|
88
|
+
if (a.ownerUserId) qs.set('ownerUserId', String(Number(a.ownerUserId)));
|
|
89
|
+
return data(await ctx.messagingGet(`/api/v1/forecast${qs.toString() ? `?${qs}` : ''}`));
|
|
90
|
+
},
|
|
91
|
+
deal_forecast_submit: async (a, ctx) => data(await ctx.messagingPost('/api/v1/forecast/submissions', { period: a.period, amount: a.amount, note: a.note })),
|
|
92
|
+
deal_forecast_set_category: async (a, ctx) => data(await ctx.messagingPut(`/api/v1/deals/${Number(a.dealId)}/forecast-category`, { category: a.category })),
|
|
93
|
+
};
|