@trustpager/mcp-server 1.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.
Files changed (61) hide show
  1. package/dist/index.d.ts +22 -0
  2. package/dist/index.d.ts.map +1 -0
  3. package/dist/index.js +149 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist/tools/activities.d.ts +7 -0
  6. package/dist/tools/activities.d.ts.map +1 -0
  7. package/dist/tools/activities.js +109 -0
  8. package/dist/tools/activities.js.map +1 -0
  9. package/dist/tools/ai.d.ts +7 -0
  10. package/dist/tools/ai.d.ts.map +1 -0
  11. package/dist/tools/ai.js +105 -0
  12. package/dist/tools/ai.js.map +1 -0
  13. package/dist/tools/automations.d.ts +7 -0
  14. package/dist/tools/automations.d.ts.map +1 -0
  15. package/dist/tools/automations.js +190 -0
  16. package/dist/tools/automations.js.map +1 -0
  17. package/dist/tools/communications.d.ts +7 -0
  18. package/dist/tools/communications.d.ts.map +1 -0
  19. package/dist/tools/communications.js +141 -0
  20. package/dist/tools/communications.js.map +1 -0
  21. package/dist/tools/contacts.d.ts +7 -0
  22. package/dist/tools/contacts.d.ts.map +1 -0
  23. package/dist/tools/contacts.js +125 -0
  24. package/dist/tools/contacts.js.map +1 -0
  25. package/dist/tools/customers.d.ts +7 -0
  26. package/dist/tools/customers.d.ts.map +1 -0
  27. package/dist/tools/customers.js +83 -0
  28. package/dist/tools/customers.js.map +1 -0
  29. package/dist/tools/deals.d.ts +7 -0
  30. package/dist/tools/deals.d.ts.map +1 -0
  31. package/dist/tools/deals.js +264 -0
  32. package/dist/tools/deals.js.map +1 -0
  33. package/dist/tools/documents.d.ts +7 -0
  34. package/dist/tools/documents.d.ts.map +1 -0
  35. package/dist/tools/documents.js +173 -0
  36. package/dist/tools/documents.js.map +1 -0
  37. package/dist/tools/forms.d.ts +7 -0
  38. package/dist/tools/forms.d.ts.map +1 -0
  39. package/dist/tools/forms.js +179 -0
  40. package/dist/tools/forms.js.map +1 -0
  41. package/dist/tools/pipelines.d.ts +7 -0
  42. package/dist/tools/pipelines.d.ts.map +1 -0
  43. package/dist/tools/pipelines.js +207 -0
  44. package/dist/tools/pipelines.js.map +1 -0
  45. package/dist/tools/platform.d.ts +7 -0
  46. package/dist/tools/platform.d.ts.map +1 -0
  47. package/dist/tools/platform.js +188 -0
  48. package/dist/tools/platform.js.map +1 -0
  49. package/dist/tools/products.d.ts +7 -0
  50. package/dist/tools/products.d.ts.map +1 -0
  51. package/dist/tools/products.js +105 -0
  52. package/dist/tools/products.js.map +1 -0
  53. package/dist/tools/tasks.d.ts +7 -0
  54. package/dist/tools/tasks.d.ts.map +1 -0
  55. package/dist/tools/tasks.js +130 -0
  56. package/dist/tools/tasks.js.map +1 -0
  57. package/dist/utils/api-client.d.ts +40 -0
  58. package/dist/utils/api-client.d.ts.map +1 -0
  59. package/dist/utils/api-client.js +98 -0
  60. package/dist/utils/api-client.js.map +1 -0
  61. package/package.json +44 -0
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * TrustPager MCP Server
4
+ *
5
+ * Connects Claude Desktop/Code to your TrustPager workspace via the REST API.
6
+ * Exposes all CRM operations as MCP tools that Claude can call.
7
+ *
8
+ * Setup in claude_desktop_config.json:
9
+ * {
10
+ * "mcpServers": {
11
+ * "trustpager": {
12
+ * "command": "npx",
13
+ * "args": ["-y", "@trustpager/mcp-server"],
14
+ * "env": {
15
+ * "TRUSTPAGER_API_KEY": "tp_live_your_key_here"
16
+ * }
17
+ * }
18
+ * }
19
+ * }
20
+ */
21
+ export {};
22
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;;;;GAkBG"}
package/dist/index.js ADDED
@@ -0,0 +1,149 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * TrustPager MCP Server
4
+ *
5
+ * Connects Claude Desktop/Code to your TrustPager workspace via the REST API.
6
+ * Exposes all CRM operations as MCP tools that Claude can call.
7
+ *
8
+ * Setup in claude_desktop_config.json:
9
+ * {
10
+ * "mcpServers": {
11
+ * "trustpager": {
12
+ * "command": "npx",
13
+ * "args": ["-y", "@trustpager/mcp-server"],
14
+ * "env": {
15
+ * "TRUSTPAGER_API_KEY": "tp_live_your_key_here"
16
+ * }
17
+ * }
18
+ * }
19
+ * }
20
+ */
21
+ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
22
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
23
+ import { ListToolsRequestSchema, CallToolRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
24
+ // Tool imports
25
+ import { contactTools, handleContactTool } from './tools/contacts.js';
26
+ import { customerTools, handleCustomerTool } from './tools/customers.js';
27
+ import { dealTools, handleDealTool } from './tools/deals.js';
28
+ import { pipelineTools, handlePipelineTool } from './tools/pipelines.js';
29
+ import { taskTools, handleTaskTool } from './tools/tasks.js';
30
+ import { activityTools, handleActivityTool } from './tools/activities.js';
31
+ import { productTools, handleProductTool } from './tools/products.js';
32
+ import { automationTools, handleAutomationTool } from './tools/automations.js';
33
+ import { formTools, handleFormTool } from './tools/forms.js';
34
+ import { documentTools, handleDocumentTool } from './tools/documents.js';
35
+ import { communicationTools, handleCommunicationTool } from './tools/communications.js';
36
+ import { platformTools, handlePlatformTool } from './tools/platform.js';
37
+ import { aiTools, handleAiTool } from './tools/ai.js';
38
+ // =============================================================================
39
+ // TOOL REGISTRY
40
+ // =============================================================================
41
+ const ALL_TOOLS = [
42
+ ...contactTools,
43
+ ...customerTools,
44
+ ...dealTools,
45
+ ...pipelineTools,
46
+ ...taskTools,
47
+ ...activityTools,
48
+ ...productTools,
49
+ ...automationTools,
50
+ ...formTools,
51
+ ...documentTools,
52
+ ...communicationTools,
53
+ ...platformTools,
54
+ ...aiTools,
55
+ ];
56
+ /** Map tool name → handler function */
57
+ const TOOL_HANDLERS = {};
58
+ // Register all handlers by tool name
59
+ for (const tool of contactTools)
60
+ TOOL_HANDLERS[tool.name] = handleContactTool;
61
+ for (const tool of customerTools)
62
+ TOOL_HANDLERS[tool.name] = handleCustomerTool;
63
+ for (const tool of dealTools)
64
+ TOOL_HANDLERS[tool.name] = handleDealTool;
65
+ for (const tool of pipelineTools)
66
+ TOOL_HANDLERS[tool.name] = handlePipelineTool;
67
+ for (const tool of taskTools)
68
+ TOOL_HANDLERS[tool.name] = handleTaskTool;
69
+ for (const tool of activityTools)
70
+ TOOL_HANDLERS[tool.name] = handleActivityTool;
71
+ for (const tool of productTools)
72
+ TOOL_HANDLERS[tool.name] = handleProductTool;
73
+ for (const tool of automationTools)
74
+ TOOL_HANDLERS[tool.name] = handleAutomationTool;
75
+ for (const tool of formTools)
76
+ TOOL_HANDLERS[tool.name] = handleFormTool;
77
+ for (const tool of documentTools)
78
+ TOOL_HANDLERS[tool.name] = handleDocumentTool;
79
+ for (const tool of communicationTools)
80
+ TOOL_HANDLERS[tool.name] = handleCommunicationTool;
81
+ for (const tool of platformTools)
82
+ TOOL_HANDLERS[tool.name] = handlePlatformTool;
83
+ for (const tool of aiTools)
84
+ TOOL_HANDLERS[tool.name] = handleAiTool;
85
+ // =============================================================================
86
+ // SERVER
87
+ // =============================================================================
88
+ const server = new Server({ name: '@trustpager/mcp-server', version: '1.0.0' }, { capabilities: { tools: {} } });
89
+ // List all available tools
90
+ server.setRequestHandler(ListToolsRequestSchema, async () => {
91
+ return { tools: ALL_TOOLS };
92
+ });
93
+ // Handle tool calls
94
+ server.setRequestHandler(CallToolRequestSchema, async (request) => {
95
+ const { name, arguments: args } = request.params;
96
+ const handler = TOOL_HANDLERS[name];
97
+ if (!handler) {
98
+ return {
99
+ content: [{
100
+ type: 'text',
101
+ text: `Unknown tool: "${name}". Available tools: ${ALL_TOOLS.map(t => t.name).join(', ')}`,
102
+ }],
103
+ isError: true,
104
+ };
105
+ }
106
+ try {
107
+ const result = await handler(name, (args || {}));
108
+ return {
109
+ content: [{ type: 'text', text: result.text }],
110
+ isError: result.isError,
111
+ };
112
+ }
113
+ catch (error) {
114
+ const message = error instanceof Error ? error.message : 'Unknown error';
115
+ return {
116
+ content: [{ type: 'text', text: `Error in ${name}: ${message}` }],
117
+ isError: true,
118
+ };
119
+ }
120
+ });
121
+ // =============================================================================
122
+ // START
123
+ // =============================================================================
124
+ async function main() {
125
+ // Validate API key is set before starting
126
+ if (!process.env.TRUSTPAGER_API_KEY) {
127
+ console.error('ERROR: TRUSTPAGER_API_KEY environment variable is not set.\n' +
128
+ 'Set it in your Claude Desktop config:\n' +
129
+ '{\n' +
130
+ ' "mcpServers": {\n' +
131
+ ' "trustpager": {\n' +
132
+ ' "command": "npx",\n' +
133
+ ' "args": ["-y", "@trustpager/mcp-server"],\n' +
134
+ ' "env": {\n' +
135
+ ' "TRUSTPAGER_API_KEY": "tp_live_your_key_here"\n' +
136
+ ' }\n' +
137
+ ' }\n' +
138
+ ' }\n' +
139
+ '}');
140
+ process.exit(1);
141
+ }
142
+ const transport = new StdioServerTransport();
143
+ await server.connect(transport);
144
+ }
145
+ main().catch((error) => {
146
+ console.error('Fatal error:', error);
147
+ process.exit(1);
148
+ });
149
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,oCAAoC,CAAC;AAE5C,eAAe;AACf,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MA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,EAAE,MAAe,EAAE,IAAI,EAAE,YAAY,IAAI,KAAK,OAAO,EAAE,EAAE,CAAC;YAC1E,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,gFAAgF;AAChF,QAAQ;AACR,gFAAgF;AAEhF,KAAK,UAAU,IAAI;IACjB,0CAA0C;IAC1C,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,CAAC;QACpC,OAAO,CAAC,KAAK,CACX,8DAA8D;YAC9D,yCAAyC;YACzC,KAAK;YACL,qBAAqB;YACrB,uBAAuB;YACvB,2BAA2B;YAC3B,mDAAmD;YACnD,kBAAkB;YAClB,yDAAyD;YACzD,WAAW;YACX,SAAS;YACT,OAAO;YACP,GAAG,CACJ,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { Tool } from '@modelcontextprotocol/sdk/types.js';
2
+ export declare const activityTools: Tool[];
3
+ export declare function handleActivityTool(name: string, args: Record<string, unknown>): Promise<{
4
+ text: string;
5
+ isError: boolean;
6
+ }>;
7
+ //# sourceMappingURL=activities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"activities.d.ts","sourceRoot":"","sources":["../../src/tools/activities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAG1D,eAAO,MAAM,aAAa,EAAE,IAAI,EAsE/B,CAAC;AAEF,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;GAmCnF"}
@@ -0,0 +1,109 @@
1
+ import { apiRequest, formatResponse, buildQuery, generateIdempotencyKey } from '../utils/api-client.js';
2
+ export const activityTools = [
3
+ {
4
+ name: 'list_activities',
5
+ description: 'List activities with optional filters. Returns paginated results with cursor navigation.',
6
+ inputSchema: {
7
+ type: 'object',
8
+ properties: {
9
+ deal_id: { type: 'string', description: 'Filter by deal UUID' },
10
+ contact_id: { type: 'string', description: 'Filter by contact UUID' },
11
+ customer_id: { type: 'string', description: 'Filter by customer UUID' },
12
+ activity_type: { type: 'string', description: 'Filter by type (note, call, meeting, etc.)' },
13
+ limit: { type: 'number', description: 'Items per page (default 25, max 100)' },
14
+ after: { type: 'string', description: 'Cursor: get items after this ID' },
15
+ },
16
+ },
17
+ },
18
+ {
19
+ name: 'add_note',
20
+ description: 'Add a note to a deal, contact, or customer.',
21
+ inputSchema: {
22
+ type: 'object',
23
+ properties: {
24
+ subject: { type: 'string', description: 'Note subject/title (required)' },
25
+ description: { type: 'string', description: 'Note body/content' },
26
+ deal_id: { type: 'string', description: 'Link to a deal UUID' },
27
+ contact_id: { type: 'string', description: 'Link to a contact UUID' },
28
+ customer_id: { type: 'string', description: 'Link to a customer UUID' },
29
+ },
30
+ required: ['subject'],
31
+ },
32
+ },
33
+ {
34
+ name: 'log_call',
35
+ description: 'Log a phone call with notes.',
36
+ inputSchema: {
37
+ type: 'object',
38
+ properties: {
39
+ subject: { type: 'string', description: 'Call subject/title (required)' },
40
+ description: { type: 'string', description: 'Call notes/summary' },
41
+ deal_id: { type: 'string', description: 'Link to a deal UUID' },
42
+ contact_id: { type: 'string', description: 'Link to a contact UUID' },
43
+ customer_id: { type: 'string', description: 'Link to a customer UUID' },
44
+ },
45
+ required: ['subject'],
46
+ },
47
+ },
48
+ {
49
+ name: 'log_meeting',
50
+ description: 'Log a meeting with notes.',
51
+ inputSchema: {
52
+ type: 'object',
53
+ properties: {
54
+ subject: { type: 'string', description: 'Meeting subject/title (required)' },
55
+ description: { type: 'string', description: 'Meeting notes/summary' },
56
+ deal_id: { type: 'string', description: 'Link to a deal UUID' },
57
+ contact_id: { type: 'string', description: 'Link to a contact UUID' },
58
+ customer_id: { type: 'string', description: 'Link to a customer UUID' },
59
+ },
60
+ required: ['subject'],
61
+ },
62
+ },
63
+ {
64
+ name: 'delete_activity',
65
+ description: 'Permanently delete an activity.',
66
+ inputSchema: {
67
+ type: 'object',
68
+ properties: { id: { type: 'string', description: 'Activity UUID' } },
69
+ required: ['id'],
70
+ },
71
+ },
72
+ ];
73
+ export async function handleActivityTool(name, args) {
74
+ switch (name) {
75
+ case 'list_activities': {
76
+ const { deal_id, contact_id, customer_id, activity_type, limit, after } = args;
77
+ const query = buildQuery({
78
+ deal_id: deal_id,
79
+ contact_id: contact_id,
80
+ customer_id: customer_id,
81
+ activity_type: activity_type,
82
+ limit: limit,
83
+ after: after,
84
+ });
85
+ return formatResponse(await apiRequest('GET', `/activities${query}`));
86
+ }
87
+ case 'add_note': {
88
+ const { id: _, ...rest } = args;
89
+ const body = { ...rest, activity_type: 'note' };
90
+ return formatResponse(await apiRequest('POST', '/activities', body, generateIdempotencyKey()));
91
+ }
92
+ case 'log_call': {
93
+ const { id: _, ...rest } = args;
94
+ const body = { ...rest, activity_type: 'call' };
95
+ return formatResponse(await apiRequest('POST', '/activities', body, generateIdempotencyKey()));
96
+ }
97
+ case 'log_meeting': {
98
+ const { id: _, ...rest } = args;
99
+ const body = { ...rest, activity_type: 'meeting' };
100
+ return formatResponse(await apiRequest('POST', '/activities', body, generateIdempotencyKey()));
101
+ }
102
+ case 'delete_activity': {
103
+ return formatResponse(await apiRequest('DELETE', `/activities/${args.id}`));
104
+ }
105
+ default:
106
+ return { text: `Unknown activity tool: ${name}`, isError: true };
107
+ }
108
+ }
109
+ //# sourceMappingURL=activities.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AI,CAAC;YAChC,MAAM,IAAI,GAAG,EAAE,GAAG,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,CAAC;YAChD,OAAO,cAAc,CAAC,MAAM,UAAU,CAAC,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,sBAAsB,EAAE,CAAC,CAAC,CAAC;QACjG,CAAC;QACD,KAAK,aAAa,CAAC,CAAC,CAAC;YACnB,MAAM,EAAE,EAAE,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC;YAChC,MAAM,IAAI,GAAG,EAAE,GAAG,IAAI,EAAE,aAAa,EAAE,SAAS,EAAE,CAAC;YACnD,OAAO,cAAc,CAAC,MAAM,UAAU,CAAC,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,sBAAsB,EAAE,CAAC,CAAC,CAAC;QACjG,CAAC;QACD,KAAK,iBAAiB,CAAC,CAAC,CAAC;YACvB,OAAO,cAAc,CAAC,MAAM,UAAU,CAAC,QAAQ,EAAE,eAAe,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;QAC9E,CAAC;QACD;YACE,OAAO,EAAE,IAAI,EAAE,0BAA0B,IAAI,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IACrE,CAAC;AACH,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { Tool } from '@modelcontextprotocol/sdk/types.js';
2
+ export declare const aiTools: Tool[];
3
+ export declare function handleAiTool(name: string, args: Record<string, unknown>): Promise<{
4
+ text: string;
5
+ isError: boolean;
6
+ }>;
7
+ //# sourceMappingURL=ai.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai.d.ts","sourceRoot":"","sources":["../../src/tools/ai.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAG1D,eAAO,MAAM,OAAO,EAAE,IAAI,EA6DzB,CAAC;AAEF,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;GAwC7E"}
@@ -0,0 +1,105 @@
1
+ import { apiRequest, formatResponse, generateIdempotencyKey } from '../utils/api-client.js';
2
+ export const aiTools = [
3
+ {
4
+ name: 'ai_enrich',
5
+ description: 'Research a contact or customer online and enrich their profile. Costs 5 credits.',
6
+ inputSchema: {
7
+ type: 'object',
8
+ properties: {
9
+ entity_type: { type: 'string', enum: ['contact', 'customer'], description: 'Type of entity to enrich (required)' },
10
+ entity_id: { type: 'string', description: 'UUID of the contact or customer (required)' },
11
+ },
12
+ required: ['entity_type', 'entity_id'],
13
+ },
14
+ },
15
+ {
16
+ name: 'ai_edit_text',
17
+ description: 'Rewrite or edit text using AI. Costs 1 credit.',
18
+ inputSchema: {
19
+ type: 'object',
20
+ properties: {
21
+ text: { type: 'string', description: 'The text to edit (required)' },
22
+ instruction: { type: 'string', description: 'What to do with the text, e.g. "make it more professional" (required)' },
23
+ style: { type: 'string', description: 'Writing style (e.g. formal, casual, persuasive)' },
24
+ },
25
+ required: ['text', 'instruction'],
26
+ },
27
+ },
28
+ {
29
+ name: 'ai_deal_probability',
30
+ description: 'Get an AI qualification score for a deal. Costs 2 credits.',
31
+ inputSchema: {
32
+ type: 'object',
33
+ properties: {
34
+ deal_id: { type: 'string', description: 'Deal UUID (required)' },
35
+ },
36
+ required: ['deal_id'],
37
+ },
38
+ },
39
+ {
40
+ name: 'ai_call_coaching',
41
+ description: 'Analyze a call transcript for coaching insights. Costs 3 credits.',
42
+ inputSchema: {
43
+ type: 'object',
44
+ properties: {
45
+ transcript_id: { type: 'string', description: 'Transcript UUID (provide this or transcript_text)' },
46
+ transcript_text: { type: 'string', description: 'Raw transcript text (provide this or transcript_id)' },
47
+ team_member_name: { type: 'string', description: 'Name of the team member for personalised coaching' },
48
+ },
49
+ },
50
+ },
51
+ {
52
+ name: 'ai_generate_pipeline',
53
+ description: 'Generate a sales pipeline from a description. Costs 3 credits.',
54
+ inputSchema: {
55
+ type: 'object',
56
+ properties: {
57
+ description: { type: 'string', description: 'Description of the sales process (required)' },
58
+ industry: { type: 'string', description: 'Industry for tailored stage suggestions' },
59
+ },
60
+ required: ['description'],
61
+ },
62
+ },
63
+ ];
64
+ export async function handleAiTool(name, args) {
65
+ switch (name) {
66
+ case 'ai_enrich': {
67
+ const { entity_type, entity_id } = args;
68
+ const res = await apiRequest('POST', '/ai/enrich', {
69
+ entity_type, entity_id,
70
+ }, generateIdempotencyKey());
71
+ return formatResponse(res);
72
+ }
73
+ case 'ai_edit_text': {
74
+ const { text, instruction, style } = args;
75
+ const res = await apiRequest('POST', '/ai/edit-text', {
76
+ text, instruction, style,
77
+ }, generateIdempotencyKey());
78
+ return formatResponse(res);
79
+ }
80
+ case 'ai_deal_probability': {
81
+ const { deal_id } = args;
82
+ const res = await apiRequest('POST', '/ai/deal-probability', {
83
+ deal_id,
84
+ }, generateIdempotencyKey());
85
+ return formatResponse(res);
86
+ }
87
+ case 'ai_call_coaching': {
88
+ const { transcript_id, transcript_text, team_member_name } = args;
89
+ const res = await apiRequest('POST', '/ai/call-coaching', {
90
+ transcript_id, transcript_text, team_member_name,
91
+ }, generateIdempotencyKey());
92
+ return formatResponse(res);
93
+ }
94
+ case 'ai_generate_pipeline': {
95
+ const { description, industry } = args;
96
+ const res = await apiRequest('POST', '/ai/generate-pipeline', {
97
+ description, industry,
98
+ }, generateIdempotencyKey());
99
+ return formatResponse(res);
100
+ }
101
+ default:
102
+ return { text: `Unknown AI tool: ${name}`, isError: true };
103
+ }
104
+ }
105
+ //# sourceMappingURL=ai.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai.js","sourceRoot":"","sources":["../../src/tools/ai.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAc,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAExG,MAAM,CAAC,MAAM,OAAO,GAAW;IAC7B;QACE,IAAI,EAAE,WAAW;QACjB,WAAW,EAAE,kFAAk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M,GAAG,GAAG,MAAM,UAAU,CAAC,MAAM,EAAE,sBAAsB,EAAE;gBAC3D,OAAO;aACR,EAAE,sBAAsB,EAAE,CAAC,CAAC;YAC7B,OAAO,cAAc,CAAC,GAAG,CAAC,CAAC;QAC7B,CAAC;QACD,KAAK,kBAAkB,CAAC,CAAC,CAAC;YACxB,MAAM,EAAE,aAAa,EAAE,eAAe,EAAE,gBAAgB,EAAE,GAAG,IAAI,CAAC;YAClE,MAAM,GAAG,GAAG,MAAM,UAAU,CAAC,MAAM,EAAE,mBAAmB,EAAE;gBACxD,aAAa,EAAE,eAAe,EAAE,gBAAgB;aACjD,EAAE,sBAAsB,EAAE,CAAC,CAAC;YAC7B,OAAO,cAAc,CAAC,GAAG,CAAC,CAAC;QAC7B,CAAC;QACD,KAAK,sBAAsB,CAAC,CAAC,CAAC;YAC5B,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;YACvC,MAAM,GAAG,GAAG,MAAM,UAAU,CAAC,MAAM,EAAE,uBAAuB,EAAE;gBAC5D,WAAW,EAAE,QAAQ;aACtB,EAAE,sBAAsB,EAAE,CAAC,CAAC;YAC7B,OAAO,cAAc,CAAC,GAAG,CAAC,CAAC;QAC7B,CAAC;QACD;YACE,OAAO,EAAE,IAAI,EAAE,oBAAoB,IAAI,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC/D,CAAC;AACH,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { Tool } from '@modelcontextprotocol/sdk/types.js';
2
+ export declare const automationTools: Tool[];
3
+ export declare function handleAutomationTool(name: string, args: Record<string, unknown>): Promise<{
4
+ text: string;
5
+ isError: boolean;
6
+ }>;
7
+ //# sourceMappingURL=automations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"automations.d.ts","sourceRoot":"","sources":["../../src/tools/automations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAG1D,eAAO,MAAM,eAAe,EAAE,IAAI,EA+IjC,CAAC;AAEF,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;GA2CrF"}
@@ -0,0 +1,190 @@
1
+ import { apiRequest, formatResponse, buildQuery, generateIdempotencyKey } from '../utils/api-client.js';
2
+ export const automationTools = [
3
+ {
4
+ name: 'list_automations',
5
+ description: 'List all automations with optional filters.',
6
+ inputSchema: {
7
+ type: 'object',
8
+ properties: {
9
+ limit: { type: 'number', description: 'Items per page (default 25, max 100)' },
10
+ after: { type: 'string', description: 'Cursor: get items after this ID' },
11
+ enabled: { type: 'boolean', description: 'Filter by enabled status' },
12
+ },
13
+ },
14
+ },
15
+ {
16
+ name: 'get_automation',
17
+ description: 'Get a single automation by ID with its triggers and actions inline.',
18
+ inputSchema: {
19
+ type: 'object',
20
+ properties: {
21
+ id: { type: 'string', description: 'Automation UUID' },
22
+ },
23
+ required: ['id'],
24
+ },
25
+ },
26
+ {
27
+ name: 'create_automation',
28
+ description: 'Create a new automation.',
29
+ inputSchema: {
30
+ type: 'object',
31
+ properties: {
32
+ name: { type: 'string', description: 'Automation name (required)' },
33
+ trigger_type: {
34
+ type: 'string',
35
+ description: 'Trigger type (required). Examples: stage_changed, form_submitted, call_analyzed, sms_received, email_received, checkout_completed',
36
+ },
37
+ description: { type: 'string', description: 'Automation description' },
38
+ enabled: { type: 'boolean', description: 'Whether the automation is enabled (default false)' },
39
+ conditions: { type: 'object', description: 'Trigger conditions (JSON)' },
40
+ crm_integration: { type: 'object', description: 'CRM integration config (JSON)' },
41
+ },
42
+ required: ['name', 'trigger_type'],
43
+ },
44
+ },
45
+ {
46
+ name: 'update_automation',
47
+ description: 'Update an existing automation. Only include fields you want to change.',
48
+ inputSchema: {
49
+ type: 'object',
50
+ properties: {
51
+ id: { type: 'string', description: 'Automation UUID' },
52
+ name: { type: 'string' },
53
+ description: { type: 'string' },
54
+ enabled: { type: 'boolean' },
55
+ conditions: { type: 'object' },
56
+ crm_integration: { type: 'object' },
57
+ },
58
+ required: ['id'],
59
+ },
60
+ },
61
+ {
62
+ name: 'delete_automation',
63
+ description: 'Permanently delete an automation.',
64
+ inputSchema: {
65
+ type: 'object',
66
+ properties: { id: { type: 'string', description: 'Automation UUID' } },
67
+ required: ['id'],
68
+ },
69
+ },
70
+ {
71
+ name: 'enable_automation',
72
+ description: 'Enable an automation so it runs when triggered.',
73
+ inputSchema: {
74
+ type: 'object',
75
+ properties: { id: { type: 'string', description: 'Automation UUID' } },
76
+ required: ['id'],
77
+ },
78
+ },
79
+ {
80
+ name: 'disable_automation',
81
+ description: 'Disable an automation so it stops running.',
82
+ inputSchema: {
83
+ type: 'object',
84
+ properties: { id: { type: 'string', description: 'Automation UUID' } },
85
+ required: ['id'],
86
+ },
87
+ },
88
+ {
89
+ name: 'add_automation_trigger',
90
+ description: 'Add a trigger to an automation.',
91
+ inputSchema: {
92
+ type: 'object',
93
+ properties: {
94
+ id: { type: 'string', description: 'Automation UUID' },
95
+ source_type: { type: 'string', description: 'Trigger source type (required)' },
96
+ source_id: { type: 'string', description: 'Trigger source ID (optional, depends on source_type)' },
97
+ config: { type: 'object', description: 'Trigger configuration (JSON)' },
98
+ },
99
+ required: ['id', 'source_type'],
100
+ },
101
+ },
102
+ {
103
+ name: 'add_automation_action',
104
+ description: 'Add an action to an automation.',
105
+ inputSchema: {
106
+ type: 'object',
107
+ properties: {
108
+ id: { type: 'string', description: 'Automation UUID' },
109
+ action_type: {
110
+ type: 'string',
111
+ description: 'Action type (required). Examples: send_custom_email, send_sms, trigger_voice_call, add_tasks, create_lead, call_webhook',
112
+ },
113
+ sequence: { type: 'number', description: 'Execution order (required, starts at 1)' },
114
+ config: { type: 'object', description: 'Action configuration (JSON)' },
115
+ integration_id: { type: 'string', description: 'Integration UUID for integration-based actions' },
116
+ },
117
+ required: ['id', 'action_type', 'sequence'],
118
+ },
119
+ },
120
+ {
121
+ name: 'list_automation_runs',
122
+ description: 'List execution runs for an automation with status and timestamps.',
123
+ inputSchema: {
124
+ type: 'object',
125
+ properties: {
126
+ id: { type: 'string', description: 'Automation UUID' },
127
+ limit: { type: 'number', description: 'Items per page (default 25, max 100)' },
128
+ after: { type: 'string', description: 'Cursor: get items after this ID' },
129
+ },
130
+ required: ['id'],
131
+ },
132
+ },
133
+ {
134
+ name: 'trigger_automation',
135
+ description: 'Manually trigger an automation. Costs 5 credits.',
136
+ inputSchema: {
137
+ type: 'object',
138
+ properties: {
139
+ id: { type: 'string', description: 'Automation UUID' },
140
+ trigger_data: { type: 'object', description: 'Optional data to pass to the trigger' },
141
+ },
142
+ required: ['id'],
143
+ },
144
+ },
145
+ ];
146
+ export async function handleAutomationTool(name, args) {
147
+ switch (name) {
148
+ case 'list_automations': {
149
+ const { limit, after, enabled } = args;
150
+ const query = buildQuery({ limit: limit, after: after, enabled: enabled });
151
+ return formatResponse(await apiRequest('GET', `/automations${query}`));
152
+ }
153
+ case 'get_automation':
154
+ return formatResponse(await apiRequest('GET', `/automations/${args.id}`));
155
+ case 'create_automation': {
156
+ const { id: _, ...body } = args;
157
+ return formatResponse(await apiRequest('POST', '/automations', body, generateIdempotencyKey()));
158
+ }
159
+ case 'update_automation': {
160
+ const { id, ...body } = args;
161
+ return formatResponse(await apiRequest('PATCH', `/automations/${id}`, body));
162
+ }
163
+ case 'delete_automation':
164
+ return formatResponse(await apiRequest('DELETE', `/automations/${args.id}`));
165
+ case 'enable_automation':
166
+ return formatResponse(await apiRequest('POST', `/automations/${args.id}/enable`, undefined, generateIdempotencyKey()));
167
+ case 'disable_automation':
168
+ return formatResponse(await apiRequest('POST', `/automations/${args.id}/disable`, undefined, generateIdempotencyKey()));
169
+ case 'add_automation_trigger': {
170
+ const { id, ...body } = args;
171
+ return formatResponse(await apiRequest('POST', `/automations/${id}/triggers`, body, generateIdempotencyKey()));
172
+ }
173
+ case 'add_automation_action': {
174
+ const { id, ...body } = args;
175
+ return formatResponse(await apiRequest('POST', `/automations/${id}/actions`, body, generateIdempotencyKey()));
176
+ }
177
+ case 'list_automation_runs': {
178
+ const { id, limit, after } = args;
179
+ const query = buildQuery({ limit: limit, after: after });
180
+ return formatResponse(await apiRequest('GET', `/automations/${id}/runs${query}`));
181
+ }
182
+ case 'trigger_automation': {
183
+ const body = args.trigger_data ? { trigger_data: args.trigger_data } : undefined;
184
+ return formatResponse(await apiRequest('POST', `/automations/${args.id}/trigger`, body, generateIdempotencyKey()));
185
+ }
186
+ default:
187
+ return { text: `Unknown automation tool: ${name}`, isError: true };
188
+ }
189
+ }
190
+ //# sourceMappingURL=automations.js.map