stellar-fungible
Generate fungible token contracts compatible with SEP-41, similar to ERC-20, using OpenZeppelin Contracts. Customize token properties like burnable, pausable, and upgradeable features. Returns Markdown-formatted source code without saving to disk.
Instructions
Make a fungible token per the Fungible Token Standard, compatible with SEP-41, similar to ERC-20.
Returns the source code of the generated contract, formatted in a Markdown code block. Does not write to disk.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| access | No | The 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. | |
| burnable | No | Whether token holders will be able to destroy their tokens | |
| info | No | Metadata about the contract and author | |
| mintable | No | Whether privileged accounts will be able to create more supply or emit more tokens | |
| name | Yes | The name of the contract | |
| pausable | No | Whether privileged accounts will be able to pause specifically marked functionality. Useful for emergency response. | |
| premint | No | The number of tokens to premint for the deployer. | |
| symbol | Yes | The short symbol for the token | |
| upgradeable | No | Whether the contract can be upgraded. |
Implementation Reference
- The handler function for the 'stellar-fungible' tool. It takes input parameters, constructs FungibleOptions, and returns Rust code generated by fungible.print(opts) wrapped in a safePrintRustCodeBlock.async ({ name, symbol, burnable, pausable, premint, mintable, upgradeable, access, info }) => { const opts: FungibleOptions = { name, symbol, burnable, pausable, premint, mintable, upgradeable, access, info, }; return { content: [ { type: 'text', text: safePrintRustCodeBlock(() => fungible.print(opts)), }, ], }; },
- Zod schema defining the input parameters for the 'stellar-fungible' tool, including name, symbol, and various optional features.export const fungibleSchema = { name: z.string().describe(commonDescriptions.name), symbol: z.string().describe(commonDescriptions.symbol), burnable: z.boolean().optional().describe(commonDescriptions.burnable), pausable: z.boolean().optional().describe(commonDescriptions.pausable), premint: z.string().optional().describe(stellarFungibleDescriptions.premint), mintable: z.boolean().optional().describe(commonDescriptions.mintable), ...commonSchema, } as const satisfies z.ZodRawShape;
- packages/mcp/src/stellar/tools/fungible.ts:8-35 (registration)The registration function for the 'stellar-fungible' tool, called with an MCP server to register the tool, its prompt, schema, and handler.export function registerStellarFungible(server: McpServer): RegisteredTool { return server.tool( 'stellar-fungible', makeDetailedPrompt(stellarPrompts.Fungible), fungibleSchema, async ({ name, symbol, burnable, pausable, premint, mintable, upgradeable, access, info }) => { const opts: FungibleOptions = { name, symbol, burnable, pausable, premint, mintable, upgradeable, access, info, }; return { content: [ { type: 'text', text: safePrintRustCodeBlock(() => fungible.print(opts)), }, ], }; }, ); }
- packages/mcp/src/stellar/tools.ts:20-24 (registration)Higher-level registration function that registers all Stellar tools, including 'stellar-fungible' via registerStellarFungible.export function registerStellarTools(server: McpServer) { Object.values(getRegisterFunctions(server)).forEach(registerTool => { registerTool(server); }); }
- packages/mcp/src/stellar/tools.ts:14-14 (registration)Maps 'Fungible' kind to the registerStellarFungible function call.Fungible: () => registerStellarFungible(server),