Repository navigation
Expand file tree
/
Copy pathindex.js
More file actions
2308 lines (2093 loc) · 71.4 KB
/
Copy pathindex.js
File metadata and controls
2308 lines (2093 loc) · 71.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import { loadEnv } from "./tools/envLoader.js";
loadEnv();
import { McpServer, ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { z } from "zod";
import * as fileOps from "./tools/fileOps.js";
import * as dirOps from "./tools/directoryOps.js";
import * as gitOps from "./tools/gitOps.js";
import * as commandOps from "./tools/commandOps.js";
import * as githubOps from "./tools/githubOps.js";
import * as vercelOps from "./tools/vercelOps.js";
import * as supabaseOps from "./tools/supabaseOps.js";
import * as slackOps from "./tools/slackOps.js";
import * as gmailOps from "./tools/gmailOps.js";
import * as projectOps from "./tools/projectOps.js";
import * as workflowOps from "./tools/workflowOps.js";
import { wrap } from "./tools/toolWrapper.js";
import * as notionOps from "./tools/notionOps.js";
import * as terraformOps from "./tools/terraformOps.js";
import * as dockerOps from "./tools/dockerOps.js";
import * as dbOps from "./tools/dbOps.js";
import * as secretsOps from "./tools/secretsOps.js";
import * as sentryOps from "./tools/sentryOps.js";
const server = new McpServer({
name: "causly-server",
version: "1.1.0",
});
//---------------- Database tools ----------------
server.registerTool(
"postgres_query",
{
description: "Run a read or write SQL query against a Postgres database.",
inputSchema: {
connection_string: z.string().describe("postgres://user:pass@host:5432/dbname"),
sql: z.string(),
params: z.array(z.any()).optional().describe("Positional params for $1, $2, ..."),
},
},
wrap("postgres_query", dbOps.postgresQuery)
);
server.registerTool(
"postgres_list_tables",
{
description: "List all tables in a Postgres database (public schema by default).",
inputSchema: {
connection_string: z.string(),
schema: z.string().optional().describe("Defaults to 'public'"),
},
},
wrap("postgres_list_tables", dbOps.postgresListTables)
);
server.registerTool(
"postgres_describe_table",
{
description: "Get column names, types, and nullability for a Postgres table.",
inputSchema: {
connection_string: z.string(),
table: z.string(),
schema: z.string().optional().describe("Defaults to 'public'"),
},
},
wrap("postgres_describe_table", dbOps.postgresDescribeTable)
);
server.registerTool(
"postgres_test_connection",
{
description: "Test a Postgres connection string — returns server version on success.",
inputSchema: { connection_string: z.string() },
},
wrap("postgres_test_connection", dbOps.postgresTestConnection)
);
server.registerTool(
"mysql_query",
{
description: "Run a read or write SQL query against a MySQL database.",
inputSchema: {
connection_string: z.string().describe("mysql://user:pass@host:3306/dbname"),
sql: z.string(),
params: z.array(z.any()).optional().describe("Positional params for ? placeholders"),
},
},
wrap("mysql_query", dbOps.mysqlQuery)
);
server.registerTool(
"mysql_list_tables",
{
description: "List all tables in a MySQL database.",
inputSchema: { connection_string: z.string() },
},
wrap("mysql_list_tables", dbOps.mysqlListTables)
);
server.registerTool(
"mysql_describe_table",
{
description: "Get column names, types, and nullability for a MySQL table.",
inputSchema: { connection_string: z.string(), table: z.string() },
},
wrap("mysql_describe_table", dbOps.mysqlDescribeTable)
);
server.registerTool(
"mysql_test_connection",
{
description: "Test a MySQL connection string — returns server version on success.",
inputSchema: { connection_string: z.string() },
},
wrap("mysql_test_connection", dbOps.mysqlTestConnection)
);
// ---------------- File tools ----------------
server.registerTool(
"read_file",
{
description: "Read the full text content of a single file.",
inputSchema: {
path: z.string().describe("Absolute path to the file"),
encoding: z.string().optional().describe("Text encoding, defaults to utf8"),
},
},
wrap("read_file", fileOps.readFile)
);
server.registerTool(
"read_multiple_files",
{
description: "Read multiple files in a single call. Failures on individual files do not stop the batch.",
inputSchema: {
paths: z.array(z.string()).describe("Array of absolute file paths"),
encoding: z.string().optional(),
},
},
wrap("read_multiple_files", fileOps.readMultipleFiles)
);
server.registerTool(
"create_file",
{
description: "Create a brand-new file. Fails if the file already exists (use write_file to overwrite).",
inputSchema: {
path: z.string(),
content: z.string().optional().describe("Initial file content, defaults to empty"),
},
},
wrap("create_file", fileOps.createFile)
);
server.registerTool(
"write_file",
{
description: "Create or completely overwrite a file with new content. Creates parent directories if needed.",
inputSchema: {
path: z.string(),
content: z.string(),
},
},
wrap("write_file", fileOps.writeFile)
);
server.registerTool(
"edit_file",
{
description:
"Edit a file via exact string find-and-replace, without rewriting the whole file. old_str must match exactly and be unique unless replace_all is set.",
inputSchema: {
path: z.string(),
old_str: z.string().describe("Exact text to find"),
new_str: z.string().describe("Text to replace it with"),
replace_all: z.boolean().optional().describe("Replace every occurrence instead of requiring uniqueness"),
},
},
wrap("edit_file", fileOps.editFile)
);
server.registerTool(
"delete_file",
{
description: "Delete a single file. DESTRUCTIVE — requires confirm: true.",
inputSchema: { path: z.string(), confirm: z.boolean().optional().describe("Must be true to proceed") },
},
wrap("delete_file", fileOps.deleteFile)
);
server.registerTool(
"move_file",
{
description: "Move or rename a file or directory.",
inputSchema: { source: z.string(), destination: z.string() },
},
wrap("move_file", fileOps.moveFile)
);
server.registerTool(
"copy_file",
{
description: "Copy a single file to a new location.",
inputSchema: { source: z.string(), destination: z.string() },
},
wrap("copy_file", fileOps.copyFile)
);
server.registerTool(
"get_file_info",
{
description: "Get metadata about a file or directory: size, type, created/modified timestamps.",
inputSchema: { path: z.string() },
},
wrap("get_file_info", fileOps.getFileInfo)
);
// ---------------- Directory tools ----------------
server.registerTool(
"list_directory",
{
description: "List the immediate files and subfolders inside a directory.",
inputSchema: { path: z.string() },
},
wrap("list_directory", dirOps.listDirectory)
);
server.registerTool(
"directory_tree",
{
description: "Recursively build a tree view of a directory's contents (skips node_modules and .git).",
inputSchema: {
path: z.string(),
max_depth: z.number().optional().describe("Maximum recursion depth, default 5"),
},
},
wrap("directory_tree", dirOps.directoryTree)
);
server.registerTool(
"create_directory",
{
description: "Create a new directory, including any missing parent directories.",
inputSchema: { path: z.string() },
},
wrap("create_directory", dirOps.createDirectory)
);
server.registerTool(
"delete_directory",
{
description: "Delete a directory. Recursive by default so it removes nested contents too. DESTRUCTIVE — requires confirm: true.",
inputSchema: {
path: z.string(),
recursive: z.boolean().optional(),
confirm: z.boolean().optional().describe("Must be true to proceed"),
},
},
wrap("delete_directory", dirOps.deleteDirectory)
);
server.registerTool(
"search_files",
{
description: "Recursively search for files/folders whose name contains a given pattern (case-insensitive).",
inputSchema: {
root_path: z.string(),
pattern: z.string(),
max_results: z.number().optional(),
},
},
wrap("search_files", dirOps.searchFiles)
);
//----------------Sceret management tools----------------
server.registerTool(
"secrets_set",
{
description: "Store an encrypted secret by name. HIGH risk — requires confirm: true.",
inputSchema: {
name: z.string(),
value: z.string(),
store_path: z.string().optional().describe("Defaults to .causly-secrets.enc in the server's working directory"),
confirm: z.boolean().optional().describe("Must be true to proceed"),
},
},
wrap("secrets_set", secretsOps.secretsSet)
);
server.registerTool(
"secrets_get",
{
description: "Retrieve and decrypt a secret by name.",
inputSchema: {
name: z.string(),
store_path: z.string().optional(),
},
},
wrap("secrets_get", secretsOps.secretsGet)
);
server.registerTool(
"secrets_list",
{
description: "List secret names in the store (never returns values).",
inputSchema: { store_path: z.string().optional() },
},
wrap("secrets_list", secretsOps.secretsList)
);
server.registerTool(
"secrets_delete",
{
description: "Delete a secret by name. DESTRUCTIVE — requires confirm: true.",
inputSchema: {
name: z.string(),
store_path: z.string().optional(),
confirm: z.boolean().optional().describe("Must be true to proceed"),
},
},
wrap("secrets_delete", secretsOps.secretsDelete)
);
server.registerTool(
"secrets_rotate_key",
{
description:
"Re-encrypt every secret in the store under a new master key. Call this AFTER setting SECRETS_MASTER_KEY_NEW in your environment. HIGH risk — requires confirm: true.",
inputSchema: {
store_path: z.string().optional(),
confirm: z.boolean().optional().describe("Must be true to proceed"),
},
},
wrap("secrets_rotate_key", secretsOps.secretsRotateKey)
);
server.registerTool(
"secrets_generate_key",
{
description: "Generate a new random 32-byte master key (hex-encoded) — use to initialize SECRETS_MASTER_KEY or for rotation.",
inputSchema: {},
},
wrap("secrets_generate_key", secretsOps.secretsGenerateKey)
);
// --------------Sentry tools----------------
server.registerTool(
"sentry_list_projects",
{
description: "List projects in the organization.",
inputSchema: { org_slug: z.string().describe("Sentry organization slug") },
},
wrap("sentry_list_projects", sentryOps.sentryListProjects)
);
server.registerTool(
"sentry_list_issues",
{
description: "List recent issues (errors) for a project.",
inputSchema: {
org_slug: z.string(),
project_slug: z.string(),
query: z.string().optional().describe("Sentry search syntax, e.g. 'is:unresolved'"),
limit: z.number().optional().describe("Defaults to 25"),
},
},
wrap("sentry_list_issues", sentryOps.sentryListIssues)
);
server.registerTool(
"sentry_search_issues",
{
description: "Search issues with a Sentry query string (e.g. 'is:unresolved level:error').",
inputSchema: {
org_slug: z.string(),
project_slug: z.string(),
query: z.string(),
limit: z.number().optional().describe("Defaults to 25"),
},
},
wrap("sentry_search_issues", sentryOps.sentrySearchIssues)
);
server.registerTool(
"sentry_get_issue",
{
description: "Get a single issue's full detail (stack trace context, occurrence counts).",
inputSchema: { issue_id: z.string() },
},
wrap("sentry_get_issue", sentryOps.sentryGetIssue)
);
server.registerTool(
"sentry_resolve_issue",
{
description: "Mark an issue as resolved. HIGH risk — requires confirm: true.",
inputSchema: { issue_id: z.string(), confirm: z.boolean().optional().describe("Must be true to proceed") },
},
wrap("sentry_resolve_issue", sentryOps.sentryResolveIssue)
);
server.registerTool(
"sentry_ignore_issue",
{
description: "Mute/ignore an issue so it stops notifying. HIGH risk — requires confirm: true.",
inputSchema: { issue_id: z.string(), confirm: z.boolean().optional().describe("Must be true to proceed") },
},
wrap("sentry_ignore_issue", sentryOps.sentryIgnoreIssue)
);
server.registerTool(
"sentry_get_project_stats",
{
description: "Get error-count stats/trends for a project over a time period.",
inputSchema: {
org_slug: z.string(),
project_slug: z.string(),
stat: z.string().optional().describe("Defaults to 'received'"),
period: z.string().optional().describe("Defaults to '24h' (informational label only)"),
},
},
wrap("sentry_get_project_stats", sentryOps.sentryGetProjectStats)
);
server.registerTool(
"sentry_add_comment",
{
description: "Add a comment/note to an issue. HIGH risk — requires confirm: true.",
inputSchema: {
issue_id: z.string(),
text: z.string(),
confirm: z.boolean().optional().describe("Must be true to proceed"),
},
},
wrap("sentry_add_comment", sentryOps.sentryAddComment)
);
// ---------------- Git tools ----------------
server.registerTool(
"git_init",
{
description: "Initialize a new git repository in the given directory.",
inputSchema: { repo_path: z.string() },
},
wrap("git_init", gitOps.gitInit)
);
server.registerTool(
"git_status",
{
description: "Show the working tree status of a git repository.",
inputSchema: { repo_path: z.string() },
},
wrap("git_status", gitOps.gitStatus)
);
server.registerTool(
"git_add",
{
description: "Stage files for commit. Defaults to staging everything ('.').",
inputSchema: { repo_path: z.string(), files: z.union([z.string(), z.array(z.string())]).optional() },
},
wrap("git_add", gitOps.gitAdd)
);
server.registerTool(
"git_commit",
{
description: "Commit staged changes with a message.",
inputSchema: { repo_path: z.string(), message: z.string() },
},
wrap("git_commit", gitOps.gitCommit)
);
server.registerTool(
"git_push",
{
description: "Push commits to a remote.",
inputSchema: { repo_path: z.string(), remote: z.string().optional(), branch: z.string().optional() },
},
wrap("git_push", gitOps.gitPush)
);
server.registerTool(
"git_pull",
{
description: "Pull changes from a remote.",
inputSchema: { repo_path: z.string(), remote: z.string().optional(), branch: z.string().optional() },
},
wrap("git_pull", gitOps.gitPull)
);
server.registerTool(
"git_log",
{
description: "Show recent commit history.",
inputSchema: { repo_path: z.string(), max_count: z.number().optional() },
},
wrap("git_log", gitOps.gitLog)
);
server.registerTool(
"git_diff",
{
description: "Show uncommitted changes, optionally scoped to one file.",
inputSchema: { repo_path: z.string(), file: z.string().optional() },
},
wrap("git_diff", gitOps.gitDiff)
);
server.registerTool(
"git_branch",
{
description: "List local branches and show the current branch.",
inputSchema: { repo_path: z.string() },
},
wrap("git_branch", gitOps.gitBranch)
);
server.registerTool(
"git_create_branch",
{
description: "Create a new local branch, optionally checking it out immediately (default: yes).",
inputSchema: {
repo_path: z.string(),
branch_name: z.string(),
checkout: z.boolean().optional().describe("Defaults to true"),
},
},
wrap("git_create_branch", gitOps.gitCreateBranch)
);
server.registerTool(
"git_checkout",
{
description: "Checkout an existing local branch.",
inputSchema: { repo_path: z.string(), branch: z.string() },
},
wrap("git_checkout", gitOps.gitCheckout)
);
server.registerTool(
"git_merge",
{
description: "Merge the given branch into the current branch.",
inputSchema: { repo_path: z.string(), branch: z.string() },
},
wrap("git_merge", gitOps.gitMerge)
);
server.registerTool(
"git_reset",
{
description: "Reset the current branch to a ref. mode: 'soft' | 'mixed' | 'hard' (defaults to mixed). HIGH risk (can lose uncommitted work with --hard) — requires confirm: true.",
inputSchema: {
repo_path: z.string(),
mode: z.string().optional().describe("soft, mixed, or hard"),
ref: z.string().optional().describe("Defaults to HEAD"),
confirm: z.boolean().optional().describe("Must be true to proceed"),
},
},
wrap("git_reset", gitOps.gitReset)
);
server.registerTool(
"git_stash",
{
description: "Stash working changes. action: 'save' | 'pop' | 'apply' | 'list' | 'drop' (defaults to save).",
inputSchema: {
repo_path: z.string(),
action: z.string().optional().describe("save, pop, apply, list, or drop"),
message: z.string().optional().describe("Stash message, only used with save"),
stash_id: z.string().optional().describe("e.g. stash@{0}, used with pop/apply/drop"),
},
},
wrap("git_stash", gitOps.gitStash)
);
server.registerTool(
"git_show",
{
description: "Show details of a commit or object. Defaults to HEAD.",
inputSchema: { repo_path: z.string(), ref: z.string().optional() },
},
wrap("git_show", gitOps.gitShow)
);
server.registerTool(
"git_remote",
{
description: "Manage git remotes. action: 'list' | 'add' | 'remove' (defaults to list).",
inputSchema: {
repo_path: z.string(),
action: z.string().optional().describe("list, add, or remove"),
name: z.string().optional().describe("Remote name, required for add/remove"),
url: z.string().optional().describe("Remote URL, required for add"),
},
},
wrap("git_remote", gitOps.gitRemote)
);
server.registerTool(
"git_tag",
{
description: "Manage git tags. action: 'list' | 'create' | 'delete' (defaults to list).",
inputSchema: {
repo_path: z.string(),
action: z.string().optional().describe("list, create, or delete"),
tag_name: z.string().optional().describe("Required for create/delete"),
message: z.string().optional().describe("Annotation message, optional for create"),
},
},
wrap("git_tag", gitOps.gitTag)
);
server.registerTool(
"git_changed_files",
{
description: "List changed files in the working tree with their change type (modified/untracked/created/deleted/renamed).",
inputSchema: { repo_path: z.string() },
},
wrap("git_changed_files", gitOps.gitChangedFiles)
);
server.registerTool(
"git_diff_stat",
{
description: "Show a summary of changes (files changed, insertions, deletions) rather than the full diff.",
inputSchema: { repo_path: z.string(), file: z.string().optional() },
},
wrap("git_diff_stat", gitOps.gitDiffStat)
);
server.registerTool(
"git_check_clean",
{
description: "Check whether the working tree is clean (no uncommitted changes).",
inputSchema: { repo_path: z.string() },
},
wrap("git_check_clean", gitOps.gitCheckClean)
);
// ---------------- Command execution ----------------
server.registerTool(
"run_command",
{
description:
"Run a shell command in a given working directory (npm install, npm run build, pip install, tests, etc.). A short list of catastrophic patterns (drive wipes, format, shutdown) is blocked; everything else executes with full permissions. HIGH risk — requires confirm: true.",
inputSchema: {
command: z.string().describe("The shell command to run"),
cwd: z.string().describe("Working directory to run the command in"),
timeout_ms: z.number().optional().describe("Timeout in ms, default 60000"),
confirm: z.boolean().optional().describe("Must be true to proceed"),
},
},
wrap("run_command", commandOps.runCommand)
);
// ---------------- GitHub tools ----------------
server.registerTool(
"github_get_authenticated_user",
{
description: "Get the authenticated GitHub user's profile. Useful as a connectivity/auth check.",
inputSchema: {},
},
wrap("github_get_authenticated_user", githubOps.githubGetAuthenticatedUser)
);
server.registerTool(
"github_create_repo",
{
description: "Create a new GitHub repository for the authenticated user.",
inputSchema: {
name: z.string(),
description: z.string().optional(),
private: z.boolean().optional().describe("Defaults to false (public)"),
auto_init: z.boolean().optional().describe("Initialize with a README, defaults to true"),
},
},
wrap("github_create_repo", githubOps.githubCreateRepo)
);
server.registerTool(
"github_delete_repo",
{
description: "Delete a GitHub repository. Requires Administration: write on the token. DESTRUCTIVE — requires confirm: true.",
inputSchema: { owner: z.string(), repo: z.string(), confirm: z.boolean().optional().describe("Must be true to proceed") },
},
wrap("github_delete_repo", githubOps.githubDeleteRepo)
);
server.registerTool(
"github_list_repos",
{
description: "List repositories for the authenticated user.",
inputSchema: {
per_page: z.number().optional(),
sort: z.string().optional().describe("created, updated, pushed, or full_name"),
},
},
wrap("github_list_repos", githubOps.githubListRepos)
);
server.registerTool(
"github_create_issue",
{
description: "Create an issue on a GitHub repository.",
inputSchema: {
owner: z.string(),
repo: z.string(),
title: z.string(),
body: z.string().optional(),
labels: z.array(z.string()).optional(),
},
},
wrap("github_create_issue", githubOps.githubCreateIssue)
);
server.registerTool(
"github_list_issues",
{
description: "List issues on a GitHub repository.",
inputSchema: {
owner: z.string(),
repo: z.string(),
state: z.string().optional().describe("open, closed, or all"),
per_page: z.number().optional(),
},
},
wrap("github_list_issues", githubOps.githubListIssues)
);
server.registerTool(
"github_create_pull_request",
{
description: "Create a pull request on a GitHub repository.",
inputSchema: {
owner: z.string(),
repo: z.string(),
title: z.string(),
head: z.string().describe("Branch containing the changes"),
base: z.string().optional().describe("Branch to merge into, defaults to main"),
body: z.string().optional(),
},
},
wrap("github_create_pull_request", githubOps.githubCreatePullRequest)
);
server.registerTool(
"github_list_pull_requests",
{
description: "List pull requests on a GitHub repository.",
inputSchema: {
owner: z.string(),
repo: z.string(),
state: z.string().optional().describe("open, closed, or all"),
per_page: z.number().optional(),
},
},
wrap("github_list_pull_requests", githubOps.githubListPullRequests)
);
server.registerTool(
"github_add_comment",
{
description: "Add a comment to a GitHub issue or pull request.",
inputSchema: {
owner: z.string(),
repo: z.string(),
issue_number: z.number(),
body: z.string(),
},
},
wrap("github_add_comment", githubOps.githubAddComment)
);
server.registerTool(
"github_get_repo",
{
description: "Get a repository's details (default branch, visibility, open issues, language, etc).",
inputSchema: { owner: z.string(), repo: z.string() },
},
wrap("github_get_repo", githubOps.githubGetRepo)
);
server.registerTool(
"github_get_issue",
{
description: "Get a single issue's details.",
inputSchema: { owner: z.string(), repo: z.string(), issue_number: z.number() },
},
wrap("github_get_issue", githubOps.githubGetIssue)
);
server.registerTool(
"github_update_issue",
{
description: "Update an issue's title, body, state, or labels.",
inputSchema: {
owner: z.string(),
repo: z.string(),
issue_number: z.number(),
title: z.string().optional(),
body: z.string().optional(),
state: z.string().optional().describe("open or closed"),
labels: z.array(z.string()).optional(),
},
},
wrap("github_update_issue", githubOps.githubUpdateIssue)
);
server.registerTool(
"github_get_pull_request",
{
description: "Get a single pull request's details, including mergeable status.",
inputSchema: { owner: z.string(), repo: z.string(), pull_number: z.number() },
},
wrap("github_get_pull_request", githubOps.githubGetPullRequest)
);
server.registerTool(
"github_update_pull_request",
{
description: "Update a pull request's title, body, state, or base branch.",
inputSchema: {
owner: z.string(),
repo: z.string(),
pull_number: z.number(),
title: z.string().optional(),
body: z.string().optional(),
state: z.string().optional().describe("open or closed"),
base: z.string().optional(),
},
},
wrap("github_update_pull_request", githubOps.githubUpdatePullRequest)
);
server.registerTool(
"github_merge_pull_request",
{
description: "Merge a pull request. HIGH risk — requires confirm: true.",
inputSchema: {
owner: z.string(),
repo: z.string(),
pull_number: z.number(),
merge_method: z.string().optional().describe("merge, squash, or rebase — defaults to merge"),
commit_title: z.string().optional(),
commit_message: z.string().optional(),
confirm: z.boolean().optional().describe("Must be true to proceed"),
},
},
wrap("github_merge_pull_request", githubOps.githubMergePullRequest)
);
server.registerTool(
"github_get_pull_request_files",
{
description: "List the files changed in a pull request, with additions/deletions per file.",
inputSchema: { owner: z.string(), repo: z.string(), pull_number: z.number(), per_page: z.number().optional() },
},
wrap("github_get_pull_request_files", githubOps.githubGetPullRequestFiles)
);
server.registerTool(
"github_get_pull_request_diff",
{
description: "Get the full raw diff of a pull request.",
inputSchema: { owner: z.string(), repo: z.string(), pull_number: z.number() },
},
wrap("github_get_pull_request_diff", githubOps.githubGetPullRequestDiff)
);
server.registerTool(
"github_get_pull_request_comments",
{
description: "List conversation comments on a pull request.",
inputSchema: { owner: z.string(), repo: z.string(), pull_number: z.number(), per_page: z.number().optional() },
},
wrap("github_get_pull_request_comments", githubOps.githubGetPullRequestComments)
);
server.registerTool(
"github_get_pull_request_reviews",
{
description: "List reviews (approved/changes-requested/commented) on a pull request.",
inputSchema: { owner: z.string(), repo: z.string(), pull_number: z.number(), per_page: z.number().optional() },
},
wrap("github_get_pull_request_reviews", githubOps.githubGetPullRequestReviews)
);
server.registerTool(
"github_get_branch",
{
description: "Get details of a single branch, including protection status and latest commit SHA.",
inputSchema: { owner: z.string(), repo: z.string(), branch: z.string() },
},
wrap("github_get_branch", githubOps.githubGetBranch)
);
server.registerTool(
"github_list_branches",
{
description: "List branches on a repository.",
inputSchema: { owner: z.string(), repo: z.string(), per_page: z.number().optional() },
},
wrap("github_list_branches", githubOps.githubListBranches)
);
server.registerTool(
"github_list_workflows",
{
description: "List workflows defined in a repository (from .github/workflows).",
inputSchema: { owner: z.string(), repo: z.string() },
},
wrap("github_list_workflows", githubOps.githubListWorkflows)
);
server.registerTool(
"github_list_workflow_runs",
{
description: "List recent GitHub Actions workflow runs, optionally filtered by branch or status (e.g. 'failure', 'in_progress').",
inputSchema: {
owner: z.string(),
repo: z.string(),
branch: z.string().optional(),
status: z.string().optional(),
per_page: z.number().optional(),
},
},
wrap("github_list_workflow_runs", githubOps.githubListWorkflowRuns)
);
server.registerTool(
"github_get_workflow_run",
{
description: "Get details of a single workflow run (status, conclusion, branch, timestamps).",
inputSchema: { owner: z.string(), repo: z.string(), run_id: z.number() },
},
wrap("github_get_workflow_run", githubOps.githubGetWorkflowRun)
);
server.registerTool(
"github_get_workflow_run_jobs",
{
description: "List jobs in a workflow run, with per-job and per-step status/conclusion — use to find which job/step failed.",
inputSchema: { owner: z.string(), repo: z.string(), run_id: z.number() },
},
wrap("github_get_workflow_run_jobs", githubOps.githubGetWorkflowRunJobs)
);
server.registerTool(
"github_get_job_logs",
{
description: "Get the raw log text for a specific job — use after finding a failed job via github_get_workflow_run_jobs.",
inputSchema: { owner: z.string(), repo: z.string(), job_id: z.number() },
},
wrap("github_get_job_logs", githubOps.githubGetJobLogs)
);
server.registerTool(
"github_rerun_workflow",
{
description: "Re-run a workflow run. Set failed_only=true to re-run only the failed jobs instead of the whole run.",
inputSchema: {
owner: z.string(),
repo: z.string(),
run_id: z.number(),
failed_only: z.boolean().optional().describe("Defaults to false"),
},
},
wrap("github_rerun_workflow", githubOps.githubRerunWorkflow)
);
// ---------------- Vercel tools ----------------
server.registerTool(
"vercel_get_authenticated_user",
{
description: "Get the authenticated Vercel user/team. Useful as a connectivity/auth check.",
inputSchema: {},
},
wrap("vercel_get_authenticated_user", vercelOps.vercelGetAuthenticatedUser)
);
server.registerTool(
"vercel_list_projects",
{
description: "List Vercel projects for the authenticated account.",
inputSchema: { limit: z.number().optional() },
},
wrap("vercel_list_projects", vercelOps.vercelListProjects)