@openzeppelin/contracts-mcp 0.0.5
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 +661 -0
- package/NOTICE +8 -0
- package/README.md +100 -0
- package/dist/cairo/schemas.d.ts +203 -0
- package/dist/cairo/schemas.d.ts.map +1 -0
- package/dist/cairo/schemas.js +132 -0
- package/dist/cairo/schemas.js.map +1 -0
- package/dist/cairo/tools/account.d.ts +3 -0
- package/dist/cairo/tools/account.d.ts.map +1 -0
- package/dist/cairo/tools/account.js +30 -0
- package/dist/cairo/tools/account.js.map +1 -0
- package/dist/cairo/tools/custom.d.ts +3 -0
- package/dist/cairo/tools/custom.d.ts.map +1 -0
- package/dist/cairo/tools/custom.js +27 -0
- package/dist/cairo/tools/custom.js.map +1 -0
- package/dist/cairo/tools/erc1155.d.ts +3 -0
- package/dist/cairo/tools/erc1155.d.ts.map +1 -0
- package/dist/cairo/tools/erc1155.js +32 -0
- package/dist/cairo/tools/erc1155.js.map +1 -0
- package/dist/cairo/tools/erc20.d.ts +3 -0
- package/dist/cairo/tools/erc20.d.ts.map +1 -0
- package/dist/cairo/tools/erc20.js +34 -0
- package/dist/cairo/tools/erc20.js.map +1 -0
- package/dist/cairo/tools/erc721.d.ts +3 -0
- package/dist/cairo/tools/erc721.d.ts.map +1 -0
- package/dist/cairo/tools/erc721.js +36 -0
- package/dist/cairo/tools/erc721.js.map +1 -0
- package/dist/cairo/tools/governor.d.ts +3 -0
- package/dist/cairo/tools/governor.d.ts.map +1 -0
- package/dist/cairo/tools/governor.js +38 -0
- package/dist/cairo/tools/governor.js.map +1 -0
- package/dist/cairo/tools/multisig.d.ts +3 -0
- package/dist/cairo/tools/multisig.d.ts.map +1 -0
- package/dist/cairo/tools/multisig.js +26 -0
- package/dist/cairo/tools/multisig.js.map +1 -0
- package/dist/cairo/tools/vesting.d.ts +3 -0
- package/dist/cairo/tools/vesting.d.ts.map +1 -0
- package/dist/cairo/tools/vesting.js +28 -0
- package/dist/cairo/tools/vesting.js.map +1 -0
- package/dist/cairo/tools.d.ts +3 -0
- package/dist/cairo/tools.d.ts.map +1 -0
- package/dist/cairo/tools.js +29 -0
- package/dist/cairo/tools.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/server.d.ts +3 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +28 -0
- package/dist/server.js.map +1 -0
- package/dist/solidity/schemas.d.ts +203 -0
- package/dist/solidity/schemas.d.ts.map +1 -0
- package/dist/solidity/schemas.js +160 -0
- package/dist/solidity/schemas.js.map +1 -0
- package/dist/solidity/tools/account.d.ts +3 -0
- package/dist/solidity/tools/account.d.ts.map +1 -0
- package/dist/solidity/tools/account.js +30 -0
- package/dist/solidity/tools/account.js.map +1 -0
- package/dist/solidity/tools/custom.d.ts +3 -0
- package/dist/solidity/tools/custom.d.ts.map +1 -0
- package/dist/solidity/tools/custom.js +27 -0
- package/dist/solidity/tools/custom.js.map +1 -0
- package/dist/solidity/tools/erc1155.d.ts +3 -0
- package/dist/solidity/tools/erc1155.d.ts.map +1 -0
- package/dist/solidity/tools/erc1155.js +32 -0
- package/dist/solidity/tools/erc1155.js.map +1 -0
- package/dist/solidity/tools/erc20.d.ts +3 -0
- package/dist/solidity/tools/erc20.d.ts.map +1 -0
- package/dist/solidity/tools/erc20.js +37 -0
- package/dist/solidity/tools/erc20.js.map +1 -0
- package/dist/solidity/tools/erc721.d.ts +3 -0
- package/dist/solidity/tools/erc721.d.ts.map +1 -0
- package/dist/solidity/tools/erc721.js +35 -0
- package/dist/solidity/tools/erc721.js.map +1 -0
- package/dist/solidity/tools/governor.d.ts +3 -0
- package/dist/solidity/tools/governor.d.ts.map +1 -0
- package/dist/solidity/tools/governor.js +38 -0
- package/dist/solidity/tools/governor.js.map +1 -0
- package/dist/solidity/tools/rwa.d.ts +3 -0
- package/dist/solidity/tools/rwa.d.ts.map +1 -0
- package/dist/solidity/tools/rwa.js +38 -0
- package/dist/solidity/tools/rwa.js.map +1 -0
- package/dist/solidity/tools/stablecoin.d.ts +3 -0
- package/dist/solidity/tools/stablecoin.d.ts.map +1 -0
- package/dist/solidity/tools/stablecoin.js +38 -0
- package/dist/solidity/tools/stablecoin.js.map +1 -0
- package/dist/solidity/tools.d.ts +3 -0
- package/dist/solidity/tools.d.ts.map +1 -0
- package/dist/solidity/tools.js +29 -0
- package/dist/solidity/tools.js.map +1 -0
- package/dist/stellar/schemas.d.ts +79 -0
- package/dist/stellar/schemas.d.ts.map +1 -0
- package/dist/stellar/schemas.js +56 -0
- package/dist/stellar/schemas.js.map +1 -0
- package/dist/stellar/tools/fungible.d.ts +3 -0
- package/dist/stellar/tools/fungible.d.ts.map +1 -0
- package/dist/stellar/tools/fungible.js +31 -0
- package/dist/stellar/tools/fungible.js.map +1 -0
- package/dist/stellar/tools/non-fungible.d.ts +3 -0
- package/dist/stellar/tools/non-fungible.d.ts.map +1 -0
- package/dist/stellar/tools/non-fungible.js +32 -0
- package/dist/stellar/tools/non-fungible.js.map +1 -0
- package/dist/stellar/tools/stablecoin.d.ts +3 -0
- package/dist/stellar/tools/stablecoin.d.ts.map +1 -0
- package/dist/stellar/tools/stablecoin.js +32 -0
- package/dist/stellar/tools/stablecoin.js.map +1 -0
- package/dist/stellar/tools.d.ts +3 -0
- package/dist/stellar/tools.d.ts.map +1 -0
- package/dist/stellar/tools.js +19 -0
- package/dist/stellar/tools.js.map +1 -0
- package/dist/stylus/schemas.d.ts +60 -0
- package/dist/stylus/schemas.d.ts.map +1 -0
- package/dist/stylus/schemas.js +44 -0
- package/dist/stylus/schemas.js.map +1 -0
- package/dist/stylus/tools/erc1155.d.ts +3 -0
- package/dist/stylus/tools/erc1155.d.ts.map +1 -0
- package/dist/stylus/tools/erc1155.js +26 -0
- package/dist/stylus/tools/erc1155.js.map +1 -0
- package/dist/stylus/tools/erc20.d.ts +3 -0
- package/dist/stylus/tools/erc20.d.ts.map +1 -0
- package/dist/stylus/tools/erc20.js +27 -0
- package/dist/stylus/tools/erc20.js.map +1 -0
- package/dist/stylus/tools/erc721.d.ts +3 -0
- package/dist/stylus/tools/erc721.d.ts.map +1 -0
- package/dist/stylus/tools/erc721.js +26 -0
- package/dist/stylus/tools/erc721.js.map +1 -0
- package/dist/stylus/tools.d.ts +3 -0
- package/dist/stylus/tools.d.ts.map +1 -0
- package/dist/stylus/tools.js +19 -0
- package/dist/stylus/tools.js.map +1 -0
- package/dist/utils.d.ts +20 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +61 -0
- package/dist/utils.js.map +1 -0
- package/package.json +40 -0
- package/src/cairo/schemas.ts +153 -0
- package/src/cairo/tools/account.ts +34 -0
- package/src/cairo/tools/custom.ts +31 -0
- package/src/cairo/tools/erc1155.ts +36 -0
- package/src/cairo/tools/erc20.ts +51 -0
- package/src/cairo/tools/erc721.ts +55 -0
- package/src/cairo/tools/governor.ts +59 -0
- package/src/cairo/tools/multisig.ts +30 -0
- package/src/cairo/tools/vesting.ts +32 -0
- package/src/cairo/tools.ts +34 -0
- package/src/index.ts +11 -0
- package/src/server.ts +30 -0
- package/src/solidity/schemas.ts +180 -0
- package/src/solidity/tools/account.ts +43 -0
- package/src/solidity/tools/custom.ts +31 -0
- package/src/solidity/tools/erc1155.ts +36 -0
- package/src/solidity/tools/erc20.ts +57 -0
- package/src/solidity/tools/erc721.ts +53 -0
- package/src/solidity/tools/governor.ts +59 -0
- package/src/solidity/tools/rwa.ts +59 -0
- package/src/solidity/tools/stablecoin.ts +59 -0
- package/src/solidity/tools.ts +34 -0
- package/src/stellar/schemas.ts +67 -0
- package/src/stellar/tools/fungible.ts +35 -0
- package/src/stellar/tools/non-fungible.ts +36 -0
- package/src/stellar/tools/stablecoin.ts +36 -0
- package/src/stellar/tools.ts +24 -0
- package/src/stylus/schemas.ts +54 -0
- package/src/stylus/tools/erc1155.ts +30 -0
- package/src/stylus/tools/erc20.ts +31 -0
- package/src/stylus/tools/erc721.ts +30 -0
- package/src/stylus/tools.ts +24 -0
- package/src/utils.ts +59 -0
package/dist/utils.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.safePrintSolidityCodeBlock = safePrintSolidityCodeBlock;
|
|
4
|
+
exports.safePrintCairoCodeBlock = safePrintCairoCodeBlock;
|
|
5
|
+
exports.safePrintRustCodeBlock = safePrintRustCodeBlock;
|
|
6
|
+
exports.makeDetailedPrompt = makeDetailedPrompt;
|
|
7
|
+
const wizard_1 = require("@openzeppelin/wizard");
|
|
8
|
+
const wizard_cairo_1 = require("@openzeppelin/wizard-cairo");
|
|
9
|
+
const wizard_stylus_1 = require("@openzeppelin/wizard-stylus");
|
|
10
|
+
const wizard_stellar_1 = require("@openzeppelin/wizard-stellar");
|
|
11
|
+
function safePrintCodeBlock(printFn, syntaxHighlightingLanguage) {
|
|
12
|
+
try {
|
|
13
|
+
return `\
|
|
14
|
+
\`\`\`${syntaxHighlightingLanguage}
|
|
15
|
+
${printFn()}
|
|
16
|
+
\`\`\`
|
|
17
|
+
`;
|
|
18
|
+
}
|
|
19
|
+
catch (e) {
|
|
20
|
+
if (e instanceof wizard_1.OptionsError ||
|
|
21
|
+
e instanceof wizard_cairo_1.OptionsError ||
|
|
22
|
+
e instanceof wizard_stylus_1.OptionsError ||
|
|
23
|
+
e instanceof wizard_stellar_1.OptionsError) {
|
|
24
|
+
return `${e.message}\n\n${JSON.stringify(e.messages, null, 2)}`;
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
return `Unexpected error: ${e}`;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Prints the contract source code, wrapped in a Markdown code block with syntax highlighting as `solidity`.
|
|
33
|
+
* Or prints the error message if an error occurs.
|
|
34
|
+
*/
|
|
35
|
+
function safePrintSolidityCodeBlock(printFn) {
|
|
36
|
+
return safePrintCodeBlock(printFn, 'solidity');
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Prints the contract source code, wrapped in a Markdown code block with syntax highlighting as `cairo`.
|
|
40
|
+
* Or prints the error message if an error occurs.
|
|
41
|
+
*/
|
|
42
|
+
function safePrintCairoCodeBlock(printFn) {
|
|
43
|
+
return safePrintCodeBlock(printFn, 'cairo');
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Prints the contract source code, wrapped in a Markdown code block with syntax highlighting as `rust`.
|
|
47
|
+
* Or prints the error message if an error occurs.
|
|
48
|
+
*/
|
|
49
|
+
function safePrintRustCodeBlock(printFn) {
|
|
50
|
+
return safePrintCodeBlock(printFn, 'rust');
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Adds a description to the prompt that explains the return format of the tool.
|
|
54
|
+
*/
|
|
55
|
+
function makeDetailedPrompt(origPrompt) {
|
|
56
|
+
return `\
|
|
57
|
+
${origPrompt}
|
|
58
|
+
|
|
59
|
+
Returns the source code of the generated contract, formatted in a Markdown code block. Does not write to disk.`;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;AA8BA,gEAEC;AAMD,0DAEC;AAMD,wDAEC;AAKD,gDAKC;AA1DD,iDAA4E;AAC5E,6DAA+E;AAC/E,+DAAiF;AACjF,iEAAmF;AAEnF,SAAS,kBAAkB,CAAC,OAAqB,EAAE,0BAAkC;IACnF,IAAI,CAAC;QACH,OAAO;QACH,0BAA0B;EAChC,OAAO,EAAE;;CAEV,CAAC;IACA,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,IACE,CAAC,YAAY,qBAAoB;YACjC,CAAC,YAAY,2BAAiB;YAC9B,CAAC,YAAY,4BAAkB;YAC/B,CAAC,YAAY,6BAAmB,EAChC,CAAC;YACD,OAAO,GAAG,CAAC,CAAC,OAAO,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;QAClE,CAAC;aAAM,CAAC;YACN,OAAO,qBAAqB,CAAC,EAAE,CAAC;QAClC,CAAC;IACH,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,SAAgB,0BAA0B,CAAC,OAAqB;IAC9D,OAAO,kBAAkB,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;AACjD,CAAC;AAED;;;GAGG;AACH,SAAgB,uBAAuB,CAAC,OAAqB;IAC3D,OAAO,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAC9C,CAAC;AAED;;;GAGG;AACH,SAAgB,sBAAsB,CAAC,OAAqB;IAC1D,OAAO,kBAAkB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AAC7C,CAAC;AAED;;GAEG;AACH,SAAgB,kBAAkB,CAAC,UAAkB;IACnD,OAAO;EACP,UAAU;;+GAEmG,CAAC;AAChH,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@openzeppelin/contracts-mcp",
|
|
3
|
+
"version": "0.0.5",
|
|
4
|
+
"description": "OpenZeppelin Contracts MCP Server",
|
|
5
|
+
"license": "AGPL-3.0-only",
|
|
6
|
+
"repository": "https://github.com/OpenZeppelin/contracts-wizard",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"bin": {
|
|
9
|
+
"contracts-mcp": "dist/index.js"
|
|
10
|
+
},
|
|
11
|
+
"ts:main": "src/index.ts",
|
|
12
|
+
"files": [
|
|
13
|
+
"LICENSE",
|
|
14
|
+
"NOTICE",
|
|
15
|
+
"/dist",
|
|
16
|
+
"/src",
|
|
17
|
+
"!**/*.test.*"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"prepare": "tsc",
|
|
21
|
+
"watch": "tsc --watch",
|
|
22
|
+
"test": "ava",
|
|
23
|
+
"test:update-snapshots": "ava --update-snapshots",
|
|
24
|
+
"test:watch": "ava --watch"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@modelcontextprotocol/sdk": "^1.11.1",
|
|
28
|
+
"@openzeppelin/wizard-common": "^0.0.2",
|
|
29
|
+
"@openzeppelin/wizard": "^0.6.0",
|
|
30
|
+
"@openzeppelin/wizard-stylus": "^0.2.0-alpha.5",
|
|
31
|
+
"@openzeppelin/wizard-stellar": "^0.4.1",
|
|
32
|
+
"@openzeppelin/wizard-cairo": "^2.0.0"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@types/node": "^20.0.0",
|
|
36
|
+
"typescript": "^5.0.0",
|
|
37
|
+
"ava": "^6.0.0",
|
|
38
|
+
"ts-node": "^10.4.0"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import {
|
|
3
|
+
commonDescriptions,
|
|
4
|
+
infoDescriptions,
|
|
5
|
+
cairoCommonDescriptions,
|
|
6
|
+
cairoERC20Descriptions,
|
|
7
|
+
cairoERC721Descriptions,
|
|
8
|
+
cairoRoyaltyInfoDescriptions,
|
|
9
|
+
cairoERC1155Descriptions,
|
|
10
|
+
cairoAccountDescriptions,
|
|
11
|
+
cairoGovernorDescriptions,
|
|
12
|
+
cairoMultisigDescriptions,
|
|
13
|
+
cairoVestingDescriptions,
|
|
14
|
+
} from '@openzeppelin/wizard-common';
|
|
15
|
+
import type { KindedOptions } from '@openzeppelin/wizard-cairo';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Static type assertions to ensure schemas satisfy the Wizard API types. Not called at runtime.
|
|
19
|
+
*/
|
|
20
|
+
function _typeAssertions() {
|
|
21
|
+
const _assertions: {
|
|
22
|
+
[K in keyof KindedOptions]: Omit<KindedOptions[K], 'kind'>;
|
|
23
|
+
} = {
|
|
24
|
+
ERC20: z.object(erc20Schema).parse({}),
|
|
25
|
+
ERC721: z.object(erc721Schema).parse({}),
|
|
26
|
+
ERC1155: z.object(erc1155Schema).parse({}),
|
|
27
|
+
Account: z.object(accountSchema).parse({}),
|
|
28
|
+
Multisig: z.object(multisigSchema).parse({}),
|
|
29
|
+
Governor: z.object(governorSchema).parse({}),
|
|
30
|
+
Vesting: z.object(vestingSchema).parse({}),
|
|
31
|
+
Custom: z.object(customSchema).parse({}),
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const commonSchema = {
|
|
36
|
+
access: z.literal('ownable').or(z.literal('roles')).optional().describe(cairoCommonDescriptions.access),
|
|
37
|
+
upgradeable: z.boolean().optional().describe(cairoCommonDescriptions.upgradeable),
|
|
38
|
+
info: z
|
|
39
|
+
.object({
|
|
40
|
+
securityContact: z.string().optional().describe(infoDescriptions.securityContact),
|
|
41
|
+
license: z.string().optional().describe(infoDescriptions.license),
|
|
42
|
+
})
|
|
43
|
+
.optional()
|
|
44
|
+
.describe(infoDescriptions.info),
|
|
45
|
+
} as const satisfies z.ZodRawShape;
|
|
46
|
+
|
|
47
|
+
export const erc20Schema = {
|
|
48
|
+
name: z.string().describe(commonDescriptions.name),
|
|
49
|
+
symbol: z.string().describe(commonDescriptions.symbol),
|
|
50
|
+
burnable: z.boolean().optional().describe(commonDescriptions.burnable),
|
|
51
|
+
pausable: z.boolean().optional().describe(commonDescriptions.pausable),
|
|
52
|
+
premint: z.string().optional().describe(cairoERC20Descriptions.premint),
|
|
53
|
+
mintable: z.boolean().optional().describe(commonDescriptions.mintable),
|
|
54
|
+
votes: z.boolean().optional().describe(cairoERC20Descriptions.votes),
|
|
55
|
+
appName: z.string().optional().describe(cairoCommonDescriptions.appName),
|
|
56
|
+
appVersion: z.string().optional().describe(cairoCommonDescriptions.appVersion),
|
|
57
|
+
...commonSchema,
|
|
58
|
+
} as const satisfies z.ZodRawShape;
|
|
59
|
+
|
|
60
|
+
export const erc721Schema = {
|
|
61
|
+
name: z.string().describe(commonDescriptions.name),
|
|
62
|
+
symbol: z.string().describe(commonDescriptions.symbol),
|
|
63
|
+
baseUri: z.string().optional().describe(cairoERC721Descriptions.baseUri),
|
|
64
|
+
burnable: z.boolean().optional().describe(commonDescriptions.burnable),
|
|
65
|
+
pausable: z.boolean().optional().describe(commonDescriptions.pausable),
|
|
66
|
+
mintable: z.boolean().optional().describe(commonDescriptions.mintable),
|
|
67
|
+
enumerable: z.boolean().optional().describe(cairoERC721Descriptions.enumerable),
|
|
68
|
+
votes: z.boolean().optional().describe(cairoERC721Descriptions.votes),
|
|
69
|
+
royaltyInfo: z
|
|
70
|
+
.object({
|
|
71
|
+
enabled: z.boolean().describe(cairoRoyaltyInfoDescriptions.enabled),
|
|
72
|
+
defaultRoyaltyFraction: z.string().describe(cairoRoyaltyInfoDescriptions.defaultRoyaltyFraction),
|
|
73
|
+
feeDenominator: z.string().describe(cairoRoyaltyInfoDescriptions.feeDenominator),
|
|
74
|
+
})
|
|
75
|
+
.optional()
|
|
76
|
+
.describe(cairoCommonDescriptions.royaltyInfo),
|
|
77
|
+
appName: z.string().optional().describe(cairoCommonDescriptions.appName),
|
|
78
|
+
appVersion: z.string().optional().describe(cairoCommonDescriptions.appVersion),
|
|
79
|
+
...commonSchema,
|
|
80
|
+
} as const satisfies z.ZodRawShape;
|
|
81
|
+
|
|
82
|
+
export const erc1155Schema = {
|
|
83
|
+
name: z.string().describe(commonDescriptions.name),
|
|
84
|
+
baseUri: z.string().describe(cairoERC1155Descriptions.baseUri),
|
|
85
|
+
burnable: z.boolean().optional().describe(commonDescriptions.burnable),
|
|
86
|
+
pausable: z.boolean().optional().describe(commonDescriptions.pausable),
|
|
87
|
+
mintable: z.boolean().optional().describe(commonDescriptions.mintable),
|
|
88
|
+
updatableUri: z.boolean().optional().describe(cairoERC1155Descriptions.updatableUri),
|
|
89
|
+
royaltyInfo: z
|
|
90
|
+
.object({
|
|
91
|
+
enabled: z.boolean().describe(cairoRoyaltyInfoDescriptions.enabled),
|
|
92
|
+
defaultRoyaltyFraction: z.string().describe(cairoRoyaltyInfoDescriptions.defaultRoyaltyFraction),
|
|
93
|
+
feeDenominator: z.string().describe(cairoRoyaltyInfoDescriptions.feeDenominator),
|
|
94
|
+
})
|
|
95
|
+
.optional()
|
|
96
|
+
.describe(cairoCommonDescriptions.royaltyInfo),
|
|
97
|
+
...commonSchema,
|
|
98
|
+
} as const satisfies z.ZodRawShape;
|
|
99
|
+
|
|
100
|
+
export const accountSchema = {
|
|
101
|
+
name: z.string().describe(commonDescriptions.name),
|
|
102
|
+
type: z.enum(['stark', 'eth']).describe(cairoAccountDescriptions.type),
|
|
103
|
+
declare: z.boolean().optional().describe(cairoAccountDescriptions.declare),
|
|
104
|
+
deploy: z.boolean().optional().describe(cairoAccountDescriptions.deploy),
|
|
105
|
+
pubkey: z.boolean().optional().describe(cairoAccountDescriptions.pubkey),
|
|
106
|
+
outsideExecution: z.boolean().optional().describe(cairoAccountDescriptions.outsideExecution),
|
|
107
|
+
upgradeable: commonSchema.upgradeable,
|
|
108
|
+
info: commonSchema.info,
|
|
109
|
+
} as const satisfies z.ZodRawShape;
|
|
110
|
+
|
|
111
|
+
export const multisigSchema = {
|
|
112
|
+
name: z.string().describe(commonDescriptions.name),
|
|
113
|
+
quorum: z.string().describe(cairoMultisigDescriptions.quorum),
|
|
114
|
+
upgradeable: commonSchema.upgradeable,
|
|
115
|
+
info: commonSchema.info,
|
|
116
|
+
} as const satisfies z.ZodRawShape;
|
|
117
|
+
|
|
118
|
+
export const governorSchema = {
|
|
119
|
+
name: z.string().describe(commonDescriptions.name),
|
|
120
|
+
delay: z.string().describe(cairoGovernorDescriptions.delay),
|
|
121
|
+
period: z.string().describe(cairoGovernorDescriptions.period),
|
|
122
|
+
votes: z.enum(['erc20votes', 'erc721votes']).optional().describe(cairoGovernorDescriptions.votes),
|
|
123
|
+
clockMode: z.enum(['timestamp']).optional().describe(cairoGovernorDescriptions.clockMode),
|
|
124
|
+
timelock: z
|
|
125
|
+
.union([z.literal(false), z.literal('openzeppelin')])
|
|
126
|
+
.optional()
|
|
127
|
+
.describe(cairoGovernorDescriptions.timelock),
|
|
128
|
+
decimals: z.number().optional().describe(cairoGovernorDescriptions.decimals),
|
|
129
|
+
proposalThreshold: z.string().optional().describe(cairoGovernorDescriptions.proposalThreshold),
|
|
130
|
+
quorumMode: z.enum(['percent', 'absolute']).optional().describe(cairoGovernorDescriptions.quorumMode),
|
|
131
|
+
quorumPercent: z.number().optional().describe(cairoGovernorDescriptions.quorumPercent),
|
|
132
|
+
quorumAbsolute: z.string().optional().describe(cairoGovernorDescriptions.quorumAbsolute),
|
|
133
|
+
settings: z.boolean().optional().describe(cairoGovernorDescriptions.settings),
|
|
134
|
+
upgradeable: commonSchema.upgradeable,
|
|
135
|
+
appName: z.string().optional().describe(cairoCommonDescriptions.appName),
|
|
136
|
+
appVersion: z.string().optional().describe(cairoCommonDescriptions.appVersion),
|
|
137
|
+
info: commonSchema.info,
|
|
138
|
+
} as const satisfies z.ZodRawShape;
|
|
139
|
+
|
|
140
|
+
export const vestingSchema = {
|
|
141
|
+
name: z.string().describe(commonDescriptions.name),
|
|
142
|
+
startDate: z.string().describe(cairoVestingDescriptions.startDate),
|
|
143
|
+
duration: z.string().describe(cairoVestingDescriptions.duration),
|
|
144
|
+
cliffDuration: z.string().describe(cairoVestingDescriptions.cliffDuration),
|
|
145
|
+
schedule: z.enum(['linear', 'custom']).describe(cairoVestingDescriptions.schedule),
|
|
146
|
+
info: commonSchema.info,
|
|
147
|
+
} as const satisfies z.ZodRawShape;
|
|
148
|
+
|
|
149
|
+
export const customSchema = {
|
|
150
|
+
name: z.string().describe(commonDescriptions.name),
|
|
151
|
+
pausable: z.boolean().optional().describe(commonDescriptions.pausable),
|
|
152
|
+
...commonSchema,
|
|
153
|
+
} as const satisfies z.ZodRawShape;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import type { AccountOptions } from '@openzeppelin/wizard-cairo';
|
|
3
|
+
import { account } from '@openzeppelin/wizard-cairo';
|
|
4
|
+
import { safePrintCairoCodeBlock, makeDetailedPrompt } from '../../utils';
|
|
5
|
+
import { accountSchema } from '../schemas';
|
|
6
|
+
import { cairoPrompts } from '@openzeppelin/wizard-common';
|
|
7
|
+
|
|
8
|
+
export function registerCairoAccount(server: McpServer): RegisteredTool {
|
|
9
|
+
return server.tool(
|
|
10
|
+
'cairo-account',
|
|
11
|
+
makeDetailedPrompt(cairoPrompts.Account),
|
|
12
|
+
accountSchema,
|
|
13
|
+
async ({ name, type, declare, deploy, pubkey, outsideExecution, upgradeable, info }) => {
|
|
14
|
+
const opts: AccountOptions = {
|
|
15
|
+
name,
|
|
16
|
+
type,
|
|
17
|
+
declare,
|
|
18
|
+
deploy,
|
|
19
|
+
pubkey,
|
|
20
|
+
outsideExecution,
|
|
21
|
+
upgradeable,
|
|
22
|
+
info,
|
|
23
|
+
};
|
|
24
|
+
return {
|
|
25
|
+
content: [
|
|
26
|
+
{
|
|
27
|
+
type: 'text',
|
|
28
|
+
text: safePrintCairoCodeBlock(() => account.print(opts)),
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
);
|
|
34
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import type { CustomOptions } from '@openzeppelin/wizard-cairo';
|
|
3
|
+
import { custom } from '@openzeppelin/wizard-cairo';
|
|
4
|
+
import { safePrintCairoCodeBlock, makeDetailedPrompt } from '../../utils';
|
|
5
|
+
import { customSchema } from '../schemas';
|
|
6
|
+
import { cairoPrompts } from '@openzeppelin/wizard-common';
|
|
7
|
+
|
|
8
|
+
export function registerCairoCustom(server: McpServer): RegisteredTool {
|
|
9
|
+
return server.tool(
|
|
10
|
+
'cairo-custom',
|
|
11
|
+
makeDetailedPrompt(cairoPrompts.Custom),
|
|
12
|
+
customSchema,
|
|
13
|
+
async ({ name, pausable, access, upgradeable, info }) => {
|
|
14
|
+
const opts: CustomOptions = {
|
|
15
|
+
name,
|
|
16
|
+
pausable,
|
|
17
|
+
access,
|
|
18
|
+
upgradeable,
|
|
19
|
+
info,
|
|
20
|
+
};
|
|
21
|
+
return {
|
|
22
|
+
content: [
|
|
23
|
+
{
|
|
24
|
+
type: 'text',
|
|
25
|
+
text: safePrintCairoCodeBlock(() => custom.print(opts)),
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
};
|
|
29
|
+
},
|
|
30
|
+
);
|
|
31
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import type { ERC1155Options } from '@openzeppelin/wizard-cairo';
|
|
3
|
+
import { erc1155 } from '@openzeppelin/wizard-cairo';
|
|
4
|
+
import { safePrintCairoCodeBlock, makeDetailedPrompt } from '../../utils';
|
|
5
|
+
import { erc1155Schema } from '../schemas';
|
|
6
|
+
import { cairoPrompts } from '@openzeppelin/wizard-common';
|
|
7
|
+
|
|
8
|
+
export function registerCairoERC1155(server: McpServer): RegisteredTool {
|
|
9
|
+
return server.tool(
|
|
10
|
+
'cairo-erc1155',
|
|
11
|
+
makeDetailedPrompt(cairoPrompts.ERC1155),
|
|
12
|
+
erc1155Schema,
|
|
13
|
+
async ({ name, baseUri, burnable, pausable, mintable, updatableUri, royaltyInfo, access, upgradeable, info }) => {
|
|
14
|
+
const opts: ERC1155Options = {
|
|
15
|
+
name,
|
|
16
|
+
baseUri,
|
|
17
|
+
burnable,
|
|
18
|
+
pausable,
|
|
19
|
+
mintable,
|
|
20
|
+
updatableUri,
|
|
21
|
+
royaltyInfo,
|
|
22
|
+
access,
|
|
23
|
+
upgradeable,
|
|
24
|
+
info,
|
|
25
|
+
};
|
|
26
|
+
return {
|
|
27
|
+
content: [
|
|
28
|
+
{
|
|
29
|
+
type: 'text',
|
|
30
|
+
text: safePrintCairoCodeBlock(() => erc1155.print(opts)),
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
);
|
|
36
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import type { ERC20Options } from '@openzeppelin/wizard-cairo';
|
|
3
|
+
import { erc20 } from '@openzeppelin/wizard-cairo';
|
|
4
|
+
import { safePrintCairoCodeBlock, makeDetailedPrompt } from '../../utils';
|
|
5
|
+
import { erc20Schema } from '../schemas';
|
|
6
|
+
import { cairoPrompts } from '@openzeppelin/wizard-common';
|
|
7
|
+
|
|
8
|
+
export function registerCairoERC20(server: McpServer): RegisteredTool {
|
|
9
|
+
return server.tool(
|
|
10
|
+
'cairo-erc20',
|
|
11
|
+
makeDetailedPrompt(cairoPrompts.ERC20),
|
|
12
|
+
erc20Schema,
|
|
13
|
+
async ({
|
|
14
|
+
name,
|
|
15
|
+
symbol,
|
|
16
|
+
burnable,
|
|
17
|
+
pausable,
|
|
18
|
+
premint,
|
|
19
|
+
mintable,
|
|
20
|
+
votes,
|
|
21
|
+
appName,
|
|
22
|
+
appVersion,
|
|
23
|
+
access,
|
|
24
|
+
upgradeable,
|
|
25
|
+
info,
|
|
26
|
+
}) => {
|
|
27
|
+
const opts: ERC20Options = {
|
|
28
|
+
name,
|
|
29
|
+
symbol,
|
|
30
|
+
burnable,
|
|
31
|
+
pausable,
|
|
32
|
+
premint,
|
|
33
|
+
mintable,
|
|
34
|
+
votes,
|
|
35
|
+
appName,
|
|
36
|
+
appVersion,
|
|
37
|
+
access,
|
|
38
|
+
upgradeable,
|
|
39
|
+
info,
|
|
40
|
+
};
|
|
41
|
+
return {
|
|
42
|
+
content: [
|
|
43
|
+
{
|
|
44
|
+
type: 'text',
|
|
45
|
+
text: safePrintCairoCodeBlock(() => erc20.print(opts)),
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
};
|
|
49
|
+
},
|
|
50
|
+
);
|
|
51
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import type { ERC721Options } from '@openzeppelin/wizard-cairo';
|
|
3
|
+
import { erc721 } from '@openzeppelin/wizard-cairo';
|
|
4
|
+
import { safePrintCairoCodeBlock, makeDetailedPrompt } from '../../utils';
|
|
5
|
+
import { erc721Schema } from '../schemas';
|
|
6
|
+
import { cairoPrompts } from '@openzeppelin/wizard-common';
|
|
7
|
+
|
|
8
|
+
export function registerCairoERC721(server: McpServer): RegisteredTool {
|
|
9
|
+
return server.tool(
|
|
10
|
+
'cairo-erc721',
|
|
11
|
+
makeDetailedPrompt(cairoPrompts.ERC721),
|
|
12
|
+
erc721Schema,
|
|
13
|
+
async ({
|
|
14
|
+
name,
|
|
15
|
+
symbol,
|
|
16
|
+
baseUri,
|
|
17
|
+
burnable,
|
|
18
|
+
pausable,
|
|
19
|
+
mintable,
|
|
20
|
+
enumerable,
|
|
21
|
+
votes,
|
|
22
|
+
royaltyInfo,
|
|
23
|
+
appName,
|
|
24
|
+
appVersion,
|
|
25
|
+
access,
|
|
26
|
+
upgradeable,
|
|
27
|
+
info,
|
|
28
|
+
}) => {
|
|
29
|
+
const opts: ERC721Options = {
|
|
30
|
+
name,
|
|
31
|
+
symbol,
|
|
32
|
+
baseUri,
|
|
33
|
+
burnable,
|
|
34
|
+
pausable,
|
|
35
|
+
mintable,
|
|
36
|
+
enumerable,
|
|
37
|
+
votes,
|
|
38
|
+
royaltyInfo,
|
|
39
|
+
appName,
|
|
40
|
+
appVersion,
|
|
41
|
+
access,
|
|
42
|
+
upgradeable,
|
|
43
|
+
info,
|
|
44
|
+
};
|
|
45
|
+
return {
|
|
46
|
+
content: [
|
|
47
|
+
{
|
|
48
|
+
type: 'text',
|
|
49
|
+
text: safePrintCairoCodeBlock(() => erc721.print(opts)),
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
};
|
|
53
|
+
},
|
|
54
|
+
);
|
|
55
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import type { GovernorOptions } from '@openzeppelin/wizard-cairo';
|
|
3
|
+
import { governor } from '@openzeppelin/wizard-cairo';
|
|
4
|
+
import { safePrintCairoCodeBlock, makeDetailedPrompt } from '../../utils';
|
|
5
|
+
import { governorSchema } from '../schemas';
|
|
6
|
+
import { cairoPrompts } from '@openzeppelin/wizard-common';
|
|
7
|
+
|
|
8
|
+
export function registerCairoGovernor(server: McpServer): RegisteredTool {
|
|
9
|
+
return server.tool(
|
|
10
|
+
'cairo-governor',
|
|
11
|
+
makeDetailedPrompt(cairoPrompts.Governor),
|
|
12
|
+
governorSchema,
|
|
13
|
+
async ({
|
|
14
|
+
name,
|
|
15
|
+
delay,
|
|
16
|
+
period,
|
|
17
|
+
votes,
|
|
18
|
+
clockMode,
|
|
19
|
+
timelock,
|
|
20
|
+
decimals,
|
|
21
|
+
proposalThreshold,
|
|
22
|
+
quorumMode,
|
|
23
|
+
quorumPercent,
|
|
24
|
+
quorumAbsolute,
|
|
25
|
+
settings,
|
|
26
|
+
upgradeable,
|
|
27
|
+
appName,
|
|
28
|
+
appVersion,
|
|
29
|
+
info,
|
|
30
|
+
}) => {
|
|
31
|
+
const opts: GovernorOptions = {
|
|
32
|
+
name,
|
|
33
|
+
delay,
|
|
34
|
+
period,
|
|
35
|
+
votes,
|
|
36
|
+
clockMode,
|
|
37
|
+
timelock,
|
|
38
|
+
decimals,
|
|
39
|
+
proposalThreshold,
|
|
40
|
+
quorumMode,
|
|
41
|
+
quorumPercent,
|
|
42
|
+
quorumAbsolute,
|
|
43
|
+
settings,
|
|
44
|
+
upgradeable,
|
|
45
|
+
appName,
|
|
46
|
+
appVersion,
|
|
47
|
+
info,
|
|
48
|
+
};
|
|
49
|
+
return {
|
|
50
|
+
content: [
|
|
51
|
+
{
|
|
52
|
+
type: 'text',
|
|
53
|
+
text: safePrintCairoCodeBlock(() => governor.print(opts)),
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
};
|
|
57
|
+
},
|
|
58
|
+
);
|
|
59
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import type { MultisigOptions } from '@openzeppelin/wizard-cairo';
|
|
3
|
+
import { multisig } from '@openzeppelin/wizard-cairo';
|
|
4
|
+
import { safePrintCairoCodeBlock, makeDetailedPrompt } from '../../utils';
|
|
5
|
+
import { multisigSchema } from '../schemas';
|
|
6
|
+
import { cairoPrompts } from '@openzeppelin/wizard-common';
|
|
7
|
+
|
|
8
|
+
export function registerCairoMultisig(server: McpServer): RegisteredTool {
|
|
9
|
+
return server.tool(
|
|
10
|
+
'cairo-multisig',
|
|
11
|
+
makeDetailedPrompt(cairoPrompts.Multisig),
|
|
12
|
+
multisigSchema,
|
|
13
|
+
async ({ name, quorum, upgradeable, info }) => {
|
|
14
|
+
const opts: MultisigOptions = {
|
|
15
|
+
name,
|
|
16
|
+
quorum,
|
|
17
|
+
upgradeable,
|
|
18
|
+
info,
|
|
19
|
+
};
|
|
20
|
+
return {
|
|
21
|
+
content: [
|
|
22
|
+
{
|
|
23
|
+
type: 'text',
|
|
24
|
+
text: safePrintCairoCodeBlock(() => multisig.print(opts)),
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
};
|
|
28
|
+
},
|
|
29
|
+
);
|
|
30
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import type { VestingOptions } from '@openzeppelin/wizard-cairo';
|
|
3
|
+
import { vesting } from '@openzeppelin/wizard-cairo';
|
|
4
|
+
import { safePrintCairoCodeBlock, makeDetailedPrompt } from '../../utils';
|
|
5
|
+
import { vestingSchema } from '../schemas';
|
|
6
|
+
import { cairoPrompts } from '@openzeppelin/wizard-common';
|
|
7
|
+
|
|
8
|
+
export function registerCairoVesting(server: McpServer): RegisteredTool {
|
|
9
|
+
return server.tool(
|
|
10
|
+
'cairo-vesting',
|
|
11
|
+
makeDetailedPrompt(cairoPrompts.Vesting),
|
|
12
|
+
vestingSchema,
|
|
13
|
+
async ({ name, startDate, duration, cliffDuration, schedule, info }) => {
|
|
14
|
+
const opts: VestingOptions = {
|
|
15
|
+
name,
|
|
16
|
+
startDate,
|
|
17
|
+
duration,
|
|
18
|
+
cliffDuration,
|
|
19
|
+
schedule,
|
|
20
|
+
info,
|
|
21
|
+
};
|
|
22
|
+
return {
|
|
23
|
+
content: [
|
|
24
|
+
{
|
|
25
|
+
type: 'text',
|
|
26
|
+
text: safePrintCairoCodeBlock(() => vesting.print(opts)),
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
};
|
|
30
|
+
},
|
|
31
|
+
);
|
|
32
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { registerCairoAccount } from './tools/account.js';
|
|
3
|
+
import { registerCairoCustom } from './tools/custom.js';
|
|
4
|
+
import { registerCairoERC20 } from './tools/erc20.js';
|
|
5
|
+
import { registerCairoERC721 } from './tools/erc721.js';
|
|
6
|
+
import { registerCairoERC1155 } from './tools/erc1155.js';
|
|
7
|
+
import { registerCairoGovernor } from './tools/governor.js';
|
|
8
|
+
import { registerCairoMultisig } from './tools/multisig.js';
|
|
9
|
+
import { registerCairoVesting } from './tools/vesting.js';
|
|
10
|
+
import type { KindedOptions } from '@openzeppelin/wizard-cairo';
|
|
11
|
+
import type { RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
12
|
+
|
|
13
|
+
type CairoToolRegisterFunctions = {
|
|
14
|
+
[kind in keyof KindedOptions]: (server: McpServer) => RegisteredTool;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
function getRegisterFunctions(server: McpServer): CairoToolRegisterFunctions {
|
|
18
|
+
return {
|
|
19
|
+
ERC20: () => registerCairoERC20(server),
|
|
20
|
+
ERC721: () => registerCairoERC721(server),
|
|
21
|
+
ERC1155: () => registerCairoERC1155(server),
|
|
22
|
+
Account: () => registerCairoAccount(server),
|
|
23
|
+
Multisig: () => registerCairoMultisig(server),
|
|
24
|
+
Governor: () => registerCairoGovernor(server),
|
|
25
|
+
Vesting: () => registerCairoVesting(server),
|
|
26
|
+
Custom: () => registerCairoCustom(server),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function registerCairoTools(server: McpServer) {
|
|
31
|
+
Object.values(getRegisterFunctions(server)).forEach(registerTool => {
|
|
32
|
+
registerTool(server);
|
|
33
|
+
});
|
|
34
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
4
|
+
import { createServer } from './server';
|
|
5
|
+
|
|
6
|
+
// Start receiving messages on stdin and sending messages on stdout
|
|
7
|
+
const transport = new StdioServerTransport();
|
|
8
|
+
(async () => {
|
|
9
|
+
const server = createServer();
|
|
10
|
+
await server.connect(transport);
|
|
11
|
+
})();
|
package/src/server.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { registerSolidityTools } from './solidity/tools.js';
|
|
3
|
+
import { registerCairoTools } from './cairo/tools.js';
|
|
4
|
+
import { registerStellarTools } from './stellar/tools.js';
|
|
5
|
+
import { registerStylusTools } from './stylus/tools.js';
|
|
6
|
+
import { version } from '../package.json';
|
|
7
|
+
|
|
8
|
+
export function createServer() {
|
|
9
|
+
const server = new McpServer(
|
|
10
|
+
{
|
|
11
|
+
name: 'OpenZeppelin Contracts Wizard',
|
|
12
|
+
version,
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
instructions: `\
|
|
16
|
+
Tools are provided for different smart contract languages: Solidity, Starknet's Cairo, Stellar Soroban, and Arbitrum Stylus.
|
|
17
|
+
Each tool generates a smart contract using recommended best practices with OpenZeppelin Contracts libraries, and returns the source code. The tools do not write to disk.
|
|
18
|
+
If the user requests to create a new smart contract, use the appropriate tool to generate the contract.
|
|
19
|
+
If the user asks to modify an existing smart contract, use these tools to determine the recommended patterns. Toggle the options in a tool to determine how different features affect the code, then apply the same types of changes to the user's contract.
|
|
20
|
+
`,
|
|
21
|
+
},
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
registerSolidityTools(server);
|
|
25
|
+
registerCairoTools(server);
|
|
26
|
+
registerStellarTools(server);
|
|
27
|
+
registerStylusTools(server);
|
|
28
|
+
|
|
29
|
+
return server;
|
|
30
|
+
}
|