context.dev-mcp 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/LICENSE +201 -0
- package/README.md +101 -0
- package/auth.d.mts +6 -0
- package/auth.d.mts.map +1 -0
- package/auth.d.ts +6 -0
- package/auth.d.ts.map +1 -0
- package/auth.js +37 -0
- package/auth.js.map +1 -0
- package/auth.mjs +32 -0
- package/auth.mjs.map +1 -0
- package/code-tool-paths.cjs +8 -0
- package/code-tool-paths.cjs.map +1 -0
- package/code-tool-paths.d.cts +2 -0
- package/code-tool-paths.d.cts.map +1 -0
- package/code-tool-types.d.mts +14 -0
- package/code-tool-types.d.mts.map +1 -0
- package/code-tool-types.d.ts +14 -0
- package/code-tool-types.d.ts.map +1 -0
- package/code-tool-types.js +4 -0
- package/code-tool-types.js.map +1 -0
- package/code-tool-types.mjs +3 -0
- package/code-tool-types.mjs.map +1 -0
- package/code-tool-worker.d.mts +5 -0
- package/code-tool-worker.d.mts.map +1 -0
- package/code-tool-worker.d.ts +5 -0
- package/code-tool-worker.d.ts.map +1 -0
- package/code-tool-worker.js +244 -0
- package/code-tool-worker.js.map +1 -0
- package/code-tool-worker.mjs +239 -0
- package/code-tool-worker.mjs.map +1 -0
- package/code-tool.d.mts +21 -0
- package/code-tool.d.mts.map +1 -0
- package/code-tool.d.ts +21 -0
- package/code-tool.d.ts.map +1 -0
- package/code-tool.js +337 -0
- package/code-tool.js.map +1 -0
- package/code-tool.mjs +301 -0
- package/code-tool.mjs.map +1 -0
- package/docs-search-tool.d.mts +57 -0
- package/docs-search-tool.d.mts.map +1 -0
- package/docs-search-tool.d.ts +57 -0
- package/docs-search-tool.d.ts.map +1 -0
- package/docs-search-tool.js +74 -0
- package/docs-search-tool.js.map +1 -0
- package/docs-search-tool.mjs +70 -0
- package/docs-search-tool.mjs.map +1 -0
- package/http.d.mts +12 -0
- package/http.d.mts.map +1 -0
- package/http.d.ts +12 -0
- package/http.d.ts.map +1 -0
- package/http.js +142 -0
- package/http.js.map +1 -0
- package/http.mjs +134 -0
- package/http.mjs.map +1 -0
- package/index.d.mts +3 -0
- package/index.d.mts.map +1 -0
- package/index.d.ts +3 -0
- package/index.d.ts.map +1 -0
- package/index.js +60 -0
- package/index.js.map +1 -0
- package/index.mjs +58 -0
- package/index.mjs.map +1 -0
- package/instructions.d.mts +2 -0
- package/instructions.d.mts.map +1 -0
- package/instructions.d.ts +2 -0
- package/instructions.d.ts.map +1 -0
- package/instructions.js +42 -0
- package/instructions.js.map +1 -0
- package/instructions.mjs +39 -0
- package/instructions.mjs.map +1 -0
- package/logger.d.mts +7 -0
- package/logger.d.mts.map +1 -0
- package/logger.d.ts +7 -0
- package/logger.d.ts.map +1 -0
- package/logger.js +29 -0
- package/logger.js.map +1 -0
- package/logger.mjs +22 -0
- package/logger.mjs.map +1 -0
- package/methods.d.mts +10 -0
- package/methods.d.mts.map +1 -0
- package/methods.d.ts +10 -0
- package/methods.d.ts.map +1 -0
- package/methods.js +185 -0
- package/methods.js.map +1 -0
- package/methods.mjs +181 -0
- package/methods.mjs.map +1 -0
- package/options.d.mts +20 -0
- package/options.d.mts.map +1 -0
- package/options.d.ts +20 -0
- package/options.d.ts.map +1 -0
- package/options.js +122 -0
- package/options.js.map +1 -0
- package/options.mjs +115 -0
- package/options.mjs.map +1 -0
- package/package.json +225 -0
- package/server.d.mts +30 -0
- package/server.d.mts.map +1 -0
- package/server.d.ts +30 -0
- package/server.d.ts.map +1 -0
- package/server.js +159 -0
- package/server.js.map +1 -0
- package/server.mjs +149 -0
- package/server.mjs.map +1 -0
- package/src/auth.ts +42 -0
- package/src/code-tool-paths.cts +5 -0
- package/src/code-tool-types.ts +17 -0
- package/src/code-tool-worker.ts +290 -0
- package/src/code-tool.ts +396 -0
- package/src/docs-search-tool.ts +100 -0
- package/src/http.ts +173 -0
- package/src/index.ts +67 -0
- package/src/instructions.ts +60 -0
- package/src/logger.ts +28 -0
- package/src/methods.ts +206 -0
- package/src/options.ts +161 -0
- package/src/server.ts +190 -0
- package/src/stdio.ts +14 -0
- package/src/tsconfig.json +11 -0
- package/src/types.ts +124 -0
- package/src/util.ts +25 -0
- package/stdio.d.mts +3 -0
- package/stdio.d.mts.map +1 -0
- package/stdio.d.ts +3 -0
- package/stdio.d.ts.map +1 -0
- package/stdio.js +15 -0
- package/stdio.js.map +1 -0
- package/stdio.mjs +11 -0
- package/stdio.mjs.map +1 -0
- package/types.d.mts +60 -0
- package/types.d.mts.map +1 -0
- package/types.d.ts +60 -0
- package/types.d.ts.map +1 -0
- package/types.js +58 -0
- package/types.js.map +1 -0
- package/types.mjs +53 -0
- package/types.mjs.map +1 -0
- package/util.d.mts +4 -0
- package/util.d.mts.map +1 -0
- package/util.d.ts +4 -0
- package/util.d.ts.map +1 -0
- package/util.js +30 -0
- package/util.js.map +1 -0
- package/util.mjs +24 -0
- package/util.mjs.map +1 -0
package/methods.mjs
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
export const sdkMethods = [
|
|
3
|
+
{
|
|
4
|
+
clientCallName: 'client.brand.retrieve',
|
|
5
|
+
fullyQualifiedName: 'brand.retrieve',
|
|
6
|
+
httpMethod: 'get',
|
|
7
|
+
httpPath: '/brand/retrieve',
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
clientCallName: 'client.brand.aiProduct',
|
|
11
|
+
fullyQualifiedName: 'brand.aiProduct',
|
|
12
|
+
httpMethod: 'post',
|
|
13
|
+
httpPath: '/brand/ai/product',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
clientCallName: 'client.brand.aiProducts',
|
|
17
|
+
fullyQualifiedName: 'brand.aiProducts',
|
|
18
|
+
httpMethod: 'post',
|
|
19
|
+
httpPath: '/brand/ai/products',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
clientCallName: 'client.brand.aiQuery',
|
|
23
|
+
fullyQualifiedName: 'brand.aiQuery',
|
|
24
|
+
httpMethod: 'post',
|
|
25
|
+
httpPath: '/brand/ai/query',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
clientCallName: 'client.brand.fonts',
|
|
29
|
+
fullyQualifiedName: 'brand.fonts',
|
|
30
|
+
httpMethod: 'get',
|
|
31
|
+
httpPath: '/brand/fonts',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
clientCallName: 'client.brand.identifyFromTransaction',
|
|
35
|
+
fullyQualifiedName: 'brand.identifyFromTransaction',
|
|
36
|
+
httpMethod: 'get',
|
|
37
|
+
httpPath: '/brand/transaction_identifier',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
clientCallName: 'client.brand.prefetch',
|
|
41
|
+
fullyQualifiedName: 'brand.prefetch',
|
|
42
|
+
httpMethod: 'post',
|
|
43
|
+
httpPath: '/brand/prefetch',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
clientCallName: 'client.brand.prefetchByEmail',
|
|
47
|
+
fullyQualifiedName: 'brand.prefetchByEmail',
|
|
48
|
+
httpMethod: 'post',
|
|
49
|
+
httpPath: '/brand/prefetch-by-email',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
clientCallName: 'client.brand.retrieveByEmail',
|
|
53
|
+
fullyQualifiedName: 'brand.retrieveByEmail',
|
|
54
|
+
httpMethod: 'get',
|
|
55
|
+
httpPath: '/brand/retrieve-by-email',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
clientCallName: 'client.brand.retrieveByIsin',
|
|
59
|
+
fullyQualifiedName: 'brand.retrieveByIsin',
|
|
60
|
+
httpMethod: 'get',
|
|
61
|
+
httpPath: '/brand/retrieve-by-isin',
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
clientCallName: 'client.brand.retrieveByName',
|
|
65
|
+
fullyQualifiedName: 'brand.retrieveByName',
|
|
66
|
+
httpMethod: 'get',
|
|
67
|
+
httpPath: '/brand/retrieve-by-name',
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
clientCallName: 'client.brand.retrieveByTicker',
|
|
71
|
+
fullyQualifiedName: 'brand.retrieveByTicker',
|
|
72
|
+
httpMethod: 'get',
|
|
73
|
+
httpPath: '/brand/retrieve-by-ticker',
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
clientCallName: 'client.brand.retrieveNaics',
|
|
77
|
+
fullyQualifiedName: 'brand.retrieveNaics',
|
|
78
|
+
httpMethod: 'get',
|
|
79
|
+
httpPath: '/brand/naics',
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
clientCallName: 'client.brand.retrieveSimplified',
|
|
83
|
+
fullyQualifiedName: 'brand.retrieveSimplified',
|
|
84
|
+
httpMethod: 'get',
|
|
85
|
+
httpPath: '/brand/retrieve-simplified',
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
clientCallName: 'client.brand.screenshot',
|
|
89
|
+
fullyQualifiedName: 'brand.screenshot',
|
|
90
|
+
httpMethod: 'get',
|
|
91
|
+
httpPath: '/brand/screenshot',
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
clientCallName: 'client.brand.styleguide',
|
|
95
|
+
fullyQualifiedName: 'brand.styleguide',
|
|
96
|
+
httpMethod: 'get',
|
|
97
|
+
httpPath: '/brand/styleguide',
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
clientCallName: 'client.brand.webScrapeHTML',
|
|
101
|
+
fullyQualifiedName: 'brand.webScrapeHTML',
|
|
102
|
+
httpMethod: 'get',
|
|
103
|
+
httpPath: '/web/scrape/html',
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
clientCallName: 'client.brand.webScrapeImages',
|
|
107
|
+
fullyQualifiedName: 'brand.webScrapeImages',
|
|
108
|
+
httpMethod: 'get',
|
|
109
|
+
httpPath: '/web/scrape/images',
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
clientCallName: 'client.brand.webScrapeMd',
|
|
113
|
+
fullyQualifiedName: 'brand.webScrapeMd',
|
|
114
|
+
httpMethod: 'get',
|
|
115
|
+
httpPath: '/web/scrape/markdown',
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
clientCallName: 'client.brand.webScrapeSitemap',
|
|
119
|
+
fullyQualifiedName: 'brand.webScrapeSitemap',
|
|
120
|
+
httpMethod: 'get',
|
|
121
|
+
httpPath: '/web/scrape/sitemap',
|
|
122
|
+
},
|
|
123
|
+
];
|
|
124
|
+
function allowedMethodsForCodeTool(options) {
|
|
125
|
+
if (!options) {
|
|
126
|
+
return undefined;
|
|
127
|
+
}
|
|
128
|
+
let allowedMethods;
|
|
129
|
+
if (options.codeAllowHttpGets || options.codeAllowedMethods) {
|
|
130
|
+
// Start with nothing allowed and then add into it from options
|
|
131
|
+
let allowedMethodsSet = new Set();
|
|
132
|
+
if (options.codeAllowHttpGets) {
|
|
133
|
+
// Add all methods that map to an HTTP GET
|
|
134
|
+
sdkMethods
|
|
135
|
+
.filter((method) => method.httpMethod === 'get')
|
|
136
|
+
.forEach((method) => allowedMethodsSet.add(method));
|
|
137
|
+
}
|
|
138
|
+
if (options.codeAllowedMethods) {
|
|
139
|
+
// Add all methods that match any of the allowed regexps
|
|
140
|
+
const allowedRegexps = options.codeAllowedMethods.map((pattern) => {
|
|
141
|
+
try {
|
|
142
|
+
return new RegExp(pattern);
|
|
143
|
+
}
|
|
144
|
+
catch (e) {
|
|
145
|
+
throw new Error(`Invalid regex pattern for allowed method: "${pattern}": ${e instanceof Error ? e.message : e}`);
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
sdkMethods
|
|
149
|
+
.filter((method) => allowedRegexps.some((regexp) => regexp.test(method.fullyQualifiedName)))
|
|
150
|
+
.forEach((method) => allowedMethodsSet.add(method));
|
|
151
|
+
}
|
|
152
|
+
allowedMethods = Array.from(allowedMethodsSet);
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
// Start with everything allowed
|
|
156
|
+
allowedMethods = [...sdkMethods];
|
|
157
|
+
}
|
|
158
|
+
if (options.codeBlockedMethods) {
|
|
159
|
+
// Filter down based on blocked regexps
|
|
160
|
+
const blockedRegexps = options.codeBlockedMethods.map((pattern) => {
|
|
161
|
+
try {
|
|
162
|
+
return new RegExp(pattern);
|
|
163
|
+
}
|
|
164
|
+
catch (e) {
|
|
165
|
+
throw new Error(`Invalid regex pattern for blocked method: "${pattern}": ${e instanceof Error ? e.message : e}`);
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
allowedMethods = allowedMethods.filter((method) => !blockedRegexps.some((regexp) => regexp.test(method.fullyQualifiedName)));
|
|
169
|
+
}
|
|
170
|
+
return allowedMethods;
|
|
171
|
+
}
|
|
172
|
+
export function blockedMethodsForCodeTool(options) {
|
|
173
|
+
const allowedMethods = allowedMethodsForCodeTool(options);
|
|
174
|
+
if (!allowedMethods) {
|
|
175
|
+
return undefined;
|
|
176
|
+
}
|
|
177
|
+
const allowedSet = new Set(allowedMethods.map((method) => method.fullyQualifiedName));
|
|
178
|
+
// Return any methods that are not explicitly allowed
|
|
179
|
+
return sdkMethods.filter((method) => !allowedSet.has(method.fullyQualifiedName));
|
|
180
|
+
}
|
|
181
|
+
//# sourceMappingURL=methods.mjs.map
|
package/methods.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"methods.mjs","sourceRoot":"","sources":["src/methods.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAWtF,MAAM,CAAC,MAAM,UAAU,GAAgB;IACrC;QACE,cAAc,EAAE,uBAAuB;QACvC,kBAAkB,EAAE,gBAAgB;QACpC,UAAU,EAAE,KAAK;QACjB,QAAQ,EAAE,iBAAiB;KAC5B;IACD;QACE,cAAc,EAAE,wBAAwB;QACxC,kBAAkB,EAAE,iBAAiB;QACrC,UAAU,EAAE,MAAM;QAClB,QAAQ,EAAE,mBAAmB;KAC9B;IACD;QACE,cAAc,EAAE,yBAAyB;QACzC,k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AAO,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC;YAC7B,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,MAAM,IAAI,KAAK,CACb,8CAA8C,OAAO,MAAM,CAAC,YAAY,KAAK,CAAC,CAAC,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,20 @@
|
|
|
1
|
+
export type CLIOptions = McpOptions & {
|
|
2
|
+
debug: boolean;
|
|
3
|
+
logFormat: 'json' | 'pretty';
|
|
4
|
+
transport: 'stdio' | 'http';
|
|
5
|
+
port: number | undefined;
|
|
6
|
+
socket: string | undefined;
|
|
7
|
+
};
|
|
8
|
+
export type McpOptions = {
|
|
9
|
+
includeCodeTool?: boolean | undefined;
|
|
10
|
+
includeDocsTools?: boolean | undefined;
|
|
11
|
+
stainlessApiKey?: string | undefined;
|
|
12
|
+
codeAllowHttpGets?: boolean | undefined;
|
|
13
|
+
codeAllowedMethods?: string[] | undefined;
|
|
14
|
+
codeBlockedMethods?: string[] | undefined;
|
|
15
|
+
codeExecutionMode: McpCodeExecutionMode;
|
|
16
|
+
};
|
|
17
|
+
export type McpCodeExecutionMode = 'stainless-sandbox' | 'local';
|
|
18
|
+
export declare function parseCLIOptions(): CLIOptions;
|
|
19
|
+
export declare function parseQueryOptions(defaultOptions: McpOptions, query: unknown): McpOptions;
|
|
20
|
+
//# sourceMappingURL=options.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.d.mts","sourceRoot":"","sources":["src/options.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG;IACpC,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC7B,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,eAAe,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACtC,gBAAgB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACvC,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,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;IAC1C,iBAAiB,EAAE,oBAAoB,CAAC;CACzC,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,mBAAmB,GAAG,OAAO,CAAC;AAEjE,wBAAgB,eAAe,IAAI,UAAU,CAgG5C;AAiBD,wBAAgB,iBAAiB,CAAC,cAAc,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,GAAG,UAAU,CAmBxF"}
|
package/options.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type CLIOptions = McpOptions & {
|
|
2
|
+
debug: boolean;
|
|
3
|
+
logFormat: 'json' | 'pretty';
|
|
4
|
+
transport: 'stdio' | 'http';
|
|
5
|
+
port: number | undefined;
|
|
6
|
+
socket: string | undefined;
|
|
7
|
+
};
|
|
8
|
+
export type McpOptions = {
|
|
9
|
+
includeCodeTool?: boolean | undefined;
|
|
10
|
+
includeDocsTools?: boolean | undefined;
|
|
11
|
+
stainlessApiKey?: string | undefined;
|
|
12
|
+
codeAllowHttpGets?: boolean | undefined;
|
|
13
|
+
codeAllowedMethods?: string[] | undefined;
|
|
14
|
+
codeBlockedMethods?: string[] | undefined;
|
|
15
|
+
codeExecutionMode: McpCodeExecutionMode;
|
|
16
|
+
};
|
|
17
|
+
export type McpCodeExecutionMode = 'stainless-sandbox' | 'local';
|
|
18
|
+
export declare function parseCLIOptions(): CLIOptions;
|
|
19
|
+
export declare function parseQueryOptions(defaultOptions: McpOptions, query: unknown): McpOptions;
|
|
20
|
+
//# sourceMappingURL=options.d.ts.map
|
package/options.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["src/options.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG;IACpC,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC7B,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,eAAe,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACtC,gBAAgB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACvC,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,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;IAC1C,iBAAiB,EAAE,oBAAoB,CAAC;CACzC,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,mBAAmB,GAAG,OAAO,CAAC;AAEjE,wBAAgB,eAAe,IAAI,UAAU,CAgG5C;AAiBD,wBAAgB,iBAAiB,CAAC,cAAc,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,GAAG,UAAU,CAmBxF"}
|
package/options.js
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.parseCLIOptions = parseCLIOptions;
|
|
8
|
+
exports.parseQueryOptions = parseQueryOptions;
|
|
9
|
+
const qs_1 = __importDefault(require("qs"));
|
|
10
|
+
const yargs_1 = __importDefault(require("yargs"));
|
|
11
|
+
const helpers_1 = require("yargs/helpers");
|
|
12
|
+
const zod_1 = __importDefault(require("zod"));
|
|
13
|
+
const util_1 = require("./util.js");
|
|
14
|
+
function parseCLIOptions() {
|
|
15
|
+
const opts = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv))
|
|
16
|
+
.option('code-allow-http-gets', {
|
|
17
|
+
type: 'boolean',
|
|
18
|
+
description: 'Allow all code tool methods that map to HTTP GET operations. If all code-allow-* flags are unset, then everything is allowed.',
|
|
19
|
+
})
|
|
20
|
+
.option('code-allowed-methods', {
|
|
21
|
+
type: 'string',
|
|
22
|
+
array: true,
|
|
23
|
+
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.',
|
|
24
|
+
})
|
|
25
|
+
.option('code-blocked-methods', {
|
|
26
|
+
type: 'string',
|
|
27
|
+
array: true,
|
|
28
|
+
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.',
|
|
29
|
+
})
|
|
30
|
+
.option('code-execution-mode', {
|
|
31
|
+
type: 'string',
|
|
32
|
+
choices: ['stainless-sandbox', 'local'],
|
|
33
|
+
default: 'stainless-sandbox',
|
|
34
|
+
description: "Where to run code execution in code tool; 'stainless-sandbox' will execute code in Stainless-hosted sandboxes whereas 'local' will execute code locally on the MCP server machine.",
|
|
35
|
+
})
|
|
36
|
+
.option('debug', { type: 'boolean', description: 'Enable debug logging' })
|
|
37
|
+
.option('log-format', {
|
|
38
|
+
type: 'string',
|
|
39
|
+
choices: ['json', 'pretty'],
|
|
40
|
+
description: 'Format for log output; defaults to json unless tty is detected',
|
|
41
|
+
})
|
|
42
|
+
.option('no-tools', {
|
|
43
|
+
type: 'string',
|
|
44
|
+
array: true,
|
|
45
|
+
choices: ['code', 'docs'],
|
|
46
|
+
description: 'Tools to explicitly disable',
|
|
47
|
+
})
|
|
48
|
+
.option('port', {
|
|
49
|
+
type: 'number',
|
|
50
|
+
default: 3000,
|
|
51
|
+
description: 'Port to serve on if using http transport',
|
|
52
|
+
})
|
|
53
|
+
.option('socket', { type: 'string', description: 'Unix socket to serve on if using http transport' })
|
|
54
|
+
.option('stainless-api-key', {
|
|
55
|
+
type: 'string',
|
|
56
|
+
default: (0, util_1.readEnv)('STAINLESS_API_KEY'),
|
|
57
|
+
description: 'API key for Stainless. Used to authenticate requests to Stainless-hosted tools endpoints.',
|
|
58
|
+
})
|
|
59
|
+
.option('tools', {
|
|
60
|
+
type: 'string',
|
|
61
|
+
array: true,
|
|
62
|
+
choices: ['code', 'docs'],
|
|
63
|
+
description: 'Tools to explicitly enable',
|
|
64
|
+
})
|
|
65
|
+
.option('transport', {
|
|
66
|
+
type: 'string',
|
|
67
|
+
choices: ['stdio', 'http'],
|
|
68
|
+
default: 'stdio',
|
|
69
|
+
description: 'What transport to use; stdio for local servers or http for remote servers',
|
|
70
|
+
})
|
|
71
|
+
.env('MCP_SERVER')
|
|
72
|
+
.version(true)
|
|
73
|
+
.help();
|
|
74
|
+
const argv = opts.parseSync();
|
|
75
|
+
const shouldIncludeToolType = (toolType) => argv.noTools?.includes(toolType) ? false
|
|
76
|
+
: argv.tools?.includes(toolType) ? true
|
|
77
|
+
: undefined;
|
|
78
|
+
const includeCodeTool = shouldIncludeToolType('code');
|
|
79
|
+
const includeDocsTools = shouldIncludeToolType('docs');
|
|
80
|
+
const transport = argv.transport;
|
|
81
|
+
const logFormat = argv.logFormat ? argv.logFormat
|
|
82
|
+
: process.stderr.isTTY ? 'pretty'
|
|
83
|
+
: 'json';
|
|
84
|
+
return {
|
|
85
|
+
...(includeCodeTool !== undefined && { includeCodeTool }),
|
|
86
|
+
...(includeDocsTools !== undefined && { includeDocsTools }),
|
|
87
|
+
debug: !!argv.debug,
|
|
88
|
+
stainlessApiKey: argv.stainlessApiKey,
|
|
89
|
+
codeAllowHttpGets: argv.codeAllowHttpGets,
|
|
90
|
+
codeAllowedMethods: argv.codeAllowedMethods,
|
|
91
|
+
codeBlockedMethods: argv.codeBlockedMethods,
|
|
92
|
+
codeExecutionMode: argv.codeExecutionMode,
|
|
93
|
+
transport,
|
|
94
|
+
logFormat,
|
|
95
|
+
port: argv.port,
|
|
96
|
+
socket: argv.socket,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
const coerceArray = (zodType) => zod_1.default.preprocess((val) => Array.isArray(val) ? val
|
|
100
|
+
: val ? [val]
|
|
101
|
+
: val, zod_1.default.array(zodType).optional());
|
|
102
|
+
const QueryOptions = zod_1.default.object({
|
|
103
|
+
tools: coerceArray(zod_1.default.enum(['code', 'docs'])).describe('Specify which MCP tools to use'),
|
|
104
|
+
no_tools: coerceArray(zod_1.default.enum(['code', 'docs'])).describe('Specify which MCP tools to not use.'),
|
|
105
|
+
tool: coerceArray(zod_1.default.string()).describe('Include tools matching the specified names'),
|
|
106
|
+
});
|
|
107
|
+
function parseQueryOptions(defaultOptions, query) {
|
|
108
|
+
const queryObject = typeof query === 'string' ? qs_1.default.parse(query) : query;
|
|
109
|
+
const queryOptions = QueryOptions.parse(queryObject);
|
|
110
|
+
let codeTool = queryOptions.no_tools && queryOptions.no_tools?.includes('code') ? false
|
|
111
|
+
: queryOptions.tools?.includes('code') ? true
|
|
112
|
+
: defaultOptions.includeCodeTool;
|
|
113
|
+
let docsTools = queryOptions.no_tools && queryOptions.no_tools?.includes('docs') ? false
|
|
114
|
+
: queryOptions.tools?.includes('docs') ? true
|
|
115
|
+
: defaultOptions.includeDocsTools;
|
|
116
|
+
return {
|
|
117
|
+
...(codeTool !== undefined && { includeCodeTool: codeTool }),
|
|
118
|
+
...(docsTools !== undefined && { includeDocsTools: docsTools }),
|
|
119
|
+
codeExecutionMode: defaultOptions.codeExecutionMode,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
//# 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":";AAAA,sFAAsF;;;;;AA4BtF,0CAgGC;AAiBD,8CAmBC;AA9JD,4CAAoB;AACpB,kDAA0B;AAC1B,2CAAwC;AACxC,8CAAoB;AACpB,oCAAiC;AAsBjC,SAAgB,eAAe;IAC7B,MAAM,IAAI,GAAG,IAAA,eAAK,EAAC,IAAA,iBAAO,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;SAC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,YAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IACxE,MAAM,YAAY,GAAG,YAAY,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IAErD,IAAI,QAAQ,GACV,YAAY,CAAC,QAAQ,IAAI,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK;QACxE,CAAC,CAAC,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI;YAC7C,CAAC,CAAC,cAAc,CAAC,eAAe,CAAC;IAEnC,IAAI,SAAS,GACX,YAAY,CAAC,QAAQ,IAAI,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK;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,QAAQ,KAAK,SAAS,IAAI,EAAE,eAAe,EAAE,QAAQ,EAAE,CAAC;QAC5D,GAAG,CAAC,SAAS,KAAK,SAAS,IAAI,EAAE,gBAAgB,EAAE,SAAS,EAAE,CAAC;QAC/D,iBAAiB,EAAE,cAAc,CAAC,iBAAiB;KACpD,CAAC;AACJ,CAAC"}
|
package/options.mjs
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import qs from 'qs';
|
|
3
|
+
import yargs from 'yargs';
|
|
4
|
+
import { hideBin } from 'yargs/helpers';
|
|
5
|
+
import z from 'zod';
|
|
6
|
+
import { readEnv } from "./util.mjs";
|
|
7
|
+
export function parseCLIOptions() {
|
|
8
|
+
const opts = yargs(hideBin(process.argv))
|
|
9
|
+
.option('code-allow-http-gets', {
|
|
10
|
+
type: 'boolean',
|
|
11
|
+
description: 'Allow all code tool methods that map to HTTP GET operations. If all code-allow-* flags are unset, then everything is allowed.',
|
|
12
|
+
})
|
|
13
|
+
.option('code-allowed-methods', {
|
|
14
|
+
type: 'string',
|
|
15
|
+
array: true,
|
|
16
|
+
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.',
|
|
17
|
+
})
|
|
18
|
+
.option('code-blocked-methods', {
|
|
19
|
+
type: 'string',
|
|
20
|
+
array: true,
|
|
21
|
+
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.',
|
|
22
|
+
})
|
|
23
|
+
.option('code-execution-mode', {
|
|
24
|
+
type: 'string',
|
|
25
|
+
choices: ['stainless-sandbox', 'local'],
|
|
26
|
+
default: 'stainless-sandbox',
|
|
27
|
+
description: "Where to run code execution in code tool; 'stainless-sandbox' will execute code in Stainless-hosted sandboxes whereas 'local' will execute code locally on the MCP server machine.",
|
|
28
|
+
})
|
|
29
|
+
.option('debug', { type: 'boolean', description: 'Enable debug logging' })
|
|
30
|
+
.option('log-format', {
|
|
31
|
+
type: 'string',
|
|
32
|
+
choices: ['json', 'pretty'],
|
|
33
|
+
description: 'Format for log output; defaults to json unless tty is detected',
|
|
34
|
+
})
|
|
35
|
+
.option('no-tools', {
|
|
36
|
+
type: 'string',
|
|
37
|
+
array: true,
|
|
38
|
+
choices: ['code', 'docs'],
|
|
39
|
+
description: 'Tools to explicitly disable',
|
|
40
|
+
})
|
|
41
|
+
.option('port', {
|
|
42
|
+
type: 'number',
|
|
43
|
+
default: 3000,
|
|
44
|
+
description: 'Port to serve on if using http transport',
|
|
45
|
+
})
|
|
46
|
+
.option('socket', { type: 'string', description: 'Unix socket to serve on if using http transport' })
|
|
47
|
+
.option('stainless-api-key', {
|
|
48
|
+
type: 'string',
|
|
49
|
+
default: readEnv('STAINLESS_API_KEY'),
|
|
50
|
+
description: 'API key for Stainless. Used to authenticate requests to Stainless-hosted tools endpoints.',
|
|
51
|
+
})
|
|
52
|
+
.option('tools', {
|
|
53
|
+
type: 'string',
|
|
54
|
+
array: true,
|
|
55
|
+
choices: ['code', 'docs'],
|
|
56
|
+
description: 'Tools to explicitly enable',
|
|
57
|
+
})
|
|
58
|
+
.option('transport', {
|
|
59
|
+
type: 'string',
|
|
60
|
+
choices: ['stdio', 'http'],
|
|
61
|
+
default: 'stdio',
|
|
62
|
+
description: 'What transport to use; stdio for local servers or http for remote servers',
|
|
63
|
+
})
|
|
64
|
+
.env('MCP_SERVER')
|
|
65
|
+
.version(true)
|
|
66
|
+
.help();
|
|
67
|
+
const argv = opts.parseSync();
|
|
68
|
+
const shouldIncludeToolType = (toolType) => argv.noTools?.includes(toolType) ? false
|
|
69
|
+
: argv.tools?.includes(toolType) ? true
|
|
70
|
+
: undefined;
|
|
71
|
+
const includeCodeTool = shouldIncludeToolType('code');
|
|
72
|
+
const includeDocsTools = shouldIncludeToolType('docs');
|
|
73
|
+
const transport = argv.transport;
|
|
74
|
+
const logFormat = argv.logFormat ? argv.logFormat
|
|
75
|
+
: process.stderr.isTTY ? 'pretty'
|
|
76
|
+
: 'json';
|
|
77
|
+
return {
|
|
78
|
+
...(includeCodeTool !== undefined && { includeCodeTool }),
|
|
79
|
+
...(includeDocsTools !== undefined && { includeDocsTools }),
|
|
80
|
+
debug: !!argv.debug,
|
|
81
|
+
stainlessApiKey: argv.stainlessApiKey,
|
|
82
|
+
codeAllowHttpGets: argv.codeAllowHttpGets,
|
|
83
|
+
codeAllowedMethods: argv.codeAllowedMethods,
|
|
84
|
+
codeBlockedMethods: argv.codeBlockedMethods,
|
|
85
|
+
codeExecutionMode: argv.codeExecutionMode,
|
|
86
|
+
transport,
|
|
87
|
+
logFormat,
|
|
88
|
+
port: argv.port,
|
|
89
|
+
socket: argv.socket,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
const coerceArray = (zodType) => z.preprocess((val) => Array.isArray(val) ? val
|
|
93
|
+
: val ? [val]
|
|
94
|
+
: val, z.array(zodType).optional());
|
|
95
|
+
const QueryOptions = z.object({
|
|
96
|
+
tools: coerceArray(z.enum(['code', 'docs'])).describe('Specify which MCP tools to use'),
|
|
97
|
+
no_tools: coerceArray(z.enum(['code', 'docs'])).describe('Specify which MCP tools to not use.'),
|
|
98
|
+
tool: coerceArray(z.string()).describe('Include tools matching the specified names'),
|
|
99
|
+
});
|
|
100
|
+
export function parseQueryOptions(defaultOptions, query) {
|
|
101
|
+
const queryObject = typeof query === 'string' ? qs.parse(query) : query;
|
|
102
|
+
const queryOptions = QueryOptions.parse(queryObject);
|
|
103
|
+
let codeTool = queryOptions.no_tools && queryOptions.no_tools?.includes('code') ? false
|
|
104
|
+
: queryOptions.tools?.includes('code') ? true
|
|
105
|
+
: defaultOptions.includeCodeTool;
|
|
106
|
+
let docsTools = queryOptions.no_tools && queryOptions.no_tools?.includes('docs') ? false
|
|
107
|
+
: queryOptions.tools?.includes('docs') ? true
|
|
108
|
+
: defaultOptions.includeDocsTools;
|
|
109
|
+
return {
|
|
110
|
+
...(codeTool !== undefined && { includeCodeTool: codeTool }),
|
|
111
|
+
...(docsTools !== undefined && { includeDocsTools: docsTools }),
|
|
112
|
+
codeExecutionMode: defaultOptions.codeExecutionMode,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=options.mjs.map
|
package/options.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.mjs","sourceRoot":"","sources":["src/options.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,MAAM,IAAI;OACZ,KAAK,MAAM,OAAO;OAClB,EAAE,OAAO,EAAE,MAAM,eAAe;OAChC,CAAC,MAAM,KAAK;OACZ,EAAE,OAAO,EAAE;AAsBlB,MAAM,UAAU,eAAe;IAC7B,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,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