@nirvana-labs/nirvana-mcp 1.45.0 → 1.45.1
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/code-tool.d.mts +4 -1
- package/code-tool.d.mts.map +1 -1
- package/code-tool.d.ts +4 -1
- package/code-tool.d.ts.map +1 -1
- package/code-tool.js +14 -1
- package/code-tool.js.map +1 -1
- package/code-tool.mjs +14 -1
- package/code-tool.mjs.map +1 -1
- package/http.d.mts.map +1 -1
- package/http.d.ts.map +1 -1
- package/http.js +2 -1
- package/http.js.map +1 -1
- package/http.mjs +2 -1
- package/http.mjs.map +1 -1
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/index.mjs +1 -1
- package/index.mjs.map +1 -1
- 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 +466 -0
- package/methods.js.map +1 -0
- package/methods.mjs +462 -0
- package/methods.mjs.map +1 -0
- package/options.d.mts +3 -0
- package/options.d.mts.map +1 -1
- package/options.d.ts +3 -0
- package/options.d.ts.map +1 -1
- package/options.js +17 -0
- package/options.js.map +1 -1
- package/options.mjs +17 -0
- package/options.mjs.map +1 -1
- package/package.json +12 -2
- package/server.d.mts.map +1 -1
- package/server.d.ts.map +1 -1
- package/server.js +7 -2
- package/server.js.map +1 -1
- package/server.mjs +7 -2
- package/server.mjs.map +1 -1
- package/src/code-tool.ts +20 -1
- package/src/http.ts +3 -0
- package/src/index.ts +1 -1
- package/src/methods.ts +486 -0
- package/src/options.ts +23 -0
- package/src/server.ts +7 -2
- package/src/stdio.ts +3 -2
- package/stdio.d.mts +2 -1
- package/stdio.d.mts.map +1 -1
- package/stdio.d.ts +2 -1
- package/stdio.d.ts.map +1 -1
- package/stdio.js +2 -2
- package/stdio.js.map +1 -1
- package/stdio.mjs +2 -2
- package/stdio.mjs.map +1 -1
package/server.js
CHANGED
|
@@ -13,6 +13,7 @@ const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
|
|
|
13
13
|
const nirvana_1 = __importDefault(require("@nirvana-labs/nirvana"));
|
|
14
14
|
const code_tool_1 = require("./code-tool.js");
|
|
15
15
|
const docs_search_tool_1 = __importDefault(require("./docs-search-tool.js"));
|
|
16
|
+
const methods_1 = require("./methods.js");
|
|
16
17
|
async function getInstructions() {
|
|
17
18
|
// This API key is optional; providing it allows the server to fetch instructions for unreleased versions.
|
|
18
19
|
const stainlessAPIKey = (0, exports.readEnv)('STAINLESS_API_KEY');
|
|
@@ -41,7 +42,7 @@ async function getInstructions() {
|
|
|
41
42
|
}
|
|
42
43
|
const newMcpServer = async () => new mcp_js_1.McpServer({
|
|
43
44
|
name: 'nirvana_labs_nirvana_api',
|
|
44
|
-
version: '1.45.
|
|
45
|
+
version: '1.45.1',
|
|
45
46
|
}, {
|
|
46
47
|
instructions: await getInstructions(),
|
|
47
48
|
capabilities: { tools: {}, logging: {} },
|
|
@@ -115,7 +116,11 @@ async function initMcpServer(params) {
|
|
|
115
116
|
* Selects the tools to include in the MCP Server based on the provided options.
|
|
116
117
|
*/
|
|
117
118
|
function selectTools(options) {
|
|
118
|
-
const includedTools = [
|
|
119
|
+
const includedTools = [
|
|
120
|
+
(0, code_tool_1.codeTool)({
|
|
121
|
+
blockedMethods: (0, methods_1.blockedMethodsForCodeTool)(options),
|
|
122
|
+
}),
|
|
123
|
+
];
|
|
119
124
|
if (options?.includeDocsTools ?? true) {
|
|
120
125
|
includedTools.push(docs_search_tool_1.default);
|
|
121
126
|
}
|
package/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["src/server.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;;;
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["src/server.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;;;AAwEtF,sCAwEC;AAKD,kCAUC;AAKD,wCAMC;AAvKD,oEAAoE;AAC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IAAI,KAAK,CAAC,2BAA2B,WAAW,EAAE,CAAC,CAAC;IAC5D,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AALW,QAAA,YAAY,gBAKvB"}
|
package/server.mjs
CHANGED
|
@@ -4,6 +4,7 @@ import { CallToolRequestSchema, ListToolsRequestSchema, SetLevelRequestSchema, }
|
|
|
4
4
|
import NirvanaLabs from '@nirvana-labs/nirvana';
|
|
5
5
|
import { codeTool } from "./code-tool.mjs";
|
|
6
6
|
import docsSearchTool from "./docs-search-tool.mjs";
|
|
7
|
+
import { blockedMethodsForCodeTool } from "./methods.mjs";
|
|
7
8
|
async function getInstructions() {
|
|
8
9
|
// This API key is optional; providing it allows the server to fetch instructions for unreleased versions.
|
|
9
10
|
const stainlessAPIKey = readEnv('STAINLESS_API_KEY');
|
|
@@ -32,7 +33,7 @@ async function getInstructions() {
|
|
|
32
33
|
}
|
|
33
34
|
export const newMcpServer = async () => new McpServer({
|
|
34
35
|
name: 'nirvana_labs_nirvana_api',
|
|
35
|
-
version: '1.45.
|
|
36
|
+
version: '1.45.1',
|
|
36
37
|
}, {
|
|
37
38
|
instructions: await getInstructions(),
|
|
38
39
|
capabilities: { tools: {}, logging: {} },
|
|
@@ -105,7 +106,11 @@ export async function initMcpServer(params) {
|
|
|
105
106
|
* Selects the tools to include in the MCP Server based on the provided options.
|
|
106
107
|
*/
|
|
107
108
|
export function selectTools(options) {
|
|
108
|
-
const includedTools = [
|
|
109
|
+
const includedTools = [
|
|
110
|
+
codeTool({
|
|
111
|
+
blockedMethods: blockedMethodsForCodeTool(options),
|
|
112
|
+
}),
|
|
113
|
+
];
|
|
109
114
|
if (options?.includeDocsTools ?? true) {
|
|
110
115
|
includedTools.push(docsSearchTool);
|
|
111
116
|
}
|
package/server.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.mjs","sourceRoot":"","sources":["src/server.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAG/E,EAA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I,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IAC5B,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,wBAAwB,GAAG,aAAa,CAAC,CAAC;IAC5D,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,CAAI,KAAoB,EAAE,WAAmB,EAAK,EAAE;IAC9E,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,2BAA2B,WAAW,EAAE,CAAC,CAAC;IAC5D,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"}
|
package/src/code-tool.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { McpTool, Metadata, ToolCallResult, asErrorResult, asTextContentResult }
|
|
|
4
4
|
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
5
5
|
import { readEnv, requireValue } from './server';
|
|
6
6
|
import { WorkerInput, WorkerOutput } from './code-tool-types';
|
|
7
|
+
import { SdkMethod } from './methods';
|
|
7
8
|
import { NirvanaLabs } from '@nirvana-labs/nirvana';
|
|
8
9
|
|
|
9
10
|
const prompt = `Runs JavaScript code to interact with the Nirvana Labs API.
|
|
@@ -46,7 +47,7 @@ Variables will not persist between calls, so make sure to return or log any data
|
|
|
46
47
|
*
|
|
47
48
|
* @param endpoints - The endpoints to include in the list.
|
|
48
49
|
*/
|
|
49
|
-
export function codeTool(): McpTool {
|
|
50
|
+
export function codeTool(params: { blockedMethods: SdkMethod[] | undefined }): McpTool {
|
|
50
51
|
const metadata: Metadata = { resource: 'all', operation: 'write', tags: [] };
|
|
51
52
|
const tool: Tool = {
|
|
52
53
|
name: 'execute',
|
|
@@ -70,6 +71,24 @@ export function codeTool(): McpTool {
|
|
|
70
71
|
const code = args.code as string;
|
|
71
72
|
const intent = args.intent as string | undefined;
|
|
72
73
|
|
|
74
|
+
// Do very basic blocking of code that includes forbidden method names.
|
|
75
|
+
//
|
|
76
|
+
// WARNING: This is not secure against obfuscation and other evasion methods. If
|
|
77
|
+
// stronger security blocks are required, then these should be enforced in the downstream
|
|
78
|
+
// API (e.g., by having users call the MCP server with API keys with limited permissions).
|
|
79
|
+
if (params.blockedMethods) {
|
|
80
|
+
const blockedMatches = params.blockedMethods.filter((method) =>
|
|
81
|
+
code.includes(method.fullyQualifiedName),
|
|
82
|
+
);
|
|
83
|
+
if (blockedMatches.length > 0) {
|
|
84
|
+
return asErrorResult(
|
|
85
|
+
`The following methods have been blocked by the MCP server and cannot be used in code execution: ${blockedMatches
|
|
86
|
+
.map((m) => m.fullyQualifiedName)
|
|
87
|
+
.join(', ')}`,
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
73
92
|
// this is not required, but passing a Stainless API key for the matching project_name
|
|
74
93
|
// will allow you to run code-mode queries against non-published versions of your SDK.
|
|
75
94
|
const stainlessAPIKey = readEnv('STAINLESS_API_KEY');
|
package/src/http.ts
CHANGED
|
@@ -11,10 +11,12 @@ import { parseAuthHeaders } from './headers';
|
|
|
11
11
|
|
|
12
12
|
const newServer = async ({
|
|
13
13
|
clientOptions,
|
|
14
|
+
mcpOptions,
|
|
14
15
|
req,
|
|
15
16
|
res,
|
|
16
17
|
}: {
|
|
17
18
|
clientOptions: ClientOptions;
|
|
19
|
+
mcpOptions: McpOptions;
|
|
18
20
|
req: express.Request;
|
|
19
21
|
res: express.Response;
|
|
20
22
|
}): Promise<McpServer | null> => {
|
|
@@ -24,6 +26,7 @@ const newServer = async ({
|
|
|
24
26
|
const authOptions = parseAuthHeaders(req, false);
|
|
25
27
|
await initMcpServer({
|
|
26
28
|
server: server,
|
|
29
|
+
mcpOptions: mcpOptions,
|
|
27
30
|
clientOptions: {
|
|
28
31
|
...clientOptions,
|
|
29
32
|
...authOptions,
|
package/src/index.ts
CHANGED
package/src/methods.ts
ADDED
|
@@ -0,0 +1,486 @@
|
|
|
1
|
+
import { McpOptions } from './options';
|
|
2
|
+
|
|
3
|
+
export type SdkMethod = {
|
|
4
|
+
clientCallName: string;
|
|
5
|
+
fullyQualifiedName: string;
|
|
6
|
+
httpMethod?: 'get' | 'post' | 'put' | 'patch' | 'delete' | 'query';
|
|
7
|
+
httpPath?: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const sdkMethods: SdkMethod[] = [
|
|
11
|
+
{
|
|
12
|
+
clientCallName: 'client.user.get',
|
|
13
|
+
fullyQualifiedName: 'user.get',
|
|
14
|
+
httpMethod: 'get',
|
|
15
|
+
httpPath: '/v1/user',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
clientCallName: 'client.user.security.update',
|
|
19
|
+
fullyQualifiedName: 'user.security.update',
|
|
20
|
+
httpMethod: 'patch',
|
|
21
|
+
httpPath: '/v1/user/security',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
clientCallName: 'client.user.security.get',
|
|
25
|
+
fullyQualifiedName: 'user.security.get',
|
|
26
|
+
httpMethod: 'get',
|
|
27
|
+
httpPath: '/v1/user/security',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
clientCallName: 'client.apiKeys.create',
|
|
31
|
+
fullyQualifiedName: 'apiKeys.create',
|
|
32
|
+
httpMethod: 'post',
|
|
33
|
+
httpPath: '/v1/api_keys',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
clientCallName: 'client.apiKeys.update',
|
|
37
|
+
fullyQualifiedName: 'apiKeys.update',
|
|
38
|
+
httpMethod: 'patch',
|
|
39
|
+
httpPath: '/v1/api_keys/{api_key_id}',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
clientCallName: 'client.apiKeys.list',
|
|
43
|
+
fullyQualifiedName: 'apiKeys.list',
|
|
44
|
+
httpMethod: 'get',
|
|
45
|
+
httpPath: '/v1/api_keys',
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
clientCallName: 'client.apiKeys.delete',
|
|
49
|
+
fullyQualifiedName: 'apiKeys.delete',
|
|
50
|
+
httpMethod: 'delete',
|
|
51
|
+
httpPath: '/v1/api_keys/{api_key_id}',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
clientCallName: 'client.apiKeys.get',
|
|
55
|
+
fullyQualifiedName: 'apiKeys.get',
|
|
56
|
+
httpMethod: 'get',
|
|
57
|
+
httpPath: '/v1/api_keys/{api_key_id}',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
clientCallName: 'client.operations.list',
|
|
61
|
+
fullyQualifiedName: 'operations.list',
|
|
62
|
+
httpMethod: 'get',
|
|
63
|
+
httpPath: '/v1/operations',
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
clientCallName: 'client.operations.get',
|
|
67
|
+
fullyQualifiedName: 'operations.get',
|
|
68
|
+
httpMethod: 'get',
|
|
69
|
+
httpPath: '/v1/operations/{operation_id}',
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
clientCallName: 'client.organizations.create',
|
|
73
|
+
fullyQualifiedName: 'organizations.create',
|
|
74
|
+
httpMethod: 'post',
|
|
75
|
+
httpPath: '/v1/organizations',
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
clientCallName: 'client.organizations.update',
|
|
79
|
+
fullyQualifiedName: 'organizations.update',
|
|
80
|
+
httpMethod: 'patch',
|
|
81
|
+
httpPath: '/v1/organizations/{organization_id}',
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
clientCallName: 'client.organizations.list',
|
|
85
|
+
fullyQualifiedName: 'organizations.list',
|
|
86
|
+
httpMethod: 'get',
|
|
87
|
+
httpPath: '/v1/organizations',
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
clientCallName: 'client.organizations.get',
|
|
91
|
+
fullyQualifiedName: 'organizations.get',
|
|
92
|
+
httpMethod: 'get',
|
|
93
|
+
httpPath: '/v1/organizations/{organization_id}',
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
clientCallName: 'client.projects.create',
|
|
97
|
+
fullyQualifiedName: 'projects.create',
|
|
98
|
+
httpMethod: 'post',
|
|
99
|
+
httpPath: '/v1/projects',
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
clientCallName: 'client.projects.update',
|
|
103
|
+
fullyQualifiedName: 'projects.update',
|
|
104
|
+
httpMethod: 'patch',
|
|
105
|
+
httpPath: '/v1/projects/{project_id}',
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
clientCallName: 'client.projects.list',
|
|
109
|
+
fullyQualifiedName: 'projects.list',
|
|
110
|
+
httpMethod: 'get',
|
|
111
|
+
httpPath: '/v1/projects',
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
clientCallName: 'client.projects.delete',
|
|
115
|
+
fullyQualifiedName: 'projects.delete',
|
|
116
|
+
httpMethod: 'delete',
|
|
117
|
+
httpPath: '/v1/projects/{project_id}',
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
clientCallName: 'client.projects.get',
|
|
121
|
+
fullyQualifiedName: 'projects.get',
|
|
122
|
+
httpMethod: 'get',
|
|
123
|
+
httpPath: '/v1/projects/{project_id}',
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
clientCallName: 'client.regions.list',
|
|
127
|
+
fullyQualifiedName: 'regions.list',
|
|
128
|
+
httpMethod: 'get',
|
|
129
|
+
httpPath: '/v1/regions',
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
clientCallName: 'client.regions.get',
|
|
133
|
+
fullyQualifiedName: 'regions.get',
|
|
134
|
+
httpMethod: 'get',
|
|
135
|
+
httpPath: '/v1/regions/{name}',
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
clientCallName: 'client.compute.vms.create',
|
|
139
|
+
fullyQualifiedName: 'compute.vms.create',
|
|
140
|
+
httpMethod: 'post',
|
|
141
|
+
httpPath: '/v1/compute/vms',
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
clientCallName: 'client.compute.vms.update',
|
|
145
|
+
fullyQualifiedName: 'compute.vms.update',
|
|
146
|
+
httpMethod: 'patch',
|
|
147
|
+
httpPath: '/v1/compute/vms/{vm_id}',
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
clientCallName: 'client.compute.vms.list',
|
|
151
|
+
fullyQualifiedName: 'compute.vms.list',
|
|
152
|
+
httpMethod: 'get',
|
|
153
|
+
httpPath: '/v1/compute/vms',
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
clientCallName: 'client.compute.vms.delete',
|
|
157
|
+
fullyQualifiedName: 'compute.vms.delete',
|
|
158
|
+
httpMethod: 'delete',
|
|
159
|
+
httpPath: '/v1/compute/vms/{vm_id}',
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
clientCallName: 'client.compute.vms.get',
|
|
163
|
+
fullyQualifiedName: 'compute.vms.get',
|
|
164
|
+
httpMethod: 'get',
|
|
165
|
+
httpPath: '/v1/compute/vms/{vm_id}',
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
clientCallName: 'client.compute.vms.restart',
|
|
169
|
+
fullyQualifiedName: 'compute.vms.restart',
|
|
170
|
+
httpMethod: 'post',
|
|
171
|
+
httpPath: '/v1/compute/vms/{vm_id}/restart',
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
clientCallName: 'client.compute.vms.availability.create',
|
|
175
|
+
fullyQualifiedName: 'compute.vms.availability.create',
|
|
176
|
+
httpMethod: 'post',
|
|
177
|
+
httpPath: '/v1/compute/vms/availability',
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
clientCallName: 'client.compute.vms.availability.update',
|
|
181
|
+
fullyQualifiedName: 'compute.vms.availability.update',
|
|
182
|
+
httpMethod: 'patch',
|
|
183
|
+
httpPath: '/v1/compute/vms/{vm_id}/availability',
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
clientCallName: 'client.compute.vms.volumes.list',
|
|
187
|
+
fullyQualifiedName: 'compute.vms.volumes.list',
|
|
188
|
+
httpMethod: 'get',
|
|
189
|
+
httpPath: '/v1/compute/vms/{vm_id}/volumes',
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
clientCallName: 'client.compute.vms.osImages.list',
|
|
193
|
+
fullyQualifiedName: 'compute.vms.osImages.list',
|
|
194
|
+
httpMethod: 'get',
|
|
195
|
+
httpPath: '/v1/compute/vms/os_images',
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
clientCallName: 'client.compute.volumes.create',
|
|
199
|
+
fullyQualifiedName: 'compute.volumes.create',
|
|
200
|
+
httpMethod: 'post',
|
|
201
|
+
httpPath: '/v1/compute/volumes',
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
clientCallName: 'client.compute.volumes.update',
|
|
205
|
+
fullyQualifiedName: 'compute.volumes.update',
|
|
206
|
+
httpMethod: 'patch',
|
|
207
|
+
httpPath: '/v1/compute/volumes/{volume_id}',
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
clientCallName: 'client.compute.volumes.list',
|
|
211
|
+
fullyQualifiedName: 'compute.volumes.list',
|
|
212
|
+
httpMethod: 'get',
|
|
213
|
+
httpPath: '/v1/compute/volumes',
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
clientCallName: 'client.compute.volumes.delete',
|
|
217
|
+
fullyQualifiedName: 'compute.volumes.delete',
|
|
218
|
+
httpMethod: 'delete',
|
|
219
|
+
httpPath: '/v1/compute/volumes/{volume_id}',
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
clientCallName: 'client.compute.volumes.attach',
|
|
223
|
+
fullyQualifiedName: 'compute.volumes.attach',
|
|
224
|
+
httpMethod: 'post',
|
|
225
|
+
httpPath: '/v1/compute/volumes/{volume_id}/attach',
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
clientCallName: 'client.compute.volumes.detach',
|
|
229
|
+
fullyQualifiedName: 'compute.volumes.detach',
|
|
230
|
+
httpMethod: 'post',
|
|
231
|
+
httpPath: '/v1/compute/volumes/{volume_id}/detach',
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
clientCallName: 'client.compute.volumes.get',
|
|
235
|
+
fullyQualifiedName: 'compute.volumes.get',
|
|
236
|
+
httpMethod: 'get',
|
|
237
|
+
httpPath: '/v1/compute/volumes/{volume_id}',
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
clientCallName: 'client.compute.volumes.availability.create',
|
|
241
|
+
fullyQualifiedName: 'compute.volumes.availability.create',
|
|
242
|
+
httpMethod: 'post',
|
|
243
|
+
httpPath: '/v1/compute/volumes/availability',
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
clientCallName: 'client.compute.volumes.availability.update',
|
|
247
|
+
fullyQualifiedName: 'compute.volumes.availability.update',
|
|
248
|
+
httpMethod: 'patch',
|
|
249
|
+
httpPath: '/v1/compute/volumes/{volume_id}/availability',
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
clientCallName: 'client.networking.vpcs.create',
|
|
253
|
+
fullyQualifiedName: 'networking.vpcs.create',
|
|
254
|
+
httpMethod: 'post',
|
|
255
|
+
httpPath: '/v1/networking/vpcs',
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
clientCallName: 'client.networking.vpcs.update',
|
|
259
|
+
fullyQualifiedName: 'networking.vpcs.update',
|
|
260
|
+
httpMethod: 'patch',
|
|
261
|
+
httpPath: '/v1/networking/vpcs/{vpc_id}',
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
clientCallName: 'client.networking.vpcs.list',
|
|
265
|
+
fullyQualifiedName: 'networking.vpcs.list',
|
|
266
|
+
httpMethod: 'get',
|
|
267
|
+
httpPath: '/v1/networking/vpcs',
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
clientCallName: 'client.networking.vpcs.delete',
|
|
271
|
+
fullyQualifiedName: 'networking.vpcs.delete',
|
|
272
|
+
httpMethod: 'delete',
|
|
273
|
+
httpPath: '/v1/networking/vpcs/{vpc_id}',
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
clientCallName: 'client.networking.vpcs.get',
|
|
277
|
+
fullyQualifiedName: 'networking.vpcs.get',
|
|
278
|
+
httpMethod: 'get',
|
|
279
|
+
httpPath: '/v1/networking/vpcs/{vpc_id}',
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
clientCallName: 'client.networking.vpcs.availability.create',
|
|
283
|
+
fullyQualifiedName: 'networking.vpcs.availability.create',
|
|
284
|
+
httpMethod: 'post',
|
|
285
|
+
httpPath: '/v1/networking/vpcs/availability',
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
clientCallName: 'client.networking.vpcs.availability.update',
|
|
289
|
+
fullyQualifiedName: 'networking.vpcs.availability.update',
|
|
290
|
+
httpMethod: 'patch',
|
|
291
|
+
httpPath: '/v1/networking/vpcs/{vpc_id}/availability',
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
clientCallName: 'client.networking.firewallRules.create',
|
|
295
|
+
fullyQualifiedName: 'networking.firewallRules.create',
|
|
296
|
+
httpMethod: 'post',
|
|
297
|
+
httpPath: '/v1/networking/vpcs/{vpc_id}/firewall_rules',
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
clientCallName: 'client.networking.firewallRules.update',
|
|
301
|
+
fullyQualifiedName: 'networking.firewallRules.update',
|
|
302
|
+
httpMethod: 'patch',
|
|
303
|
+
httpPath: '/v1/networking/vpcs/{vpc_id}/firewall_rules/{firewall_rule_id}',
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
clientCallName: 'client.networking.firewallRules.list',
|
|
307
|
+
fullyQualifiedName: 'networking.firewallRules.list',
|
|
308
|
+
httpMethod: 'get',
|
|
309
|
+
httpPath: '/v1/networking/vpcs/{vpc_id}/firewall_rules',
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
clientCallName: 'client.networking.firewallRules.delete',
|
|
313
|
+
fullyQualifiedName: 'networking.firewallRules.delete',
|
|
314
|
+
httpMethod: 'delete',
|
|
315
|
+
httpPath: '/v1/networking/vpcs/{vpc_id}/firewall_rules/{firewall_rule_id}',
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
clientCallName: 'client.networking.firewallRules.get',
|
|
319
|
+
fullyQualifiedName: 'networking.firewallRules.get',
|
|
320
|
+
httpMethod: 'get',
|
|
321
|
+
httpPath: '/v1/networking/vpcs/{vpc_id}/firewall_rules/{firewall_rule_id}',
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
clientCallName: 'client.networking.connect.connections.create',
|
|
325
|
+
fullyQualifiedName: 'networking.connect.connections.create',
|
|
326
|
+
httpMethod: 'post',
|
|
327
|
+
httpPath: '/v1/networking/connect/connections',
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
clientCallName: 'client.networking.connect.connections.update',
|
|
331
|
+
fullyQualifiedName: 'networking.connect.connections.update',
|
|
332
|
+
httpMethod: 'patch',
|
|
333
|
+
httpPath: '/v1/networking/connect/connections/{connection_id}',
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
clientCallName: 'client.networking.connect.connections.list',
|
|
337
|
+
fullyQualifiedName: 'networking.connect.connections.list',
|
|
338
|
+
httpMethod: 'get',
|
|
339
|
+
httpPath: '/v1/networking/connect/connections',
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
clientCallName: 'client.networking.connect.connections.delete',
|
|
343
|
+
fullyQualifiedName: 'networking.connect.connections.delete',
|
|
344
|
+
httpMethod: 'delete',
|
|
345
|
+
httpPath: '/v1/networking/connect/connections/{connection_id}',
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
clientCallName: 'client.networking.connect.connections.get',
|
|
349
|
+
fullyQualifiedName: 'networking.connect.connections.get',
|
|
350
|
+
httpMethod: 'get',
|
|
351
|
+
httpPath: '/v1/networking/connect/connections/{connection_id}',
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
clientCallName: 'client.networking.connect.routes.list',
|
|
355
|
+
fullyQualifiedName: 'networking.connect.routes.list',
|
|
356
|
+
httpMethod: 'get',
|
|
357
|
+
httpPath: '/v1/networking/connect/routes',
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
clientCallName: 'client.rpcNodes.flex.create',
|
|
361
|
+
fullyQualifiedName: 'rpcNodes.flex.create',
|
|
362
|
+
httpMethod: 'post',
|
|
363
|
+
httpPath: '/v1/rpc_nodes/flex',
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
clientCallName: 'client.rpcNodes.flex.update',
|
|
367
|
+
fullyQualifiedName: 'rpcNodes.flex.update',
|
|
368
|
+
httpMethod: 'patch',
|
|
369
|
+
httpPath: '/v1/rpc_nodes/flex/{node_id}',
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
clientCallName: 'client.rpcNodes.flex.list',
|
|
373
|
+
fullyQualifiedName: 'rpcNodes.flex.list',
|
|
374
|
+
httpMethod: 'get',
|
|
375
|
+
httpPath: '/v1/rpc_nodes/flex',
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
clientCallName: 'client.rpcNodes.flex.delete',
|
|
379
|
+
fullyQualifiedName: 'rpcNodes.flex.delete',
|
|
380
|
+
httpMethod: 'delete',
|
|
381
|
+
httpPath: '/v1/rpc_nodes/flex/{node_id}',
|
|
382
|
+
},
|
|
383
|
+
{
|
|
384
|
+
clientCallName: 'client.rpcNodes.flex.get',
|
|
385
|
+
fullyQualifiedName: 'rpcNodes.flex.get',
|
|
386
|
+
httpMethod: 'get',
|
|
387
|
+
httpPath: '/v1/rpc_nodes/flex/{node_id}',
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
clientCallName: 'client.rpcNodes.flex.blockchains.list',
|
|
391
|
+
fullyQualifiedName: 'rpcNodes.flex.blockchains.list',
|
|
392
|
+
httpMethod: 'get',
|
|
393
|
+
httpPath: '/v1/rpc_nodes/flex/blockchains',
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
clientCallName: 'client.rpcNodes.dedicated.list',
|
|
397
|
+
fullyQualifiedName: 'rpcNodes.dedicated.list',
|
|
398
|
+
httpMethod: 'get',
|
|
399
|
+
httpPath: '/v1/rpc_nodes/dedicated',
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
clientCallName: 'client.rpcNodes.dedicated.get',
|
|
403
|
+
fullyQualifiedName: 'rpcNodes.dedicated.get',
|
|
404
|
+
httpMethod: 'get',
|
|
405
|
+
httpPath: '/v1/rpc_nodes/dedicated/{node_id}',
|
|
406
|
+
},
|
|
407
|
+
{
|
|
408
|
+
clientCallName: 'client.rpcNodes.dedicated.blockchains.list',
|
|
409
|
+
fullyQualifiedName: 'rpcNodes.dedicated.blockchains.list',
|
|
410
|
+
httpMethod: 'get',
|
|
411
|
+
httpPath: '/v1/rpc_nodes/dedicated/blockchains',
|
|
412
|
+
},
|
|
413
|
+
];
|
|
414
|
+
|
|
415
|
+
function allowedMethodsForCodeTool(options: McpOptions | undefined): SdkMethod[] | undefined {
|
|
416
|
+
if (!options) {
|
|
417
|
+
return undefined;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
let allowedMethods: SdkMethod[];
|
|
421
|
+
|
|
422
|
+
if (options.codeAllowHttpGets || options.codeAllowedMethods) {
|
|
423
|
+
// Start with nothing allowed and then add into it from options
|
|
424
|
+
let allowedMethodsSet = new Set<SdkMethod>();
|
|
425
|
+
|
|
426
|
+
if (options.codeAllowHttpGets) {
|
|
427
|
+
// Add all methods that map to an HTTP GET
|
|
428
|
+
sdkMethods
|
|
429
|
+
.filter((method) => method.httpMethod === 'get')
|
|
430
|
+
.forEach((method) => allowedMethodsSet.add(method));
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
if (options.codeAllowedMethods) {
|
|
434
|
+
// Add all methods that match any of the allowed regexps
|
|
435
|
+
const allowedRegexps = options.codeAllowedMethods.map((pattern) => {
|
|
436
|
+
try {
|
|
437
|
+
return new RegExp(pattern);
|
|
438
|
+
} catch (e) {
|
|
439
|
+
throw new Error(
|
|
440
|
+
`Invalid regex pattern for allowed method: "${pattern}": ${e instanceof Error ? e.message : e}`,
|
|
441
|
+
);
|
|
442
|
+
}
|
|
443
|
+
});
|
|
444
|
+
|
|
445
|
+
sdkMethods
|
|
446
|
+
.filter((method) => allowedRegexps.some((regexp) => regexp.test(method.fullyQualifiedName)))
|
|
447
|
+
.forEach((method) => allowedMethodsSet.add(method));
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
allowedMethods = Array.from(allowedMethodsSet);
|
|
451
|
+
} else {
|
|
452
|
+
// Start with everything allowed
|
|
453
|
+
allowedMethods = [...sdkMethods];
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
if (options.codeBlockedMethods) {
|
|
457
|
+
// Filter down based on blocked regexps
|
|
458
|
+
const blockedRegexps = options.codeBlockedMethods.map((pattern) => {
|
|
459
|
+
try {
|
|
460
|
+
return new RegExp(pattern);
|
|
461
|
+
} catch (e) {
|
|
462
|
+
throw new Error(
|
|
463
|
+
`Invalid regex pattern for blocked method: "${pattern}": ${e instanceof Error ? e.message : e}`,
|
|
464
|
+
);
|
|
465
|
+
}
|
|
466
|
+
});
|
|
467
|
+
|
|
468
|
+
allowedMethods = allowedMethods.filter(
|
|
469
|
+
(method) => !blockedRegexps.some((regexp) => regexp.test(method.fullyQualifiedName)),
|
|
470
|
+
);
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
return allowedMethods;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
export function blockedMethodsForCodeTool(options: McpOptions | undefined): SdkMethod[] | undefined {
|
|
477
|
+
const allowedMethods = allowedMethodsForCodeTool(options);
|
|
478
|
+
if (!allowedMethods) {
|
|
479
|
+
return undefined;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
const allowedSet = new Set(allowedMethods.map((method) => method.fullyQualifiedName));
|
|
483
|
+
|
|
484
|
+
// Return any methods that are not explicitly allowed
|
|
485
|
+
return sdkMethods.filter((method) => !allowedSet.has(method.fullyQualifiedName));
|
|
486
|
+
}
|