@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,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setUsageTools = setUsageTools;
|
|
4
|
+
const generic_args_1 = require("../common/generic_args");
|
|
5
|
+
const utils_1 = require("../common/utils");
|
|
6
|
+
function setUsageTools(server, client) {
|
|
7
|
+
server.registerTool("get-rpc-usage", {
|
|
8
|
+
description: "Get the usage data for the user's QuickNode RPC account. The start_time and end_time parameters are ISO 8601 date strings to filter the usage data by time range",
|
|
9
|
+
inputSchema: { ...generic_args_1.genericArgs.timeRangeArgs },
|
|
10
|
+
}, async ({ start_time, end_time }) => {
|
|
11
|
+
const start_time_unix = (0, utils_1.isoToUnixTimestamp)(start_time);
|
|
12
|
+
const end_time_unix = (0, utils_1.isoToUnixTimestamp)(end_time);
|
|
13
|
+
if (!start_time_unix || !end_time_unix) {
|
|
14
|
+
throw new Error("Invalid time range, start_time and end_time must be valid ISO 8601 date strings");
|
|
15
|
+
}
|
|
16
|
+
const usage = await client.getRpcUsage({
|
|
17
|
+
start_time: start_time_unix,
|
|
18
|
+
end_time: end_time_unix,
|
|
19
|
+
});
|
|
20
|
+
const data = {
|
|
21
|
+
...usage.data,
|
|
22
|
+
start_time: (0, utils_1.unixTimestampToIso)(usage.data.start_time),
|
|
23
|
+
end_time: (0, utils_1.unixTimestampToIso)(usage.data.end_time),
|
|
24
|
+
};
|
|
25
|
+
return {
|
|
26
|
+
structuredContent: { data },
|
|
27
|
+
content: [
|
|
28
|
+
{
|
|
29
|
+
type: "text",
|
|
30
|
+
text: JSON.stringify(data, null, 2),
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
server.registerTool("get-rpc-usage-by-endpoint", {
|
|
36
|
+
description: "Get the usage data for the user's QuickNode RPC endpoints. The start_time and end_time parameters are ISO 8601 date strings to filter the usage data by time range",
|
|
37
|
+
inputSchema: { ...generic_args_1.genericArgs.timeRangeArgs },
|
|
38
|
+
}, async ({ start_time, end_time }) => {
|
|
39
|
+
const start_time_unix = (0, utils_1.isoToUnixTimestamp)(start_time);
|
|
40
|
+
const end_time_unix = (0, utils_1.isoToUnixTimestamp)(end_time);
|
|
41
|
+
if (!start_time_unix || !end_time_unix) {
|
|
42
|
+
throw new Error("Invalid time range, start_time and end_time must be valid ISO 8601 date strings");
|
|
43
|
+
}
|
|
44
|
+
const usage = await client.getRpcUsageByEndpoint({
|
|
45
|
+
start_time: start_time_unix,
|
|
46
|
+
end_time: end_time_unix,
|
|
47
|
+
});
|
|
48
|
+
const data = {
|
|
49
|
+
...usage.data,
|
|
50
|
+
start_time: (0, utils_1.unixTimestampToIso)(usage.data.start_time),
|
|
51
|
+
end_time: (0, utils_1.unixTimestampToIso)(usage.data.end_time),
|
|
52
|
+
};
|
|
53
|
+
return {
|
|
54
|
+
structuredContent: { data },
|
|
55
|
+
content: [
|
|
56
|
+
{
|
|
57
|
+
type: "text",
|
|
58
|
+
text: JSON.stringify(data, null, 2),
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
};
|
|
62
|
+
});
|
|
63
|
+
server.registerTool("get-rpc-usage-by-method", {
|
|
64
|
+
description: "Get the usage data for the user's QuickNode RPC endpoints, broken down by method. The start_time and end_time parameters are ISO 8601 date strings to filter the usage data by time range",
|
|
65
|
+
inputSchema: { ...generic_args_1.genericArgs.timeRangeArgs },
|
|
66
|
+
}, async ({ start_time, end_time }) => {
|
|
67
|
+
const start_time_unix = (0, utils_1.isoToUnixTimestamp)(start_time);
|
|
68
|
+
const end_time_unix = (0, utils_1.isoToUnixTimestamp)(end_time);
|
|
69
|
+
if (!start_time_unix || !end_time_unix) {
|
|
70
|
+
throw new Error("Invalid time range, start_time and end_time must be valid ISO 8601 date strings");
|
|
71
|
+
}
|
|
72
|
+
const usage = await client.getRpcUsageByMethod({
|
|
73
|
+
start_time: start_time_unix,
|
|
74
|
+
end_time: end_time_unix,
|
|
75
|
+
});
|
|
76
|
+
const data = {
|
|
77
|
+
...usage.data,
|
|
78
|
+
start_time: (0, utils_1.unixTimestampToIso)(usage.data.start_time),
|
|
79
|
+
end_time: (0, utils_1.unixTimestampToIso)(usage.data.end_time),
|
|
80
|
+
};
|
|
81
|
+
return {
|
|
82
|
+
structuredContent: { data },
|
|
83
|
+
content: [
|
|
84
|
+
{
|
|
85
|
+
type: "text",
|
|
86
|
+
text: JSON.stringify(data, null, 2),
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
};
|
|
90
|
+
});
|
|
91
|
+
server.registerTool("get-rpc-usage-by-chain", {
|
|
92
|
+
description: "Get the usage data for the user's QuickNode RPC endpoints, broken down by chain. The start_time and end_time parameters are ISO 8601 date strings to filter the usage data by time range",
|
|
93
|
+
inputSchema: { ...generic_args_1.genericArgs.timeRangeArgs },
|
|
94
|
+
}, async ({ start_time, end_time }) => {
|
|
95
|
+
const start_time_unix = (0, utils_1.isoToUnixTimestamp)(start_time);
|
|
96
|
+
const end_time_unix = (0, utils_1.isoToUnixTimestamp)(end_time);
|
|
97
|
+
if (!start_time_unix || !end_time_unix) {
|
|
98
|
+
throw new Error("Invalid time range, start_time and end_time must be valid ISO 8601 date strings");
|
|
99
|
+
}
|
|
100
|
+
const usage = await client.getRpcUsageByChain({
|
|
101
|
+
start_time: start_time_unix,
|
|
102
|
+
end_time: end_time_unix,
|
|
103
|
+
});
|
|
104
|
+
const data = {
|
|
105
|
+
...usage.data,
|
|
106
|
+
start_time: (0, utils_1.unixTimestampToIso)(usage.data.start_time),
|
|
107
|
+
end_time: (0, utils_1.unixTimestampToIso)(usage.data.end_time),
|
|
108
|
+
};
|
|
109
|
+
return {
|
|
110
|
+
structuredContent: { data },
|
|
111
|
+
content: [
|
|
112
|
+
{
|
|
113
|
+
type: "text",
|
|
114
|
+
text: JSON.stringify(data, null, 2),
|
|
115
|
+
},
|
|
116
|
+
],
|
|
117
|
+
};
|
|
118
|
+
});
|
|
119
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@quicknode/mcp",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "MCP Server for building web3 infrastructure with QuickNode, leading Web3 infrastructure provider",
|
|
5
|
+
"author": "QuickNode <devex@quicknode.com>",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/quiknode-labs/qn-mcp.git"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/quiknode-labs/qn-mcp#readme",
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/quiknode-labs/qn-mcp/issues"
|
|
13
|
+
},
|
|
14
|
+
"bin": {
|
|
15
|
+
"qn-mcp": "dist/index.js"
|
|
16
|
+
},
|
|
17
|
+
"engines": {
|
|
18
|
+
"node": ">=18.18.0"
|
|
19
|
+
},
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "tsc && shx chmod +x dist/*.js",
|
|
22
|
+
"prepare": "npm run build",
|
|
23
|
+
"watch": "tsc --watch",
|
|
24
|
+
"format": "prettier --write .",
|
|
25
|
+
"format-test": "prettier --check .",
|
|
26
|
+
"test": "jest",
|
|
27
|
+
"test:watch": "jest --watch",
|
|
28
|
+
"test:coverage": "jest --coverage"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@modelcontextprotocol/sdk": "1.13.2",
|
|
32
|
+
"express": "^5.1.0",
|
|
33
|
+
"zod": "^3.25.67",
|
|
34
|
+
"zod-to-json-schema": "^3.24.6"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@types/jest": "^29.5.14",
|
|
38
|
+
"@types/node": "^22.15.33",
|
|
39
|
+
"jest": "^29.7.0",
|
|
40
|
+
"prettier": "^3.6.2",
|
|
41
|
+
"shx": "^0.4.0",
|
|
42
|
+
"ts-jest": "^29.4.0",
|
|
43
|
+
"typescript": "^5.8.3"
|
|
44
|
+
},
|
|
45
|
+
"keywords": [
|
|
46
|
+
"web3",
|
|
47
|
+
"ai",
|
|
48
|
+
"mcp",
|
|
49
|
+
"model-context-protocol",
|
|
50
|
+
"quicknode",
|
|
51
|
+
"blockchain",
|
|
52
|
+
"infrastructure",
|
|
53
|
+
"api",
|
|
54
|
+
"endpoints",
|
|
55
|
+
"security",
|
|
56
|
+
"monitoring",
|
|
57
|
+
"management",
|
|
58
|
+
"provisioning",
|
|
59
|
+
"scaling",
|
|
60
|
+
"performance",
|
|
61
|
+
"claude",
|
|
62
|
+
"cursor",
|
|
63
|
+
"assistant"
|
|
64
|
+
],
|
|
65
|
+
"license": "ISC"
|
|
66
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"strict": true,
|
|
5
|
+
"esModuleInterop": true,
|
|
6
|
+
"skipLibCheck": true,
|
|
7
|
+
"forceConsistentCasingInFileNames": true,
|
|
8
|
+
"resolveJsonModule": true,
|
|
9
|
+
"outDir": "./dist",
|
|
10
|
+
"moduleResolution": "NodeNext",
|
|
11
|
+
"module": "NodeNext",
|
|
12
|
+
"isolatedModules": true
|
|
13
|
+
},
|
|
14
|
+
"include": ["./**/*.ts"],
|
|
15
|
+
"exclude": ["node_modules"]
|
|
16
|
+
}
|