@lightsparkdev/grid-mcp 0.3.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 (103) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +107 -0
  3. package/code-tool-types.d.mts +14 -0
  4. package/code-tool-types.d.mts.map +1 -0
  5. package/code-tool-types.d.ts +14 -0
  6. package/code-tool-types.d.ts.map +1 -0
  7. package/code-tool-types.js +4 -0
  8. package/code-tool-types.js.map +1 -0
  9. package/code-tool-types.mjs +3 -0
  10. package/code-tool-types.mjs.map +1 -0
  11. package/code-tool.d.mts +15 -0
  12. package/code-tool.d.mts.map +1 -0
  13. package/code-tool.d.ts +15 -0
  14. package/code-tool.d.ts.map +1 -0
  15. package/code-tool.js +116 -0
  16. package/code-tool.js.map +1 -0
  17. package/code-tool.mjs +113 -0
  18. package/code-tool.mjs.map +1 -0
  19. package/docs-search-tool.d.mts +51 -0
  20. package/docs-search-tool.d.mts.map +1 -0
  21. package/docs-search-tool.d.ts +51 -0
  22. package/docs-search-tool.d.ts.map +1 -0
  23. package/docs-search-tool.js +51 -0
  24. package/docs-search-tool.js.map +1 -0
  25. package/docs-search-tool.mjs +47 -0
  26. package/docs-search-tool.mjs.map +1 -0
  27. package/headers.d.mts +4 -0
  28. package/headers.d.mts.map +1 -0
  29. package/headers.d.ts +4 -0
  30. package/headers.d.ts.map +1 -0
  31. package/headers.js +35 -0
  32. package/headers.js.map +1 -0
  33. package/headers.mjs +31 -0
  34. package/headers.mjs.map +1 -0
  35. package/http.d.mts +14 -0
  36. package/http.d.mts.map +1 -0
  37. package/http.d.ts +14 -0
  38. package/http.d.ts.map +1 -0
  39. package/http.js +105 -0
  40. package/http.js.map +1 -0
  41. package/http.mjs +97 -0
  42. package/http.mjs.map +1 -0
  43. package/index.d.mts +3 -0
  44. package/index.d.mts.map +1 -0
  45. package/index.d.ts +3 -0
  46. package/index.d.ts.map +1 -0
  47. package/index.js +59 -0
  48. package/index.js.map +1 -0
  49. package/index.mjs +57 -0
  50. package/index.mjs.map +1 -0
  51. package/methods.d.mts +10 -0
  52. package/methods.d.mts.map +1 -0
  53. package/methods.d.ts +10 -0
  54. package/methods.d.ts.map +1 -0
  55. package/methods.js +328 -0
  56. package/methods.js.map +1 -0
  57. package/methods.mjs +324 -0
  58. package/methods.mjs.map +1 -0
  59. package/options.d.mts +15 -0
  60. package/options.d.mts.map +1 -0
  61. package/options.d.ts +15 -0
  62. package/options.d.ts.map +1 -0
  63. package/options.js +91 -0
  64. package/options.js.map +1 -0
  65. package/options.mjs +84 -0
  66. package/options.mjs.map +1 -0
  67. package/package.json +174 -0
  68. package/server.d.mts +30 -0
  69. package/server.d.mts.map +1 -0
  70. package/server.d.ts +30 -0
  71. package/server.d.ts.map +1 -0
  72. package/server.js +160 -0
  73. package/server.js.map +1 -0
  74. package/server.mjs +147 -0
  75. package/server.mjs.map +1 -0
  76. package/src/code-tool-types.ts +16 -0
  77. package/src/code-tool.ts +140 -0
  78. package/src/docs-search-tool.ts +59 -0
  79. package/src/headers.ts +39 -0
  80. package/src/http.ts +130 -0
  81. package/src/index.ts +65 -0
  82. package/src/methods.ts +348 -0
  83. package/src/options.ts +118 -0
  84. package/src/server.ts +195 -0
  85. package/src/stdio.ts +13 -0
  86. package/src/tsconfig.json +11 -0
  87. package/src/types.ts +115 -0
  88. package/stdio.d.mts +3 -0
  89. package/stdio.d.mts.map +1 -0
  90. package/stdio.d.ts +3 -0
  91. package/stdio.d.ts.map +1 -0
  92. package/stdio.js +14 -0
  93. package/stdio.js.map +1 -0
  94. package/stdio.mjs +10 -0
  95. package/stdio.mjs.map +1 -0
  96. package/types.d.mts +52 -0
  97. package/types.d.mts.map +1 -0
  98. package/types.d.ts +52 -0
  99. package/types.d.ts.map +1 -0
  100. package/types.js +58 -0
  101. package/types.js.map +1 -0
  102. package/types.mjs +53 -0
  103. package/types.mjs.map +1 -0
