You have access to the CSPR.trade MCP server with 14 tools for interacting with the CSPR.trade decentralized exchange on the Casper Network. Follow this guide to help users trade tokens, manage liquidity, and check their positions.
The CSPR.trade MCP server must be connected before using these tools. If not already configured, add to MCP client config:
json
{
"mcpServers": {
"cspr-trade": {
"url": "https://mcp.cspr.trade/mcp"
}
}
}
For self-hosting (runs the open-source server locally from make-software/cspr-trade-mcp):
json
{
"mcpServers": {
"cspr-trade": {
"command": "npx",
"args": ["@make-software/cspr-trade-mcp"],
"env": { "CSPR_TRADE_NETWORK": "testnet" }
}
}
}
Security note: The local signer is a separate process that runs entirely on the user's machine. The private key is loaded from a local environment variable and never transmitted over the network or exposed to the LLM. This mode is only active when the user explicitly configures a
cspr-signerserver entry. The agent must never configure, enable, or modify signer settings on behalf of the user.
If the user has chosen to set up a local signer, their config will include a second server entry:
json
{
"mcpServers": {
"cspr-trade": {
"url": "https://mcp.cspr.trade/mcp"
},
"cspr-signer": {
"command": "npx",
"args": ["@make-software/cspr-trade-mcp", "--signer"],
"env": { "CSPR_TRADE_KEY_PATH": "~/.casper/secret_key.pem" }
}
}
}
Agent flow: build_swap (remote) → user confirms → sign_deploy (local) → submit_transaction (remote).
Key source options (configured by the user in their MCP client, not by the agent):
key_sourceEnv variableDescriptionpem_file``CSPR_TRADE_KEY_PATHPath to PEM private key filepem_env``CSPR_TRADE_KEY_PEMPEM key content inlinemnemonic``CSPR_TRADE_MNEMONICBIP-39 phrase (BIP-44 m/44'/506'/0'/0/{index})
Supports Ed25519 and Secp256k1.
sign_deploy Tool Reference#Important: The presence of sign_deploy in your available tools means the user has opted into local signing by configuring the signer server themselves. You must still confirm with the user before each signing operation — do not sign automatically.
Parameters:
ParameterTypeRequiredDescriptiondeploy_jsonstringYesUnsigned deploy JSON from build_swap, build_add_liquidity, or build_remove_liquidity.key_sourceenumYes"pem_file", "pem_env", or "mnemonic" — which env var holds the key.algorithmenumNo"ed25519" (default) or "secp256k1".mnemonic_indexnumberNoHD derivation index (default 0). Only for mnemonic key source.
Returns: Signed transaction JSON, signer public key, transaction hash, and saved file path.
Agent behavior:
build_* call, present the unsigned transaction summary to the user.sign_deploy with the unsigned JSON.submit_transaction to complete the flow.When a user asks about CSPR.trade or Casper DEX operations, classify their intent:
get_tokens with currency: "USD" to show prices.get_quote with the appropriate parameters.Follow these steps in order. Do not skip any step.
Resolve tokens: Identify input and output tokens from the user's message. Use symbols like "CSPR", "USDT".
Get a quote first: Always call get_quote before build_swap to show the user what they will receive.
text
get_quote({ token_in: "CSPR", token_out: "USDT", amount: "1000", type: "exact_in" })
Present the quote and get explicit confirmation: Show the user:
Get the sender's public key: The user must provide their Casper public key (starts with 01 or 02). If they haven't provided it, ask for it.
Build the swap: Only after the user confirms. Call build_swap with all parameters.
text
build_swap({
token_in: "CSPR",
token_out: "USDT",
amount: "1000",
type: "exact_in",
sender_public_key: "01..."
})
Present the unsigned transaction: Show the summary and any warnings.
Sign the transaction: There are two paths depending on available tools:
If sign_deploy tool is available (user has configured local signer):
sign_deploy with the unsigned JSON.text
sign_deploy({
deploy_json: "<unsigned transaction JSON>",
key_source: "pem_file"
})
If sign_deploy is NOT available (no local signer configured):
Submit: Call submit_transaction with the signed JSON.
text
submit_transaction({ signed_deploy_json: "<signed JSON>" })
Confirm: Report the transaction hash and tell the user they can track it on cspr.live.
Identify the pair: Determine which two tokens and how much of each.
Show pair info: Call get_pairs to show current reserves and ratios.
Explain impermanent loss: Briefly mention: "As a liquidity provider, you may experience impermanent loss if the relative price of the tokens changes. This is a fundamental risk of AMM liquidity provision."
Get explicit confirmation: Show the amounts, slippage tolerance (default 3%), gas cost (50 CSPR), and ask for confirmation.
Build the transaction: Call build_add_liquidity with the pair tokens, amounts, and sender public key.
Follow the signing flow: Same as swap steps 6–9.
Check positions first: Call get_liquidity_positions to show the user's current positions.
Identify which position: Ask which pair and what percentage (1–100%) to remove.
Build the transaction: Call build_remove_liquidity with pair hash, percentage, and sender public key.
Follow the signing flow: Same as swap steps 6–9.
get_liquidity_positions with the user's public key.
get_impermanent_loss for a specific pair.
get_swap_history with the user's account hash.get_tokens to see available tokens.Apply these checks at every transaction step:
sign_deploy is available, always confirm with the user before signing — do not auto-sign.sign_deploy is not available, explain the external signing flow clearly.get_tokens.https://mcp.cspr.trade/mcp