@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
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import {
|
|
3
|
+
commonDescriptions,
|
|
4
|
+
infoDescriptions,
|
|
5
|
+
solidityCommonDescriptions,
|
|
6
|
+
solidityERC20Descriptions,
|
|
7
|
+
solidityERC721Descriptions,
|
|
8
|
+
solidityERC1155Descriptions,
|
|
9
|
+
solidityGovernorDescriptions,
|
|
10
|
+
solidityAccountDescriptions,
|
|
11
|
+
solidityStablecoinDescriptions,
|
|
12
|
+
} from '@openzeppelin/wizard-common';
|
|
13
|
+
import type { KindedOptions } from '@openzeppelin/wizard';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Static type assertions to ensure schemas satisfy the Wizard API types. Not called at runtime.
|
|
17
|
+
*/
|
|
18
|
+
function _typeAssertions() {
|
|
19
|
+
const _assertions: {
|
|
20
|
+
[K in keyof KindedOptions]: Omit<KindedOptions[K], 'kind'>;
|
|
21
|
+
} = {
|
|
22
|
+
ERC20: z.object(erc20Schema).parse({}),
|
|
23
|
+
ERC721: z.object(erc721Schema).parse({}),
|
|
24
|
+
ERC1155: z.object(erc1155Schema).parse({}),
|
|
25
|
+
Stablecoin: z.object(stablecoinSchema).parse({}),
|
|
26
|
+
RealWorldAsset: z.object(rwaSchema).parse({}),
|
|
27
|
+
Account: z.object(accountSchema).parse({}),
|
|
28
|
+
Governor: z.object(governorSchema).parse({}),
|
|
29
|
+
Custom: z.object(customSchema).parse({}),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const commonSchema = {
|
|
34
|
+
access: z
|
|
35
|
+
.literal('ownable')
|
|
36
|
+
.or(z.literal('roles'))
|
|
37
|
+
.or(z.literal('managed'))
|
|
38
|
+
.optional()
|
|
39
|
+
.describe(solidityCommonDescriptions.access),
|
|
40
|
+
upgradeable: z
|
|
41
|
+
.literal('transparent')
|
|
42
|
+
.or(z.literal('uups'))
|
|
43
|
+
.optional()
|
|
44
|
+
.describe(solidityCommonDescriptions.upgradeable),
|
|
45
|
+
info: z
|
|
46
|
+
.object({
|
|
47
|
+
securityContact: z.string().optional().describe(infoDescriptions.securityContact),
|
|
48
|
+
license: z.string().optional().describe(infoDescriptions.license),
|
|
49
|
+
})
|
|
50
|
+
.optional()
|
|
51
|
+
.describe(infoDescriptions.info),
|
|
52
|
+
} as const satisfies z.ZodRawShape;
|
|
53
|
+
|
|
54
|
+
export const erc20Schema = {
|
|
55
|
+
name: z.string().describe(commonDescriptions.name),
|
|
56
|
+
symbol: z.string().describe(commonDescriptions.symbol),
|
|
57
|
+
burnable: z.boolean().optional().describe(commonDescriptions.burnable),
|
|
58
|
+
pausable: z.boolean().optional().describe(commonDescriptions.pausable),
|
|
59
|
+
premint: z.string().optional().describe(solidityERC20Descriptions.premint),
|
|
60
|
+
premintChainId: z.string().optional().describe(solidityERC20Descriptions.premintChainId),
|
|
61
|
+
mintable: z.boolean().optional().describe(commonDescriptions.mintable),
|
|
62
|
+
callback: z.boolean().optional().describe(solidityERC20Descriptions.callback),
|
|
63
|
+
permit: z.boolean().optional().describe(solidityERC20Descriptions.permit),
|
|
64
|
+
votes: z.literal('blocknumber').or(z.literal('timestamp')).optional().describe(solidityERC20Descriptions.votes),
|
|
65
|
+
flashmint: z.boolean().optional().describe(solidityERC20Descriptions.flashmint),
|
|
66
|
+
crossChainBridging: z
|
|
67
|
+
.literal('custom')
|
|
68
|
+
.or(z.literal('superchain'))
|
|
69
|
+
.optional()
|
|
70
|
+
.describe(solidityERC20Descriptions.crossChainBridging),
|
|
71
|
+
...commonSchema,
|
|
72
|
+
} as const satisfies z.ZodRawShape;
|
|
73
|
+
|
|
74
|
+
export const erc721Schema = {
|
|
75
|
+
name: z.string().describe(commonDescriptions.name),
|
|
76
|
+
symbol: z.string().describe(commonDescriptions.symbol),
|
|
77
|
+
baseUri: z.string().optional().describe(solidityERC721Descriptions.baseUri),
|
|
78
|
+
enumerable: z.boolean().optional().describe(solidityERC721Descriptions.enumerable),
|
|
79
|
+
uriStorage: z.boolean().optional().describe(solidityERC721Descriptions.uriStorage),
|
|
80
|
+
burnable: z.boolean().optional().describe(commonDescriptions.burnable),
|
|
81
|
+
pausable: z.boolean().optional().describe(commonDescriptions.pausable),
|
|
82
|
+
mintable: z.boolean().optional().describe(commonDescriptions.mintable),
|
|
83
|
+
incremental: z.boolean().optional().describe(solidityERC721Descriptions.incremental),
|
|
84
|
+
votes: z.literal('blocknumber').or(z.literal('timestamp')).optional().describe(solidityERC721Descriptions.votes),
|
|
85
|
+
...commonSchema,
|
|
86
|
+
} as const satisfies z.ZodRawShape;
|
|
87
|
+
|
|
88
|
+
export const erc1155Schema = {
|
|
89
|
+
name: z.string().describe(commonDescriptions.name),
|
|
90
|
+
uri: z.string().describe(solidityERC1155Descriptions.uri),
|
|
91
|
+
burnable: z.boolean().optional().describe(commonDescriptions.burnable),
|
|
92
|
+
pausable: z.boolean().optional().describe(commonDescriptions.pausable),
|
|
93
|
+
mintable: z.boolean().optional().describe(commonDescriptions.mintable),
|
|
94
|
+
supply: z.boolean().optional().describe(solidityERC1155Descriptions.supply),
|
|
95
|
+
updatableUri: z.boolean().optional().describe(solidityERC1155Descriptions.updatableUri),
|
|
96
|
+
...commonSchema,
|
|
97
|
+
} as const satisfies z.ZodRawShape;
|
|
98
|
+
|
|
99
|
+
const { upgradeable: _, ...erc20SchemaOmitUpgradeable } = erc20Schema;
|
|
100
|
+
|
|
101
|
+
export const stablecoinSchema = {
|
|
102
|
+
...erc20SchemaOmitUpgradeable,
|
|
103
|
+
limitations: z
|
|
104
|
+
.literal(false)
|
|
105
|
+
.or(z.literal('allowlist'))
|
|
106
|
+
.or(z.literal('blocklist'))
|
|
107
|
+
.optional()
|
|
108
|
+
.describe(solidityStablecoinDescriptions.limitations),
|
|
109
|
+
custodian: z.boolean().optional().describe(solidityStablecoinDescriptions.custodian),
|
|
110
|
+
} as const satisfies z.ZodRawShape;
|
|
111
|
+
|
|
112
|
+
export const rwaSchema = stablecoinSchema;
|
|
113
|
+
|
|
114
|
+
export const accountSchema = {
|
|
115
|
+
name: z.string().describe('The name of the account contract'),
|
|
116
|
+
signatureValidation: z
|
|
117
|
+
.literal(false)
|
|
118
|
+
.or(z.literal('ERC1271'))
|
|
119
|
+
.or(z.literal('ERC7739'))
|
|
120
|
+
.optional()
|
|
121
|
+
.describe(solidityAccountDescriptions.signatureValidation),
|
|
122
|
+
ERC721Holder: z.boolean().optional().describe(solidityAccountDescriptions.ERC721Holder),
|
|
123
|
+
ERC1155Holder: z.boolean().optional().describe(solidityAccountDescriptions.ERC1155Holder),
|
|
124
|
+
signer: z
|
|
125
|
+
.literal(false)
|
|
126
|
+
.or(z.literal('ERC7702'))
|
|
127
|
+
.or(z.literal('ECDSA'))
|
|
128
|
+
.or(z.literal('P256'))
|
|
129
|
+
.or(z.literal('RSA'))
|
|
130
|
+
.or(z.literal('Multisig'))
|
|
131
|
+
.or(z.literal('MultisigWeighted'))
|
|
132
|
+
.optional()
|
|
133
|
+
.describe(solidityAccountDescriptions.signer),
|
|
134
|
+
batchedExecution: z.boolean().optional().describe(solidityAccountDescriptions.batchedExecution),
|
|
135
|
+
ERC7579Modules: z
|
|
136
|
+
.literal(false)
|
|
137
|
+
.or(z.literal('AccountERC7579'))
|
|
138
|
+
.or(z.literal('AccountERC7579Hooked'))
|
|
139
|
+
.optional()
|
|
140
|
+
.describe(solidityAccountDescriptions.ERC7579Modules),
|
|
141
|
+
info: commonSchema.info,
|
|
142
|
+
} as const satisfies z.ZodRawShape;
|
|
143
|
+
|
|
144
|
+
export const governorSchema = {
|
|
145
|
+
name: z.string().describe(commonDescriptions.name),
|
|
146
|
+
delay: z.string().describe(solidityGovernorDescriptions.delay),
|
|
147
|
+
period: z.string().describe(solidityGovernorDescriptions.period),
|
|
148
|
+
votes: z.literal('erc20votes').or(z.literal('erc721votes')).optional().describe(solidityGovernorDescriptions.votes),
|
|
149
|
+
clockMode: z
|
|
150
|
+
.literal('blocknumber')
|
|
151
|
+
.or(z.literal('timestamp'))
|
|
152
|
+
.optional()
|
|
153
|
+
.describe(solidityGovernorDescriptions.clockMode),
|
|
154
|
+
timelock: z
|
|
155
|
+
.literal(false)
|
|
156
|
+
.or(z.literal('openzeppelin'))
|
|
157
|
+
.or(z.literal('compound'))
|
|
158
|
+
.optional()
|
|
159
|
+
.describe(solidityGovernorDescriptions.timelock),
|
|
160
|
+
blockTime: z.number().optional().describe(solidityGovernorDescriptions.blockTime),
|
|
161
|
+
decimals: z.number().optional().describe(solidityGovernorDescriptions.decimals),
|
|
162
|
+
proposalThreshold: z.string().optional().describe(solidityGovernorDescriptions.proposalThreshold),
|
|
163
|
+
quorumMode: z
|
|
164
|
+
.literal('percent')
|
|
165
|
+
.or(z.literal('absolute'))
|
|
166
|
+
.optional()
|
|
167
|
+
.describe(solidityGovernorDescriptions.quorumMode),
|
|
168
|
+
quorumPercent: z.number().optional().describe(solidityGovernorDescriptions.quorumPercent),
|
|
169
|
+
quorumAbsolute: z.string().optional().describe(solidityGovernorDescriptions.quorumAbsolute),
|
|
170
|
+
storage: z.boolean().optional().describe(solidityGovernorDescriptions.storage),
|
|
171
|
+
settings: z.boolean().optional().describe(solidityGovernorDescriptions.settings),
|
|
172
|
+
upgradeable: commonSchema.upgradeable,
|
|
173
|
+
info: commonSchema.info,
|
|
174
|
+
} as const satisfies z.ZodRawShape;
|
|
175
|
+
|
|
176
|
+
export const customSchema = {
|
|
177
|
+
name: z.string().describe(commonDescriptions.name),
|
|
178
|
+
pausable: z.boolean().optional().describe(commonDescriptions.pausable),
|
|
179
|
+
...commonSchema,
|
|
180
|
+
} as const satisfies z.ZodRawShape;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import type { AccountOptions } from '@openzeppelin/wizard';
|
|
3
|
+
import { account } from '@openzeppelin/wizard';
|
|
4
|
+
import { safePrintSolidityCodeBlock, makeDetailedPrompt } from '../../utils';
|
|
5
|
+
import { accountSchema } from '../schemas';
|
|
6
|
+
import { solidityPrompts } from '@openzeppelin/wizard-common';
|
|
7
|
+
|
|
8
|
+
export function registerSolidityAccount(server: McpServer): RegisteredTool {
|
|
9
|
+
return server.tool(
|
|
10
|
+
'solidity-account',
|
|
11
|
+
makeDetailedPrompt(solidityPrompts.Account),
|
|
12
|
+
accountSchema,
|
|
13
|
+
async ({
|
|
14
|
+
name,
|
|
15
|
+
signatureValidation,
|
|
16
|
+
ERC721Holder,
|
|
17
|
+
ERC1155Holder,
|
|
18
|
+
signer,
|
|
19
|
+
batchedExecution,
|
|
20
|
+
ERC7579Modules,
|
|
21
|
+
info,
|
|
22
|
+
}) => {
|
|
23
|
+
const opts: AccountOptions = {
|
|
24
|
+
name,
|
|
25
|
+
signatureValidation,
|
|
26
|
+
ERC721Holder,
|
|
27
|
+
ERC1155Holder,
|
|
28
|
+
signer,
|
|
29
|
+
batchedExecution,
|
|
30
|
+
ERC7579Modules,
|
|
31
|
+
info,
|
|
32
|
+
};
|
|
33
|
+
return {
|
|
34
|
+
content: [
|
|
35
|
+
{
|
|
36
|
+
type: 'text',
|
|
37
|
+
text: safePrintSolidityCodeBlock(() => account.print(opts)),
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
);
|
|
43
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import type { CustomOptions } from '@openzeppelin/wizard';
|
|
3
|
+
import { custom } from '@openzeppelin/wizard';
|
|
4
|
+
import { safePrintSolidityCodeBlock, makeDetailedPrompt } from '../../utils';
|
|
5
|
+
import { customSchema } from '../schemas';
|
|
6
|
+
import { solidityPrompts } from '@openzeppelin/wizard-common';
|
|
7
|
+
|
|
8
|
+
export function registerSolidityCustom(server: McpServer): RegisteredTool {
|
|
9
|
+
return server.tool(
|
|
10
|
+
'solidity-custom',
|
|
11
|
+
makeDetailedPrompt(solidityPrompts.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: safePrintSolidityCodeBlock(() => 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';
|
|
3
|
+
import { erc1155 } from '@openzeppelin/wizard';
|
|
4
|
+
import { safePrintSolidityCodeBlock, makeDetailedPrompt } from '../../utils';
|
|
5
|
+
import { erc1155Schema } from '../schemas';
|
|
6
|
+
import { solidityPrompts } from '@openzeppelin/wizard-common';
|
|
7
|
+
|
|
8
|
+
export function registerSolidityERC1155(server: McpServer): RegisteredTool {
|
|
9
|
+
return server.tool(
|
|
10
|
+
'solidity-erc1155',
|
|
11
|
+
makeDetailedPrompt(solidityPrompts.ERC1155),
|
|
12
|
+
erc1155Schema,
|
|
13
|
+
async ({ name, uri, burnable, pausable, mintable, supply, updatableUri, access, upgradeable, info }) => {
|
|
14
|
+
const opts: ERC1155Options = {
|
|
15
|
+
name,
|
|
16
|
+
uri,
|
|
17
|
+
burnable,
|
|
18
|
+
pausable,
|
|
19
|
+
mintable,
|
|
20
|
+
supply,
|
|
21
|
+
updatableUri,
|
|
22
|
+
access,
|
|
23
|
+
upgradeable,
|
|
24
|
+
info,
|
|
25
|
+
};
|
|
26
|
+
return {
|
|
27
|
+
content: [
|
|
28
|
+
{
|
|
29
|
+
type: 'text',
|
|
30
|
+
text: safePrintSolidityCodeBlock(() => erc1155.print(opts)),
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
);
|
|
36
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import type { ERC20Options } from '@openzeppelin/wizard';
|
|
3
|
+
import { erc20 } from '@openzeppelin/wizard';
|
|
4
|
+
import { safePrintSolidityCodeBlock, makeDetailedPrompt } from '../../utils';
|
|
5
|
+
import { erc20Schema } from '../schemas';
|
|
6
|
+
import { solidityPrompts } from '@openzeppelin/wizard-common';
|
|
7
|
+
|
|
8
|
+
export function registerSolidityERC20(server: McpServer): RegisteredTool {
|
|
9
|
+
return server.tool(
|
|
10
|
+
'solidity-erc20',
|
|
11
|
+
makeDetailedPrompt(solidityPrompts.ERC20),
|
|
12
|
+
erc20Schema,
|
|
13
|
+
async ({
|
|
14
|
+
name,
|
|
15
|
+
symbol,
|
|
16
|
+
burnable,
|
|
17
|
+
pausable,
|
|
18
|
+
premint,
|
|
19
|
+
premintChainId,
|
|
20
|
+
mintable,
|
|
21
|
+
callback,
|
|
22
|
+
permit,
|
|
23
|
+
votes,
|
|
24
|
+
flashmint,
|
|
25
|
+
crossChainBridging,
|
|
26
|
+
access,
|
|
27
|
+
upgradeable,
|
|
28
|
+
info,
|
|
29
|
+
}) => {
|
|
30
|
+
const opts: ERC20Options = {
|
|
31
|
+
name,
|
|
32
|
+
symbol,
|
|
33
|
+
burnable,
|
|
34
|
+
pausable,
|
|
35
|
+
premint,
|
|
36
|
+
premintChainId,
|
|
37
|
+
mintable,
|
|
38
|
+
callback,
|
|
39
|
+
permit,
|
|
40
|
+
votes,
|
|
41
|
+
flashmint,
|
|
42
|
+
crossChainBridging,
|
|
43
|
+
access,
|
|
44
|
+
upgradeable,
|
|
45
|
+
info,
|
|
46
|
+
};
|
|
47
|
+
return {
|
|
48
|
+
content: [
|
|
49
|
+
{
|
|
50
|
+
type: 'text',
|
|
51
|
+
text: safePrintSolidityCodeBlock(() => erc20.print(opts)),
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
);
|
|
57
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import type { ERC721Options } from '@openzeppelin/wizard';
|
|
3
|
+
import { erc721 } from '@openzeppelin/wizard';
|
|
4
|
+
import { safePrintSolidityCodeBlock, makeDetailedPrompt } from '../../utils';
|
|
5
|
+
import { erc721Schema } from '../schemas';
|
|
6
|
+
import { solidityPrompts } from '@openzeppelin/wizard-common';
|
|
7
|
+
|
|
8
|
+
export function registerSolidityERC721(server: McpServer): RegisteredTool {
|
|
9
|
+
return server.tool(
|
|
10
|
+
'solidity-erc721',
|
|
11
|
+
makeDetailedPrompt(solidityPrompts.ERC721),
|
|
12
|
+
erc721Schema,
|
|
13
|
+
async ({
|
|
14
|
+
name,
|
|
15
|
+
symbol,
|
|
16
|
+
baseUri,
|
|
17
|
+
enumerable,
|
|
18
|
+
uriStorage,
|
|
19
|
+
burnable,
|
|
20
|
+
pausable,
|
|
21
|
+
mintable,
|
|
22
|
+
incremental,
|
|
23
|
+
votes,
|
|
24
|
+
access,
|
|
25
|
+
upgradeable,
|
|
26
|
+
info,
|
|
27
|
+
}) => {
|
|
28
|
+
const opts: ERC721Options = {
|
|
29
|
+
name,
|
|
30
|
+
symbol,
|
|
31
|
+
baseUri,
|
|
32
|
+
enumerable,
|
|
33
|
+
uriStorage,
|
|
34
|
+
burnable,
|
|
35
|
+
pausable,
|
|
36
|
+
mintable,
|
|
37
|
+
incremental,
|
|
38
|
+
votes,
|
|
39
|
+
access,
|
|
40
|
+
upgradeable,
|
|
41
|
+
info,
|
|
42
|
+
};
|
|
43
|
+
return {
|
|
44
|
+
content: [
|
|
45
|
+
{
|
|
46
|
+
type: 'text',
|
|
47
|
+
text: safePrintSolidityCodeBlock(() => erc721.print(opts)),
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
};
|
|
51
|
+
},
|
|
52
|
+
);
|
|
53
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import type { GovernorOptions } from '@openzeppelin/wizard';
|
|
3
|
+
import { governor } from '@openzeppelin/wizard';
|
|
4
|
+
import { safePrintSolidityCodeBlock, makeDetailedPrompt } from '../../utils';
|
|
5
|
+
import { governorSchema } from '../schemas';
|
|
6
|
+
import { solidityPrompts } from '@openzeppelin/wizard-common';
|
|
7
|
+
|
|
8
|
+
export function registerSolidityGovernor(server: McpServer): RegisteredTool {
|
|
9
|
+
return server.tool(
|
|
10
|
+
'solidity-governor',
|
|
11
|
+
makeDetailedPrompt(solidityPrompts.Governor),
|
|
12
|
+
governorSchema,
|
|
13
|
+
async ({
|
|
14
|
+
name,
|
|
15
|
+
delay,
|
|
16
|
+
period,
|
|
17
|
+
votes,
|
|
18
|
+
clockMode,
|
|
19
|
+
timelock,
|
|
20
|
+
blockTime,
|
|
21
|
+
decimals,
|
|
22
|
+
proposalThreshold,
|
|
23
|
+
quorumMode,
|
|
24
|
+
quorumPercent,
|
|
25
|
+
quorumAbsolute,
|
|
26
|
+
storage,
|
|
27
|
+
settings,
|
|
28
|
+
upgradeable,
|
|
29
|
+
info,
|
|
30
|
+
}) => {
|
|
31
|
+
const opts: GovernorOptions = {
|
|
32
|
+
name,
|
|
33
|
+
delay,
|
|
34
|
+
period,
|
|
35
|
+
votes,
|
|
36
|
+
clockMode,
|
|
37
|
+
timelock,
|
|
38
|
+
blockTime,
|
|
39
|
+
decimals,
|
|
40
|
+
proposalThreshold,
|
|
41
|
+
quorumMode,
|
|
42
|
+
quorumPercent,
|
|
43
|
+
quorumAbsolute,
|
|
44
|
+
storage,
|
|
45
|
+
settings,
|
|
46
|
+
upgradeable,
|
|
47
|
+
info,
|
|
48
|
+
};
|
|
49
|
+
return {
|
|
50
|
+
content: [
|
|
51
|
+
{
|
|
52
|
+
type: 'text',
|
|
53
|
+
text: safePrintSolidityCodeBlock(() => governor.print(opts)),
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
};
|
|
57
|
+
},
|
|
58
|
+
);
|
|
59
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import type { StablecoinOptions } from '@openzeppelin/wizard';
|
|
3
|
+
import { realWorldAsset } from '@openzeppelin/wizard';
|
|
4
|
+
import { safePrintSolidityCodeBlock, makeDetailedPrompt } from '../../utils';
|
|
5
|
+
import { rwaSchema } from '../schemas';
|
|
6
|
+
import { solidityPrompts } from '@openzeppelin/wizard-common';
|
|
7
|
+
|
|
8
|
+
export function registerSolidityRWA(server: McpServer) {
|
|
9
|
+
return server.tool(
|
|
10
|
+
'solidity-rwa',
|
|
11
|
+
makeDetailedPrompt(solidityPrompts.RWA),
|
|
12
|
+
rwaSchema,
|
|
13
|
+
async ({
|
|
14
|
+
name,
|
|
15
|
+
symbol,
|
|
16
|
+
burnable,
|
|
17
|
+
pausable,
|
|
18
|
+
premint,
|
|
19
|
+
premintChainId,
|
|
20
|
+
mintable,
|
|
21
|
+
callback,
|
|
22
|
+
permit,
|
|
23
|
+
votes,
|
|
24
|
+
flashmint,
|
|
25
|
+
crossChainBridging,
|
|
26
|
+
access,
|
|
27
|
+
info,
|
|
28
|
+
limitations,
|
|
29
|
+
custodian,
|
|
30
|
+
}) => {
|
|
31
|
+
const opts: StablecoinOptions = {
|
|
32
|
+
name,
|
|
33
|
+
symbol,
|
|
34
|
+
burnable,
|
|
35
|
+
pausable,
|
|
36
|
+
premint,
|
|
37
|
+
premintChainId,
|
|
38
|
+
mintable,
|
|
39
|
+
callback,
|
|
40
|
+
permit,
|
|
41
|
+
votes,
|
|
42
|
+
flashmint,
|
|
43
|
+
crossChainBridging,
|
|
44
|
+
access,
|
|
45
|
+
info,
|
|
46
|
+
limitations,
|
|
47
|
+
custodian,
|
|
48
|
+
};
|
|
49
|
+
return {
|
|
50
|
+
content: [
|
|
51
|
+
{
|
|
52
|
+
type: 'text',
|
|
53
|
+
text: safePrintSolidityCodeBlock(() => realWorldAsset.print(opts)),
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
};
|
|
57
|
+
},
|
|
58
|
+
);
|
|
59
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import type { StablecoinOptions } from '@openzeppelin/wizard';
|
|
3
|
+
import { stablecoin } from '@openzeppelin/wizard';
|
|
4
|
+
import { safePrintSolidityCodeBlock, makeDetailedPrompt } from '../../utils';
|
|
5
|
+
import { stablecoinSchema } from '../schemas';
|
|
6
|
+
import { solidityPrompts } from '@openzeppelin/wizard-common';
|
|
7
|
+
|
|
8
|
+
export function registerSolidityStablecoin(server: McpServer): RegisteredTool {
|
|
9
|
+
return server.tool(
|
|
10
|
+
'solidity-stablecoin',
|
|
11
|
+
makeDetailedPrompt(solidityPrompts.Stablecoin),
|
|
12
|
+
stablecoinSchema,
|
|
13
|
+
async ({
|
|
14
|
+
name,
|
|
15
|
+
symbol,
|
|
16
|
+
burnable,
|
|
17
|
+
pausable,
|
|
18
|
+
premint,
|
|
19
|
+
premintChainId,
|
|
20
|
+
mintable,
|
|
21
|
+
callback,
|
|
22
|
+
permit,
|
|
23
|
+
votes,
|
|
24
|
+
flashmint,
|
|
25
|
+
crossChainBridging,
|
|
26
|
+
access,
|
|
27
|
+
info,
|
|
28
|
+
limitations,
|
|
29
|
+
custodian,
|
|
30
|
+
}) => {
|
|
31
|
+
const opts: StablecoinOptions = {
|
|
32
|
+
name,
|
|
33
|
+
symbol,
|
|
34
|
+
burnable,
|
|
35
|
+
pausable,
|
|
36
|
+
premint,
|
|
37
|
+
premintChainId,
|
|
38
|
+
mintable,
|
|
39
|
+
callback,
|
|
40
|
+
permit,
|
|
41
|
+
votes,
|
|
42
|
+
flashmint,
|
|
43
|
+
crossChainBridging,
|
|
44
|
+
access,
|
|
45
|
+
info,
|
|
46
|
+
limitations,
|
|
47
|
+
custodian,
|
|
48
|
+
};
|
|
49
|
+
return {
|
|
50
|
+
content: [
|
|
51
|
+
{
|
|
52
|
+
type: 'text',
|
|
53
|
+
text: safePrintSolidityCodeBlock(() => stablecoin.print(opts)),
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
};
|
|
57
|
+
},
|
|
58
|
+
);
|
|
59
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { registerSolidityAccount } from './tools/account.js';
|
|
3
|
+
import { registerSolidityCustom } from './tools/custom.js';
|
|
4
|
+
import { registerSolidityERC20 } from './tools/erc20.js';
|
|
5
|
+
import { registerSolidityERC721 } from './tools/erc721.js';
|
|
6
|
+
import { registerSolidityERC1155 } from './tools/erc1155.js';
|
|
7
|
+
import { registerSolidityGovernor } from './tools/governor.js';
|
|
8
|
+
import { registerSolidityStablecoin } from './tools/stablecoin.js';
|
|
9
|
+
import { registerSolidityRWA } from './tools/rwa.js';
|
|
10
|
+
import type { KindedOptions } from '@openzeppelin/wizard';
|
|
11
|
+
import type { RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
12
|
+
|
|
13
|
+
type SolidityToolRegisterFunctions = {
|
|
14
|
+
[kind in keyof KindedOptions]: (server: McpServer) => RegisteredTool;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
function getRegisterFunctions(server: McpServer): SolidityToolRegisterFunctions {
|
|
18
|
+
return {
|
|
19
|
+
ERC20: () => registerSolidityERC20(server),
|
|
20
|
+
ERC721: () => registerSolidityERC721(server),
|
|
21
|
+
ERC1155: () => registerSolidityERC1155(server),
|
|
22
|
+
Stablecoin: () => registerSolidityStablecoin(server),
|
|
23
|
+
RealWorldAsset: () => registerSolidityRWA(server),
|
|
24
|
+
Account: () => registerSolidityAccount(server),
|
|
25
|
+
Governor: () => registerSolidityGovernor(server),
|
|
26
|
+
Custom: () => registerSolidityCustom(server),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function registerSolidityTools(server: McpServer) {
|
|
31
|
+
Object.values(getRegisterFunctions(server)).forEach(registerTool => {
|
|
32
|
+
registerTool(server);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import {
|
|
3
|
+
commonDescriptions,
|
|
4
|
+
infoDescriptions,
|
|
5
|
+
stellarCommonDescriptions,
|
|
6
|
+
stellarFungibleDescriptions,
|
|
7
|
+
stellarNonFungibleDescriptions,
|
|
8
|
+
stellarStablecoinDescriptions,
|
|
9
|
+
} from '@openzeppelin/wizard-common';
|
|
10
|
+
import type { KindedOptions } from '@openzeppelin/wizard-stellar';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Static type assertions to ensure schemas satisfy the Wizard API types. Not called at runtime.
|
|
14
|
+
*/
|
|
15
|
+
function _typeAssertions() {
|
|
16
|
+
const _assertions: {
|
|
17
|
+
[K in keyof KindedOptions]: Omit<KindedOptions[K], 'kind'>;
|
|
18
|
+
} = {
|
|
19
|
+
Fungible: z.object(fungibleSchema).parse({}),
|
|
20
|
+
Stablecoin: z.object(stablecoinSchema).parse({}),
|
|
21
|
+
NonFungible: z.object(nonFungibleSchema).parse({}),
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const commonSchema = {
|
|
26
|
+
access: z.literal('ownable').or(z.literal('roles')).optional().describe(stellarCommonDescriptions.access),
|
|
27
|
+
upgradeable: z.boolean().optional().describe(stellarCommonDescriptions.upgradeable),
|
|
28
|
+
info: z
|
|
29
|
+
.object({
|
|
30
|
+
securityContact: z.string().optional().describe(infoDescriptions.securityContact),
|
|
31
|
+
license: z.string().optional().describe(infoDescriptions.license),
|
|
32
|
+
})
|
|
33
|
+
.optional()
|
|
34
|
+
.describe(infoDescriptions.info),
|
|
35
|
+
} as const satisfies z.ZodRawShape;
|
|
36
|
+
|
|
37
|
+
export const fungibleSchema = {
|
|
38
|
+
name: z.string().describe(commonDescriptions.name),
|
|
39
|
+
symbol: z.string().describe(commonDescriptions.symbol),
|
|
40
|
+
burnable: z.boolean().optional().describe(commonDescriptions.burnable),
|
|
41
|
+
pausable: z.boolean().optional().describe(commonDescriptions.pausable),
|
|
42
|
+
premint: z.string().optional().describe(stellarFungibleDescriptions.premint),
|
|
43
|
+
mintable: z.boolean().optional().describe(commonDescriptions.mintable),
|
|
44
|
+
...commonSchema,
|
|
45
|
+
} as const satisfies z.ZodRawShape;
|
|
46
|
+
|
|
47
|
+
export const stablecoinSchema = {
|
|
48
|
+
...fungibleSchema,
|
|
49
|
+
limitations: z
|
|
50
|
+
.literal(false)
|
|
51
|
+
.or(z.literal('allowlist'))
|
|
52
|
+
.or(z.literal('blocklist'))
|
|
53
|
+
.optional()
|
|
54
|
+
.describe(stellarStablecoinDescriptions.limitations),
|
|
55
|
+
} as const satisfies z.ZodRawShape;
|
|
56
|
+
|
|
57
|
+
export const nonFungibleSchema = {
|
|
58
|
+
name: z.string().describe(commonDescriptions.name),
|
|
59
|
+
symbol: z.string().describe(commonDescriptions.symbol),
|
|
60
|
+
burnable: z.boolean().optional().describe(commonDescriptions.burnable),
|
|
61
|
+
enumerable: z.boolean().optional().describe(stellarNonFungibleDescriptions.enumerable),
|
|
62
|
+
consecutive: z.boolean().optional().describe(stellarNonFungibleDescriptions.consecutive),
|
|
63
|
+
pausable: z.boolean().optional().describe(commonDescriptions.pausable),
|
|
64
|
+
mintable: z.boolean().optional().describe(commonDescriptions.mintable),
|
|
65
|
+
sequential: z.boolean().optional().describe(stellarNonFungibleDescriptions.sequential),
|
|
66
|
+
...commonSchema,
|
|
67
|
+
} as const satisfies z.ZodRawShape;
|