package/methods.mjs ADDED
@@ -0,0 +1,324 @@
1
+ export const sdkMethods = [
2
+ {
3
+ clientCallName: 'client.config.retrieve',
4
+ fullyQualifiedName: 'config.retrieve',
5
+ httpMethod: 'get',
6
+ httpPath: '/config',
7
+ },
8
+ {
9
+ clientCallName: 'client.config.update',
10
+ fullyQualifiedName: 'config.update',
11
+ httpMethod: 'patch',
12
+ httpPath: '/config',
13
+ },
14
+ {
15
+ clientCallName: 'client.customers.create',
16
+ fullyQualifiedName: 'customers.create',
17
+ httpMethod: 'post',
18
+ httpPath: '/customers',
19
+ },
20
+ {
21
+ clientCallName: 'client.customers.retrieve',
22
+ fullyQualifiedName: 'customers.retrieve',
23
+ httpMethod: 'get',
24
+ httpPath: '/customers/{customerId}',
25
+ },
26
+ {
27
+ clientCallName: 'client.customers.update',
28
+ fullyQualifiedName: 'customers.update',
29
+ httpMethod: 'patch',
30
+ httpPath: '/customers/{customerId}',
31
+ },
32
+ {
33
+ clientCallName: 'client.customers.list',
34
+ fullyQualifiedName: 'customers.list',
35
+ httpMethod: 'get',
36
+ httpPath: '/customers',
37
+ },
38
+ {
39
+ clientCallName: 'client.customers.delete',
40
+ fullyQualifiedName: 'customers.delete',
41
+ httpMethod: 'delete',
42
+ httpPath: '/customers/{customerId}',
43
+ },
44
+ {
45
+ clientCallName: 'client.customers.getKYCLink',
46
+ fullyQualifiedName: 'customers.getKYCLink',
47
+ httpMethod: 'get',
48
+ httpPath: '/customers/kyc-link',
49
+ },
50
+ {
51
+ clientCallName: 'client.customers.listInternalAccounts',
52
+ fullyQualifiedName: 'customers.listInternalAccounts',
53
+ httpMethod: 'get',
54
+ httpPath: '/customers/internal-accounts',
55
+ },
56
+ {
57
+ clientCallName: 'client.customers.externalAccounts.create',
58
+ fullyQualifiedName: 'customers.externalAccounts.create',
59
+ httpMethod: 'post',
60
+ httpPath: '/customers/external-accounts',
61
+ },
62
+ {
63
+ clientCallName: 'client.customers.externalAccounts.list',
64
+ fullyQualifiedName: 'customers.externalAccounts.list',
65
+ httpMethod: 'get',
66
+ httpPath: '/customers/external-accounts',
67
+ },
68
+ {
69
+ clientCallName: 'client.customers.bulk.getJobStatus',
70
+ fullyQualifiedName: 'customers.bulk.getJobStatus',
71
+ httpMethod: 'get',
72
+ httpPath: '/customers/bulk/jobs/{jobId}',
73
+ },
74
+ {
75
+ clientCallName: 'client.customers.bulk.uploadCsv',
76
+ fullyQualifiedName: 'customers.bulk.uploadCsv',
77
+ httpMethod: 'post',
78
+ httpPath: '/customers/bulk/csv',
79
+ },
80
+ {
81
+ clientCallName: 'client.platform.listInternalAccounts',
82
+ fullyQualifiedName: 'platform.listInternalAccounts',
83
+ httpMethod: 'get',
84
+ httpPath: '/platform/internal-accounts',
85
+ },
86
+ {
87
+ clientCallName: 'client.platform.externalAccounts.create',
88
+ fullyQualifiedName: 'platform.externalAccounts.create',
89
+ httpMethod: 'post',
90
+ httpPath: '/platform/external-accounts',
91
+ },
92
+ {
93
+ clientCallName: 'client.platform.externalAccounts.list',
94
+ fullyQualifiedName: 'platform.externalAccounts.list',
95
+ httpMethod: 'get',
96
+ httpPath: '/platform/external-accounts',
97
+ },
98
+ {
99
+ clientCallName: 'client.plaid.createLinkToken',
100
+ fullyQualifiedName: 'plaid.createLinkToken',
101
+ httpMethod: 'post',
102
+ httpPath: '/plaid/link-tokens',
103
+ },
104
+ {
105
+ clientCallName: 'client.plaid.submitPublicToken',
106
+ fullyQualifiedName: 'plaid.submitPublicToken',
107
+ httpMethod: 'post',
108
+ httpPath: '/plaid/callback/{plaid_link_token}',
109
+ },
110
+ {
111
+ clientCallName: 'client.transferIn.create',
112
+ fullyQualifiedName: 'transferIn.create',
113
+ httpMethod: 'post',
114
+ httpPath: '/transfer-in',
115
+ },
116
+ {
117
+ clientCallName: 'client.transferOut.create',
118
+ fullyQualifiedName: 'transferOut.create',
119
+ httpMethod: 'post',
120
+ httpPath: '/transfer-out',
121
+ },
122
+ {
123
+ clientCallName: 'client.receiver.lookupExternalAccount',
124
+ fullyQualifiedName: 'receiver.lookupExternalAccount',
125
+ httpMethod: 'get',
126
+ httpPath: '/receiver/external-account/{accountId}',
127
+ },
128
+ {
129
+ clientCallName: 'client.receiver.lookupUma',
130
+ fullyQualifiedName: 'receiver.lookupUma',
131
+ httpMethod: 'get',
132
+ httpPath: '/receiver/uma/{receiverUmaAddress}',
133
+ },
134
+ {
135
+ clientCallName: 'client.quotes.create',
136
+ fullyQualifiedName: 'quotes.create',
137
+ httpMethod: 'post',
138
+ httpPath: '/quotes',
139
+ },
140
+ {
141
+ clientCallName: 'client.quotes.retrieve',
142
+ fullyQualifiedName: 'quotes.retrieve',
143
+ httpMethod: 'get',
144
+ httpPath: '/quotes/{quoteId}',
145
+ },
146
+ {
147
+ clientCallName: 'client.quotes.list',
148
+ fullyQualifiedName: 'quotes.list',
149
+ httpMethod: 'get',
150
+ httpPath: '/quotes',
151
+ },
152
+ {
153
+ clientCallName: 'client.quotes.execute',
154
+ fullyQualifiedName: 'quotes.execute',
155
+ httpMethod: 'post',
156
+ httpPath: '/quotes/{quoteId}/execute',
157
+ },
158
+ {
159
+ clientCallName: 'client.transactions.retrieve',
160
+ fullyQualifiedName: 'transactions.retrieve',
161
+ httpMethod: 'get',
162
+ httpPath: '/transactions/{transactionId}',
163
+ },
164
+ {
165
+ clientCallName: 'client.transactions.list',
166
+ fullyQualifiedName: 'transactions.list',
167
+ httpMethod: 'get',
168
+ httpPath: '/transactions',
169
+ },
170
+ {
171
+ clientCallName: 'client.transactions.approve',
172
+ fullyQualifiedName: 'transactions.approve',
173
+ httpMethod: 'post',
174
+ httpPath: '/transactions/{transactionId}/approve',
175
+ },
176
+ {
177
+ clientCallName: 'client.transactions.reject',
178
+ fullyQualifiedName: 'transactions.reject',
179
+ httpMethod: 'post',
180
+ httpPath: '/transactions/{transactionId}/reject',
181
+ },
182
+ {
183
+ clientCallName: 'client.webhooks.sendTest',
184
+ fullyQualifiedName: 'webhooks.sendTest',
185
+ httpMethod: 'post',
186
+ httpPath: '/webhooks/test',
187
+ },
188
+ {
189
+ clientCallName: 'client.invitations.create',
190
+ fullyQualifiedName: 'invitations.create',
191
+ httpMethod: 'post',
192
+ httpPath: '/invitations',
193
+ },
194
+ {
195
+ clientCallName: 'client.invitations.retrieve',
196
+ fullyQualifiedName: 'invitations.retrieve',
197
+ httpMethod: 'get',
198
+ httpPath: '/invitations/{invitationCode}',
199
+ },
200
+ {
201
+ clientCallName: 'client.invitations.cancel',
202
+ fullyQualifiedName: 'invitations.cancel',
203
+ httpMethod: 'post',
204
+ httpPath: '/invitations/{invitationCode}/cancel',
205
+ },
206
+ {
207
+ clientCallName: 'client.invitations.claim',
208
+ fullyQualifiedName: 'invitations.claim',
209
+ httpMethod: 'post',
210
+ httpPath: '/invitations/{invitationCode}/claim',
211
+ },
212
+ {
213
+ clientCallName: 'client.sandbox.sendFunds',
214
+ fullyQualifiedName: 'sandbox.sendFunds',
215
+ httpMethod: 'post',
216
+ httpPath: '/sandbox/send',
217
+ },
218
+ {
219
+ clientCallName: 'client.sandbox.uma.receivePayment',
220
+ fullyQualifiedName: 'sandbox.uma.receivePayment',
221
+ httpMethod: 'post',
222
+ httpPath: '/sandbox/uma/receive',
223
+ },
224
+ {
225
+ clientCallName: 'client.sandbox.internalAccounts.fund',
226
+ fullyQualifiedName: 'sandbox.internalAccounts.fund',
227
+ httpMethod: 'post',
228
+ httpPath: '/sandbox/internal-accounts/{accountId}/fund',
229
+ },
230
+ {
231
+ clientCallName: 'client.umaProviders.list',
232
+ fullyQualifiedName: 'umaProviders.list',
233
+ httpMethod: 'get',
234
+ httpPath: '/uma-providers',
235
+ },
236
+ {
237
+ clientCallName: 'client.tokens.create',
238
+ fullyQualifiedName: 'tokens.create',
239
+ httpMethod: 'post',
240
+ httpPath: '/tokens',
241
+ },
242
+ {
243
+ clientCallName: 'client.tokens.retrieve',
244
+ fullyQualifiedName: 'tokens.retrieve',
245
+ httpMethod: 'get',
246
+ httpPath: '/tokens/{tokenId}',
247
+ },
248
+ {
249
+ clientCallName: 'client.tokens.list',
250
+ fullyQualifiedName: 'tokens.list',
251
+ httpMethod: 'get',
252
+ httpPath: '/tokens',
253
+ },
254
+ {
255
+ clientCallName: 'client.tokens.delete',
256
+ fullyQualifiedName: 'tokens.delete',
257
+ httpMethod: 'delete',
258
+ httpPath: '/tokens/{tokenId}',
259
+ },
260
+ {
261
+ clientCallName: 'client.exchangeRates.list',
262
+ fullyQualifiedName: 'exchangeRates.list',
263
+ httpMethod: 'get',
264
+ httpPath: '/exchange-rates',
265
+ },
266
+ ];
267
+ function allowedMethodsForCodeTool(options) {
268
+ if (!options) {
269
+ return undefined;
270
+ }
271
+ let allowedMethods;
272
+ if (options.codeAllowHttpGets || options.codeAllowedMethods) {
273
+ // Start with nothing allowed and then add into it from options
274
+ let allowedMethodsSet = new Set();
275
+ if (options.codeAllowHttpGets) {
276
+ // Add all methods that map to an HTTP GET
277
+ sdkMethods
278
+ .filter((method) => method.httpMethod === 'get')
279
+ .forEach((method) => allowedMethodsSet.add(method));
280
+ }
281
+ if (options.codeAllowedMethods) {
282
+ // Add all methods that match any of the allowed regexps
283
+ const allowedRegexps = options.codeAllowedMethods.map((pattern) => {
284
+ try {
285
+ return new RegExp(pattern);
286
+ }
287
+ catch (e) {
288
+ throw new Error(`Invalid regex pattern for allowed method: "${pattern}": ${e instanceof Error ? e.message : e}`);
289
+ }
290
+ });
291
+ sdkMethods
292
+ .filter((method) => allowedRegexps.some((regexp) => regexp.test(method.fullyQualifiedName)))
293
+ .forEach((method) => allowedMethodsSet.add(method));
294
+ }
295
+ allowedMethods = Array.from(allowedMethodsSet);
296
+ }
297
+ else {
298
+ // Start with everything allowed
299
+ allowedMethods = [...sdkMethods];
300
+ }
301
+ if (options.codeBlockedMethods) {
302
+ // Filter down based on blocked regexps
303
+ const blockedRegexps = options.codeBlockedMethods.map((pattern) => {
304
+ try {
305
+ return new RegExp(pattern);
306
+ }
307
+ catch (e) {
308
+ throw new Error(`Invalid regex pattern for blocked method: "${pattern}": ${e instanceof Error ? e.message : e}`);
309
+ }
310
+ });
311
+ allowedMethods = allowedMethods.filter((method) => !blockedRegexps.some((regexp) => regexp.test(method.fullyQualifiedName)));
312
+ }
313
+ return allowedMethods;
314
+ }
315
+ export function blockedMethodsForCodeTool(options) {
316
+ const allowedMethods = allowedMethodsForCodeTool(options);
317
+ if (!allowedMethods) {
318
+ return undefined;
319
+ }
320
+ const allowedSet = new Set(allowedMethods.map((method) => method.fullyQualifiedName));
321
+ // Return any methods that are not explicitly allowed
322
+ return sdkMethods.filter((method) => !allowedSet.has(method.fullyQualifiedName));
323
+ }
324
+ //# sourceMappingURL=methods.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"methods.mjs","sourceRoot":"","sources":["src/methods.ts"],"names":[],"mappings":"AASA,MAAM,CAAC,MAAM,UAAU,GAAgB;IACrC;QACE,cAAc,EAAE,wBAAwB;QACxC,kBAAkB,EAAE,iBAAiB;QACrC,UAAU,EAAE,KAAK;QACjB,QAAQ,EAAE,SAAS;KACpB;IACD;QACE,cAAc,EAAE,sBAAsB;QACtC,kBAAkB,EAAE,eAAe;QACnC,UAAU,EAAE,OAAO;QACnB,QAAQ,EAAE,SAAS;KACpB;IACD;QACE,cAAc,EAAE,yBAAyB;QACzC,kBAAkB,EAAE,kBAAkB;QACtC,UAAU,EAAE,MAAM;QAClB,QAAQ,EAAE,YAAY;KACvB;IACD;QACE,cAAc,EAAE,2BAA2B;QAC3C,kBAAkB,EAAE,oBAAoB;QACxC,UAAU,EAAE,KAAK;QACjB,QAAQ,EAAE,yBAAyB;KACpC;IACD;QACE,cAAc,EAAE,yBAAyB;QACzC,kBAAkB,EAAE,kBAAkB;QACtC,UAAU,EAAE,OAAO;QACnB,QAAQ,EAAE,yBAAyB;KACpC;IACD;QACE,cAAc,EAAE,uBAAuB;QACvC,kBAAkB,EAAE,gBAAgB;QACpC,UAAU,EAAE,KAAK;QACjB,QAAQ,EAAE,YAAY;KACvB;IACD;QACE,cAAc,EAAE,yBAAyB;QACzC,kBAAkB,EAAE,kBAAkB;QACtC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,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAChG,CAAC;YACJ,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,cAAc,GAAG,cAAc,CAAC,MAAM,CACpC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,CACrF,CAAC;IACJ,CAAC;IAED,OAAO,cAAc,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,OAA+B;IACvE,MAAM,cAAc,GAAG,yBAAyB,CAAC,OAAO,CAAC,CAAC;IAC1D,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAEtF,qDAAqD;IACrD,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC;AACnF,CAAC"}
package/options.d.mts ADDED
@@ -0,0 +1,15 @@
1
+ export type CLIOptions = McpOptions & {
2
+ debug: boolean;
3
+ transport: 'stdio' | 'http';
4
+ port: number | undefined;
5
+ socket: string | undefined;
6
+ };
7
+ export type McpOptions = {
8
+ includeDocsTools?: boolean | undefined;
9
+ codeAllowHttpGets?: boolean | undefined;
10
+ codeAllowedMethods?: string[] | undefined;
11
+ codeBlockedMethods?: string[] | undefined;
12
+ };
13
+ export declare function parseCLIOptions(): CLIOptions;
14
+ export declare function parseQueryOptions(defaultOptions: McpOptions, query: unknown): McpOptions;
15
+ //# sourceMappingURL=options.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.d.mts","sourceRoot":"","sources":["src/options.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG;IACpC,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,EAAE,OAAO,GAAG,MAAM,CAAC;IAC5B,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,gBAAgB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACvC,iBAAiB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACxC,kBAAkB,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAC1C,kBAAkB,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;CAC3C,CAAC;AAEF,wBAAgB,eAAe,IAAI,UAAU,CAqE5C;AAiBD,wBAAgB,iBAAiB,CAAC,cAAc,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,GAAG,UAAU,CAYxF"}
package/options.d.ts ADDED
@@ -0,0 +1,15 @@
1
+ export type CLIOptions = McpOptions & {
2
+ debug: boolean;
3
+ transport: 'stdio' | 'http';
4
+ port: number | undefined;
5
+ socket: string | undefined;
6
+ };
7
+ export type McpOptions = {
8
+ includeDocsTools?: boolean | undefined;
9
+ codeAllowHttpGets?: boolean | undefined;
10
+ codeAllowedMethods?: string[] | undefined;
11
+ codeBlockedMethods?: string[] | undefined;
12
+ };
13
+ export declare function parseCLIOptions(): CLIOptions;
14
+ export declare function parseQueryOptions(defaultOptions: McpOptions, query: unknown): McpOptions;
15
+ //# sourceMappingURL=options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["src/options.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG;IACpC,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,EAAE,OAAO,GAAG,MAAM,CAAC;IAC5B,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,gBAAgB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACvC,iBAAiB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACxC,kBAAkB,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAC1C,kBAAkB,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;CAC3C,CAAC;AAEF,wBAAgB,eAAe,IAAI,UAAU,CAqE5C;AAiBD,wBAAgB,iBAAiB,CAAC,cAAc,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,GAAG,UAAU,CAYxF"}
package/options.js ADDED
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.parseCLIOptions = parseCLIOptions;
7
+ exports.parseQueryOptions = parseQueryOptions;
8
+ const qs_1 = __importDefault(require("qs"));
9
+ const yargs_1 = __importDefault(require("yargs"));
10
+ const helpers_1 = require("yargs/helpers");
11
+ const zod_1 = __importDefault(require("zod"));
12
+ function parseCLIOptions() {
13
+ const opts = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv))
14
+ .option('code-allow-http-gets', {
15
+ type: 'boolean',
16
+ description: 'Allow all code tool methods that map to HTTP GET operations. If all code-allow-* flags are unset, then everything is allowed.',
17
+ })
18
+ .option('code-allowed-methods', {
19
+ type: 'string',
20
+ array: true,
21
+ description: 'Methods to explicitly allow for code tool. Evaluated as regular expressions against method fully qualified names. If all code-allow-* flags are unset, then everything is allowed.',
22
+ })
23
+ .option('code-blocked-methods', {
24
+ type: 'string',
25
+ array: true,
26
+ description: 'Methods to explicitly block for code tool. Evaluated as regular expressions against method fully qualified names. If all code-allow-* flags are unset, then everything is allowed.',
27
+ })
28
+ .option('debug', { type: 'boolean', description: 'Enable debug logging' })
29
+ .option('no-tools', {
30
+ type: 'string',
31
+ array: true,
32
+ choices: ['code', 'docs'],
33
+ description: 'Tools to explicitly disable',
34
+ })
35
+ .option('port', {
36
+ type: 'number',
37
+ default: 3000,
38
+ description: 'Port to serve on if using http transport',
39
+ })
40
+ .option('socket', { type: 'string', description: 'Unix socket to serve on if using http transport' })
41
+ .option('tools', {
42
+ type: 'string',
43
+ array: true,
44
+ choices: ['code', 'docs'],
45
+ description: 'Tools to explicitly enable',
46
+ })
47
+ .option('transport', {
48
+ type: 'string',
49
+ choices: ['stdio', 'http'],
50
+ default: 'stdio',
51
+ description: 'What transport to use; stdio for local servers or http for remote servers',
52
+ })
53
+ .env('MCP_SERVER')
54
+ .version(true)
55
+ .help();
56
+ const argv = opts.parseSync();
57
+ const shouldIncludeToolType = (toolType) => argv.noTools?.includes(toolType) ? false
58
+ : argv.tools?.includes(toolType) ? true
59
+ : undefined;
60
+ const includeDocsTools = shouldIncludeToolType('docs');
61
+ const transport = argv.transport;
62
+ return {
63
+ ...(includeDocsTools !== undefined && { includeDocsTools }),
64
+ debug: !!argv.debug,
65
+ codeAllowHttpGets: argv.codeAllowHttpGets,
66
+ codeAllowedMethods: argv.codeAllowedMethods,
67
+ codeBlockedMethods: argv.codeBlockedMethods,
68
+ transport,
69
+ port: argv.port,
70
+ socket: argv.socket,
71
+ };
72
+ }
73
+ const coerceArray = (zodType) => zod_1.default.preprocess((val) => Array.isArray(val) ? val
74
+ : val ? [val]
75
+ : val, zod_1.default.array(zodType).optional());
76
+ const QueryOptions = zod_1.default.object({
77
+ tools: coerceArray(zod_1.default.enum(['code', 'docs'])).describe('Specify which MCP tools to use'),
78
+ no_tools: coerceArray(zod_1.default.enum(['code', 'docs'])).describe('Specify which MCP tools to not use.'),
79
+ tool: coerceArray(zod_1.default.string()).describe('Include tools matching the specified names'),
80
+ });
81
+ function parseQueryOptions(defaultOptions, query) {
82
+ const queryObject = typeof query === 'string' ? qs_1.default.parse(query) : query;
83
+ const queryOptions = QueryOptions.parse(queryObject);
84
+ let docsTools = queryOptions.no_tools && queryOptions.no_tools?.includes('docs') ? false
85
+ : queryOptions.tools?.includes('docs') ? true
86
+ : defaultOptions.includeDocsTools;
87
+ return {
88
+ ...(docsTools !== undefined && { includeDocsTools: docsTools }),
89
+ };
90
+ }
91
+ //# sourceMappingURL=options.js.map
package/options.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.js","sourceRoot":"","sources":["src/options.ts"],"names":[],"mappings":";;;;;AAmBA,0CAqEC;AAiBD,8CAYC;AArHD,4CAAoB;AACpB,kDAA0B;AAC1B,2CAAwC;AACxC,8CAAoB;AAgBpB,SAAgB,eAAe;IAC7B,MAAM,IAAI,GAAG,IAAA,eAAK,EAAC,IAAA,iBAAO,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;SACtC,MAAM,CAAC,sBAAsB,EAAE;QAC9B,IAAI,EAAE,SAAS;QACf,WAAW,EACT,+HAA+H;KAClI,CAAC;SACD,MAAM,CAAC,sBAAsB,EAAE;QAC9B,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,IAAI;QACX,WAAW,EACT,oLAAoL;KACvL,CAAC;SACD,MAAM,CAAC,sBAAsB,EAAE;QAC9B,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,IAAI;QACX,WAAW,EACT,oLAAoL;KACvL,CAAC;SACD,MAAM,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,sBAAsB,EAAE,CAAC;SACzE,MAAM,CAAC,UAAU,EAAE;QAClB,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,IAAI;QACX,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;QACzB,WAAW,EAAE,6BAA6B;KAC3C,CAAC;SACD,MAAM,CAAC,MAAM,EAAE;QACd,IAAI,EAAE,QAAQ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AK;QACxE,CAAC,CAAC,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI;YAC7C,CAAC,CAAC,cAAc,CAAC,gBAAgB,CAAC;IAEpC,OAAO;QACL,GAAG,CAAC,SAAS,KAAK,SAAS,IAAI,EAAE,gBAAgB,EAAE,SAAS,EAAE,CAAC;KAChE,CAAC;AACJ,CAAC"}
package/options.mjs ADDED
@@ -0,0 +1,84 @@
1
+ import qs from 'qs';
2
+ import yargs from 'yargs';
3
+ import { hideBin } from 'yargs/helpers';
4
+ import z from 'zod';
5
+ export function parseCLIOptions() {
6
+ const opts = yargs(hideBin(process.argv))
7
+ .option('code-allow-http-gets', {
8
+ type: 'boolean',
9
+ description: 'Allow all code tool methods that map to HTTP GET operations. If all code-allow-* flags are unset, then everything is allowed.',
10
+ })
11
+ .option('code-allowed-methods', {
12
+ type: 'string',
13
+ array: true,
14
+ description: 'Methods to explicitly allow for code tool. Evaluated as regular expressions against method fully qualified names. If all code-allow-* flags are unset, then everything is allowed.',
15
+ })
16
+ .option('code-blocked-methods', {
17
+ type: 'string',
18
+ array: true,
19
+ description: 'Methods to explicitly block for code tool. Evaluated as regular expressions against method fully qualified names. If all code-allow-* flags are unset, then everything is allowed.',
20
+ })
21
+ .option('debug', { type: 'boolean', description: 'Enable debug logging' })
22
+ .option('no-tools', {
23
+ type: 'string',
24
+ array: true,
25
+ choices: ['code', 'docs'],
26
+ description: 'Tools to explicitly disable',
27
+ })
28
+ .option('port', {
29
+ type: 'number',
30
+ default: 3000,
31
+ description: 'Port to serve on if using http transport',
32
+ })
33
+ .option('socket', { type: 'string', description: 'Unix socket to serve on if using http transport' })
34
+ .option('tools', {
35
+ type: 'string',
36
+ array: true,
37
+ choices: ['code', 'docs'],
38
+ description: 'Tools to explicitly enable',
39
+ })
40
+ .option('transport', {
41
+ type: 'string',
42
+ choices: ['stdio', 'http'],
43
+ default: 'stdio',
44
+ description: 'What transport to use; stdio for local servers or http for remote servers',
45
+ })
46
+ .env('MCP_SERVER')
47
+ .version(true)
48
+ .help();
49
+ const argv = opts.parseSync();
50
+ const shouldIncludeToolType = (toolType) => argv.noTools?.includes(toolType) ? false
51
+ : argv.tools?.includes(toolType) ? true
52
+ : undefined;
53
+ const includeDocsTools = shouldIncludeToolType('docs');
54
+ const transport = argv.transport;
55
+ return {
56
+ ...(includeDocsTools !== undefined && { includeDocsTools }),
57
+ debug: !!argv.debug,
58
+ codeAllowHttpGets: argv.codeAllowHttpGets,
59
+ codeAllowedMethods: argv.codeAllowedMethods,
60
+ codeBlockedMethods: argv.codeBlockedMethods,
61
+ transport,
62
+ port: argv.port,
63
+ socket: argv.socket,
64
+ };
65
+ }
66
+ const coerceArray = (zodType) => z.preprocess((val) => Array.isArray(val) ? val
67
+ : val ? [val]
68
+ : val, z.array(zodType).optional());
69
+ const QueryOptions = z.object({
70
+ tools: coerceArray(z.enum(['code', 'docs'])).describe('Specify which MCP tools to use'),
71
+ no_tools: coerceArray(z.enum(['code', 'docs'])).describe('Specify which MCP tools to not use.'),
72
+ tool: coerceArray(z.string()).describe('Include tools matching the specified names'),
73
+ });
74
+ export function parseQueryOptions(defaultOptions, query) {
75
+ const queryObject = typeof query === 'string' ? qs.parse(query) : query;
76
+ const queryOptions = QueryOptions.parse(queryObject);
77
+ let docsTools = queryOptions.no_tools && queryOptions.no_tools?.includes('docs') ? false
78
+ : queryOptions.tools?.includes('docs') ? true
79
+ : defaultOptions.includeDocsTools;
80
+ return {
81
+ ...(docsTools !== undefined && { includeDocsTools: docsTools }),
82
+ };
83
+ }
84
+ //# sourceMappingURL=options.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.mjs","sourceRoot":"","sources":["src/options.ts"],"names":[],"mappings":"OAAO,EAAE,MAAM,IAAI;OACZ,KAAK,MAAM,OAAO;OAClB,EAAE,OAAO,EAAE,MAAM,eAAe;OAChC,CAAC,MAAM,KAAK;AAgBnB,MAAM,UAAU,eAAe;IAC7B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