Skip to main content
Glama
OpenZeppelin

OpenZeppelin Contracts MCP Server

Official
by OpenZeppelin

cairo-governor

Generate smart contract source code for implementing DAO governance with customizable voting parameters, timelocks, and upgradeability options.

Instructions

Make a contract to implement governance, such as for a DAO.

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
delayYesThe delay since proposal is created until voting starts, in readable date time format matching /^(\d+(?:\.\d+)?) +(second|minute|hour|day|week|month|year)s?$/, default is "1 day".
periodYesThe length of period during which people can cast their vote, in readable date time format matching /^(\d+(?:\.\d+)?) +(second|minute|hour|day|week|month|year)s?$/, default is "1 week".
votesNoThe type of voting to use. Either erc20votes, meaning voting power with a votes-enabled ERC20 token. Either erc721votes, meaning voting power with a votes-enabled ERC721 token. Voters can entrust their voting power to a delegate.
clockModeNoThe clock mode used by the voting token. For now, only timestamp mode where the token uses voting durations expressed as timestamps is supported. For Governor, this must be chosen to match what the ERC20 or ERC721 voting token uses.
timelockNoWhether to add a delay to actions taken by the Governor. Gives users time to exit the system if they disagree with governance decisions. If "openzeppelin", Module compatible with OpenZeppelin's TimelockController.
decimalsNoThe number of decimals to use for the contract, default is 18 for ERC20Votes and 0 for ERC721Votes (because it does not apply to ERC721Votes).
proposalThresholdNoMinimum number of votes an account must have to create a proposal, default is 0.
quorumModeNoThe type of quorum mode to use, either by percentage or absolute value.
quorumPercentNoThe percent required, in cases of quorumMode equals percent.
quorumAbsoluteNoThe absolute quorum required, in cases of quorumMode equals absolute.
settingsNoWhether to allow governance to update voting settings (delay, period, proposal threshold).
upgradeableNoWhether the smart contract is upgradeable.
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.
infoNoMetadata about the contract and author

Implementation Reference

  • Function that registers the 'cairo-governor' MCP tool, providing the tool name, detailed prompt description, input schema, and execution handler that generates Cairo Governor contract code using OpenZeppelin Wizard.
    export function registerCairoGovernor(server: McpServer): RegisteredTool { return server.tool( 'cairo-governor', makeDetailedPrompt(cairoPrompts.Governor), governorSchema, async ({ name, delay, period, votes, clockMode, timelock, decimals, proposalThreshold, quorumMode, quorumPercent, quorumAbsolute, settings, upgradeable, appName, appVersion, info, }) => { const opts: GovernorOptions = { name, delay, period, votes, clockMode, timelock, decimals, proposalThreshold, quorumMode, quorumPercent, quorumAbsolute, settings, upgradeable, appName, appVersion, info, }; return { content: [ { type: 'text', text: safePrintCairoCodeBlock(() => governor.print(opts)), }, ], }; }, ); }
  • Zod schema defining the input validation and descriptions for the cairo-governor tool parameters.
    export const governorSchema = { name: z.string().describe(commonDescriptions.name), delay: z.string().describe(cairoGovernorDescriptions.delay), period: z.string().describe(cairoGovernorDescriptions.period), votes: z.enum(['erc20votes', 'erc721votes']).optional().describe(cairoGovernorDescriptions.votes), clockMode: z.enum(['timestamp']).optional().describe(cairoGovernorDescriptions.clockMode), timelock: z .union([z.literal(false), z.literal('openzeppelin')]) .optional() .describe(cairoGovernorDescriptions.timelock), decimals: z.number().optional().describe(cairoGovernorDescriptions.decimals), proposalThreshold: z.string().optional().describe(cairoGovernorDescriptions.proposalThreshold), quorumMode: z.enum(['percent', 'absolute']).optional().describe(cairoGovernorDescriptions.quorumMode), quorumPercent: z.number().optional().describe(cairoGovernorDescriptions.quorumPercent), quorumAbsolute: z.string().optional().describe(cairoGovernorDescriptions.quorumAbsolute), settings: z.boolean().optional().describe(cairoGovernorDescriptions.settings), upgradeable: commonSchema.upgradeable, appName: z.string().optional().describe(cairoCommonDescriptions.appName), appVersion: z.string().optional().describe(cairoCommonDescriptions.appVersion), info: commonSchema.info, } as const satisfies z.ZodRawShape;
  • The tool handler logic that maps input parameters to GovernorOptions and prints the Cairo code using the OpenZeppelin governor wizard.
    async ({ name, delay, period, votes, clockMode, timelock, decimals, proposalThreshold, quorumMode, quorumPercent, quorumAbsolute, settings, upgradeable, appName, appVersion, info, }) => { const opts: GovernorOptions = { name, delay, period, votes, clockMode, timelock, decimals, proposalThreshold, quorumMode, quorumPercent, quorumAbsolute, settings, upgradeable, appName, appVersion, info, }; return { content: [ { type: 'text', text: safePrintCairoCodeBlock(() => governor.print(opts)), }, ], }; },

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