@quicknode/mcp 0.0.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/README.md +114 -0
- package/dist/clients/base_http_client/base_client.js +75 -0
- package/dist/clients/base_http_client/index.js +17 -0
- package/dist/clients/console_api_client/console_client.js +142 -0
- package/dist/clients/console_api_client/index.js +18 -0
- package/dist/clients/console_api_client/types.js +29 -0
- package/dist/common/generic_args.js +29 -0
- package/dist/common/utils.js +66 -0
- package/dist/index.js +34 -0
- package/dist/resource/endpoints.js +46 -0
- package/dist/resource/index.js +7 -0
- package/dist/tools/billing.js +48 -0
- package/dist/tools/chains.js +19 -0
- package/dist/tools/endpoints.js +623 -0
- package/dist/tools/index.js +13 -0
- package/dist/tools/usage.js +119 -0
- package/package.json +66 -0
- package/tsconfig.json +16 -0
|
@@ -0,0 +1,623 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setEndpointTools = setEndpointTools;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const types_1 = require("../clients/console_api_client/types");
|
|
6
|
+
const generic_args_1 = require("../common/generic_args");
|
|
7
|
+
const utils_1 = require("../common/utils");
|
|
8
|
+
const endpointLogsArgs = {
|
|
9
|
+
...generic_args_1.genericArgs.endpointIdArgs,
|
|
10
|
+
from: zod_1.z
|
|
11
|
+
.string()
|
|
12
|
+
.describe("The start timestamp for logs (ISO 8601 format)")
|
|
13
|
+
.refine(utils_1.isValidIsoString, {
|
|
14
|
+
message: "from must be a valid ISO 8601 date string",
|
|
15
|
+
}),
|
|
16
|
+
to: zod_1.z
|
|
17
|
+
.string()
|
|
18
|
+
.describe("The end timestamp for logs (ISO 8601 format)")
|
|
19
|
+
.refine(utils_1.isValidIsoString, {
|
|
20
|
+
message: "to must be a valid ISO 8601 date string",
|
|
21
|
+
}),
|
|
22
|
+
limit: zod_1.z
|
|
23
|
+
.number()
|
|
24
|
+
.min(1)
|
|
25
|
+
.max(100)
|
|
26
|
+
.default(20)
|
|
27
|
+
.describe("Number of logs to retrieve (1-100, default: 20)"),
|
|
28
|
+
include_details: zod_1.z
|
|
29
|
+
.boolean()
|
|
30
|
+
.default(false)
|
|
31
|
+
.describe("Include request/response details in logs"),
|
|
32
|
+
next_at: zod_1.z
|
|
33
|
+
.string()
|
|
34
|
+
.optional()
|
|
35
|
+
.describe("Pagination token from previous response"),
|
|
36
|
+
};
|
|
37
|
+
const createEndpointArgs = {
|
|
38
|
+
chain: zod_1.z
|
|
39
|
+
.string()
|
|
40
|
+
.describe("The blockchain chain (e.g., 'ethereum', 'polygon', 'arbitrum')"),
|
|
41
|
+
network: zod_1.z
|
|
42
|
+
.string()
|
|
43
|
+
.describe("The specific network within the chain (e.g., 'mainnet', 'testnet')"),
|
|
44
|
+
};
|
|
45
|
+
const endpointMetricArgs = {
|
|
46
|
+
...generic_args_1.genericArgs.endpointIdArgs,
|
|
47
|
+
period: zod_1.z
|
|
48
|
+
.enum([
|
|
49
|
+
types_1.MetricsPeriod.HOUR,
|
|
50
|
+
types_1.MetricsPeriod.DAY,
|
|
51
|
+
types_1.MetricsPeriod.WEEK,
|
|
52
|
+
types_1.MetricsPeriod.MONTH,
|
|
53
|
+
])
|
|
54
|
+
.describe("The time period for which the data is to be retrieved"),
|
|
55
|
+
metric: zod_1.z
|
|
56
|
+
.enum([
|
|
57
|
+
types_1.MetricsType.METHOD_CALLS_OVER_TIME,
|
|
58
|
+
types_1.MetricsType.RESPONSE_STATUS_OVER_TIME,
|
|
59
|
+
types_1.MetricsType.METHOD_CALL_BREAKDOWN,
|
|
60
|
+
types_1.MetricsType.RESPONSE_STATUS_BREAKDOWN,
|
|
61
|
+
types_1.MetricsType.METHOD_RESPONSE_TIME_MAX,
|
|
62
|
+
])
|
|
63
|
+
.describe("The type of metric to retrieve"),
|
|
64
|
+
};
|
|
65
|
+
const updateRateLimitsArgs = {
|
|
66
|
+
...generic_args_1.genericArgs.endpointIdArgs,
|
|
67
|
+
rps: zod_1.z.number().min(1).optional().describe("Maximum requests per second"),
|
|
68
|
+
rpm: zod_1.z.number().min(1).optional().describe("Maximum requests per minute"),
|
|
69
|
+
rpd: zod_1.z.number().min(1).optional().describe("Maximum requests per day"),
|
|
70
|
+
};
|
|
71
|
+
const createMethodRateLimitArgs = {
|
|
72
|
+
...generic_args_1.genericArgs.endpointIdArgs,
|
|
73
|
+
interval: zod_1.z
|
|
74
|
+
.enum([
|
|
75
|
+
types_1.RateLimitInterval.SECOND,
|
|
76
|
+
types_1.RateLimitInterval.MINUTE,
|
|
77
|
+
types_1.RateLimitInterval.HOUR,
|
|
78
|
+
])
|
|
79
|
+
.describe("The time interval for the rate limit"),
|
|
80
|
+
methods: zod_1.z
|
|
81
|
+
.array(zod_1.z.string())
|
|
82
|
+
.min(1)
|
|
83
|
+
.describe("Array of method names to apply the rate limit to"),
|
|
84
|
+
rate: zod_1.z
|
|
85
|
+
.number()
|
|
86
|
+
.min(1)
|
|
87
|
+
.describe("Maximum number of requests allowed within the specified interval"),
|
|
88
|
+
};
|
|
89
|
+
const updateMethodRateLimitArgs = {
|
|
90
|
+
...generic_args_1.genericArgs.endpointIdArgs,
|
|
91
|
+
method_rate_limit_id: zod_1.z
|
|
92
|
+
.string()
|
|
93
|
+
.describe("The unique identifier for the rate limiter"),
|
|
94
|
+
status: zod_1.z
|
|
95
|
+
.enum([types_1.RateLimitStatus.ENABLED, types_1.RateLimitStatus.DISABLED])
|
|
96
|
+
.describe("If the rate limiter should be enabled or disabled"),
|
|
97
|
+
methods: zod_1.z
|
|
98
|
+
.array(zod_1.z.string())
|
|
99
|
+
.min(1)
|
|
100
|
+
.describe("Array of method names to apply the rate limit to"),
|
|
101
|
+
rate: zod_1.z
|
|
102
|
+
.number()
|
|
103
|
+
.min(1)
|
|
104
|
+
.describe("Maximum number of requests allowed within the specified interval"),
|
|
105
|
+
};
|
|
106
|
+
const deleteMethodRateLimitArgs = {
|
|
107
|
+
...generic_args_1.genericArgs.endpointIdArgs,
|
|
108
|
+
method_rate_limit_id: zod_1.z
|
|
109
|
+
.string()
|
|
110
|
+
.describe("The unique identifier of the rate limiter to delete. This can be found in the output of the get-endpoint-method-rate-limits tool"),
|
|
111
|
+
};
|
|
112
|
+
const updateSecurityOptionsArgs = {
|
|
113
|
+
...generic_args_1.genericArgs.endpointIdArgs,
|
|
114
|
+
tokens: zod_1.z
|
|
115
|
+
.enum(["enabled", "disabled"])
|
|
116
|
+
.optional()
|
|
117
|
+
.describe("Controls the token-based authentication mechanism"),
|
|
118
|
+
referrers: zod_1.z
|
|
119
|
+
.enum(["enabled", "disabled"])
|
|
120
|
+
.optional()
|
|
121
|
+
.describe("The URL or domain that is allowed to access the specific API endpoint"),
|
|
122
|
+
jwts: zod_1.z
|
|
123
|
+
.enum(["enabled", "disabled"])
|
|
124
|
+
.optional()
|
|
125
|
+
.describe("Configures JSON Web Tokens (JWTs) for secure authentication and authorization"),
|
|
126
|
+
ips: zod_1.z
|
|
127
|
+
.enum(["enabled", "disabled"])
|
|
128
|
+
.optional()
|
|
129
|
+
.describe("Specifies IP address-based restrictions or permissions"),
|
|
130
|
+
domainMasks: zod_1.z
|
|
131
|
+
.enum(["enabled", "disabled"])
|
|
132
|
+
.optional()
|
|
133
|
+
.describe("Configures the masking or restriction of specific domains"),
|
|
134
|
+
hsts: zod_1.z
|
|
135
|
+
.enum(["enabled", "disabled"])
|
|
136
|
+
.optional()
|
|
137
|
+
.describe("The HTTP Strict Transport Security (HSTS)"),
|
|
138
|
+
cors: zod_1.z
|
|
139
|
+
.enum(["enabled", "disabled"])
|
|
140
|
+
.optional()
|
|
141
|
+
.describe("Configures Cross-Origin Resource Sharing (CORS) policies to control how resources can be accessed by external domains"),
|
|
142
|
+
};
|
|
143
|
+
// Security management argument schemas
|
|
144
|
+
const createDomainMaskArgs = {
|
|
145
|
+
...generic_args_1.genericArgs.endpointIdArgs,
|
|
146
|
+
domain_mask: zod_1.z
|
|
147
|
+
.string()
|
|
148
|
+
.describe("The domain mask that you will use to mask your endpoint"),
|
|
149
|
+
};
|
|
150
|
+
const deleteDomainMaskArgs = {
|
|
151
|
+
...generic_args_1.genericArgs.endpointIdArgs,
|
|
152
|
+
domain_mask_id: zod_1.z
|
|
153
|
+
.string()
|
|
154
|
+
.describe("The unique identifier of the domain mask to delete"),
|
|
155
|
+
};
|
|
156
|
+
const createIpArgs = {
|
|
157
|
+
...generic_args_1.genericArgs.endpointIdArgs,
|
|
158
|
+
ip: zod_1.z
|
|
159
|
+
.string()
|
|
160
|
+
.describe("The specific IP address that is allowed to access the API endpoint"),
|
|
161
|
+
};
|
|
162
|
+
const deleteIpArgs = {
|
|
163
|
+
...generic_args_1.genericArgs.endpointIdArgs,
|
|
164
|
+
ip_id: zod_1.z.string().describe("The unique identifier of the IP rule to delete"),
|
|
165
|
+
};
|
|
166
|
+
const createJwtArgs = {
|
|
167
|
+
...generic_args_1.genericArgs.endpointIdArgs,
|
|
168
|
+
public_key: zod_1.z
|
|
169
|
+
.string()
|
|
170
|
+
.describe("The public key used to verify the JWT token"),
|
|
171
|
+
kid: zod_1.z
|
|
172
|
+
.string()
|
|
173
|
+
.describe("The key identifier (KID) associated with the public key"),
|
|
174
|
+
name: zod_1.z.string().describe("A human-readable name for the JWT configuration"),
|
|
175
|
+
};
|
|
176
|
+
const deleteJwtArgs = {
|
|
177
|
+
...generic_args_1.genericArgs.endpointIdArgs,
|
|
178
|
+
jwt_id: zod_1.z
|
|
179
|
+
.string()
|
|
180
|
+
.describe("The unique identifier of the JWT configuration to delete"),
|
|
181
|
+
};
|
|
182
|
+
const createReferrerArgs = {
|
|
183
|
+
...generic_args_1.genericArgs.endpointIdArgs,
|
|
184
|
+
referrer: zod_1.z
|
|
185
|
+
.string()
|
|
186
|
+
.describe("The URL or domain that is allowed to access the specific API endpoint"),
|
|
187
|
+
};
|
|
188
|
+
const deleteReferrerArgs = {
|
|
189
|
+
...generic_args_1.genericArgs.endpointIdArgs,
|
|
190
|
+
referrer_id: zod_1.z
|
|
191
|
+
.string()
|
|
192
|
+
.describe("The unique identifier of the referrer rule to delete"),
|
|
193
|
+
};
|
|
194
|
+
const createTokenArgs = {
|
|
195
|
+
...generic_args_1.genericArgs.endpointIdArgs,
|
|
196
|
+
token: zod_1.z
|
|
197
|
+
.string()
|
|
198
|
+
.describe("The authentication token that is allowed to access the API endpoint"),
|
|
199
|
+
};
|
|
200
|
+
const deleteTokenArgs = {
|
|
201
|
+
...generic_args_1.genericArgs.endpointIdArgs,
|
|
202
|
+
token_id: zod_1.z.string().describe("The unique identifier of the token to delete"),
|
|
203
|
+
};
|
|
204
|
+
const getLogDetailsArgs = {
|
|
205
|
+
...generic_args_1.genericArgs.endpointIdArgs,
|
|
206
|
+
request_id: zod_1.z
|
|
207
|
+
.string()
|
|
208
|
+
.describe("The UUID of the log entry to get detailed information for"),
|
|
209
|
+
};
|
|
210
|
+
function setEndpointTools(server, client) {
|
|
211
|
+
server.registerTool("get-endpoints", {
|
|
212
|
+
description: "Get all web3 QuickNode endpoints for the user, this is a list of all the endpoints that the user has created across all chains and networks",
|
|
213
|
+
}, async () => {
|
|
214
|
+
const endpoints = await client.listEndpoints();
|
|
215
|
+
return {
|
|
216
|
+
structuredContent: { data: endpoints },
|
|
217
|
+
content: [
|
|
218
|
+
{
|
|
219
|
+
type: "text",
|
|
220
|
+
text: JSON.stringify(endpoints, null, 2),
|
|
221
|
+
},
|
|
222
|
+
],
|
|
223
|
+
};
|
|
224
|
+
});
|
|
225
|
+
server.registerTool("get-endpoint", {
|
|
226
|
+
description: "Get a specific web3 QuickNode endpoint details by id",
|
|
227
|
+
inputSchema: { ...generic_args_1.genericArgs.endpointIdArgs },
|
|
228
|
+
}, async ({ endpoint_id }) => {
|
|
229
|
+
const endpoint = await client.getEndpoint(endpoint_id);
|
|
230
|
+
return {
|
|
231
|
+
structuredContent: { data: endpoint.data },
|
|
232
|
+
content: [
|
|
233
|
+
{
|
|
234
|
+
type: "text",
|
|
235
|
+
text: JSON.stringify(endpoint.data, null, 2),
|
|
236
|
+
},
|
|
237
|
+
],
|
|
238
|
+
};
|
|
239
|
+
});
|
|
240
|
+
server.registerTool("get-endpoint-logs", {
|
|
241
|
+
description: "Get the request/response logs for a specific QuickNode endpoint",
|
|
242
|
+
inputSchema: { ...endpointLogsArgs },
|
|
243
|
+
}, async ({ endpoint_id, from, to, limit, include_details, next_at }) => {
|
|
244
|
+
const logs = await client.getEndpointLogs({
|
|
245
|
+
endpoint_id,
|
|
246
|
+
from,
|
|
247
|
+
to,
|
|
248
|
+
limit,
|
|
249
|
+
include_details,
|
|
250
|
+
next_at: next_at,
|
|
251
|
+
});
|
|
252
|
+
return {
|
|
253
|
+
structuredContent: { data: logs.data },
|
|
254
|
+
content: [
|
|
255
|
+
{
|
|
256
|
+
type: "text",
|
|
257
|
+
text: JSON.stringify(logs.data, null, 2),
|
|
258
|
+
},
|
|
259
|
+
],
|
|
260
|
+
nextCursor: logs.next_at,
|
|
261
|
+
};
|
|
262
|
+
});
|
|
263
|
+
server.registerTool("get-endpoint-log-details", {
|
|
264
|
+
description: "Get detailed request and response information for a specific log entry. This provides the raw request payload and full response that were logged for a particular request",
|
|
265
|
+
inputSchema: { ...getLogDetailsArgs },
|
|
266
|
+
}, async ({ endpoint_id, request_id }) => {
|
|
267
|
+
const logDetails = await client.getEndpointLogDetails({
|
|
268
|
+
endpoint_id,
|
|
269
|
+
request_id,
|
|
270
|
+
});
|
|
271
|
+
return {
|
|
272
|
+
structuredContent: { data: logDetails.data },
|
|
273
|
+
content: [
|
|
274
|
+
{
|
|
275
|
+
type: "text",
|
|
276
|
+
text: JSON.stringify(logDetails.data, null, 2),
|
|
277
|
+
},
|
|
278
|
+
],
|
|
279
|
+
};
|
|
280
|
+
});
|
|
281
|
+
server.registerTool("create-endpoint", {
|
|
282
|
+
description: "Create a new web3 RPC endpoint for a given chain and network under user's QuickNode account. This can error if the chain and network combination is not supported or if the user has reached their endpoint limit, in which case the user should try a different chain and network combination (can request get-chains tool for information on supported chains) or delete an existing endpoint",
|
|
283
|
+
inputSchema: { ...createEndpointArgs },
|
|
284
|
+
}, async ({ chain, network }) => {
|
|
285
|
+
const endpoint = await client.createEndpoint({ chain, network });
|
|
286
|
+
return {
|
|
287
|
+
structuredContent: { data: endpoint.data },
|
|
288
|
+
content: [
|
|
289
|
+
{
|
|
290
|
+
type: "text",
|
|
291
|
+
text: JSON.stringify(endpoint.data, null, 2),
|
|
292
|
+
},
|
|
293
|
+
],
|
|
294
|
+
};
|
|
295
|
+
});
|
|
296
|
+
server.registerTool("delete-endpoint", {
|
|
297
|
+
description: "Archive a QuickNode endpoint by its ID. This will archive the endpoint and make it inactive. THIS IS A DESTRUCTIVE ACTION",
|
|
298
|
+
inputSchema: { ...generic_args_1.genericArgs.endpointIdArgs },
|
|
299
|
+
}, async ({ endpoint_id }) => {
|
|
300
|
+
const result = await client.deleteEndpoint(endpoint_id);
|
|
301
|
+
return {
|
|
302
|
+
structuredContent: { data: result.data },
|
|
303
|
+
content: [
|
|
304
|
+
{
|
|
305
|
+
type: "text",
|
|
306
|
+
text: JSON.stringify(result.data, null, 2),
|
|
307
|
+
},
|
|
308
|
+
],
|
|
309
|
+
};
|
|
310
|
+
});
|
|
311
|
+
server.registerTool("get-endpoint-metrics", {
|
|
312
|
+
description: "Get metrics for a specific QuickNode endpoint. Supports various metrics like method calls, response status, and response times over different time periods",
|
|
313
|
+
inputSchema: { ...endpointMetricArgs },
|
|
314
|
+
}, async ({ endpoint_id, period, metric }) => {
|
|
315
|
+
const metrics = await client.getEndpointMetrics(endpoint_id, {
|
|
316
|
+
period,
|
|
317
|
+
metric,
|
|
318
|
+
});
|
|
319
|
+
return {
|
|
320
|
+
structuredContent: { data: metrics.data },
|
|
321
|
+
content: [
|
|
322
|
+
{
|
|
323
|
+
type: "text",
|
|
324
|
+
text: JSON.stringify(metrics.data, null, 2),
|
|
325
|
+
},
|
|
326
|
+
],
|
|
327
|
+
};
|
|
328
|
+
});
|
|
329
|
+
server.registerTool("update-endpoint-rate-limits", {
|
|
330
|
+
description: "Update the general rate limits (RPS, RPM, RPD) for a QuickNode endpoint",
|
|
331
|
+
inputSchema: { ...updateRateLimitsArgs },
|
|
332
|
+
}, async ({ endpoint_id, rps, rpm, rpd }) => {
|
|
333
|
+
const rateLimits = await client.updateRateLimits(endpoint_id, {
|
|
334
|
+
rate_limits: {
|
|
335
|
+
...(rps !== undefined && { rps }),
|
|
336
|
+
...(rpm !== undefined && { rpm }),
|
|
337
|
+
...(rpd !== undefined && { rpd }),
|
|
338
|
+
},
|
|
339
|
+
});
|
|
340
|
+
return {
|
|
341
|
+
structuredContent: { data: rateLimits.data },
|
|
342
|
+
content: [
|
|
343
|
+
{
|
|
344
|
+
type: "text",
|
|
345
|
+
text: JSON.stringify(rateLimits.data, null, 2),
|
|
346
|
+
},
|
|
347
|
+
],
|
|
348
|
+
};
|
|
349
|
+
});
|
|
350
|
+
server.registerTool("get-endpoint-method-rate-limits", {
|
|
351
|
+
description: "Get all method rate limits for a specific QuickNode endpoint",
|
|
352
|
+
inputSchema: { ...generic_args_1.genericArgs.endpointIdArgs },
|
|
353
|
+
}, async ({ endpoint_id }) => {
|
|
354
|
+
const rateLimits = await client.getMethodRateLimits(endpoint_id);
|
|
355
|
+
return {
|
|
356
|
+
structuredContent: { data: rateLimits.data },
|
|
357
|
+
content: [
|
|
358
|
+
{
|
|
359
|
+
type: "text",
|
|
360
|
+
text: JSON.stringify(rateLimits.data, null, 2),
|
|
361
|
+
},
|
|
362
|
+
],
|
|
363
|
+
};
|
|
364
|
+
});
|
|
365
|
+
server.registerTool("create-endpoint-method-rate-limit", {
|
|
366
|
+
description: "Create a new method-specific rate limiter for a QuickNode endpoint",
|
|
367
|
+
inputSchema: { ...createMethodRateLimitArgs },
|
|
368
|
+
}, async ({ endpoint_id, interval, methods, rate }) => {
|
|
369
|
+
const rateLimit = await client.createMethodRateLimit(endpoint_id, {
|
|
370
|
+
interval,
|
|
371
|
+
methods,
|
|
372
|
+
rate,
|
|
373
|
+
});
|
|
374
|
+
return {
|
|
375
|
+
structuredContent: { data: rateLimit.data },
|
|
376
|
+
content: [
|
|
377
|
+
{
|
|
378
|
+
type: "text",
|
|
379
|
+
text: JSON.stringify(rateLimit.data, null, 2),
|
|
380
|
+
},
|
|
381
|
+
],
|
|
382
|
+
};
|
|
383
|
+
});
|
|
384
|
+
server.registerTool("update-endpoint-method-rate-limit", {
|
|
385
|
+
description: "Update an existing method-specific rate limit for a QuickNode endpoint",
|
|
386
|
+
inputSchema: { ...updateMethodRateLimitArgs },
|
|
387
|
+
}, async ({ endpoint_id, method_rate_limit_id, status, methods, rate }) => {
|
|
388
|
+
const rateLimit = await client.updateMethodRateLimit(endpoint_id, method_rate_limit_id, {
|
|
389
|
+
status,
|
|
390
|
+
methods,
|
|
391
|
+
rate,
|
|
392
|
+
});
|
|
393
|
+
return {
|
|
394
|
+
structuredContent: { data: rateLimit.data },
|
|
395
|
+
content: [
|
|
396
|
+
{
|
|
397
|
+
type: "text",
|
|
398
|
+
text: JSON.stringify(rateLimit.data, null, 2),
|
|
399
|
+
},
|
|
400
|
+
],
|
|
401
|
+
};
|
|
402
|
+
});
|
|
403
|
+
server.registerTool("delete-endpoint-method-rate-limit", {
|
|
404
|
+
description: "Delete a method-specific rate limit from a QuickNode endpoint. THIS IS A DESTRUCTIVE ACTION",
|
|
405
|
+
inputSchema: { ...deleteMethodRateLimitArgs },
|
|
406
|
+
}, async ({ endpoint_id, method_rate_limit_id }) => {
|
|
407
|
+
const result = await client.deleteMethodRateLimit(endpoint_id, method_rate_limit_id);
|
|
408
|
+
return {
|
|
409
|
+
structuredContent: { data: result.data },
|
|
410
|
+
content: [
|
|
411
|
+
{
|
|
412
|
+
type: "text",
|
|
413
|
+
text: JSON.stringify(result.data, null, 2),
|
|
414
|
+
},
|
|
415
|
+
],
|
|
416
|
+
};
|
|
417
|
+
});
|
|
418
|
+
server.registerTool("get-endpoint-security-options", {
|
|
419
|
+
description: "Get security options for a specific QuickNode endpoint",
|
|
420
|
+
inputSchema: { ...generic_args_1.genericArgs.endpointIdArgs },
|
|
421
|
+
}, async ({ endpoint_id }) => {
|
|
422
|
+
const securityOptions = await client.getSecurityOptions(endpoint_id);
|
|
423
|
+
return {
|
|
424
|
+
structuredContent: { data: securityOptions.data },
|
|
425
|
+
content: [
|
|
426
|
+
{
|
|
427
|
+
type: "text",
|
|
428
|
+
text: JSON.stringify(securityOptions.data, null, 2),
|
|
429
|
+
},
|
|
430
|
+
],
|
|
431
|
+
};
|
|
432
|
+
});
|
|
433
|
+
server.registerTool("update-endpoint-security-options", {
|
|
434
|
+
description: "Update security options for a specific QuickNode endpoint",
|
|
435
|
+
inputSchema: { ...updateSecurityOptionsArgs },
|
|
436
|
+
}, async ({ endpoint_id, tokens, referrers, jwts, ips, domainMasks, hsts, cors, }) => {
|
|
437
|
+
const options = {};
|
|
438
|
+
if (tokens !== undefined)
|
|
439
|
+
options.tokens = tokens;
|
|
440
|
+
if (referrers !== undefined)
|
|
441
|
+
options.referrers = referrers;
|
|
442
|
+
if (jwts !== undefined)
|
|
443
|
+
options.jwts = jwts;
|
|
444
|
+
if (ips !== undefined)
|
|
445
|
+
options.ips = ips;
|
|
446
|
+
if (domainMasks !== undefined)
|
|
447
|
+
options.domainMasks = domainMasks;
|
|
448
|
+
if (hsts !== undefined)
|
|
449
|
+
options.hsts = hsts;
|
|
450
|
+
if (cors !== undefined)
|
|
451
|
+
options.cors = cors;
|
|
452
|
+
const securityOptions = await client.updateSecurityOptions(endpoint_id, {
|
|
453
|
+
options,
|
|
454
|
+
});
|
|
455
|
+
return {
|
|
456
|
+
structuredContent: { data: securityOptions.data },
|
|
457
|
+
content: [
|
|
458
|
+
{
|
|
459
|
+
type: "text",
|
|
460
|
+
text: JSON.stringify(securityOptions.data, null, 2),
|
|
461
|
+
},
|
|
462
|
+
],
|
|
463
|
+
};
|
|
464
|
+
});
|
|
465
|
+
server.registerTool("create-endpoint-security-domain-mask", {
|
|
466
|
+
description: "Create a domain mask for a QuickNode endpoint",
|
|
467
|
+
inputSchema: { ...createDomainMaskArgs },
|
|
468
|
+
}, async ({ endpoint_id, domain_mask }) => {
|
|
469
|
+
const domainMask = await client.createEndpointSecurityDomainMask(endpoint_id, {
|
|
470
|
+
domain_mask,
|
|
471
|
+
});
|
|
472
|
+
return {
|
|
473
|
+
structuredContent: { data: domainMask.data },
|
|
474
|
+
content: [
|
|
475
|
+
{
|
|
476
|
+
type: "text",
|
|
477
|
+
text: JSON.stringify(domainMask.data, null, 2),
|
|
478
|
+
},
|
|
479
|
+
],
|
|
480
|
+
};
|
|
481
|
+
});
|
|
482
|
+
server.registerTool("delete-endpoint-security-domain-mask", {
|
|
483
|
+
description: "Delete a domain mask from a QuickNode endpoint. THIS IS A DESTRUCTIVE ACTION",
|
|
484
|
+
inputSchema: { ...deleteDomainMaskArgs },
|
|
485
|
+
}, async ({ endpoint_id, domain_mask_id }) => {
|
|
486
|
+
const result = await client.deleteEndpointSecurityDomainMask(endpoint_id, domain_mask_id);
|
|
487
|
+
return {
|
|
488
|
+
structuredContent: { data: result.data },
|
|
489
|
+
content: [
|
|
490
|
+
{
|
|
491
|
+
type: "text",
|
|
492
|
+
text: JSON.stringify(result.data, null, 2),
|
|
493
|
+
},
|
|
494
|
+
],
|
|
495
|
+
};
|
|
496
|
+
});
|
|
497
|
+
server.registerTool("create-endpoint-security-ip", {
|
|
498
|
+
description: "Create an IP restriction for a QuickNode endpoint",
|
|
499
|
+
inputSchema: { ...createIpArgs },
|
|
500
|
+
}, async ({ endpoint_id, ip }) => {
|
|
501
|
+
const ipRule = await client.createEndpointSecurityIp(endpoint_id, { ip });
|
|
502
|
+
return {
|
|
503
|
+
structuredContent: { data: ipRule.data },
|
|
504
|
+
content: [
|
|
505
|
+
{
|
|
506
|
+
type: "text",
|
|
507
|
+
text: JSON.stringify(ipRule.data, null, 2),
|
|
508
|
+
},
|
|
509
|
+
],
|
|
510
|
+
};
|
|
511
|
+
});
|
|
512
|
+
server.registerTool("delete-endpoint-security-ip", {
|
|
513
|
+
description: "Delete an IP restriction from a QuickNode endpoint. THIS IS A DESTRUCTIVE ACTION",
|
|
514
|
+
inputSchema: { ...deleteIpArgs },
|
|
515
|
+
}, async ({ endpoint_id, ip_id }) => {
|
|
516
|
+
const result = await client.deleteEndpointSecurityIp(endpoint_id, ip_id);
|
|
517
|
+
return {
|
|
518
|
+
structuredContent: { data: result.data },
|
|
519
|
+
content: [
|
|
520
|
+
{
|
|
521
|
+
type: "text",
|
|
522
|
+
text: JSON.stringify(result.data, null, 2),
|
|
523
|
+
},
|
|
524
|
+
],
|
|
525
|
+
};
|
|
526
|
+
});
|
|
527
|
+
server.registerTool("create-endpoint-security-jwt", {
|
|
528
|
+
description: "Create a JWT configuration for a QuickNode endpoint",
|
|
529
|
+
inputSchema: { ...createJwtArgs },
|
|
530
|
+
}, async ({ endpoint_id, public_key, kid, name }) => {
|
|
531
|
+
const jwt = await client.createEndpointSecurityJwt(endpoint_id, {
|
|
532
|
+
public_key,
|
|
533
|
+
kid,
|
|
534
|
+
name,
|
|
535
|
+
});
|
|
536
|
+
return {
|
|
537
|
+
structuredContent: { data: jwt.data },
|
|
538
|
+
content: [
|
|
539
|
+
{
|
|
540
|
+
type: "text",
|
|
541
|
+
text: JSON.stringify(jwt.data, null, 2),
|
|
542
|
+
},
|
|
543
|
+
],
|
|
544
|
+
};
|
|
545
|
+
});
|
|
546
|
+
server.registerTool("delete-endpoint-security-jwt", {
|
|
547
|
+
description: "Delete a JWT configuration from a QuickNode endpoint. THIS IS A DESTRUCTIVE ACTION",
|
|
548
|
+
inputSchema: { ...deleteJwtArgs },
|
|
549
|
+
}, async ({ endpoint_id, jwt_id }) => {
|
|
550
|
+
const result = await client.deleteEndpointSecurityJwt(endpoint_id, jwt_id);
|
|
551
|
+
return {
|
|
552
|
+
structuredContent: { data: result.data },
|
|
553
|
+
content: [
|
|
554
|
+
{
|
|
555
|
+
type: "text",
|
|
556
|
+
text: JSON.stringify(result.data, null, 2),
|
|
557
|
+
},
|
|
558
|
+
],
|
|
559
|
+
};
|
|
560
|
+
});
|
|
561
|
+
server.registerTool("create-endpoint-security-referrer", {
|
|
562
|
+
description: "Create a referrer restriction for a QuickNode endpoint",
|
|
563
|
+
inputSchema: { ...createReferrerArgs },
|
|
564
|
+
}, async ({ endpoint_id, referrer }) => {
|
|
565
|
+
const referrerRule = await client.createEndpointSecurityReferrer(endpoint_id, { referrer });
|
|
566
|
+
return {
|
|
567
|
+
structuredContent: { data: referrerRule.data },
|
|
568
|
+
content: [
|
|
569
|
+
{
|
|
570
|
+
type: "text",
|
|
571
|
+
text: JSON.stringify(referrerRule.data, null, 2),
|
|
572
|
+
},
|
|
573
|
+
],
|
|
574
|
+
};
|
|
575
|
+
});
|
|
576
|
+
server.registerTool("delete-endpoint-security-referrer", {
|
|
577
|
+
description: "Delete a referrer restriction from a QuickNode endpoint. THIS IS A DESTRUCTIVE ACTION",
|
|
578
|
+
inputSchema: { ...deleteReferrerArgs },
|
|
579
|
+
}, async ({ endpoint_id, referrer_id }) => {
|
|
580
|
+
const result = await client.deleteEndpointSecurityReferrer(endpoint_id, referrer_id);
|
|
581
|
+
return {
|
|
582
|
+
structuredContent: { data: result.data },
|
|
583
|
+
content: [
|
|
584
|
+
{
|
|
585
|
+
type: "text",
|
|
586
|
+
text: JSON.stringify(result.data, null, 2),
|
|
587
|
+
},
|
|
588
|
+
],
|
|
589
|
+
};
|
|
590
|
+
});
|
|
591
|
+
server.registerTool("create-endpoint-security-token", {
|
|
592
|
+
description: "Create an authentication token for a QuickNode endpoint",
|
|
593
|
+
inputSchema: { ...createTokenArgs },
|
|
594
|
+
}, async ({ endpoint_id, token }) => {
|
|
595
|
+
const authToken = await client.createEndpointSecurityToken(endpoint_id, {
|
|
596
|
+
token,
|
|
597
|
+
});
|
|
598
|
+
return {
|
|
599
|
+
structuredContent: { data: authToken.data },
|
|
600
|
+
content: [
|
|
601
|
+
{
|
|
602
|
+
type: "text",
|
|
603
|
+
text: JSON.stringify(authToken.data, null, 2),
|
|
604
|
+
},
|
|
605
|
+
],
|
|
606
|
+
};
|
|
607
|
+
});
|
|
608
|
+
server.registerTool("delete-endpoint-security-token", {
|
|
609
|
+
description: "Delete an authentication token from a QuickNode endpoint. THIS IS A DESTRUCTIVE ACTION",
|
|
610
|
+
inputSchema: { ...deleteTokenArgs },
|
|
611
|
+
}, async ({ endpoint_id, token_id }) => {
|
|
612
|
+
const result = await client.deleteEndpointSecurityToken(endpoint_id, token_id);
|
|
613
|
+
return {
|
|
614
|
+
structuredContent: { data: result.data },
|
|
615
|
+
content: [
|
|
616
|
+
{
|
|
617
|
+
type: "text",
|
|
618
|
+
text: JSON.stringify(result.data, null, 2),
|
|
619
|
+
},
|
|
620
|
+
],
|
|
621
|
+
};
|
|
622
|
+
});
|
|
623
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setTools = setTools;
|
|
4
|
+
const billing_1 = require("./billing");
|
|
5
|
+
const chains_1 = require("./chains");
|
|
6
|
+
const endpoints_1 = require("./endpoints");
|
|
7
|
+
const usage_1 = require("./usage");
|
|
8
|
+
function setTools(server, client) {
|
|
9
|
+
(0, endpoints_1.setEndpointTools)(server, client);
|
|
10
|
+
(0, chains_1.setChainTools)(server, client);
|
|
11
|
+
(0, usage_1.setUsageTools)(server, client);
|
|
12
|
+
(0, billing_1.setBillingTools)(server, client);
|
|
13
|
+
}
|