@openzeppelin/contracts-mcp 0.5.1 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/confidential/schemas.d.ts +33 -0
- package/dist/confidential/schemas.d.ts.map +1 -0
- package/dist/confidential/schemas.js +33 -0
- package/dist/confidential/schemas.js.map +1 -0
- package/dist/confidential/tools/erc7984.d.ts +3 -0
- package/dist/confidential/tools/erc7984.d.ts.map +1 -0
- package/dist/confidential/tools/erc7984.js +30 -0
- package/dist/confidential/tools/erc7984.js.map +1 -0
- package/dist/confidential/tools.d.ts +3 -0
- package/dist/confidential/tools.d.ts.map +1 -0
- package/dist/confidential/tools.js +15 -0
- package/dist/confidential/tools.js.map +1 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +9 -7
- package/dist/server.js.map +1 -1
- package/package.json +5 -4
- package/src/confidential/schemas.ts +35 -0
- package/src/confidential/tools/erc7984.ts +34 -0
- package/src/confidential/tools.ts +20 -0
- package/src/server.ts +3 -1
package/README.md
CHANGED
|
@@ -17,6 +17,7 @@ Provides tools to generate smart contract source code for the following language
|
|
|
17
17
|
| --- | --- |
|
|
18
18
|
| solidity | erc20, erc721, erc1155, stablecoin, rwa, account, governor, custom |
|
|
19
19
|
| cairo | erc20, erc721, erc1155, account, multisig, governor, vesting, custom |
|
|
20
|
+
| confidential | erc7984 |
|
|
20
21
|
| stellar | fungible, stablecoin, non-fungible |
|
|
21
22
|
| stylus | erc20, erc721, erc1155 |
|
|
22
23
|
| uniswap-hooks | hooks (tool name is just `uniswap-hooks`) |
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const commonSchema: {
|
|
3
|
+
readonly info: z.ZodOptional<z.ZodObject<{
|
|
4
|
+
securityContact: z.ZodOptional<z.ZodString>;
|
|
5
|
+
license: z.ZodOptional<z.ZodString>;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
securityContact?: string | undefined;
|
|
8
|
+
license?: string | undefined;
|
|
9
|
+
}, {
|
|
10
|
+
securityContact?: string | undefined;
|
|
11
|
+
license?: string | undefined;
|
|
12
|
+
}>>;
|
|
13
|
+
};
|
|
14
|
+
export declare const erc7984Schema: {
|
|
15
|
+
readonly info: z.ZodOptional<z.ZodObject<{
|
|
16
|
+
securityContact: z.ZodOptional<z.ZodString>;
|
|
17
|
+
license: z.ZodOptional<z.ZodString>;
|
|
18
|
+
}, "strip", z.ZodTypeAny, {
|
|
19
|
+
securityContact?: string | undefined;
|
|
20
|
+
license?: string | undefined;
|
|
21
|
+
}, {
|
|
22
|
+
securityContact?: string | undefined;
|
|
23
|
+
license?: string | undefined;
|
|
24
|
+
}>>;
|
|
25
|
+
readonly name: z.ZodString;
|
|
26
|
+
readonly symbol: z.ZodString;
|
|
27
|
+
readonly contractURI: z.ZodString;
|
|
28
|
+
readonly premint: z.ZodOptional<z.ZodString>;
|
|
29
|
+
readonly networkConfig: z.ZodLiteral<"zama-ethereum">;
|
|
30
|
+
readonly wrappable: z.ZodOptional<z.ZodBoolean>;
|
|
31
|
+
readonly votes: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"blocknumber">, z.ZodLiteral<"timestamp">]>>;
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/confidential/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAexB,eAAO,MAAM,YAAY;;;;;;;;;;;CAQS,CAAC;AAEnC,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;CASQ,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.erc7984Schema = exports.commonSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const wizard_common_1 = require("@openzeppelin/wizard-common");
|
|
6
|
+
/**
|
|
7
|
+
* Static type assertions to ensure schemas satisfy the Wizard API types. Not called at runtime.
|
|
8
|
+
*/
|
|
9
|
+
function _typeAssertions() {
|
|
10
|
+
const _assertions = {
|
|
11
|
+
ERC7984: zod_1.z.object(exports.erc7984Schema).parse({}),
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
exports.commonSchema = {
|
|
15
|
+
info: zod_1.z
|
|
16
|
+
.object({
|
|
17
|
+
securityContact: zod_1.z.string().optional().describe(wizard_common_1.infoDescriptions.securityContact),
|
|
18
|
+
license: zod_1.z.string().optional().describe(wizard_common_1.infoDescriptions.license),
|
|
19
|
+
})
|
|
20
|
+
.optional()
|
|
21
|
+
.describe(wizard_common_1.infoDescriptions.info),
|
|
22
|
+
};
|
|
23
|
+
exports.erc7984Schema = {
|
|
24
|
+
name: zod_1.z.string().describe(wizard_common_1.commonDescriptions.name),
|
|
25
|
+
symbol: zod_1.z.string().describe(wizard_common_1.commonDescriptions.symbol),
|
|
26
|
+
contractURI: zod_1.z.string().describe(wizard_common_1.confidentialERC7984Descriptions.contractURI),
|
|
27
|
+
premint: zod_1.z.string().optional().describe(wizard_common_1.confidentialERC7984Descriptions.premint),
|
|
28
|
+
networkConfig: zod_1.z.literal('zama-ethereum').describe(wizard_common_1.confidentialERC7984Descriptions.networkConfig),
|
|
29
|
+
wrappable: zod_1.z.boolean().optional().describe(wizard_common_1.confidentialERC7984Descriptions.wrappable),
|
|
30
|
+
votes: zod_1.z.literal('blocknumber').or(zod_1.z.literal('timestamp')).optional().describe(wizard_common_1.confidentialERC7984Descriptions.votes),
|
|
31
|
+
...exports.commonSchema,
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../src/confidential/schemas.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,+DAAoH;AAGpH;;GAEG;AACH,SAAS,eAAe;IACtB,MAAM,WAAW,GAEb;QACF,OAAO,EAAE,OAAC,CAAC,MAAM,CAAC,qBAAa,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;KAC3C,CAAC;AACJ,CAAC;AAEY,QAAA,YAAY,GAAG;IAC1B,IAAI,EAAE,OAAC;SACJ,MAAM,CAAC;QACN,eAAe,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,gCAAgB,CAAC,eAAe,CAAC;QACjF,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,gCAAgB,CAAC,OAAO,CAAC;KAClE,CAAC;SACD,QAAQ,EAAE;SACV,QAAQ,CAAC,gCAAgB,CAAC,IAAI,CAAC;CACF,CAAC;AAEtB,QAAA,aAAa,GAAG;IAC3B,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,kCAAkB,CAAC,IAAI,CAAC;IAClD,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,kCAAkB,CAAC,MAAM,CAAC;IACtD,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,+CAA+B,CAAC,WAAW,CAAC;IAC7E,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,+CAA+B,CAAC,OAAO,CAAC;IAChF,aAAa,EAAE,OAAC,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,QAAQ,CAAC,+CAA+B,CAAC,aAAa,CAAC;IACjG,SAAS,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,+CAA+B,CAAC,SAAS,CAAC;IACrF,KAAK,EAAE,OAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,OAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,+CAA+B,CAAC,KAAK,CAAC;IACrH,GAAG,oBAAY;CACiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"erc7984.d.ts","sourceRoot":"","sources":["../../../src/confidential/tools/erc7984.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAOzF,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,SAAS,GAAG,cAAc,CA0B7E"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerConfidentialERC7984 = registerConfidentialERC7984;
|
|
4
|
+
const wizard_confidential_1 = require("@openzeppelin/wizard-confidential");
|
|
5
|
+
const utils_1 = require("../../utils");
|
|
6
|
+
const schemas_1 = require("../schemas");
|
|
7
|
+
const wizard_common_1 = require("@openzeppelin/wizard-common");
|
|
8
|
+
function registerConfidentialERC7984(server) {
|
|
9
|
+
return server.tool('erc7984', (0, utils_1.makeDetailedPrompt)(wizard_common_1.confidentialPrompts.ERC7984), schemas_1.erc7984Schema, async ({ name, symbol, contractURI, premint, networkConfig, wrappable, votes, info }) => {
|
|
10
|
+
const opts = {
|
|
11
|
+
name,
|
|
12
|
+
symbol,
|
|
13
|
+
contractURI,
|
|
14
|
+
premint,
|
|
15
|
+
networkConfig,
|
|
16
|
+
wrappable,
|
|
17
|
+
votes,
|
|
18
|
+
info,
|
|
19
|
+
};
|
|
20
|
+
return {
|
|
21
|
+
content: [
|
|
22
|
+
{
|
|
23
|
+
type: 'text',
|
|
24
|
+
text: (0, utils_1.safePrintSolidityCodeBlock)(() => wizard_confidential_1.erc7984.print(opts)),
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=erc7984.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"erc7984.js","sourceRoot":"","sources":["../../../src/confidential/tools/erc7984.ts"],"names":[],"mappings":";;AAOA,kEA0BC;AA/BD,2EAA4D;AAC5D,uCAA6E;AAC7E,wCAA2C;AAC3C,+DAAkE;AAElE,SAAgB,2BAA2B,CAAC,MAAiB;IAC3D,OAAO,MAAM,CAAC,IAAI,CAChB,SAAS,EACT,IAAA,0BAAkB,EAAC,mCAAmB,CAAC,OAAO,CAAC,EAC/C,uBAAa,EACb,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE;QACtF,MAAM,IAAI,GAAmB;YAC3B,IAAI;YACJ,MAAM;YACN,WAAW;YACX,OAAO;YACP,aAAa;YACb,SAAS;YACT,KAAK;YACL,IAAI;SACL,CAAC;QACF,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,IAAA,kCAA0B,EAAC,GAAG,EAAE,CAAC,6BAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;iBAC5D;aACF;SACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/confidential/tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAezE,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,SAAS,QAI1D"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerConfidentialTools = registerConfidentialTools;
|
|
4
|
+
const erc7984_js_1 = require("./tools/erc7984.js");
|
|
5
|
+
function getRegisterFunctions(server) {
|
|
6
|
+
return {
|
|
7
|
+
ERC7984: () => (0, erc7984_js_1.registerConfidentialERC7984)(server),
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
function registerConfidentialTools(server) {
|
|
11
|
+
Object.values(getRegisterFunctions(server)).forEach(registerTool => {
|
|
12
|
+
registerTool(server);
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/confidential/tools.ts"],"names":[],"mappings":";;AAeA,8DAIC;AAlBD,mDAAiE;AAQjE,SAAS,oBAAoB,CAAC,MAAiB;IAC7C,OAAO;QACL,OAAO,EAAE,GAAG,EAAE,CAAC,IAAA,wCAA2B,EAAC,MAAM,CAAC;KACnD,CAAC;AACJ,CAAC;AAED,SAAgB,yBAAyB,CAAC,MAAiB;IACzD,MAAM,CAAC,MAAM,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE;QACjE,YAAY,CAAC,MAAM,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AASpE,wBAAgB,YAAY,cAwB3B"}
|
package/dist/server.js
CHANGED
|
@@ -4,9 +4,10 @@ exports.createServer = createServer;
|
|
|
4
4
|
const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
|
|
5
5
|
const tools_js_1 = require("./solidity/tools.js");
|
|
6
6
|
const tools_js_2 = require("./cairo/tools.js");
|
|
7
|
-
const tools_js_3 = require("./
|
|
8
|
-
const tools_js_4 = require("./
|
|
9
|
-
const tools_js_5 = require("./
|
|
7
|
+
const tools_js_3 = require("./confidential/tools.js");
|
|
8
|
+
const tools_js_4 = require("./stellar/tools.js");
|
|
9
|
+
const tools_js_5 = require("./stylus/tools.js");
|
|
10
|
+
const tools_js_6 = require("./uniswap-hooks/tools.js");
|
|
10
11
|
const package_json_1 = require("../package.json");
|
|
11
12
|
function createServer() {
|
|
12
13
|
const server = new mcp_js_1.McpServer({
|
|
@@ -14,7 +15,7 @@ function createServer() {
|
|
|
14
15
|
version: package_json_1.version,
|
|
15
16
|
}, {
|
|
16
17
|
instructions: `\
|
|
17
|
-
Tools are provided for different smart contract languages and
|
|
18
|
+
Tools are provided for different smart contract languages and blockchain ecosystems.
|
|
18
19
|
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.
|
|
19
20
|
If the user requests to create a new smart contract, use the appropriate tool to generate the contract.
|
|
20
21
|
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.
|
|
@@ -22,9 +23,10 @@ If the user asks to modify an existing smart contract, use these tools to determ
|
|
|
22
23
|
});
|
|
23
24
|
(0, tools_js_1.registerSolidityTools)(server);
|
|
24
25
|
(0, tools_js_2.registerCairoTools)(server);
|
|
25
|
-
(0, tools_js_3.
|
|
26
|
-
(0, tools_js_4.
|
|
27
|
-
(0, tools_js_5.
|
|
26
|
+
(0, tools_js_3.registerConfidentialTools)(server);
|
|
27
|
+
(0, tools_js_4.registerStellarTools)(server);
|
|
28
|
+
(0, tools_js_5.registerStylusTools)(server);
|
|
29
|
+
(0, tools_js_6.registerUniswapHooksTools)(server);
|
|
28
30
|
return server;
|
|
29
31
|
}
|
|
30
32
|
//# sourceMappingURL=server.js.map
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";;AASA,oCAwBC;AAjCD,oEAAoE;AACpE,kDAA4D;AAC5D,+CAAsD;AACtD,sDAAoE;AACpE,iDAA0D;AAC1D,gDAAwD;AACxD,uDAAqE;AACrE,kDAA0C;AAE1C,SAAgB,YAAY;IAC1B,MAAM,MAAM,GAAG,IAAI,kBAAS,CAC1B;QACE,IAAI,EAAE,+BAA+B;QACrC,OAAO,EAAP,sBAAO;KACR,EACD;QACE,YAAY,EAAE;;;;;CAKnB;KACI,CACF,CAAC;IAEF,IAAA,gCAAqB,EAAC,MAAM,CAAC,CAAC;IAC9B,IAAA,6BAAkB,EAAC,MAAM,CAAC,CAAC;IAC3B,IAAA,oCAAyB,EAAC,MAAM,CAAC,CAAC;IAClC,IAAA,+BAAoB,EAAC,MAAM,CAAC,CAAC;IAC7B,IAAA,8BAAmB,EAAC,MAAM,CAAC,CAAC;IAC5B,IAAA,oCAAyB,EAAC,MAAM,CAAC,CAAC;IAElC,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openzeppelin/contracts-mcp",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"description": "OpenZeppelin Contracts MCP Server",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"repository": "https://github.com/OpenZeppelin/contracts-wizard",
|
|
@@ -24,11 +24,12 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@modelcontextprotocol/sdk": "^1.11.1",
|
|
27
|
-
"@openzeppelin/wizard-common": "^0.4.
|
|
28
|
-
"@openzeppelin/wizard": "^0.10.
|
|
27
|
+
"@openzeppelin/wizard-common": "^0.4.3",
|
|
28
|
+
"@openzeppelin/wizard": "^0.10.6",
|
|
29
29
|
"@openzeppelin/wizard-stylus": "^0.3.0",
|
|
30
|
-
"@openzeppelin/wizard-stellar": "^0.
|
|
30
|
+
"@openzeppelin/wizard-stellar": "^0.5.0",
|
|
31
31
|
"@openzeppelin/wizard-cairo": "^3.0.0",
|
|
32
|
+
"@openzeppelin/wizard-confidential": "^0.1.0",
|
|
32
33
|
"@openzeppelin/wizard-uniswap-hooks": "^0.1.0"
|
|
33
34
|
},
|
|
34
35
|
"devDependencies": {
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { commonDescriptions, infoDescriptions, confidentialERC7984Descriptions } from '@openzeppelin/wizard-common';
|
|
3
|
+
import type { KindedOptions } from '@openzeppelin/wizard-confidential';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Static type assertions to ensure schemas satisfy the Wizard API types. Not called at runtime.
|
|
7
|
+
*/
|
|
8
|
+
function _typeAssertions() {
|
|
9
|
+
const _assertions: {
|
|
10
|
+
[K in keyof KindedOptions]: Omit<KindedOptions[K], 'kind'>;
|
|
11
|
+
} = {
|
|
12
|
+
ERC7984: z.object(erc7984Schema).parse({}),
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const commonSchema = {
|
|
17
|
+
info: z
|
|
18
|
+
.object({
|
|
19
|
+
securityContact: z.string().optional().describe(infoDescriptions.securityContact),
|
|
20
|
+
license: z.string().optional().describe(infoDescriptions.license),
|
|
21
|
+
})
|
|
22
|
+
.optional()
|
|
23
|
+
.describe(infoDescriptions.info),
|
|
24
|
+
} as const satisfies z.ZodRawShape;
|
|
25
|
+
|
|
26
|
+
export const erc7984Schema = {
|
|
27
|
+
name: z.string().describe(commonDescriptions.name),
|
|
28
|
+
symbol: z.string().describe(commonDescriptions.symbol),
|
|
29
|
+
contractURI: z.string().describe(confidentialERC7984Descriptions.contractURI),
|
|
30
|
+
premint: z.string().optional().describe(confidentialERC7984Descriptions.premint),
|
|
31
|
+
networkConfig: z.literal('zama-ethereum').describe(confidentialERC7984Descriptions.networkConfig),
|
|
32
|
+
wrappable: z.boolean().optional().describe(confidentialERC7984Descriptions.wrappable),
|
|
33
|
+
votes: z.literal('blocknumber').or(z.literal('timestamp')).optional().describe(confidentialERC7984Descriptions.votes),
|
|
34
|
+
...commonSchema,
|
|
35
|
+
} as const satisfies z.ZodRawShape;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import type { ERC7984Options } from '@openzeppelin/wizard-confidential';
|
|
3
|
+
import { erc7984 } from '@openzeppelin/wizard-confidential';
|
|
4
|
+
import { safePrintSolidityCodeBlock, makeDetailedPrompt } from '../../utils';
|
|
5
|
+
import { erc7984Schema } from '../schemas';
|
|
6
|
+
import { confidentialPrompts } from '@openzeppelin/wizard-common';
|
|
7
|
+
|
|
8
|
+
export function registerConfidentialERC7984(server: McpServer): RegisteredTool {
|
|
9
|
+
return server.tool(
|
|
10
|
+
'erc7984',
|
|
11
|
+
makeDetailedPrompt(confidentialPrompts.ERC7984),
|
|
12
|
+
erc7984Schema,
|
|
13
|
+
async ({ name, symbol, contractURI, premint, networkConfig, wrappable, votes, info }) => {
|
|
14
|
+
const opts: ERC7984Options = {
|
|
15
|
+
name,
|
|
16
|
+
symbol,
|
|
17
|
+
contractURI,
|
|
18
|
+
premint,
|
|
19
|
+
networkConfig,
|
|
20
|
+
wrappable,
|
|
21
|
+
votes,
|
|
22
|
+
info,
|
|
23
|
+
};
|
|
24
|
+
return {
|
|
25
|
+
content: [
|
|
26
|
+
{
|
|
27
|
+
type: 'text',
|
|
28
|
+
text: safePrintSolidityCodeBlock(() => erc7984.print(opts)),
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
);
|
|
34
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { registerConfidentialERC7984 } from './tools/erc7984.js';
|
|
3
|
+
import type { KindedOptions } from '@openzeppelin/wizard-confidential';
|
|
4
|
+
import type { RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
5
|
+
|
|
6
|
+
type ConfidentialToolRegisterFunctions = {
|
|
7
|
+
[kind in keyof KindedOptions]: (server: McpServer) => RegisteredTool;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
function getRegisterFunctions(server: McpServer): ConfidentialToolRegisterFunctions {
|
|
11
|
+
return {
|
|
12
|
+
ERC7984: () => registerConfidentialERC7984(server),
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function registerConfidentialTools(server: McpServer) {
|
|
17
|
+
Object.values(getRegisterFunctions(server)).forEach(registerTool => {
|
|
18
|
+
registerTool(server);
|
|
19
|
+
});
|
|
20
|
+
}
|
package/src/server.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
2
|
import { registerSolidityTools } from './solidity/tools.js';
|
|
3
3
|
import { registerCairoTools } from './cairo/tools.js';
|
|
4
|
+
import { registerConfidentialTools } from './confidential/tools.js';
|
|
4
5
|
import { registerStellarTools } from './stellar/tools.js';
|
|
5
6
|
import { registerStylusTools } from './stylus/tools.js';
|
|
6
7
|
import { registerUniswapHooksTools } from './uniswap-hooks/tools.js';
|
|
@@ -14,7 +15,7 @@ export function createServer() {
|
|
|
14
15
|
},
|
|
15
16
|
{
|
|
16
17
|
instructions: `\
|
|
17
|
-
Tools are provided for different smart contract languages and
|
|
18
|
+
Tools are provided for different smart contract languages and blockchain ecosystems.
|
|
18
19
|
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.
|
|
19
20
|
If the user requests to create a new smart contract, use the appropriate tool to generate the contract.
|
|
20
21
|
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.
|
|
@@ -24,6 +25,7 @@ If the user asks to modify an existing smart contract, use these tools to determ
|
|
|
24
25
|
|
|
25
26
|
registerSolidityTools(server);
|
|
26
27
|
registerCairoTools(server);
|
|
28
|
+
registerConfidentialTools(server);
|
|
27
29
|
registerStellarTools(server);
|
|
28
30
|
registerStylusTools(server);
|
|
29
31
|
registerUniswapHooksTools(server);
|