Starknet NFT Minting Guide for MCP
Overview
This document describes the complete process of minting NFTs on the Starknet blockchain using MCP (Model Context Protocol) tools. The process involves several steps that must be executed in a specific order to successfully create and mint NFTs.
📋 Prerequisites: Before using these tools, make sure you have set up MCP integration with your API key.
Process Flow
MCP Tools
1. Deploy Collection
Tool: starknet-deploy-collection
Description: Deploy a collection. As a result of executing this command, you will receive a transaction that needs to be signed and sent to the blockchain.
Input data:
{
name: string, // Collection name
symbol: string, // Collection symbol
description: string, // Description
image: string, // Collection image URL
image_url: string, // Alternative image URL
banner_image_url: string, // Banner URL
external_link: string, // External link
royalty_fraction: string, // Royalty (e.g., "600" = 6%)
transferrable: boolean, // Whether NFT can be transferred
max_total_supply: string, // Maximum NFT count
mint_price: string, // Mint price in wei
whitelisted_mint_price: string, // Whitelist price
collection_expires: string, // Expiration date (timestamp)
referral_code: string, // Referral code
payment_token: "STRK"|"ETH"|"USDC" // Payment token
}
Output data:
{
calls: [
{
contractAddress: string,
entrypoint: string,
calldata: any[]
}
]
}
2. Approve Payment Token (Required before Mint)
⚠️ Important: Before minting NFTs, you must approve the collection contract to spend the required amount of payment tokens on your behalf.
Implementation:
// Example: approve 1000000000000000000 wei (1 token)
const approveCall = {
contractAddress:
"0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d", // STRK token
entrypoint: "approve",
calldata: [
collection_address, // spender
"1000000000000000000", // amount
"0", // high part
],
};
await account.execute([approveCall]);
3. Mint NFT
Tool: starknet-mint-nft
Description: Mint an NFT. As a result of executing this command, you will receive a transaction that needs to be signed and sent to the blockchain.
Input data:
{
collection_address: string, // Created collection address
receiver: string, // NFT receiver address
items: [
{
name: string, // NFT name
description: string, // NFT description
price: number, // Price in wei
quantity: number, // Number of copies
image?: string, // NFT image URL
externalUrl?: string, // External link
animation_url?: string, // Animation URL
attributes?: [ // NFT attributes
{
trait_type: string,
value: string
}
]
}
]
}
Output data:
{
calls: [
{
contractAddress: string,
entrypoint: string,
calldata: any[]
}
]
}
Usage
// 1. Deploy collection using MCP tool
const deployResult = await mcp.callTool("deploy-collection", {
data: collectionData,
});
const { calls } = deployResult.content[0].text; // Extract calls from MCP response
// On frontend: account.execute(calls)
// From receipt: collection_address = receipt.events[0].from_address
// 2. Before minting: Approve payment token
const totalAmount = mintData.items
.reduce(
(sum, item) => sum + BigInt(item.price) * BigInt(item.quantity),
BigInt(0)
)
.toString();
const tokenAddress = {
STRK: "0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d",
ETH: "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",
USDC: "0x053c91253bc9682c04929ca02ed00b3e423f6710d2ee7e0d5ebb06f3ecf368a8",
}[paymentToken]; // Use the same payment token as in collection
const approveCall = {
contractAddress: tokenAddress,
entrypoint: "approve",
calldata: [collection_address, totalAmount, "0"],
};
// Execute approve transaction
await account.execute([approveCall]);
// 3. Mint NFT using MCP tool
const mintResult = await mcp.callTool("mint-nft", {
data: mintData,
});
const { calls } = mintResult.content[0].text; // Extract calls from MCP response
// On frontend: account.execute(calls)
Errors
MCP tools return errors in the standard MCP error format when operations fail.