@helm-ai/mcp-server 0.1.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/dist/index.js ADDED
@@ -0,0 +1,1316 @@
1
+ #!/usr/bin/env node
2
+ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
3
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
+ import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
5
+ // Get configuration from environment variables
6
+ const HELM_API_KEY = process.env.HELM_API_KEY;
7
+ const HELM_API_URL = process.env.HELM_API_URL || "https://revhnqwxovofdgwovloq.supabase.co/functions/v1";
8
+ const SUPABASE_ANON_KEY = process.env.SUPABASE_ANON_KEY || "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InJldmhucXd4b3ZvZmRnd292bG9xIiwicm9sZSI6ImFub24iLCJpYXQiOjE3Mzk4Mjg1ODEsImV4cCI6MjA1NTQwNDU4MX0.xePlF-hXLpS3I7jKDm5zLDxnff2-rN23lL5hfXiWmtw";
9
+ const HELM_DEFAULT_PROJECT_ID = process.env.HELM_DEFAULT_PROJECT_ID;
10
+ if (!HELM_API_KEY) {
11
+ console.error("Error: HELM_API_KEY environment variable is required");
12
+ process.exit(1);
13
+ }
14
+ // Helper function to make authenticated requests to Helm API
15
+ async function helmApiRequest(action, method = "GET", body) {
16
+ const url = new URL(`${HELM_API_URL}/mcp`);
17
+ url.searchParams.set("action", action);
18
+ // Add query params for GET requests
19
+ if (method === "GET" && body) {
20
+ Object.entries(body).forEach(([key, value]) => {
21
+ if (value !== undefined && value !== null) {
22
+ url.searchParams.set(key, String(value));
23
+ }
24
+ });
25
+ }
26
+ const response = await fetch(url.toString(), {
27
+ method,
28
+ headers: {
29
+ "Authorization": `Bearer ${SUPABASE_ANON_KEY}`,
30
+ "X-Helm-API-Key": HELM_API_KEY,
31
+ "Content-Type": "application/json",
32
+ "apikey": SUPABASE_ANON_KEY,
33
+ },
34
+ body: method !== "GET" && body ? JSON.stringify(body) : undefined,
35
+ });
36
+ const data = await response.json();
37
+ if (!response.ok || !data.success) {
38
+ throw new Error(data.error || `API request failed with status ${response.status}`);
39
+ }
40
+ return data;
41
+ }
42
+ // Define MCP tools
43
+ const tools = [
44
+ {
45
+ name: "helm__get_projects",
46
+ description: "Get a list of projects in your Helm workspace",
47
+ inputSchema: {
48
+ type: "object",
49
+ properties: {},
50
+ required: [],
51
+ },
52
+ },
53
+ {
54
+ name: "helm__add_task",
55
+ description: "Create a new task in Helm. All tasks must be linked to a project. If HELM_DEFAULT_PROJECT_ID is set, project_id is optional.",
56
+ inputSchema: {
57
+ type: "object",
58
+ properties: {
59
+ title: {
60
+ type: "string",
61
+ description: "The title of the task",
62
+ },
63
+ description: {
64
+ type: "string",
65
+ description: "Detailed description of the task",
66
+ },
67
+ project_id: {
68
+ type: "string",
69
+ description: "ID of the project to link this task to. If not provided, uses HELM_DEFAULT_PROJECT_ID.",
70
+ },
71
+ priority: {
72
+ type: "string",
73
+ enum: ["low", "medium", "high", "urgent"],
74
+ description: "Priority level of the task (default: medium)",
75
+ },
76
+ status: {
77
+ type: "string",
78
+ enum: ["backlog", "todo", "in_progress", "for_review", "for_approval", "approved", "on_hold", "completed", "archived"],
79
+ description: "Initial status of the task (default: backlog)",
80
+ },
81
+ assignee_ids: {
82
+ type: "array",
83
+ items: { type: "string" },
84
+ description: "Array of user IDs to assign to this task (max 5)",
85
+ },
86
+ },
87
+ required: ["title"],
88
+ },
89
+ },
90
+ {
91
+ name: "helm__get_tasks",
92
+ description: "Get tasks from Helm with optional filters. Archived tasks are excluded by default.",
93
+ inputSchema: {
94
+ type: "object",
95
+ properties: {
96
+ status: {
97
+ type: "string",
98
+ enum: ["backlog", "todo", "in_progress", "for_review", "for_approval", "approved", "on_hold", "completed", "archived"],
99
+ description: "Filter by task status",
100
+ },
101
+ priority: {
102
+ type: "string",
103
+ enum: ["low", "medium", "high", "urgent"],
104
+ description: "Filter by priority level",
105
+ },
106
+ project_id: {
107
+ type: "string",
108
+ description: "Filter by project ID",
109
+ },
110
+ active_only: {
111
+ type: "boolean",
112
+ description: "If true, exclude completed and archived tasks (default: false)",
113
+ },
114
+ include_archived: {
115
+ type: "boolean",
116
+ description: "If true, include archived tasks (default: false - archived excluded by default)",
117
+ },
118
+ limit: {
119
+ type: "number",
120
+ description: "Maximum number of tasks to return (default: 50)",
121
+ },
122
+ },
123
+ required: [],
124
+ },
125
+ },
126
+ {
127
+ name: "helm__get_task",
128
+ description: "Get a specific task by ID",
129
+ inputSchema: {
130
+ type: "object",
131
+ properties: {
132
+ task_id: {
133
+ type: "string",
134
+ description: "The ID of the task to retrieve",
135
+ },
136
+ },
137
+ required: ["task_id"],
138
+ },
139
+ },
140
+ {
141
+ name: "helm__update_task",
142
+ description: "Update an existing task. Can update title, description, status, priority, assignees (up to 5), or due date.",
143
+ inputSchema: {
144
+ type: "object",
145
+ properties: {
146
+ task_id: {
147
+ type: "string",
148
+ description: "The ID of the task to update",
149
+ },
150
+ title: {
151
+ type: "string",
152
+ description: "Updated task title",
153
+ },
154
+ description: {
155
+ type: "string",
156
+ description: "Updated task description",
157
+ },
158
+ status: {
159
+ type: "string",
160
+ enum: ["backlog", "todo", "in_progress", "for_review", "for_approval", "approved", "on_hold", "completed", "archived"],
161
+ description: "Updated task status",
162
+ },
163
+ priority: {
164
+ type: "string",
165
+ enum: ["low", "medium", "high", "urgent"],
166
+ description: "Updated priority level",
167
+ },
168
+ assignee_id: {
169
+ type: "string",
170
+ description: "Updated assignee user ID (legacy - use assignee_ids for multiple assignees)",
171
+ },
172
+ assignee_ids: {
173
+ type: "array",
174
+ items: { type: "string" },
175
+ description: "Array of user IDs to assign to this task (max 5). Replaces all existing assignees.",
176
+ },
177
+ due_date: {
178
+ type: "string",
179
+ description: "Updated due date (ISO 8601 format)",
180
+ },
181
+ },
182
+ required: ["task_id"],
183
+ },
184
+ },
185
+ {
186
+ name: "helm__add_task_comment",
187
+ description: "Add a comment to a task.",
188
+ inputSchema: {
189
+ type: "object",
190
+ properties: {
191
+ task_id: {
192
+ type: "string",
193
+ description: "The ID of the task to comment on",
194
+ },
195
+ content: {
196
+ type: "string",
197
+ description: "The comment content",
198
+ },
199
+ },
200
+ required: ["task_id", "content"],
201
+ },
202
+ },
203
+ {
204
+ name: "helm__create_document",
205
+ description: "Create a new document in Helm. Documents can optionally be linked to a project.",
206
+ inputSchema: {
207
+ type: "object",
208
+ properties: {
209
+ title: {
210
+ type: "string",
211
+ description: "The title of the document",
212
+ },
213
+ description: {
214
+ type: "string",
215
+ description: "Optional description of the document",
216
+ },
217
+ content: {
218
+ oneOf: [
219
+ { type: "string" },
220
+ { type: "object" }
221
+ ],
222
+ description: "Document content as markdown string or Novel.sh editor JSON format. Markdown will be automatically converted to the editor format.",
223
+ },
224
+ project_id: {
225
+ type: "string",
226
+ description: "Optional ID of the project to link this document to",
227
+ },
228
+ status: {
229
+ type: "string",
230
+ enum: ["draft", "published", "archived"],
231
+ description: "Document status (default: draft)",
232
+ },
233
+ visibility: {
234
+ type: "string",
235
+ enum: ["private", "workspace", "shared", "public"],
236
+ description: "Document visibility (default: private)",
237
+ },
238
+ category: {
239
+ type: "string",
240
+ description: "Document category (default: general)",
241
+ },
242
+ tags: {
243
+ type: "array",
244
+ items: { type: "string" },
245
+ description: "Tags for categorizing the document",
246
+ },
247
+ },
248
+ required: ["title"],
249
+ },
250
+ },
251
+ {
252
+ name: "helm__update_document",
253
+ description: "Update an existing document in Helm",
254
+ inputSchema: {
255
+ type: "object",
256
+ properties: {
257
+ document_id: {
258
+ type: "string",
259
+ description: "The ID of the document to update",
260
+ },
261
+ title: {
262
+ type: "string",
263
+ description: "Updated title",
264
+ },
265
+ description: {
266
+ type: "string",
267
+ description: "Updated description",
268
+ },
269
+ content: {
270
+ oneOf: [
271
+ { type: "string" },
272
+ { type: "object" }
273
+ ],
274
+ description: "Updated content as markdown string or Novel.sh editor JSON format. Markdown will be automatically converted to the editor format.",
275
+ },
276
+ status: {
277
+ type: "string",
278
+ enum: ["draft", "published", "archived"],
279
+ description: "Updated status",
280
+ },
281
+ visibility: {
282
+ type: "string",
283
+ enum: ["private", "workspace", "shared", "public"],
284
+ description: "Updated visibility",
285
+ },
286
+ category: {
287
+ type: "string",
288
+ description: "Updated category",
289
+ },
290
+ tags: {
291
+ type: "array",
292
+ items: { type: "string" },
293
+ description: "Updated tags",
294
+ },
295
+ project_id: {
296
+ type: "string",
297
+ description: "Updated project link",
298
+ },
299
+ },
300
+ required: ["document_id"],
301
+ },
302
+ },
303
+ {
304
+ name: "helm__get_documents",
305
+ description: "Get documents from Helm with optional filters",
306
+ inputSchema: {
307
+ type: "object",
308
+ properties: {
309
+ status: {
310
+ type: "string",
311
+ enum: ["draft", "published", "archived"],
312
+ description: "Filter by document status",
313
+ },
314
+ visibility: {
315
+ type: "string",
316
+ enum: ["private", "workspace", "shared", "public"],
317
+ description: "Filter by visibility",
318
+ },
319
+ category: {
320
+ type: "string",
321
+ description: "Filter by category",
322
+ },
323
+ project_id: {
324
+ type: "string",
325
+ description: "Filter by project ID",
326
+ },
327
+ limit: {
328
+ type: "number",
329
+ description: "Maximum number of documents to return (default: 50)",
330
+ },
331
+ },
332
+ required: [],
333
+ },
334
+ },
335
+ {
336
+ name: "helm__get_document",
337
+ description: "Get a specific document by ID",
338
+ inputSchema: {
339
+ type: "object",
340
+ properties: {
341
+ document_id: {
342
+ type: "string",
343
+ description: "The ID of the document to retrieve",
344
+ },
345
+ },
346
+ required: ["document_id"],
347
+ },
348
+ },
349
+ {
350
+ name: "helm__create_time_entry",
351
+ description: "Create a manual time entry. Provide either duration_minutes OR both start_time and end_time.",
352
+ inputSchema: {
353
+ type: "object",
354
+ properties: {
355
+ project_id: {
356
+ type: "string",
357
+ description: "Optional ID of the project to link this time entry to",
358
+ },
359
+ task_id: {
360
+ type: "string",
361
+ description: "Optional ID of the task to link this time entry to",
362
+ },
363
+ task_type: {
364
+ type: "string",
365
+ description: "Type of work (e.g., 'development', 'meeting', 'design', 'testing'). Defaults to 'development'.",
366
+ },
367
+ description: {
368
+ type: "string",
369
+ description: "Description of the work performed",
370
+ },
371
+ duration_minutes: {
372
+ type: "number",
373
+ description: "Duration in minutes (if not providing start/end times)",
374
+ },
375
+ start_time: {
376
+ type: "string",
377
+ description: "Start time (ISO 8601 format)",
378
+ },
379
+ end_time: {
380
+ type: "string",
381
+ description: "End time (ISO 8601 format)",
382
+ },
383
+ },
384
+ required: [],
385
+ },
386
+ },
387
+ {
388
+ name: "helm__get_time_entries",
389
+ description: "Get time entries with optional filters",
390
+ inputSchema: {
391
+ type: "object",
392
+ properties: {
393
+ project_id: {
394
+ type: "string",
395
+ description: "Filter by project ID",
396
+ },
397
+ task_id: {
398
+ type: "string",
399
+ description: "Filter by task ID",
400
+ },
401
+ user_id: {
402
+ type: "string",
403
+ description: "Filter by user ID",
404
+ },
405
+ is_running: {
406
+ type: "string",
407
+ description: "Filter by running status (true/false)",
408
+ },
409
+ limit: {
410
+ type: "number",
411
+ description: "Maximum number of time entries to return (default: 50)",
412
+ },
413
+ },
414
+ required: [],
415
+ },
416
+ },
417
+ {
418
+ name: "helm__create_estimate",
419
+ description: "Create a new estimate with line items",
420
+ inputSchema: {
421
+ type: "object",
422
+ properties: {
423
+ account_id: {
424
+ type: "string",
425
+ description: "Optional ID of the account/client this estimate is for",
426
+ },
427
+ title: {
428
+ type: "string",
429
+ description: "The title of the estimate",
430
+ },
431
+ description: {
432
+ type: "string",
433
+ description: "Optional description of the estimate",
434
+ },
435
+ line_items: {
436
+ type: "array",
437
+ description: "Array of line items for the estimate",
438
+ items: {
439
+ type: "object",
440
+ properties: {
441
+ description: { type: "string" },
442
+ quantity: { type: "number" },
443
+ rate: { type: "number" },
444
+ time_entry_id: { type: "string" },
445
+ project_id: { type: "string" },
446
+ task_id: { type: "string" },
447
+ },
448
+ },
449
+ },
450
+ tax_rate: {
451
+ type: "number",
452
+ description: "Tax rate as a percentage (default: 0)",
453
+ },
454
+ issue_date: {
455
+ type: "string",
456
+ description: "Issue date (ISO 8601 format)",
457
+ },
458
+ expiry_date: {
459
+ type: "string",
460
+ description: "Expiry date (ISO 8601 format)",
461
+ },
462
+ notes: {
463
+ type: "string",
464
+ description: "Client-visible notes",
465
+ },
466
+ internal_notes: {
467
+ type: "string",
468
+ description: "Internal notes (not visible to client)",
469
+ },
470
+ },
471
+ required: ["title"],
472
+ },
473
+ },
474
+ {
475
+ name: "helm__get_estimates",
476
+ description: "Get estimates with optional filters",
477
+ inputSchema: {
478
+ type: "object",
479
+ properties: {
480
+ status: {
481
+ type: "string",
482
+ description: "Filter by estimate status",
483
+ },
484
+ account_id: {
485
+ type: "string",
486
+ description: "Filter by account ID",
487
+ },
488
+ limit: {
489
+ type: "number",
490
+ description: "Maximum number of estimates to return (default: 50)",
491
+ },
492
+ },
493
+ required: [],
494
+ },
495
+ },
496
+ // Account tools
497
+ {
498
+ name: "helm__get_accounts",
499
+ description: "Get accounts/clients from Helm with optional filters",
500
+ inputSchema: {
501
+ type: "object",
502
+ properties: {
503
+ status: {
504
+ type: "string",
505
+ enum: ["active", "inactive", "paused"],
506
+ description: "Filter by account status",
507
+ },
508
+ health: {
509
+ type: "string",
510
+ enum: ["not_set", "needs_attention", "at_risk", "good"],
511
+ description: "Filter by account health",
512
+ },
513
+ owner_id: {
514
+ type: "string",
515
+ description: "Filter by account owner ID",
516
+ },
517
+ limit: {
518
+ type: "number",
519
+ description: "Maximum number of accounts to return (default: 50)",
520
+ },
521
+ },
522
+ required: [],
523
+ },
524
+ },
525
+ {
526
+ name: "helm__get_account",
527
+ description: "Get a specific account by ID",
528
+ inputSchema: {
529
+ type: "object",
530
+ properties: {
531
+ account_id: {
532
+ type: "string",
533
+ description: "The ID of the account to retrieve",
534
+ },
535
+ },
536
+ required: ["account_id"],
537
+ },
538
+ },
539
+ {
540
+ name: "helm__add_account",
541
+ description: "Create a new account/client in Helm",
542
+ inputSchema: {
543
+ type: "object",
544
+ properties: {
545
+ name: {
546
+ type: "string",
547
+ description: "The name of the account (required)",
548
+ },
549
+ email: {
550
+ type: "string",
551
+ description: "Primary email address",
552
+ },
553
+ website: {
554
+ type: "string",
555
+ description: "Website URL",
556
+ },
557
+ phone: {
558
+ type: "string",
559
+ description: "Phone number",
560
+ },
561
+ status: {
562
+ type: "string",
563
+ enum: ["active", "inactive", "paused"],
564
+ description: "Account status (default: active)",
565
+ },
566
+ health: {
567
+ type: "string",
568
+ enum: ["not_set", "needs_attention", "at_risk", "good"],
569
+ description: "Account health indicator (default: not_set)",
570
+ },
571
+ description: {
572
+ type: "string",
573
+ description: "Description of the account",
574
+ },
575
+ address: {
576
+ type: "string",
577
+ description: "Street address",
578
+ },
579
+ city: {
580
+ type: "string",
581
+ description: "City",
582
+ },
583
+ state: {
584
+ type: "string",
585
+ description: "State/Province",
586
+ },
587
+ zip: {
588
+ type: "string",
589
+ description: "ZIP/Postal code",
590
+ },
591
+ country: {
592
+ type: "string",
593
+ description: "Country",
594
+ },
595
+ owner_id: {
596
+ type: "string",
597
+ description: "ID of the account owner (user)",
598
+ },
599
+ },
600
+ required: ["name"],
601
+ },
602
+ },
603
+ {
604
+ name: "helm__update_account",
605
+ description: "Update an existing account/client",
606
+ inputSchema: {
607
+ type: "object",
608
+ properties: {
609
+ account_id: {
610
+ type: "string",
611
+ description: "The ID of the account to update",
612
+ },
613
+ name: {
614
+ type: "string",
615
+ description: "Updated account name",
616
+ },
617
+ email: {
618
+ type: "string",
619
+ description: "Updated email address",
620
+ },
621
+ website: {
622
+ type: "string",
623
+ description: "Updated website URL",
624
+ },
625
+ phone: {
626
+ type: "string",
627
+ description: "Updated phone number",
628
+ },
629
+ status: {
630
+ type: "string",
631
+ enum: ["active", "inactive", "paused"],
632
+ description: "Updated account status",
633
+ },
634
+ health: {
635
+ type: "string",
636
+ enum: ["not_set", "needs_attention", "at_risk", "good"],
637
+ description: "Updated account health",
638
+ },
639
+ description: {
640
+ type: "string",
641
+ description: "Updated description",
642
+ },
643
+ address: {
644
+ type: "string",
645
+ description: "Updated street address",
646
+ },
647
+ city: {
648
+ type: "string",
649
+ description: "Updated city",
650
+ },
651
+ state: {
652
+ type: "string",
653
+ description: "Updated state/province",
654
+ },
655
+ zip: {
656
+ type: "string",
657
+ description: "Updated ZIP/postal code",
658
+ },
659
+ country: {
660
+ type: "string",
661
+ description: "Updated country",
662
+ },
663
+ owner_id: {
664
+ type: "string",
665
+ description: "Updated account owner ID",
666
+ },
667
+ },
668
+ required: ["account_id"],
669
+ },
670
+ },
671
+ // Contact tools
672
+ {
673
+ name: "helm__get_contacts",
674
+ description: "Get contacts/people from Helm with optional filters",
675
+ inputSchema: {
676
+ type: "object",
677
+ properties: {
678
+ account_id: {
679
+ type: "string",
680
+ description: "Filter by associated account ID",
681
+ },
682
+ contact_type: {
683
+ type: "string",
684
+ enum: ["lead", "prospect", "customer", "partner", "vendor"],
685
+ description: "Filter by contact type",
686
+ },
687
+ priority: {
688
+ type: "string",
689
+ enum: ["low", "medium", "high", "urgent"],
690
+ description: "Filter by priority level",
691
+ },
692
+ limit: {
693
+ type: "number",
694
+ description: "Maximum number of contacts to return (default: 50)",
695
+ },
696
+ },
697
+ required: [],
698
+ },
699
+ },
700
+ {
701
+ name: "helm__get_contact",
702
+ description: "Get a specific contact by ID",
703
+ inputSchema: {
704
+ type: "object",
705
+ properties: {
706
+ contact_id: {
707
+ type: "string",
708
+ description: "The ID of the contact to retrieve",
709
+ },
710
+ },
711
+ required: ["contact_id"],
712
+ },
713
+ },
714
+ {
715
+ name: "helm__add_contact",
716
+ description: "Create a new contact/person in Helm",
717
+ inputSchema: {
718
+ type: "object",
719
+ properties: {
720
+ first_name: {
721
+ type: "string",
722
+ description: "First name (required)",
723
+ },
724
+ last_name: {
725
+ type: "string",
726
+ description: "Last name",
727
+ },
728
+ email: {
729
+ type: "string",
730
+ description: "Email address",
731
+ },
732
+ phone: {
733
+ type: "string",
734
+ description: "Phone number",
735
+ },
736
+ account_id: {
737
+ type: "string",
738
+ description: "ID of the associated account",
739
+ },
740
+ title: {
741
+ type: "string",
742
+ description: "Job title",
743
+ },
744
+ contact_type: {
745
+ type: "string",
746
+ enum: ["lead", "prospect", "customer", "partner", "vendor"],
747
+ description: "Type of contact",
748
+ },
749
+ priority: {
750
+ type: "string",
751
+ enum: ["low", "medium", "high", "urgent"],
752
+ description: "Contact priority",
753
+ },
754
+ notes: {
755
+ type: "string",
756
+ description: "Notes about the contact",
757
+ },
758
+ },
759
+ required: ["first_name"],
760
+ },
761
+ },
762
+ {
763
+ name: "helm__update_contact",
764
+ description: "Update an existing contact/person",
765
+ inputSchema: {
766
+ type: "object",
767
+ properties: {
768
+ contact_id: {
769
+ type: "string",
770
+ description: "The ID of the contact to update",
771
+ },
772
+ first_name: {
773
+ type: "string",
774
+ description: "Updated first name",
775
+ },
776
+ last_name: {
777
+ type: "string",
778
+ description: "Updated last name",
779
+ },
780
+ email: {
781
+ type: "string",
782
+ description: "Updated email address",
783
+ },
784
+ phone: {
785
+ type: "string",
786
+ description: "Updated phone number",
787
+ },
788
+ account_id: {
789
+ type: "string",
790
+ description: "Updated associated account ID",
791
+ },
792
+ title: {
793
+ type: "string",
794
+ description: "Updated job title",
795
+ },
796
+ contact_type: {
797
+ type: "string",
798
+ enum: ["lead", "prospect", "customer", "partner", "vendor"],
799
+ description: "Updated contact type",
800
+ },
801
+ priority: {
802
+ type: "string",
803
+ enum: ["low", "medium", "high", "urgent"],
804
+ description: "Updated priority",
805
+ },
806
+ notes: {
807
+ type: "string",
808
+ description: "Updated notes",
809
+ },
810
+ },
811
+ required: ["contact_id"],
812
+ },
813
+ },
814
+ // Deal tools
815
+ {
816
+ name: "helm__get_deals",
817
+ description: "Get deals from Helm with optional filters",
818
+ inputSchema: {
819
+ type: "object",
820
+ properties: {
821
+ stage: {
822
+ type: "string",
823
+ enum: ["lead", "qualified", "proposal", "negotiation", "won", "lost", "archived"],
824
+ description: "Filter by deal stage",
825
+ },
826
+ priority: {
827
+ type: "string",
828
+ enum: ["low", "medium", "high", "urgent"],
829
+ description: "Filter by priority level",
830
+ },
831
+ account_id: {
832
+ type: "string",
833
+ description: "Filter by account ID",
834
+ },
835
+ limit: {
836
+ type: "number",
837
+ description: "Maximum number of deals to return (default: 50)",
838
+ },
839
+ },
840
+ required: [],
841
+ },
842
+ },
843
+ {
844
+ name: "helm__get_deal",
845
+ description: "Get a specific deal by ID",
846
+ inputSchema: {
847
+ type: "object",
848
+ properties: {
849
+ deal_id: {
850
+ type: "string",
851
+ description: "The ID of the deal to retrieve",
852
+ },
853
+ },
854
+ required: ["deal_id"],
855
+ },
856
+ },
857
+ {
858
+ name: "helm__add_deal",
859
+ description: "Create a new deal in Helm",
860
+ inputSchema: {
861
+ type: "object",
862
+ properties: {
863
+ title: {
864
+ type: "string",
865
+ description: "The title of the deal (required)",
866
+ },
867
+ description: {
868
+ type: "string",
869
+ description: "Deal description",
870
+ },
871
+ stage: {
872
+ type: "string",
873
+ enum: ["lead", "qualified", "proposal", "negotiation", "won", "lost", "archived"],
874
+ description: "Deal stage (default: lead)",
875
+ },
876
+ priority: {
877
+ type: "string",
878
+ enum: ["low", "medium", "high", "urgent"],
879
+ description: "Priority level (default: medium)",
880
+ },
881
+ value: {
882
+ type: "number",
883
+ description: "Deal value in dollars",
884
+ },
885
+ probability: {
886
+ type: "number",
887
+ description: "Win probability (0-100)",
888
+ },
889
+ account_id: {
890
+ type: "string",
891
+ description: "Associated account ID",
892
+ },
893
+ expected_close_date: {
894
+ type: "string",
895
+ description: "Expected close date (ISO 8601 format)",
896
+ },
897
+ },
898
+ required: ["title"],
899
+ },
900
+ },
901
+ {
902
+ name: "helm__update_deal",
903
+ description: "Update an existing deal",
904
+ inputSchema: {
905
+ type: "object",
906
+ properties: {
907
+ deal_id: {
908
+ type: "string",
909
+ description: "The ID of the deal to update",
910
+ },
911
+ title: {
912
+ type: "string",
913
+ description: "Updated deal title",
914
+ },
915
+ description: {
916
+ type: "string",
917
+ description: "Updated description",
918
+ },
919
+ stage: {
920
+ type: "string",
921
+ enum: ["lead", "qualified", "proposal", "negotiation", "won", "lost", "archived"],
922
+ description: "Updated deal stage",
923
+ },
924
+ priority: {
925
+ type: "string",
926
+ enum: ["low", "medium", "high", "urgent"],
927
+ description: "Updated priority level",
928
+ },
929
+ value: {
930
+ type: "number",
931
+ description: "Updated deal value",
932
+ },
933
+ probability: {
934
+ type: "number",
935
+ description: "Updated win probability (0-100)",
936
+ },
937
+ account_id: {
938
+ type: "string",
939
+ description: "Updated associated account ID",
940
+ },
941
+ expected_close_date: {
942
+ type: "string",
943
+ description: "Updated expected close date",
944
+ },
945
+ },
946
+ required: ["deal_id"],
947
+ },
948
+ },
949
+ {
950
+ name: "helm__delete_deal",
951
+ description: "Delete a deal",
952
+ inputSchema: {
953
+ type: "object",
954
+ properties: {
955
+ deal_id: {
956
+ type: "string",
957
+ description: "The ID of the deal to delete",
958
+ },
959
+ },
960
+ required: ["deal_id"],
961
+ },
962
+ },
963
+ ];
964
+ // Create MCP server
965
+ const server = new Server({
966
+ name: "helm-mcp-server",
967
+ version: "0.1.0",
968
+ }, {
969
+ capabilities: {
970
+ tools: {},
971
+ },
972
+ });
973
+ // Handle list tools request
974
+ server.setRequestHandler(ListToolsRequestSchema, async () => {
975
+ return { tools };
976
+ });
977
+ // Handle tool execution
978
+ server.setRequestHandler(CallToolRequestSchema, async (request) => {
979
+ const { name, arguments: args } = request.params;
980
+ try {
981
+ switch (name) {
982
+ case "helm__get_projects": {
983
+ const result = await helmApiRequest("get_projects", "GET");
984
+ return {
985
+ content: [
986
+ {
987
+ type: "text",
988
+ text: JSON.stringify(result.projects, null, 2),
989
+ },
990
+ ],
991
+ };
992
+ }
993
+ case "helm__add_task": {
994
+ // Use default project_id if not provided
995
+ const taskArgs = {
996
+ ...(args || {}),
997
+ project_id: args?.project_id || HELM_DEFAULT_PROJECT_ID,
998
+ };
999
+ if (!taskArgs.project_id) {
1000
+ throw new Error("project_id is required. Either provide it or set HELM_DEFAULT_PROJECT_ID.");
1001
+ }
1002
+ const result = await helmApiRequest("add_task", "POST", taskArgs);
1003
+ return {
1004
+ content: [
1005
+ {
1006
+ type: "text",
1007
+ text: `Task created successfully!\n\n${JSON.stringify(result.task, null, 2)}`,
1008
+ },
1009
+ ],
1010
+ };
1011
+ }
1012
+ case "helm__get_tasks": {
1013
+ const result = await helmApiRequest("get_tasks", "GET", args);
1014
+ return {
1015
+ content: [
1016
+ {
1017
+ type: "text",
1018
+ text: JSON.stringify(result.tasks, null, 2),
1019
+ },
1020
+ ],
1021
+ };
1022
+ }
1023
+ case "helm__get_task": {
1024
+ const result = await helmApiRequest("get_task", "GET", args);
1025
+ return {
1026
+ content: [
1027
+ {
1028
+ type: "text",
1029
+ text: JSON.stringify(result.task, null, 2),
1030
+ },
1031
+ ],
1032
+ };
1033
+ }
1034
+ case "helm__update_task": {
1035
+ const result = await helmApiRequest("update_task", "POST", args);
1036
+ return {
1037
+ content: [
1038
+ {
1039
+ type: "text",
1040
+ text: `Task updated successfully!\n\n${JSON.stringify(result.task, null, 2)}`,
1041
+ },
1042
+ ],
1043
+ };
1044
+ }
1045
+ case "helm__add_task_comment": {
1046
+ const result = await helmApiRequest("add_task_comment", "POST", args);
1047
+ return {
1048
+ content: [
1049
+ {
1050
+ type: "text",
1051
+ text: `Comment added successfully!\n\n${JSON.stringify(result.comment, null, 2)}`,
1052
+ },
1053
+ ],
1054
+ };
1055
+ }
1056
+ case "helm__create_document": {
1057
+ const result = await helmApiRequest("create_document", "POST", args);
1058
+ return {
1059
+ content: [
1060
+ {
1061
+ type: "text",
1062
+ text: `Document created successfully!\n\n${JSON.stringify(result.document, null, 2)}`,
1063
+ },
1064
+ ],
1065
+ };
1066
+ }
1067
+ case "helm__update_document": {
1068
+ const result = await helmApiRequest("update_document", "POST", args);
1069
+ return {
1070
+ content: [
1071
+ {
1072
+ type: "text",
1073
+ text: `Document updated successfully!\n\n${JSON.stringify(result.document, null, 2)}`,
1074
+ },
1075
+ ],
1076
+ };
1077
+ }
1078
+ case "helm__get_documents": {
1079
+ const result = await helmApiRequest("get_documents", "GET", args);
1080
+ return {
1081
+ content: [
1082
+ {
1083
+ type: "text",
1084
+ text: JSON.stringify(result.documents, null, 2),
1085
+ },
1086
+ ],
1087
+ };
1088
+ }
1089
+ case "helm__get_document": {
1090
+ const result = await helmApiRequest("get_document", "GET", args);
1091
+ return {
1092
+ content: [
1093
+ {
1094
+ type: "text",
1095
+ text: JSON.stringify(result.document, null, 2),
1096
+ },
1097
+ ],
1098
+ };
1099
+ }
1100
+ case "helm__create_time_entry": {
1101
+ const result = await helmApiRequest("create_time_entry", "POST", args);
1102
+ return {
1103
+ content: [
1104
+ {
1105
+ type: "text",
1106
+ text: `Time entry created successfully!\n\n${JSON.stringify(result.time_entry, null, 2)}`,
1107
+ },
1108
+ ],
1109
+ };
1110
+ }
1111
+ case "helm__get_time_entries": {
1112
+ const result = await helmApiRequest("get_time_entries", "GET", args);
1113
+ return {
1114
+ content: [
1115
+ {
1116
+ type: "text",
1117
+ text: JSON.stringify(result.time_entries, null, 2),
1118
+ },
1119
+ ],
1120
+ };
1121
+ }
1122
+ case "helm__create_estimate": {
1123
+ const result = await helmApiRequest("create_estimate", "POST", args);
1124
+ return {
1125
+ content: [
1126
+ {
1127
+ type: "text",
1128
+ text: `Estimate created successfully!\n\n${JSON.stringify(result.estimate, null, 2)}`,
1129
+ },
1130
+ ],
1131
+ };
1132
+ }
1133
+ case "helm__get_estimates": {
1134
+ const result = await helmApiRequest("get_estimates", "GET", args);
1135
+ return {
1136
+ content: [
1137
+ {
1138
+ type: "text",
1139
+ text: JSON.stringify(result.estimates, null, 2),
1140
+ },
1141
+ ],
1142
+ };
1143
+ }
1144
+ // Account handlers
1145
+ case "helm__get_accounts": {
1146
+ const result = await helmApiRequest("get_accounts", "GET", args);
1147
+ return {
1148
+ content: [
1149
+ {
1150
+ type: "text",
1151
+ text: JSON.stringify(result.accounts, null, 2),
1152
+ },
1153
+ ],
1154
+ };
1155
+ }
1156
+ case "helm__get_account": {
1157
+ const result = await helmApiRequest("get_account", "GET", args);
1158
+ return {
1159
+ content: [
1160
+ {
1161
+ type: "text",
1162
+ text: JSON.stringify(result.account, null, 2),
1163
+ },
1164
+ ],
1165
+ };
1166
+ }
1167
+ case "helm__add_account": {
1168
+ const result = await helmApiRequest("add_account", "POST", args);
1169
+ return {
1170
+ content: [
1171
+ {
1172
+ type: "text",
1173
+ text: `Account created successfully!\n\n${JSON.stringify(result.account, null, 2)}`,
1174
+ },
1175
+ ],
1176
+ };
1177
+ }
1178
+ case "helm__update_account": {
1179
+ const result = await helmApiRequest("update_account", "POST", args);
1180
+ return {
1181
+ content: [
1182
+ {
1183
+ type: "text",
1184
+ text: `Account updated successfully!\n\n${JSON.stringify(result.account, null, 2)}`,
1185
+ },
1186
+ ],
1187
+ };
1188
+ }
1189
+ // Contact handlers
1190
+ case "helm__get_contacts": {
1191
+ const result = await helmApiRequest("get_contacts", "GET", args);
1192
+ return {
1193
+ content: [
1194
+ {
1195
+ type: "text",
1196
+ text: JSON.stringify(result.contacts, null, 2),
1197
+ },
1198
+ ],
1199
+ };
1200
+ }
1201
+ case "helm__get_contact": {
1202
+ const result = await helmApiRequest("get_contact", "GET", args);
1203
+ return {
1204
+ content: [
1205
+ {
1206
+ type: "text",
1207
+ text: JSON.stringify(result.contact, null, 2),
1208
+ },
1209
+ ],
1210
+ };
1211
+ }
1212
+ case "helm__add_contact": {
1213
+ const result = await helmApiRequest("add_contact", "POST", args);
1214
+ return {
1215
+ content: [
1216
+ {
1217
+ type: "text",
1218
+ text: `Contact created successfully!\n\n${JSON.stringify(result.contact, null, 2)}`,
1219
+ },
1220
+ ],
1221
+ };
1222
+ }
1223
+ case "helm__update_contact": {
1224
+ const result = await helmApiRequest("update_contact", "POST", args);
1225
+ return {
1226
+ content: [
1227
+ {
1228
+ type: "text",
1229
+ text: `Contact updated successfully!\n\n${JSON.stringify(result.contact, null, 2)}`,
1230
+ },
1231
+ ],
1232
+ };
1233
+ }
1234
+ // Deal handlers
1235
+ case "helm__get_deals": {
1236
+ const result = await helmApiRequest("get_deals", "GET", args);
1237
+ return {
1238
+ content: [
1239
+ {
1240
+ type: "text",
1241
+ text: JSON.stringify(result.deals, null, 2),
1242
+ },
1243
+ ],
1244
+ };
1245
+ }
1246
+ case "helm__get_deal": {
1247
+ const result = await helmApiRequest("get_deal", "GET", args);
1248
+ return {
1249
+ content: [
1250
+ {
1251
+ type: "text",
1252
+ text: JSON.stringify(result.deal, null, 2),
1253
+ },
1254
+ ],
1255
+ };
1256
+ }
1257
+ case "helm__add_deal": {
1258
+ const result = await helmApiRequest("add_deal", "POST", args);
1259
+ return {
1260
+ content: [
1261
+ {
1262
+ type: "text",
1263
+ text: `Deal created successfully!\n\n${JSON.stringify(result.deal, null, 2)}`,
1264
+ },
1265
+ ],
1266
+ };
1267
+ }
1268
+ case "helm__update_deal": {
1269
+ const result = await helmApiRequest("update_deal", "POST", args);
1270
+ return {
1271
+ content: [
1272
+ {
1273
+ type: "text",
1274
+ text: `Deal updated successfully!\n\n${JSON.stringify(result.deal, null, 2)}`,
1275
+ },
1276
+ ],
1277
+ };
1278
+ }
1279
+ case "helm__delete_deal": {
1280
+ const result = await helmApiRequest("delete_deal", "POST", args);
1281
+ return {
1282
+ content: [
1283
+ {
1284
+ type: "text",
1285
+ text: `Deal deleted successfully!`,
1286
+ },
1287
+ ],
1288
+ };
1289
+ }
1290
+ default:
1291
+ throw new Error(`Unknown tool: ${name}`);
1292
+ }
1293
+ }
1294
+ catch (error) {
1295
+ return {
1296
+ content: [
1297
+ {
1298
+ type: "text",
1299
+ text: `Error: ${error instanceof Error ? error.message : "Unknown error occurred"}`,
1300
+ },
1301
+ ],
1302
+ isError: true,
1303
+ };
1304
+ }
1305
+ });
1306
+ // Start server
1307
+ async function main() {
1308
+ const transport = new StdioServerTransport();
1309
+ await server.connect(transport);
1310
+ console.error("Helm MCP server running on stdio");
1311
+ }
1312
+ main().catch((error) => {
1313
+ console.error("Fatal error in main():", error);
1314
+ process.exit(1);
1315
+ });
1316
+ //# sourceMappingURL=index.js.map