Skip to main content
Glama
OpenZeppelin

OpenZeppelin Contracts MCP Server

Official
by OpenZeppelin

cairo-account

Generate custom smart contracts for Starknet or Ethereum-style accounts with configurable features like upgradeability, deployment, and signature types using OpenZeppelin Contracts libraries.

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

Implementation Reference

  • The core handler function for the 'cairo-account' tool. It constructs AccountOptions from inputs and generates Cairo code using account.print(opts) from '@openzeppelin/wizard-cairo'.
    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 for the 'cairo-account' tool, including name, type, declare, deploy, etc.
    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;
  • Function that registers the 'cairo-account' tool with the MCP server, specifying name, prompt, schema, and handler.
    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)), }, ], }; }, ); }
  • Higher-level registration function that invokes registerCairoAccount among others for all Cairo tools.
    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