Skip to main content
Glama
OpenZeppelin

OpenZeppelin Contracts MCP Server

Official
by OpenZeppelin

cairo-erc721

Generate ERC-721 compliant non-fungible token contracts using OpenZeppelin Contracts. Input name, symbol, and optional features like burnable, pausable, or royalty tracking. Outputs contract code in Markdown format.

Instructions

Make a non-fungible token per the ERC-721 standard.

Returns the source code of the generated contract, formatted in a Markdown code block. Does not write to disk.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
accessNoThe type of access control to provision. Ownable is a simple mechanism with a single account authorized for all privileged actions. Roles is a flexible mechanism with a separate role for each privileged action. A role can have many authorized accounts.
appNameNoRequired when votes is enabled, for hashing and signing typed structured data. Name for domain separator implementing SNIP12Metadata trait. Prevents two applications from producing the same hash.
appVersionNoRequired when votes is enabled, for hashing and signing typed structured data. Version for domain separator implementing SNIP12Metadata trait. Prevents two versions of the same application from producing the same hash.
baseUriNoA base uri for the non-fungible token.
burnableNoWhether token holders will be able to destroy their tokens
enumerableNoWhether to allow on-chain enumeration of all tokens or those owned by an account. Increases gas cost of transfers.
infoNoMetadata about the contract and author
mintableNoWhether privileged accounts will be able to create more supply or emit more tokens
nameYesThe name of the contract
pausableNoWhether privileged accounts will be able to pause specifically marked functionality. Useful for emergency response.
royaltyInfoNoProvides information for how much royalty is owed and to whom, based on a sale price. Follows ERC-2981 standard.
symbolYesThe short symbol for the token
upgradeableNoWhether the smart contract is upgradeable.
votesNoWhether to keep track of individual units for voting in on-chain governance. Voting durations can be expressed as block numbers or timestamps.

Implementation Reference

  • The handler function for the 'cairo-erc721' tool. It takes input options, constructs ERC721Options, generates the Cairo contract code using the OpenZeppelin Wizard's erc721.print method, wraps it in a safe code block, and returns it as tool output.
    async ({ name, symbol, baseUri, burnable, pausable, mintable, enumerable, votes, royaltyInfo, appName, appVersion, access, upgradeable, info, }) => { const opts: ERC721Options = { name, symbol, baseUri, burnable, pausable, mintable, enumerable, votes, royaltyInfo, appName, appVersion, access, upgradeable, info, }; return { content: [ { type: 'text', text: safePrintCairoCodeBlock(() => erc721.print(opts)), }, ], }; },
  • Zod schema defining the input shape and descriptions for the 'cairo-erc721' tool parameters.
    export const erc721Schema = { name: z.string().describe(commonDescriptions.name), symbol: z.string().describe(commonDescriptions.symbol), baseUri: z.string().optional().describe(cairoERC721Descriptions.baseUri), burnable: z.boolean().optional().describe(commonDescriptions.burnable), pausable: z.boolean().optional().describe(commonDescriptions.pausable), mintable: z.boolean().optional().describe(commonDescriptions.mintable), enumerable: z.boolean().optional().describe(cairoERC721Descriptions.enumerable), votes: z.boolean().optional().describe(cairoERC721Descriptions.votes), royaltyInfo: z .object({ enabled: z.boolean().describe(cairoRoyaltyInfoDescriptions.enabled), defaultRoyaltyFraction: z.string().describe(cairoRoyaltyInfoDescriptions.defaultRoyaltyFraction), feeDenominator: z.string().describe(cairoRoyaltyInfoDescriptions.feeDenominator), }) .optional() .describe(cairoCommonDescriptions.royaltyInfo), appName: z.string().optional().describe(cairoCommonDescriptions.appName), appVersion: z.string().optional().describe(cairoCommonDescriptions.appVersion), ...commonSchema, } as const satisfies z.ZodRawShape;
  • Registers the 'cairo-erc721' tool on the MCP server using server.tool with the tool name, detailed prompt, schema, and handler function.
    export function registerCairoERC721(server: McpServer): RegisteredTool { return server.tool( 'cairo-erc721', makeDetailedPrompt(cairoPrompts.ERC721), erc721Schema, async ({ name, symbol, baseUri, burnable, pausable, mintable, enumerable, votes, royaltyInfo, appName, appVersion, access, upgradeable, info, }) => { const opts: ERC721Options = { name, symbol, baseUri, burnable, pausable, mintable, enumerable, votes, royaltyInfo, appName, appVersion, access, upgradeable, info, }; return { content: [ { type: 'text', text: safePrintCairoCodeBlock(() => erc721.print(opts)), }, ], }; }, ); }
  • Helper function used in the handler to safely print the generated Cairo code in a Markdown block or error message if generation fails.
    export function safePrintCairoCodeBlock(printFn: () => string): string { return safePrintCodeBlock(printFn, 'cairo'); }
  • Top-level registration function for all Cairo tools, which calls registerCairoERC721 among others.
    export function registerCairoTools(server: McpServer) { Object.values(getRegisterFunctions(server)).forEach(registerTool => { registerTool(server); }); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/OpenZeppelin/contracts-wizard'

If you have feedback or need assistance with the MCP directory API, please join our Discord server