MCP
Connect a coding agent to Sugar on Sui with @sugarcasino/mcp. The package includes a local stdio server, a plugin bundle and an MCP App for reviewing transactions.
By default, the server prepares transactions without signing or executing them. It can read Sugar config and game metadata, pair a browser wallet, inspect balances and coin objects, build unsigned bytes and dry-run transactions through Sui client APIs. In execute mode, it can open a wallet approval request.
You can also create a local session wallet. The server stores its key in the operating-system keychain and uses it to sign and submit transactions directly. Fund it only with the amount you are willing to delegate to the local MCP process.
GitHub: Sugar TypeScript SDKs repository
This guide covers @sugarcasino/mcp 1.0.0-beta.34 and @sugarcasino/sdk 0.1.0-beta.0. The stdio server supports MCP 2026-07-28 and older initialization-based clients. Existing MCP Apps 1.x hosts remain compatible with the bundled App.
What the MCP server does
Sugar MCP gives your coding agent the configuration and game inputs it needs to prepare transactions for a wallet or backend signer.
It can:
- Read network-aware Sugar package ids, registry ids, supported coin metadata, and price info object ids
- Describe live game parameters, required inputs, Move targets, type arguments, and integration notes
- Pair or disconnect a browser wallet through a short-lived localhost flow
- Read aggregate wallet balances and paginated coin objects
- Create, recover, inspect, and fund a persistent local session wallet
- List the Sugar NFT catalog and matching NFTs owned by an address
- Read claimable referral commission and level-up USD rewards
- Build unsigned base64 transaction bytes for supported Sugar game flows
- Build unsigned referral reward claim transactions
- Build unsigned NFT V1 mint transactions
- Build unsigned SweetHouse public-pool deposit, redeem-request, and delayed self-claim transactions
- Dry-run supported game transactions and summarize success, gas, balance changes, errors, and decoded events
- Execute with a paired wallet approval URL, then check approval status
- Execute supported game transactions directly from a funded local session wallet
- Return structured JSON payloads alongside human-readable text
- Render the Sugar Transaction Inspector in MCP App-capable hosts
It cannot:
- Access private keys from chat messages
- Approve a paired-wallet transaction without the user reviewing it in the browser wallet flow
- Execute from a session wallet unless the user has explicitly set up and funded that local wallet
- Choose an unlimited budget for a user
- Replace your production app's wallet UX, policy checks, or transaction-confirmation UI
Install
Add @sugarcasino/mcp as a local stdio server in your agent's MCP client.
The server requires Node.js ^24.0.0 || ^26.0.0.
All detected coding agents
Use add-mcp to install Sugar MCP for the coding agents it finds on your machine:
npx add-mcp @sugarcasino/mcp@latest --name sugar
Add -y to skip installer prompts, then restart or reload your MCP client.
Generic MCP config
Add the server to a JSON-based MCP config:
{
"mcpServers": {
"sugar": {
"command": "npx",
"args": ["-y", "@sugarcasino/mcp@latest"]
}
}
}
Restart or reload the MCP client after changing its config.
Codex CLI
codex mcp add sugar -- npx -y @sugarcasino/mcp@latest
Start Codex from your project and ask it to list or use the Sugar MCP tools.
Claude Code
claude mcp add sugar -- npx -y @sugarcasino/mcp@latest
Run /mcp in Claude Code to check that sugar is connected.
Cursor
Add this to .cursor/mcp.json in your project, or to your global Cursor MCP config:
{
"mcpServers": {
"sugar": {
"command": "npx",
"args": ["-y", "@sugarcasino/mcp@latest"]
}
}
}
Restart Cursor after saving the file.
VS Code and other clients
Use the same command and args in any MCP client that supports stdio servers:
- Command:
npx - Args:
["-y", "@sugarcasino/mcp@latest"]
Setup details vary by client. If the client has separate fields for name, command, and arguments, use sugar, npx, and -y @sugarcasino/mcp@latest.
For programmatic imports, install @sugarcasino/mcp from npm or jsr:@sugarcasino/mcp from JSR. createSugarMcpServer() returns an MCP SDK 2 McpServer from @modelcontextprotocol/server; startSugarMcpServer() starts the stdio server. Programmatic consumers must use MCP SDK 2 types.
Available tools
Current tools:
setup_session_walletget_session_walletfund_session_walletsugar_loginsugar_logoutget_connection_statusread_configread_game_metadatalist_nftsget_wallet_balanceslist_wallet_coinsget_execution_statusget_referral_commissionget_referral_level_up_usd_rewardsbuild_referral_commission_claim_transactionbuild_referral_level_up_usd_rewards_claim_transactionbuild_nft_v1_mint_transactionbuild_sweethouse_deposit_transactionbuild_sweethouse_redeem_request_transactionbuild_sweethouse_claim_own_redeem_request_after_delay_transactionbuild_coinflip_transactionbuild_keno_transactionbuild_limbo_transactionbuild_plinko_transactionbuild_soccer_transactionbuild_wheel_transactionbuild_range_transactionbuild_pvp_coinflip_create_transactionbuild_pvp_coinflip_join_transactionbuild_pvp_coinflip_cancel_transaction
Tools return text in content and structured data in structuredContent. Hosts with MCP Apps support can display Sugar views for configuration, live game parameters, NFTs, referral rewards and SweetHouse plans. They can also show wallet and session-wallet state, execution status and transaction details. If a known tool's input validation or handler fails, the response includes isError: true with text and structured details. Unknown tool names return JSON-RPC invalid params (-32602).
Wallet tools
sugar_login, sugar_logout, and get_connection_status manage the paired browser wallet for the selected network. Login and logout open the wallet pairing page automatically through the CLI's local browser bridge. You do not need to copy the URL into a browser.
get_wallet_balances returns aggregate balances for the paired wallet or an explicit address. For individual coin objects, use the paginated results from list_wallet_coins with either address source. Check these values before sizing a bet or funding a session wallet.
setup_session_wallet opens a local setup page to create, recover, or import one persistent session wallet. Recovery phrases and imported suiprivkey... exports stay in the local browser setup flow; they are not returned through MCP. The signing key is stored in the operating-system keychain.
get_session_wallet returns the session wallet address, formatted balances for the selected network, a funding QR code, and, when a browser wallet is paired, a prefilled funding link. fund_session_wallet opens that prefilled transfer flow so the user can choose a coin and amount, then review and sign from the paired wallet.
Command-line wallet management is also available:
npx -y @sugarcasino/mcp login --network testnet
npx -y @sugarcasino/mcp status --network testnet
npx -y @sugarcasino/mcp logout --network testnet
npx -y @sugarcasino/mcp clean
Useful environment variables:
SUGAR_MCP_BRIDGE_WEB_URLfor a custom connection-page originSUGAR_MCP_BRIDGE_TIMEOUT_MSfor login, logout, and approval bridge expirySUGAR_MCP_BRIDGE_MAX_BODY_BYTESfor maximum browser callback JSON body sizeSUGAR_MCP_SESSION_SETUP_TIMEOUT_MSfor local session-wallet setup page expiry
Read tools
read_config returns the resolved Sugar configuration for mainnet or testnet, including package ids, registry ids, supported coin metadata, and price info object ids.
read_game_metadata returns a game flow's inputs, live onchain parameters and transaction details. Call it before building a transaction to check required fields, optional fields and supported modes.
list_nfts returns the Sugar NFT V1 catalog and matching NFTs owned by an address or SuiNS name. get_referral_commission and get_referral_level_up_usd_rewards simulate the corresponding claim and return the amount currently available; a non-claimable reward returns 0.
Transaction builder tools
Transaction tools cover:
- Standard games: Coinflip, Keno, Limbo, Plinko, Soccer, Wheel, and Range
- PvP Coinflip: create, join, and cancel
- SweetHouse: public-pool deposit, redeem request, and delayed self-claim
- Referral rewards: commission and level-up USD reward claims
- NFT V1 minting
Check each tool's supported modes: read-only, build, dry-run, and execute. Game tools can execute from a session wallet; other execute flows require paired-wallet approval.
Modes
read-only: resolves config and returns the intended Move target, type arguments, required inputs, and notes.build: returns unsigned transaction bytes as base64 plus a transaction summary.dry-run: simulates the unsigned transaction and returns a JSON-safe raw dry-run result plus a stable summary.execute: opens a paired-wallet approval request by default. For game tools, passexecutionWallet: "session"to sign and submit from the funded local session wallet instead.
Dry-run summaries include success state, errors when present, gas deltas, balance changes, and decoded event fields when available.
Inputs
For build, dry-run, and paired-wallet execute, transaction owner inputs accept raw Sui addresses, SuiNS names such as name.sui, and SuiNS subnames such as sub.name.sui.
For session-wallet execution, MCP uses the local session-wallet address. In that mode, owner is optional; if supplied, it must match the selected session wallet.
stake and cashStake are currency amounts in the selected coin, not base-unit integers. For example, stake: 1 means 1 SUI or 1 USDC depending on the resolved coin type. The MCP server converts those amounts to base units before calling @sugarcasino/sdk.
metadata values must be JSON-compatible strings, numbers, or booleans. Send large integer metadata values as strings.
Optional shared transaction inputs include gasBudget in MIST and useGasCoin for native SUI coin sourcing where supported. Some game tools accept betCount; when provided for Keno, Limbo, Plinko, Range, Soccer, or Wheel, MCP reads active onchain parameters and rejects counts above the declared maximum. PvP Coinflip cancel does not accept metadata or useGasCoin.
NFT V1 minting requires owner and specId. Referral commission claims require owner and optionally coinType; referral level-up USD reward claims require owner.
Keno requires configId and a picks array of board positions. SweetHouse deposit and redeem-request tools require owner and amount; the delayed self-claim tool requires owner and requestId. amount uses the selected coin's human units, just like stake. The redeem request spends hTokens, and a delayed claim must be signed by the address that created the request.
Config
network defaults to testnet. Supported networks are mainnet and testnet. Pass providerUrl when the MCP client should use a specific Sui gRPC endpoint instead of the default network endpoint.
Optional config follows the public SDK extension override shape:
{
packageIds?: {
nftV1?: string;
referral?: string;
core?: string;
coinflip?: string;
keno?: string;
limbo?: string;
plinko?: string;
pvpCoinflip?: string;
range?: string;
soccer?: string;
wheel?: string;
};
objectIds?: {
sweetHouse?: string;
nftV1Factory?: string;
};
registryIds?: { pvpCoinflip?: string };
coins?: {
sui?: { coinType?: string; decimals?: number; priceInfoObjectId?: string };
usdc?: { coinType?: string; decimals?: number; priceInfoObjectId?: string };
};
}
Partner attribution should be passed as top-level partner. The MCP server forwards it through sugar({ partner }).
Example prompts
Once connected, you can ask your agent:
- "Use Sugar MCP to read mainnet config and tell me the supported coin types."
- "Use Sugar MCP to inspect the Coinflip transaction inputs before wiring my form."
- "Log in my testnet Sugar wallet through MCP and show the connection status."
- "Show my paired wallet balances and list my SUI coin objects."
- "Set up a local session wallet, then show me its funding QR code."
- "Build a testnet Coinflip transaction in read-only mode for owner
0x..., SUI, stake1, and heads." - "Dry-run a testnet Plinko transaction for owner
0x...with SUI stake0.1and summarize any errors." - "Execute a tiny testnet Coinflip with my paired wallet and give me the approval URL."
- "Use my funded session wallet to execute a testnet Coinflip, then return the digest."
- "Show the Sugar NFTs owned by
name.sui." - "Build an NFT V1 mint transaction for spec
0x...in read-only mode." - "Check the referral commission available for
name.sui, then build the claim in read-only mode." - "Use Sugar MCP to get PvP Coinflip metadata, then show me the fields needed to create a lobby."
- "Read the current Keno limits, then build a testnet Keno bet with config
0and picks[1, 7, 12, 20]." - "Inspect a SweetHouse public-pool deposit in read-only mode before I choose an amount."
For build and dry-run, pass a real owner address or resolvable SuiNS name. For dry-run, the owner must have enough funds and the selected network must have live Sugar config.
Agent Skills
Install skills from SugarCasino/agent-skills to give your agent more detailed instructions. The sugar-mcp skill covers installation, configuration, use and troubleshooting for the server and MCP App.
Browse available skills:
npx skills list SugarCasino/agent-skills --list
Install a specific skill:
npx skills add SugarCasino/agent-skills --skill sugar-mcp
Install all skills:
npx skills add SugarCasino/agent-skills
Boundaries
- Transaction builder inputs do not expose coin object ids or explicit coin sourcing.
list_nfts, wallet reads, session-wallet reads, connection status, execution status, and referral reward reads are read-only.- Referral claim and NFT mint builders return transactions for review and never claim or mint by themselves in
read-only,build, ordry-run. - PvP Coinflip join may need live object reads when serialized or dry-run, because the SDK resolves the current game stake from the game object.
- Use
@sugarcasino/sdkdirectly to handle signing, execution or a custom wallet interface in your app.
Security notes
- Verify that the server command points to the official package:
@sugarcasino/mcpfrom github.com/SugarCasino/ts-sdks. - Keep human review enabled for any workflow that later signs or executes the transaction bytes produced by MCP.
- Use session wallets only with limited funds you are willing to delegate to the local MCP process.
- Enter session-wallet recovery phrases and private-key exports only on the local setup page. Keep them out of MCP chats.
- A dry-run simulates the transaction against current onchain state. If that state changes before signing, execution can still fail.
- Do not paste private keys, seed phrases, or signing credentials into an MCP chat. Sugar MCP does not need them.