@kasarlabs/openzeppelin-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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Kasar Labs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,27 @@
1
+ # Snak - OpenZeppelin Plugin
2
+
3
+ The OpenZeppelin Plugin provides tools for creating and deploying OpenZeppelin account contracts on the Starknet blockchain.
4
+
5
+ ## Features
6
+
7
+ This plugin adds the following tools:
8
+
9
+ - **create_new_openzeppelin_account**: Create a new OpenZeppelin account and return the privateKey, publicKey, and contractAddress.
10
+ - **deploy_existing_openzeppelin_account**: Deploy an existing OpenZeppelin Account and return the privateKey, publicKey, and contractAddress.
11
+
12
+ ## Usage
13
+
14
+ The OpenZeppelin Plugin is used internally by the Starknet Agent and doesn't need to be called directly. When the agent is initialized, it automatically registers these tools, making them available for use.
15
+
16
+ ## Example
17
+
18
+ When asking the agent to perform OpenZeppelin-related tasks, it will use the appropriate tool from this plugin:
19
+
20
+ ```
21
+ "Create a new OpenZeppelin wallet for me" // Uses create_new_openzeppelin_account
22
+ "Deploy my existing OpenZeppelin account" // Uses deploy_existing_openzeppelin_account
23
+ ```
24
+
25
+ ## Development
26
+
27
+ To extend this plugin, add new tools in the `src/tools` directory and register them in the `registerTools` function in `src/tools/index.ts`.
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env node
2
+ import { existsSync } from 'fs';
3
+ import { fileURLToPath } from 'url';
4
+ import { dirname, join } from 'path';
5
+
6
+ const __dirname = dirname(fileURLToPath(import.meta.url));
7
+ const buildPath = join(__dirname, '..', 'build', 'index.js');
8
+
9
+ if (!existsSync(buildPath)) {
10
+ console.error('Build not found. Run: npm run build');
11
+ process.exit(1);
12
+ }
13
+
14
+ await import(buildPath);
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export declare const RegisterToolInServer: () => Promise<void>;
package/build/index.js ADDED
@@ -0,0 +1,48 @@
1
+ #!/usr/bin/env node
2
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
3
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
4
+ import { registerToolsWithServer, getOnchainRead, } from '@kasarlabs/ask-starknet-core';
5
+ import dotenv from 'dotenv';
6
+ import { accountDetailsSchema } from './schemas/index.js';
7
+ import { DeployOZAccount } from './tools/deployAccount.js';
8
+ import { CreateOZAccount } from './tools/createAccount.js';
9
+ dotenv.config();
10
+ const server = new McpServer({
11
+ name: 'starknet-openzeppelin-mcp',
12
+ version: '0.0.1',
13
+ });
14
+ const registerTools = (OpenZeppelinToolRegistry) => {
15
+ OpenZeppelinToolRegistry.push({
16
+ name: 'create_new_openzeppelin_account',
17
+ description: 'Create a new Open Zeppelin account and return the privateKey/publicKey/contractAddress',
18
+ execute: async () => {
19
+ const response = await CreateOZAccount();
20
+ response;
21
+ },
22
+ });
23
+ OpenZeppelinToolRegistry.push({
24
+ name: 'deploy_existing_openzeppelin_account',
25
+ description: 'Deploy an existing Open Zeppelin Account return the privateKey/publicKey/contractAddress',
26
+ schema: accountDetailsSchema,
27
+ execute: async (params) => {
28
+ const onchainRead = getOnchainRead();
29
+ return await DeployOZAccount(onchainRead, params);
30
+ },
31
+ });
32
+ };
33
+ export const RegisterToolInServer = async () => {
34
+ const tools = [];
35
+ registerTools(tools);
36
+ await registerToolsWithServer(server, tools);
37
+ };
38
+ async function main() {
39
+ const transport = new StdioServerTransport();
40
+ await RegisterToolInServer();
41
+ await server.connect(transport);
42
+ console.error('Starknet OpenZeppelin MCP Server running on stdio');
43
+ }
44
+ main().catch((error) => {
45
+ console.error('Fatal error in main():', error);
46
+ process.exit(1);
47
+ });
48
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF,OAAO,EAEL,uBAAuB,EACvB,cAAc,GACf,MAAM,8BAA8B,CAAC;AACtC,OAAO,MAAM,MAAM,QAAQ,CAAC;AAG5B,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D,MAAM,CAAC,MAAM,EAAE,CAAC;AAEhB,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;IAC3B,IAAI,EAAE,2BAA2B;IACjC,OAAO,EAAE,OAAO;CACjB,CAAC,CAAC;AAEH,MAAM,aAAa,GAAG,CAAC,wBAAmC,EAAE,EAAE;IAC5D,wBAAwB,CAAC,IAAI,CAAC;QA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items?: undefined;
7
+ variants?: undefined;
8
+ inputs?: undefined;
9
+ kind?: undefined;
10
+ } | {
11
+ type: string;
12
+ name: string;
13
+ members: {
14
+ name: string;
15
+ type: string;
16
+ }[];
17
+ interface_name?: undefined;
18
+ items?: undefined;
19
+ variants?: undefined;
20
+ inputs?: undefined;
21
+ kind?: undefined;
22
+ } | {
23
+ type: string;
24
+ name: string;
25
+ items: {
26
+ type: string;
27
+ name: string;
28
+ inputs: {
29
+ name: string;
30
+ type: string;
31
+ }[];
32
+ outputs: {
33
+ type: string;
34
+ }[];
35
+ state_mutability: string;
36
+ }[];
37
+ interface_name?: undefined;
38
+ members?: undefined;
39
+ variants?: undefined;
40
+ inputs?: undefined;
41
+ kind?: undefined;
42
+ } | {
43
+ type: string;
44
+ name: string;
45
+ variants: {
46
+ name: string;
47
+ type: string;
48
+ }[];
49
+ interface_name?: undefined;
50
+ members?: undefined;
51
+ items?: undefined;
52
+ inputs?: undefined;
53
+ kind?: undefined;
54
+ } | {
55
+ type: string;
56
+ name: string;
57
+ inputs: {
58
+ name: string;
59
+ type: string;
60
+ }[];
61
+ interface_name?: undefined;
62
+ members?: undefined;
63
+ items?: undefined;
64
+ variants?: undefined;
65
+ kind?: undefined;
66
+ } | {
67
+ type: string;
68
+ name: string;
69
+ kind: string;
70
+ members: {
71
+ name: string;
72
+ type: string;
73
+ kind: string;
74
+ }[];
75
+ interface_name?: undefined;
76
+ items?: undefined;
77
+ variants?: undefined;
78
+ inputs?: undefined;
79
+ } | {
80
+ type: string;
81
+ name: string;
82
+ kind: string;
83
+ variants: {
84
+ name: string;
85
+ type: string;
86
+ kind: string;
87
+ }[];
88
+ interface_name?: undefined;
89
+ members?: undefined;
90
+ items?: undefined;
91
+ inputs?: undefined;
92
+ })[];
@@ -0,0 +1,370 @@
1
+ export const ACCOUNT_ABI = [
2
+ {
3
+ type: 'impl',
4
+ name: 'SRC6Impl',
5
+ interface_name: 'openzeppelin::account::interface::ISRC6',
6
+ },
7
+ {
8
+ type: 'struct',
9
+ name: 'core::starknet::account::Call',
10
+ members: [
11
+ {
12
+ name: 'to',
13
+ type: 'core::starknet::contract_address::ContractAddress',
14
+ },
15
+ {
16
+ name: 'selector',
17
+ type: 'core::felt252',
18
+ },
19
+ {
20
+ name: 'calldata',
21
+ type: 'core::array::Array::<core::felt252>',
22
+ },
23
+ ],
24
+ },
25
+ {
26
+ type: 'struct',
27
+ name: 'core::array::Span::<core::felt252>',
28
+ members: [
29
+ {
30
+ name: 'snapshot',
31
+ type: '@core::array::Array::<core::felt252>',
32
+ },
33
+ ],
34
+ },
35
+ {
36
+ type: 'interface',
37
+ name: 'openzeppelin::account::interface::ISRC6',
38
+ items: [
39
+ {
40
+ type: 'function',
41
+ name: '__execute__',
42
+ inputs: [
43
+ {
44
+ name: 'calls',
45
+ type: 'core::array::Array::<core::starknet::account::Call>',
46
+ },
47
+ ],
48
+ outputs: [
49
+ {
50
+ type: 'core::array::Array::<core::array::Span::<core::felt252>>',
51
+ },
52
+ ],
53
+ state_mutability: 'view',
54
+ },
55
+ {
56
+ type: 'function',
57
+ name: '__validate__',
58
+ inputs: [
59
+ {
60
+ name: 'calls',
61
+ type: 'core::array::Array::<core::starknet::account::Call>',
62
+ },
63
+ ],
64
+ outputs: [
65
+ {
66
+ type: 'core::felt252',
67
+ },
68
+ ],
69
+ state_mutability: 'view',
70
+ },
71
+ {
72
+ type: 'function',
73
+ name: 'is_valid_signature',
74
+ inputs: [
75
+ {
76
+ name: 'hash',
77
+ type: 'core::felt252',
78
+ },
79
+ {
80
+ name: 'signature',
81
+ type: 'core::array::Array::<core::felt252>',
82
+ },
83
+ ],
84
+ outputs: [
85
+ {
86
+ type: 'core::felt252',
87
+ },
88
+ ],
89
+ state_mutability: 'view',
90
+ },
91
+ ],
92
+ },
93
+ {
94
+ type: 'impl',
95
+ name: 'SRC6CamelOnlyImpl',
96
+ interface_name: 'openzeppelin::account::interface::ISRC6CamelOnly',
97
+ },
98
+ {
99
+ type: 'interface',
100
+ name: 'openzeppelin::account::interface::ISRC6CamelOnly',
101
+ items: [
102
+ {
103
+ type: 'function',
104
+ name: 'isValidSignature',
105
+ inputs: [
106
+ {
107
+ name: 'hash',
108
+ type: 'core::felt252',
109
+ },
110
+ {
111
+ name: 'signature',
112
+ type: 'core::array::Array::<core::felt252>',
113
+ },
114
+ ],
115
+ outputs: [
116
+ {
117
+ type: 'core::felt252',
118
+ },
119
+ ],
120
+ state_mutability: 'view',
121
+ },
122
+ ],
123
+ },
124
+ {
125
+ type: 'impl',
126
+ name: 'PublicKeyImpl',
127
+ interface_name: 'openzeppelin::account::interface::IPublicKey',
128
+ },
129
+ {
130
+ type: 'interface',
131
+ name: 'openzeppelin::account::interface::IPublicKey',
132
+ items: [
133
+ {
134
+ type: 'function',
135
+ name: 'get_public_key',
136
+ inputs: [],
137
+ outputs: [
138
+ {
139
+ type: 'core::felt252',
140
+ },
141
+ ],
142
+ state_mutability: 'view',
143
+ },
144
+ {
145
+ type: 'function',
146
+ name: 'set_public_key',
147
+ inputs: [
148
+ {
149
+ name: 'new_public_key',
150
+ type: 'core::felt252',
151
+ },
152
+ ],
153
+ outputs: [],
154
+ state_mutability: 'external',
155
+ },
156
+ ],
157
+ },
158
+ {
159
+ type: 'impl',
160
+ name: 'PublicKeyCamelImpl',
161
+ interface_name: 'openzeppelin::account::interface::IPublicKeyCamel',
162
+ },
163
+ {
164
+ type: 'interface',
165
+ name: 'openzeppelin::account::interface::IPublicKeyCamel',
166
+ items: [
167
+ {
168
+ type: 'function',
169
+ name: 'getPublicKey',
170
+ inputs: [],
171
+ outputs: [
172
+ {
173
+ type: 'core::felt252',
174
+ },
175
+ ],
176
+ state_mutability: 'view',
177
+ },
178
+ {
179
+ type: 'function',
180
+ name: 'setPublicKey',
181
+ inputs: [
182
+ {
183
+ name: 'newPublicKey',
184
+ type: 'core::felt252',
185
+ },
186
+ ],
187
+ outputs: [],
188
+ state_mutability: 'external',
189
+ },
190
+ ],
191
+ },
192
+ {
193
+ type: 'impl',
194
+ name: 'DeclarerImpl',
195
+ interface_name: 'openzeppelin::account::interface::IDeclarer',
196
+ },
197
+ {
198
+ type: 'interface',
199
+ name: 'openzeppelin::account::interface::IDeclarer',
200
+ items: [
201
+ {
202
+ type: 'function',
203
+ name: '__validate_declare__',
204
+ inputs: [
205
+ {
206
+ name: 'class_hash',
207
+ type: 'core::felt252',
208
+ },
209
+ ],
210
+ outputs: [
211
+ {
212
+ type: 'core::felt252',
213
+ },
214
+ ],
215
+ state_mutability: 'view',
216
+ },
217
+ ],
218
+ },
219
+ {
220
+ type: 'impl',
221
+ name: 'DeployableImpl',
222
+ interface_name: 'openzeppelin::account::interface::IDeployable',
223
+ },
224
+ {
225
+ type: 'interface',
226
+ name: 'openzeppelin::account::interface::IDeployable',
227
+ items: [
228
+ {
229
+ type: 'function',
230
+ name: '__validate_deploy__',
231
+ inputs: [
232
+ {
233
+ name: 'class_hash',
234
+ type: 'core::felt252',
235
+ },
236
+ {
237
+ name: 'contract_address_salt',
238
+ type: 'core::felt252',
239
+ },
240
+ {
241
+ name: 'public_key',
242
+ type: 'core::felt252',
243
+ },
244
+ ],
245
+ outputs: [
246
+ {
247
+ type: 'core::felt252',
248
+ },
249
+ ],
250
+ state_mutability: 'view',
251
+ },
252
+ ],
253
+ },
254
+ {
255
+ type: 'impl',
256
+ name: 'SRC5Impl',
257
+ interface_name: 'openzeppelin::introspection::interface::ISRC5',
258
+ },
259
+ {
260
+ type: 'enum',
261
+ name: 'core::bool',
262
+ variants: [
263
+ {
264
+ name: 'False',
265
+ type: '()',
266
+ },
267
+ {
268
+ name: 'True',
269
+ type: '()',
270
+ },
271
+ ],
272
+ },
273
+ {
274
+ type: 'interface',
275
+ name: 'openzeppelin::introspection::interface::ISRC5',
276
+ items: [
277
+ {
278
+ type: 'function',
279
+ name: 'supports_interface',
280
+ inputs: [
281
+ {
282
+ name: 'interface_id',
283
+ type: 'core::felt252',
284
+ },
285
+ ],
286
+ outputs: [
287
+ {
288
+ type: 'core::bool',
289
+ },
290
+ ],
291
+ state_mutability: 'view',
292
+ },
293
+ ],
294
+ },
295
+ {
296
+ type: 'constructor',
297
+ name: 'constructor',
298
+ inputs: [
299
+ {
300
+ name: 'public_key',
301
+ type: 'core::felt252',
302
+ },
303
+ ],
304
+ },
305
+ {
306
+ type: 'event',
307
+ name: 'openzeppelin::account::account::AccountComponent::OwnerAdded',
308
+ kind: 'struct',
309
+ members: [
310
+ {
311
+ name: 'new_owner_guid',
312
+ type: 'core::felt252',
313
+ kind: 'data',
314
+ },
315
+ ],
316
+ },
317
+ {
318
+ type: 'event',
319
+ name: 'openzeppelin::account::account::AccountComponent::OwnerRemoved',
320
+ kind: 'struct',
321
+ members: [
322
+ {
323
+ name: 'removed_owner_guid',
324
+ type: 'core::felt252',
325
+ kind: 'data',
326
+ },
327
+ ],
328
+ },
329
+ {
330
+ type: 'event',
331
+ name: 'openzeppelin::account::account::AccountComponent::Event',
332
+ kind: 'enum',
333
+ variants: [
334
+ {
335
+ name: 'OwnerAdded',
336
+ type: 'openzeppelin::account::account::AccountComponent::OwnerAdded',
337
+ kind: 'nested',
338
+ },
339
+ {
340
+ name: 'OwnerRemoved',
341
+ type: 'openzeppelin::account::account::AccountComponent::OwnerRemoved',
342
+ kind: 'nested',
343
+ },
344
+ ],
345
+ },
346
+ {
347
+ type: 'event',
348
+ name: 'openzeppelin::introspection::src5::SRC5Component::Event',
349
+ kind: 'enum',
350
+ variants: [],
351
+ },
352
+ {
353
+ type: 'event',
354
+ name: 'openzeppelin::presets::account::Account::Event',
355
+ kind: 'enum',
356
+ variants: [
357
+ {
358
+ name: 'AccountEvent',
359
+ type: 'openzeppelin::account::account::AccountComponent::Event',
360
+ kind: 'flat',
361
+ },
362
+ {
363
+ name: 'SRC5Event',
364
+ type: 'openzeppelin::introspection::src5::SRC5Component::Event',
365
+ kind: 'flat',
366
+ },
367
+ ],
368
+ },
369
+ ];
370
+ //# sourceMappingURL=ozAbi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ozAbi.js","sourceRoot":"","sources":["../../../src/lib/abis/ozAbi.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB;QACE,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,UAAU;QAChB,cAAc,EAAE,yCAAyC;KAC1D;IACD;QACE,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,+BAA+B;QACrC,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,IAAI;gBACV,IAAI,EAAE,mDAAmD;aAC1D;YACD;gBACE,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,eAAe;aACtB;YACD;gBACE,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,qCAAqC;aAC5C;SACF;KACF;IACD;QACE,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,oCAAoC;QAC1C,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,sCAAsC;aAC7C;SACF;KACF;IACD;QACE,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,yCAAyC;QAC/C,KAAK,EAAE;YACL;gBACE,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,aAAa;gBACnB,MAAM,EAAE;oBACN;wBACE,IAAI,EAAE,OAAO;wBACb,IAAI,EAAE,qDAAqD;qBAC5D;iBACF;gBACD,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,0DAA0D;qBACjE;iBACF;gBACD,gBAAgB,EAAE,MAAM;aACzB;YACD;gBACE,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,cAAc;gBACpB,MAAM,EAAE;oBACN;wBACE,IAAI,EAAE,OAAO;wBACb,IAAI,EAAE,qDAAqD;qBAC5D;iBACF;gBACD,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,eAAe;qBACtB;iBACF;gBACD,gBAAgB,EAAE,MAAM;aACzB;YACD;gBACE,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,oBAAoB;gBAC1B,MA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,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,gEAAgE;QACtE,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,oBAAoB;gBAC1B,IAAI,EAAE,eAAe;gBACrB,IAAI,EAAE,MAAM;aACb;SACF;KACF;IACD;QACE,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,yDAAyD;QAC/D,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,YAAY;gBAClB,IAAI,EAAE,8DAA8D;gBACpE,IAAI,EAAE,QAAQ;aACf;YACD;gBACE,IAAI,EAAE,cAAc;gBACpB,IAAI,EAAE,gEAAgE;gBACtE,IAAI,EAAE,QAAQ;aACf;SACF;KACF;IACD;QACE,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,yDAAyD;QAC/D,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,EAAE;KACb;IACD;QACE,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,gDAAgD;QACtD,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,cAAc;gBACpB,IAAI,EAAE,yDAAyD;gBAC/D,IAAI,EAAE,MAAM;aACb;YACD;gBACE,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,yDAAyD;gBAC/D,IAAI,EAAE,MAAM;aACb;SACF;KACF;CACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const OZ_CLASSHASH = "0x061dac032f228abef9c6626f995015233097ae253a7f72d68552db02f2971b8f";
2
+ export declare const DEFAULT_GUARDIAN = "0x0";
3
+ export declare const DEFAULT_NONCE = "0x0";
@@ -0,0 +1,4 @@
1
+ export const OZ_CLASSHASH = '0x061dac032f228abef9c6626f995015233097ae253a7f72d68552db02f2971b8f';
2
+ export const DEFAULT_GUARDIAN = '0x0';
3
+ export const DEFAULT_NONCE = '0x0';
4
+ //# sourceMappingURL=contract.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract.js","sourceRoot":"","sources":["../../../src/lib/constant/contract.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GACvB,oEAAoE,CAAC;AAEvE,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,CAAC;AACtC,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,CAAC"}
@@ -0,0 +1,2 @@
1
+ import winston from 'winston';
2
+ export declare const logger: winston.Logger;
@@ -0,0 +1,45 @@
1
+ import winston from 'winston';
2
+ const levels = {
3
+ error: 0,
4
+ warn: 1,
5
+ info: 2,
6
+ http: 3,
7
+ debug: 4,
8
+ };
9
+ const colors = {
10
+ error: 'red',
11
+ warn: 'yellow',
12
+ info: 'green',
13
+ http: 'magenta',
14
+ debug: 'blue',
15
+ };
16
+ winston.addColors(colors);
17
+ const level = () => {
18
+ if (process.env.LOG_LEVEL) {
19
+ return process.env.LOG_LEVEL.toLowerCase();
20
+ }
21
+ const env = process.env.NODE_ENV || 'production';
22
+ return env === 'development' ? 'debug' : 'info';
23
+ };
24
+ const format = winston.format.combine(winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }), winston.format.colorize({ all: true }), winston.format.printf((info) => `${info.timestamp} ${info.level}: ${info.message}`));
25
+ let transports;
26
+ try {
27
+ transports = [
28
+ new winston.transports.Console(),
29
+ new winston.transports.File({
30
+ filename: 'logs/error.log',
31
+ level: 'error',
32
+ }),
33
+ new winston.transports.File({ filename: 'logs/combined.log' }),
34
+ ];
35
+ }
36
+ catch (error) {
37
+ transports = [new winston.transports.Console()];
38
+ }
39
+ export const logger = winston.createLogger({
40
+ level: level(),
41
+ levels,
42
+ format,
43
+ transports,
44
+ });
45
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/lib/dependances/types.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,MAAM,MAAM,GAAG;IACb,KAAK,E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B,KAAK,EAAE,OAAO;SACf,CAAC;QAEF,IAAI,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,mBAAmB,EAAE,CAAC;KAC/D,CAAC;AACJ,CAAC;AAAC,OAAO,KAAK,EAAE,CAAC;IACf,UAAU,GAAG,CAAC,IAAI,OAAO,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC;AAClD,CAAC;AAED,MAAM,CAAC,MAAM,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IACzC,KAAK,EAAE,KAAK,EAAE;IACd,MAAM;IACN,MAAM;IACN,UAAU;CACX,CAAC,CAAC"}
@@ -0,0 +1,57 @@
1
+ import { ProviderInterface } from 'starknet';
2
+ export interface AccountDetails {
3
+ contractAddress: string;
4
+ publicKey: string;
5
+ privateKey: string;
6
+ }
7
+ export interface TransactionResult {
8
+ status: 'success' | 'failure';
9
+ transactionHash?: string;
10
+ contractAddress?: string;
11
+ error?: string;
12
+ }
13
+ export interface BaseUtilityClass {
14
+ provider: ProviderInterface;
15
+ }
16
+ export interface ContractDeployResult {
17
+ transactionHash: string;
18
+ contractAddress: string | string[];
19
+ }
20
+ export interface TokenAmount {
21
+ amount: string;
22
+ decimals: number;
23
+ }
24
+ export type TypedData = {
25
+ types: {
26
+ StarkNetDomain?: TypeElement[];
27
+ [additionalProperties: string]: TypeElement[] | undefined;
28
+ };
29
+ primaryType: string;
30
+ domain: StarkNetDomain;
31
+ message: Record<string, unknown>;
32
+ };
33
+ export type TypeElement = {
34
+ name: string;
35
+ type: string;
36
+ };
37
+ export type StarkNetDomain = {
38
+ name: string;
39
+ version: string;
40
+ chainId: string | number;
41
+ };
42
+ export type WeierstrassSignatureType = {
43
+ r: string;
44
+ s: string;
45
+ recoveryParam?: number | null;
46
+ };
47
+ export interface AccountResponse {
48
+ status: 'success' | 'failure';
49
+ wallet: string;
50
+ publicKey?: string;
51
+ privateKey?: string;
52
+ contractAddress?: string;
53
+ error?: string;
54
+ message?: string;
55
+ deployFee?: string;
56
+ transaction_type?: string;
57
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=accounts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accounts.js","sourceRoot":"","sources":["../../../src/lib/types/accounts.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ import { AccountDetails, BaseUtilityClass, TransactionResult } from '../types/accounts.js';
2
+ export declare class AccountManager implements BaseUtilityClass {
3
+ provider: any;
4
+ constructor(provider: any);
5
+ createAccount(accountClassHash: string): Promise<AccountDetails>;
6
+ deployAccount(accountClassHash: string, accountDetails: AccountDetails): Promise<TransactionResult>;
7
+ estimateAccountDeployFee(accountClassHash: string, accountDetails: AccountDetails): Promise<import("starknet").EstimateFee>;
8
+ }
9
+ export declare const wrapAccountCreationResponse: (response: string) => string;
@@ -0,0 +1,76 @@
1
+ import { Account, CallData, stark, hash, ec } from 'starknet';
2
+ export class AccountManager {
3
+ constructor(provider) {
4
+ this.provider = provider;
5
+ }
6
+ async createAccount(accountClassHash) {
7
+ try {
8
+ const privateKey = stark.randomAddress();
9
+ const publicKey = ec.starkCurve.getStarkKey(privateKey);
10
+ const constructorCallData = CallData.compile({ publicKey });
11
+ const contractAddress = hash.calculateContractAddressFromHash(publicKey, accountClassHash, constructorCallData, 0);
12
+ return {
13
+ contractAddress,
14
+ privateKey,
15
+ publicKey,
16
+ };
17
+ }
18
+ catch (error) {
19
+ throw new Error(`Failed to create account: ${error.message}`);
20
+ }
21
+ }
22
+ async deployAccount(accountClassHash, accountDetails) {
23
+ try {
24
+ const account = new Account(this.provider, accountDetails.contractAddress, accountDetails.privateKey);
25
+ const constructorCallData = CallData.compile({
26
+ publicKey: accountDetails.publicKey,
27
+ });
28
+ const { transaction_hash, contract_address } = await account.deployAccount({
29
+ classHash: accountClassHash,
30
+ constructorCalldata: constructorCallData,
31
+ addressSalt: accountDetails.publicKey,
32
+ });
33
+ await this.provider.waitForTransaction(transaction_hash);
34
+ return {
35
+ status: 'success',
36
+ transactionHash: transaction_hash,
37
+ contractAddress: contract_address,
38
+ };
39
+ }
40
+ catch (error) {
41
+ throw new Error(`Failed to create account: ${error.message}`);
42
+ }
43
+ }
44
+ async estimateAccountDeployFee(accountClassHash, accountDetails) {
45
+ try {
46
+ const account = new Account(this.provider, accountDetails.contractAddress, accountDetails.privateKey);
47
+ const constructorCallData = CallData.compile({
48
+ publicKey: accountDetails.publicKey,
49
+ });
50
+ return await account.estimateAccountDeployFee({
51
+ classHash: accountClassHash,
52
+ constructorCalldata: constructorCallData,
53
+ addressSalt: accountDetails.publicKey,
54
+ });
55
+ }
56
+ catch (error) {
57
+ throw new Error(`Failed to estimate deploy fee: ${error.message}`);
58
+ }
59
+ }
60
+ }
61
+ export const wrapAccountCreationResponse = (response) => {
62
+ try {
63
+ const data = JSON.parse(response);
64
+ if (data.status === 'success') {
65
+ return JSON.stringify({
66
+ ...data,
67
+ message: `Your ${data.wallet} account has been successfully created at ${data.contractAddress}\nPublic key: ${data.publicKey}\nPrivate key: ${data.privateKey}`,
68
+ });
69
+ }
70
+ return response;
71
+ }
72
+ catch {
73
+ return response;
74
+ }
75
+ };
76
+ //# sourceMappingURL=AccountManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AccountManager.js","sourceRoot":"","sources":["../../../src/lib/utils/AccountManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAa9D,MAAM,OAAO,cAAc;IACzB,YAAmB,QAAa;QAAb,aAAQ,GAAR,QAAQ,CAAK;IAAG,CAAC;IASpC,KAAK,CAAC,aAAa,CAAC,gBAAwB;QAC1C,IAAI,CAAC;YACH,MAAM,UAAU,GAAG,KAAK,CAAC,aAAa,EAAE,CAAC;YACzC,MAAM,SAAS,GAAG,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;YA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ZodString;
6
+ }, "strip", z.ZodTypeAny, {
7
+ contractAddress: string;
8
+ publicKey: string;
9
+ privateKey: string;
10
+ }, {
11
+ contractAddress: string;
12
+ publicKey: string;
13
+ privateKey: string;
14
+ }>;
@@ -0,0 +1,13 @@
1
+ import { z } from 'zod';
2
+ export const accountDetailsSchema = z.object({
3
+ contractAddress: z
4
+ .string()
5
+ .describe("The starknet address of the account's contract"),
6
+ publicKey: z
7
+ .string()
8
+ .describe('The public key of the openzeppelin(OZ) account'),
9
+ privateKey: z
10
+ .string()
11
+ .describe('The private key of the openzeppelin(OZ) account'),
12
+ });
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAUxB,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,eAAe,EAAE,CAAC;SACf,MAAM,EAAE;SACR,QAAQ,CAAC,gDAAgD,CAAC;IAC7D,SAAS,EAAE,CAAC;SACT,MAAM,EAAE;SACR,QAAQ,CAAC,gDAAgD,CAAC;IAC7D,UAAU,EAAE,CAAC;SACV,MAAM,EAAE;SACR,QAAQ,CAAC,iDAAiD,CAAC;CAC/D,CAAC,CAAC"}
@@ -0,0 +1,15 @@
1
+ export declare const CreateOZAccount: () => Promise<{
2
+ status: string;
3
+ wallet: string;
4
+ publicKey: string;
5
+ privateKey: string;
6
+ contractAddress: string;
7
+ error?: undefined;
8
+ } | {
9
+ status: string;
10
+ error: string;
11
+ wallet?: undefined;
12
+ publicKey?: undefined;
13
+ privateKey?: undefined;
14
+ contractAddress?: undefined;
15
+ }>;
@@ -0,0 +1,22 @@
1
+ import { OZ_CLASSHASH } from '../lib/constant/contract.js';
2
+ import { AccountManager } from '../lib/utils/AccountManager.js';
3
+ export const CreateOZAccount = async () => {
4
+ try {
5
+ const accountManager = new AccountManager(undefined);
6
+ const accountDetails = await accountManager.createAccount(OZ_CLASSHASH);
7
+ return {
8
+ status: 'success',
9
+ wallet: 'Open Zeppelin',
10
+ publicKey: accountDetails.publicKey,
11
+ privateKey: accountDetails.privateKey,
12
+ contractAddress: accountDetails.contractAddress,
13
+ };
14
+ }
15
+ catch (error) {
16
+ return {
17
+ status: 'failure',
18
+ error: error instanceof Error ? error.message : 'Unknown error',
19
+ };
20
+ }
21
+ };
22
+ //# sourceMappingURL=createAccount.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createAccount.js","sourceRoot":"","sources":["../../src/tools/createAccount.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAShE,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,IAAI,EAAE;IACxC,IAAI,CAAC;QACH,MAAM,cAAc,GAAG,IAAI,cAAc,CAAC,SAAS,CAAC,CAAC;QACrD,MAAM,cAAc,GAAG,MAAM,cAAc,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;QAExE,OAAO;YACL,MAAM,EAAE,SAAS;YACjB,MAAM,EAAE,eAAe;YACvB,SAAS,EAAE,cAAc,CAAC,SAAS;YACnC,UAAU,EAAE,cAAc,CAAC,UAAU;YACrC,eAAe,EAAE,cAAc,CAAC,eAAe;SAChD,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,MAAM,EAAE,SAAS;YACjB,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe;SAChE,CAAC;IACJ,CAAC;AACH,CAAC,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { onchainRead } from '@kasarlabs/ask-starknet-core';
2
+ import { z } from 'zod';
3
+ import { accountDetailsSchema } from '../schemas/index.js';
4
+ export declare const DeployOZAccount: (env: onchainRead, params: z.infer<typeof accountDetailsSchema>) => Promise<{
5
+ status: string;
6
+ wallet: string;
7
+ transaction_hash: string | undefined;
8
+ contract_address: string | undefined;
9
+ error?: undefined;
10
+ } | {
11
+ status: string;
12
+ error: string;
13
+ wallet?: undefined;
14
+ transaction_hash?: undefined;
15
+ contract_address?: undefined;
16
+ }>;
@@ -0,0 +1,22 @@
1
+ import { OZ_CLASSHASH } from '../lib/constant/contract.js';
2
+ import { AccountManager } from '../lib/utils/AccountManager.js';
3
+ export const DeployOZAccount = async (env, params) => {
4
+ try {
5
+ const provider = env.provider;
6
+ const accountManager = new AccountManager(provider);
7
+ const tx = await accountManager.deployAccount(OZ_CLASSHASH, params);
8
+ return {
9
+ status: 'success',
10
+ wallet: 'OpenZeppelin',
11
+ transaction_hash: tx.transactionHash,
12
+ contract_address: tx.contractAddress,
13
+ };
14
+ }
15
+ catch (error) {
16
+ return {
17
+ status: 'failure',
18
+ error: error instanceof Error ? error.message : 'Unknown error',
19
+ };
20
+ }
21
+ };
22
+ //# sourceMappingURL=deployAccount.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deployAccount.js","sourceRoot":"","sources":["../../src/tools/deployAccount.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAahE,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,EAClC,GAAgB,EAChB,MAA4C,EAC5C,EAAE;IACF,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;QAE9B,MAAM,cAAc,GAAG,IAAI,cAAc,CAAC,QAAQ,CAAC,CAAC;QACpD,MAAM,EAAE,GAAG,MAAM,cAAc,CAAC,aAAa,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;QAEpE,OAAO;YACL,MAAM,EAAE,SAAS;YACjB,MAAM,EAAE,cAAc;YACtB,gBAAgB,EAAE,EAAE,CAAC,eAAe;YACpC,gBAAgB,EAAE,EAAE,CAAC,eAAe;SACrC,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,MAAM,EAAE,SAAS;YACjB,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe;SAChE,CAAC;IACJ,CAAC;AACH,CAAC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@kasarlabs/openzeppelin-mcp",
3
+ "version": "0.1.0",
4
+ "main": "index.js",
5
+ "type": "module",
6
+ "bin": {
7
+ "openzeppelin-mcp": "./bin/openzeppelin-mcp.js"
8
+ },
9
+ "scripts": {
10
+ "build": "tsc && chmod 755 build/index.js",
11
+ "clean": "rm -rf build",
12
+ "clean:all": "rm -rf build node_modules",
13
+ "start": "node build/index.js"
14
+ },
15
+ "files": [
16
+ "build"
17
+ ],
18
+ "dependencies": {
19
+ "@kasarlabs/ask-starknet-core": "0.1.0",
20
+ "@langchain/core": "^0.3.42",
21
+ "@modelcontextprotocol/sdk": "^1.11.2",
22
+ "dotenv": "^16.4.7",
23
+ "starknet": "^7.6.4",
24
+ "winston": "^3.17.0",
25
+ "zod": "^3.24.2"
26
+ },
27
+ "devDependencies": {
28
+ "@types/node": "^22.13.10",
29
+ "typescript": "^5.8.2"
30
+ },
31
+ "keywords": [
32
+ "mcp",
33
+ "starknet",
34
+ "openzeppelin"
35
+ ],
36
+ "author": "kasarlabs",
37
+ "license": "MIT",
38
+ "description": "MCP server for creating and deploying OpenZeppelin account contracts on Starknet.",
39
+ "publishConfig": {
40
+ "access": "public"
41
+ },
42
+ "gitHead": "2239ec60f8e369abd318807cecd22fe97c0ab917"
43
+ }