@velaro/mcp-server 2.0.96 → 2.0.98
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@velaro/mcp-server",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.98",
|
|
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,110 @@
|
|
|
1
|
+
// MCP parity for `velaro crm-object` and `velaro crm-rel` (cli/lib/commands/crm-objects-relationships.js).
|
|
2
|
+
// Backend: velaro-messaging CrmObjectsController and CrmRelationshipsController
|
|
3
|
+
// (docs/architecture/crm-studio-program.md, features 18 and 19). Site from the credential, never an argument.
|
|
4
|
+
|
|
5
|
+
const REL_ENTITIES = ['contact', 'company', 'deal', 'object'];
|
|
6
|
+
|
|
7
|
+
const data = (r) => (r && typeof r === 'object' && 'data' in r ? r.data : r);
|
|
8
|
+
const q = (o) => {
|
|
9
|
+
const p = Object.entries(o).filter(([, v]) => v !== undefined && v !== null && v !== '').map(([k, v]) => `${k}=${encodeURIComponent(v)}`);
|
|
10
|
+
return p.length ? `?${p.join('&')}` : '';
|
|
11
|
+
};
|
|
12
|
+
const id = (v) => encodeURIComponent(v);
|
|
13
|
+
const num = { type: 'number' };
|
|
14
|
+
|
|
15
|
+
export const tools = [
|
|
16
|
+
{ name: 'crm_object_type_list', description: 'List the custom CRM object types of this account (your own record types such as Projects or Assets).', inputSchema: { type: 'object', properties: {} } },
|
|
17
|
+
{
|
|
18
|
+
name: 'crm_object_type_save',
|
|
19
|
+
description: 'Create a custom CRM object type, or update one with id. Administrator only. Part of the CRM Studio package (see your plan). Types are archived, never hard-deleted.',
|
|
20
|
+
inputSchema: { type: 'object', properties: { id: num, name: { type: 'string' }, pluralName: { type: 'string' }, description: { type: 'string' } }, required: ['name'] },
|
|
21
|
+
},
|
|
22
|
+
{ name: 'crm_object_type_archive', description: 'Archive a custom object type; its records are kept. Administrator only.', inputSchema: { type: 'object', properties: { id: num }, required: ['id'] } },
|
|
23
|
+
{ name: 'crm_object_type_restore', description: 'Restore an archived custom object type. Administrator only.', inputSchema: { type: 'object', properties: { id: num }, required: ['id'] } },
|
|
24
|
+
{ name: 'crm_object_field_list', description: 'List the fields of a custom object type, with their types and role security.', inputSchema: { type: 'object', properties: { typeId: num }, required: ['typeId'] } },
|
|
25
|
+
{
|
|
26
|
+
name: 'crm_object_field_save',
|
|
27
|
+
description: 'Add a field to a custom object type, or update one with fieldId. Administrator only. The definition has label, fieldType, optionsJson, isRequired, helpText, defaultValue and optional read and write roles. Calculated fields are not offered on custom objects.',
|
|
28
|
+
inputSchema: { type: 'object', properties: { typeId: num, fieldId: num, definition: { type: 'object', description: 'Field definition: label, fieldType, optionsJson, isRequired, helpText, defaultValue, readRolesJson, writeRolesJson.' } }, required: ['typeId', 'definition'] },
|
|
29
|
+
},
|
|
30
|
+
{ name: 'crm_object_field_archive', description: 'Archive a custom object field. Administrator only.', inputSchema: { type: 'object', properties: { typeId: num, fieldId: num }, required: ['typeId', 'fieldId'] } },
|
|
31
|
+
{
|
|
32
|
+
name: 'crm_object_record_list',
|
|
33
|
+
description: 'List the records of a custom object type, a page at a time. Search matches the record name only.',
|
|
34
|
+
inputSchema: { type: 'object', properties: { typeId: num, search: { type: 'string' }, includeArchived: { type: 'boolean' }, page: num, pageSize: num }, required: ['typeId'] },
|
|
35
|
+
},
|
|
36
|
+
{ name: 'crm_object_record_get', description: 'Get one custom object record with its field values (fields the caller cannot read are left out).', inputSchema: { type: 'object', properties: { typeId: num, id: num }, required: ['typeId', 'id'] } },
|
|
37
|
+
{
|
|
38
|
+
name: 'crm_object_record_save',
|
|
39
|
+
description: 'Create a custom object record, or update one with id. Values go through the same format rules and field security as other CRM custom fields.',
|
|
40
|
+
inputSchema: {
|
|
41
|
+
type: 'object',
|
|
42
|
+
properties: {
|
|
43
|
+
typeId: num, id: num, name: { type: 'string' },
|
|
44
|
+
values: { type: 'array', items: { type: 'object', properties: { customFieldId: num, value: {} }, required: ['customFieldId'] } },
|
|
45
|
+
},
|
|
46
|
+
required: ['typeId', 'name'],
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
{ name: 'crm_object_record_archive', description: 'Archive a custom object record (restorable).', inputSchema: { type: 'object', properties: { typeId: num, id: num }, required: ['typeId', 'id'] } },
|
|
50
|
+
{ name: 'crm_object_record_restore', description: 'Restore an archived custom object record.', inputSchema: { type: 'object', properties: { typeId: num, id: num }, required: ['typeId', 'id'] } },
|
|
51
|
+
{ name: 'crm_rel_type_list', description: 'List the relationship types of this account, such as "reports to" and "manages". Part of the CRM Studio package (see your plan).', inputSchema: { type: 'object', properties: {} } },
|
|
52
|
+
{
|
|
53
|
+
name: 'crm_rel_type_save',
|
|
54
|
+
description: 'Create a relationship type, or update one with id. A blank inverseName makes the type symmetric (for example "partner of"). Administrator only.',
|
|
55
|
+
inputSchema: { type: 'object', properties: { id: num, name: { type: 'string' }, inverseName: { type: 'string' } }, required: ['name'] },
|
|
56
|
+
},
|
|
57
|
+
{ name: 'crm_rel_type_archive', description: 'Archive a relationship type. Administrator only.', inputSchema: { type: 'object', properties: { id: num }, required: ['id'] } },
|
|
58
|
+
{ name: 'crm_rel_type_restore', description: 'Restore an archived relationship type. Administrator only.', inputSchema: { type: 'object', properties: { id: num }, required: ['id'] } },
|
|
59
|
+
{
|
|
60
|
+
name: 'crm_rel_link',
|
|
61
|
+
description: 'Link two CRM records (contact, company, deal or custom object record) with a relationship type. Linking the same pair twice keeps one link.',
|
|
62
|
+
inputSchema: {
|
|
63
|
+
type: 'object',
|
|
64
|
+
properties: { typeId: num, fromEntity: { type: 'string', enum: REL_ENTITIES }, fromId: num, toEntity: { type: 'string', enum: REL_ENTITIES }, toId: num },
|
|
65
|
+
required: ['typeId', 'fromEntity', 'fromId', 'toEntity', 'toId'],
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
{ name: 'crm_rel_unlink', description: 'Remove a relationship link by its id.', inputSchema: { type: 'object', properties: { id: num }, required: ['id'] } },
|
|
69
|
+
{
|
|
70
|
+
name: 'crm_rel_list',
|
|
71
|
+
description: 'List every relationship of one CRM record in both directions, each side with its own label.',
|
|
72
|
+
inputSchema: { type: 'object', properties: { entity: { type: 'string', enum: REL_ENTITIES }, id: num }, required: ['entity', 'id'] },
|
|
73
|
+
},
|
|
74
|
+
];
|
|
75
|
+
|
|
76
|
+
export const handlers = {
|
|
77
|
+
crm_object_type_list: async (_a, ctx) => data(await ctx.messagingGet('/CrmObjects')),
|
|
78
|
+
crm_object_type_save: async (a, ctx) => {
|
|
79
|
+
const body = { name: a.name, pluralName: a.pluralName, description: a.description };
|
|
80
|
+
return data(a.id ? await ctx.messagingPut(`/CrmObjects/${id(a.id)}`, body) : await ctx.messagingPost('/CrmObjects', body));
|
|
81
|
+
},
|
|
82
|
+
crm_object_type_archive: async (a, ctx) => data(await ctx.messagingDel(`/CrmObjects/${id(a.id)}`)),
|
|
83
|
+
crm_object_type_restore: async (a, ctx) => data(await ctx.messagingPost(`/CrmObjects/${id(a.id)}/restore`, {})),
|
|
84
|
+
crm_object_field_list: async (a, ctx) => data(await ctx.messagingGet(`/CrmObjects/${id(a.typeId)}/fields`)),
|
|
85
|
+
crm_object_field_save: async (a, ctx) => data(a.fieldId
|
|
86
|
+
? await ctx.messagingPut(`/CrmObjects/${id(a.typeId)}/fields/${id(a.fieldId)}`, a.definition)
|
|
87
|
+
: await ctx.messagingPost(`/CrmObjects/${id(a.typeId)}/fields`, a.definition)),
|
|
88
|
+
crm_object_field_archive: async (a, ctx) => data(await ctx.messagingDel(`/CrmObjects/${id(a.typeId)}/fields/${id(a.fieldId)}`)),
|
|
89
|
+
crm_object_record_list: async (a, ctx) => data(await ctx.messagingGet(`/CrmObjects/${id(a.typeId)}/records${q({ search: a.search, includeArchived: a.includeArchived ? 'true' : undefined, page: a.page, pageSize: a.pageSize })}`)),
|
|
90
|
+
crm_object_record_get: async (a, ctx) => data(await ctx.messagingGet(`/CrmObjects/${id(a.typeId)}/records/${id(a.id)}`)),
|
|
91
|
+
crm_object_record_save: async (a, ctx) => {
|
|
92
|
+
const body = { name: a.name };
|
|
93
|
+
if (a.values !== undefined) body.values = a.values;
|
|
94
|
+
return data(a.id
|
|
95
|
+
? await ctx.messagingPut(`/CrmObjects/${id(a.typeId)}/records/${id(a.id)}`, body)
|
|
96
|
+
: await ctx.messagingPost(`/CrmObjects/${id(a.typeId)}/records`, body));
|
|
97
|
+
},
|
|
98
|
+
crm_object_record_archive: async (a, ctx) => data(await ctx.messagingDel(`/CrmObjects/${id(a.typeId)}/records/${id(a.id)}`)),
|
|
99
|
+
crm_object_record_restore: async (a, ctx) => data(await ctx.messagingPost(`/CrmObjects/${id(a.typeId)}/records/${id(a.id)}/restore`, {})),
|
|
100
|
+
crm_rel_type_list: async (_a, ctx) => data(await ctx.messagingGet('/CrmRelationships/types')),
|
|
101
|
+
crm_rel_type_save: async (a, ctx) => {
|
|
102
|
+
const body = { name: a.name, inverseName: a.inverseName };
|
|
103
|
+
return data(a.id ? await ctx.messagingPut(`/CrmRelationships/types/${id(a.id)}`, body) : await ctx.messagingPost('/CrmRelationships/types', body));
|
|
104
|
+
},
|
|
105
|
+
crm_rel_type_archive: async (a, ctx) => data(await ctx.messagingDel(`/CrmRelationships/types/${id(a.id)}`)),
|
|
106
|
+
crm_rel_type_restore: async (a, ctx) => data(await ctx.messagingPost(`/CrmRelationships/types/${id(a.id)}/restore`, {})),
|
|
107
|
+
crm_rel_link: async (a, ctx) => data(await ctx.messagingPost('/CrmRelationships', { typeId: a.typeId, fromEntity: a.fromEntity, fromId: a.fromId, toEntity: a.toEntity, toId: a.toId })),
|
|
108
|
+
crm_rel_unlink: async (a, ctx) => data(await ctx.messagingDel(`/CrmRelationships/${id(a.id)}`)),
|
|
109
|
+
crm_rel_list: async (a, ctx) => data(await ctx.messagingGet(`/CrmRelationships/record/${id(a.entity)}/${id(a.id)}`)),
|
|
110
|
+
};
|