Skip to main content
Glama

Rootstock MCP Server

by cuongpo

mint_tokens

Mint ERC20 tokens on Rootstock by specifying the token contract address, recipient, and amount. Optional gas limit and price parameters available. Works with mintable tokens only.

Instructions

Mint tokens (only for mintable tokens)

Input Schema

NameRequiredDescriptionDefault
amountYesAmount of tokens to mint
gasLimitNoOptional gas limit
gasPriceNoOptional gas price
toYesAddress to mint tokens to
tokenAddressYesERC20 token contract address

Input Schema (JSON Schema)

{ "properties": { "amount": { "description": "Amount of tokens to mint", "type": "string" }, "gasLimit": { "description": "Optional gas limit", "type": "string" }, "gasPrice": { "description": "Optional gas price", "type": "string" }, "to": { "description": "Address to mint tokens to", "type": "string" }, "tokenAddress": { "description": "ERC20 token contract address", "type": "string" } }, "required": [ "tokenAddress", "to", "amount" ], "type": "object" }

Implementation Reference

  • MCP tool handler for 'mint_tokens': retrieves current wallet, calls rootstockClient.mintTokens with parameters, formats success/error response with explorer links.
    private async handleMintTokens(params: MintTokensParams) { try { const wallet = this.walletManager.getCurrentWallet(); const result = await this.rootstockClient.mintTokens( wallet, params.tokenAddress, params.to, params.amount, params.gasLimit, params.gasPrice ); const explorerUrl = this.rootstockClient.getExplorerUrl(); const txExplorerLink = `${explorerUrl}/tx/${result.hash}`; const contractExplorerLink = `${explorerUrl}/address/${params.tokenAddress}`; return { content: [ { type: 'text', text: `Tokens Minted Successfully!\n\nTransaction Hash: ${result.hash}\nTransaction Explorer: ${txExplorerLink}\n\nToken Contract: ${params.tokenAddress}\nContract Explorer: ${contractExplorerLink}\n\nMint Details:\nMinted To: ${params.to}\nAmount: ${params.amount}\nStatus: ${result.status}\nGas Used: ${result.gasUsed}`, }, ], }; } catch (error) { throw new Error(`Failed to mint tokens: ${error}`); } }
  • Blockchain interaction helper: connects wallet to provider, creates ERC20 contract instance, calls mint(to, amount), waits for receipt, returns transaction details.
    async mintTokens( wallet: ethers.Wallet | ethers.HDNodeWallet, tokenAddress: string, to: string, amount: string, gasLimit?: string, gasPrice?: string ): Promise<TransactionResponse> { try { const connectedWallet = wallet.connect(this.getProvider()); const tokenContract = new ethers.Contract( tokenAddress, this.getMintableERC20ABI(), connectedWallet ); // Get token decimals const decimals = await tokenContract.decimals(); const parsedAmount = ethers.parseUnits(amount, decimals); const tx = await tokenContract.mint(to, parsedAmount, { gasLimit: gasLimit ? BigInt(gasLimit) : undefined, gasPrice: gasPrice ? BigInt(gasPrice) : undefined, }); const receipt = await tx.wait(); return { hash: tx.hash, from: wallet.address, to: tokenAddress, value: amount, gasUsed: receipt?.gasUsed.toString(), gasPrice: tx.gasPrice?.toString(), blockNumber: receipt?.blockNumber, blockHash: receipt?.blockHash, status: receipt?.status === 1 ? 'confirmed' : 'failed', }; } catch (error) { throw new Error(`Failed to mint tokens: ${error}`); } }
  • TypeScript interface defining input parameters for mint_tokens tool.
    export interface MintTokensParams { tokenAddress: string; to: string; amount: string; gasLimit?: string; gasPrice?: string; }
  • src/index.ts:458-487 (registration)
    Tool registration in MCP server's getAvailableTools(): defines name, description, and JSON inputSchema for validation.
    { name: 'mint_tokens', description: 'Mint tokens (only for mintable tokens)', inputSchema: { type: 'object', properties: { tokenAddress: { type: 'string', description: 'ERC20 token contract address', }, to: { type: 'string', description: 'Address to mint tokens to', }, amount: { type: 'string', description: 'Amount of tokens to mint', }, gasLimit: { type: 'string', description: 'Optional gas limit', }, gasPrice: { type: 'string', description: 'Optional gas price', }, }, required: ['tokenAddress', 'to', 'amount'], }, },

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/cuongpo/rootstock-mcp'

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