Skip to main content
Glama
OpenZeppelin

OpenZeppelin Contracts MCP Server

Official
by OpenZeppelin

cairo-account

Generate custom smart contract code for Starknet or Ethereum-flavored accounts that validate transactions, execute interactions, and support features like upgradeability and external execution.

Instructions

Make a custom smart contract that represents an account that can be deployed and interacted with other contracts, and can be extended to implement custom logic. An account is a special type of contract that is used to validate and execute transactions.

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesThe name of the contract
typeYesType of signature used for signature checking by the Account contract, Starknet account uses the STARK curve, Ethereum-flavored account uses the Secp256k1 curve.
declareNoWhether to enable the account to declare other contract classes.
deployNoWhether to enables the account to be counterfactually deployed.
pubkeyNoWhether to enables the account to change its own public key.
outsideExecutionNoWhether to allow a protocol to submit transactions on behalf of the account, as long as it has the relevant signatures.
upgradeableNoWhether the smart contract is upgradeable.
infoNoMetadata about the contract and author

Implementation Reference

  • The core handler function for the 'cairo-account' tool. It receives input parameters, constructs AccountOptions, calls the external account.print(opts) to generate Cairo code, formats it safely, and returns it as text content.
    async ({ name, type, declare, deploy, pubkey, outsideExecution, upgradeable, info }) => { const opts: AccountOptions = { name, type, declare, deploy, pubkey, outsideExecution, upgradeable, info, }; return { content: [ { type: 'text', text: safePrintCairoCodeBlock(() => account.print(opts)), }, ], }; },
  • Zod schema defining the input parameters and validation for the 'cairo-account' tool.
    export const accountSchema = { name: z.string().describe(commonDescriptions.name), type: z.enum(['stark', 'eth']).describe(cairoAccountDescriptions.type), declare: z.boolean().optional().describe(cairoAccountDescriptions.declare), deploy: z.boolean().optional().describe(cairoAccountDescriptions.deploy), pubkey: z.boolean().optional().describe(cairoAccountDescriptions.pubkey), outsideExecution: z.boolean().optional().describe(cairoAccountDescriptions.outsideExecution), upgradeable: commonSchema.upgradeable, info: commonSchema.info, } as const satisfies z.ZodRawShape;
  • Registration of the 'cairo-account' tool via server.tool(), specifying name, prompt generator, schema, and handler function.
    export function registerCairoAccount(server: McpServer): RegisteredTool { return server.tool( 'cairo-account', makeDetailedPrompt(cairoPrompts.Account), accountSchema, async ({ name, type, declare, deploy, pubkey, outsideExecution, upgradeable, info }) => { const opts: AccountOptions = { name, type, declare, deploy, pubkey, outsideExecution, upgradeable, info, }; return { content: [ { type: 'text', text: safePrintCairoCodeBlock(() => account.print(opts)), }, ], }; }, ); }
  • In getRegisterFunctions, the 'Account' entry that triggers registration of 'cairo-account' tool when registerCairoTools is called.
    function getRegisterFunctions(server: McpServer): CairoToolRegisterFunctions { return { ERC20: () => registerCairoERC20(server), ERC721: () => registerCairoERC721(server), ERC1155: () => registerCairoERC1155(server), Account: () => registerCairoAccount(server), Multisig: () => registerCairoMultisig(server), Governor: () => registerCairoGovernor(server), Vesting: () => registerCairoVesting(server), Custom: () => registerCairoCustom(server),
  • Top-level call to registerCairoTools in createServer(), which registers all Cairo tools including 'cairo-account'.
    registerCairoTools(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