MAIN MCP
MAIN MCPサーバー
Base上のMAIN DEX用MCP (Model Context Protocol) サーバー。AIエージェント(Claude、Cursorなど)がプロトコルと対話するためのツールを提供します:トークンのスワップ、流動性の管理、ALM戦略への参加・離脱など。
Claudeへの接続
Claude Code:
claude mcp add main-mcp --transport http https://api.main.exchange/mcpMCPプロトコル
本サーバーは、Streamable HTTPトランスポート上でMCP spec 2025-03-26を実装しています。
# Initialize
curl -s -X POST https://api.main.exchange/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"test","version":"1.0.0"}}}'
# List tools
curl -s -X POST https://api.main.exchange/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' \
| jq '.result.tools[] | {name, description}'
# Health
curl https://api.main.exchange/mcp/healthx402決済
一部のツールでは、x402プロトコルを介したUSDC決済が必要です。有料ツールが決済なしで呼び出された場合、サーバーは決済要件(金額、受取人、ネットワーク)を含むJSON-RPCエラーを返します。x402互換クライアントはこれを自動的に処理します。
有料ツール: createPool, launchToken
ツール
トークン
getTokens — 取引高順にソートされたプロトコル内の全トークンを取得します。
curl -s -X POST https://api.main.exchange/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"getTokens","arguments":{}}}' \
| jq '.result.content[0].text | fromjson'approveTokens — ERC20の承認トランザクションを準備します。
curl -s -X POST https://api.main.exchange/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"approveTokens","arguments":{"tokenAddress":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","spenderAddress":"0x002E67c3F7BF96eB3aA4066073923e415581d385"}}}' \
| jq '.result.content[0].text | fromjson'launchToken (x402経由で有料) — MAIN上で新しいERC-20トークンをローンチします。TokenFactory.createToken用のcalldataを返します。ロゴとバナーは事前にIPFSにアップロードしておく必要があります(ツール説明内のIPFSアップロードエンドポイントを参照)。すべてのトークンデータは作成後に変更できません。
curl -s -X POST https://api.main.exchange/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"launchToken","arguments":{"name":"My Token","symbol":"MTK","totalSupply":"10000000","logo":"bafkreibgxsqxrkrha3oqoatypp4gpuemft47ablrgxkfucqn2rvhsdwaka","description":"A cool token","website":"https://example.com"}}}' \
| jq '.result.content[0].text | fromjson'取引
getPrice — スワップの見積もりを取得します:指定したtokenInの量に対して、どれだけのtokenOutが得られるか。
curl -s -X POST https://api.main.exchange/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"getPrice","arguments":{"amount":"1000000000000000000","tokenIn":"0x4200000000000000000000000000000000000006","tokenOut":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"}}}' \
| jq '.result.content[0].text | fromjson'quoteSwap — SwapRouter経由で実行するためのcalldataを含む完全なスワップ見積もりを取得します。
curl -s -X POST https://api.main.exchange/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"quoteSwap","arguments":{"amountIn":"1000000","tokenIn":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","tokenOut":"0x4200000000000000000000000000000000000006","recipient":"0xYOUR_ADDRESS"}}}' \
| jq '.result.content[0].text | fromjson'プール
getPools — TVL、取引高、手数料を含む流動性プールを取得します。
curl -s -X POST https://api.main.exchange/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"getPools","arguments":{}}}' \
| jq '.result.content[0].text | fromjson'getPoolAPR — プールのAPRを取得します(全プールまたは特定のプール)。
curl -s -X POST https://api.main.exchange/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"getPoolAPR","arguments":{}}}' \
| jq '.result.content[0].text | fromjson'addLiquidityToPool — Algebraプールに流動性を追加するためのトランザクションを準備します。
curl -s -X POST https://api.main.exchange/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"addLiquidityToPool","arguments":{"poolAddress":"0xPOOL","amount0":"1000000000000000000","amount1":"1000000","userAddress":"0xYOUR_ADDRESS"}}}' \
| jq '.result.content[0].text | fromjson'removeLiquidityFromPool — 流動性を削除するためのトランザクションを準備します。
curl -s -X POST https://api.main.exchange/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"removeLiquidityFromPool","arguments":{"tokenId":"123","percentage":100,"userAddress":"0xYOUR_ADDRESS"}}}' \
| jq '.result.content[0].text | fromjson'createPool (x402経由で有料) — MAIN上に新しいCLMMプールを作成および初期化します。任意の順序のトークンと人間が読み取れる価格を受け付けます。このツールはオンチェーンでトークンの小数点以下桁数を取得し、トークンをソートし、sqrtPriceX96を計算し、プールが既に存在しないことを確認します。
curl -s -X POST https://api.main.exchange/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"createPool","arguments":{"tokenA":"0xTOKEN_A","tokenB":"0xTOKEN_B","price":"0.1"}}}' \
| jq '.result.content[0].text | fromjson'ポジション
getPositions — アドレスのすべてのオープンな流動性ポジションを取得します。
curl -s -X POST https://api.main.exchange/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"getPositions","arguments":{"userAddress":"0xYOUR_ADDRESS"}}}' \
| jq '.result.content[0].text | fromjson'スマートウォレット
ALM戦略は、ユーザーごとにデプロイされる決定論的なプロキシコントラクトであるスマートウォレットを通じて実行されます。スマートウォレットは、戦略に参加する前にオンチェーン上に存在している必要があります。
deploySmartWallet — ユーザーのスマートウォレットをデプロイします。戦略ツールを使用する前に一度呼び出す必要があります。トランザクションはユーザーのEOAから直接送信される必要があります(ファクトリーはmsg.senderをデプロイメントソルトとして使用します)。
curl -s -X POST https://api.main.exchange/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"deploySmartWallet","arguments":{"userAddress":"0xYOUR_ADDRESS"}}}' \
| jq '.result.content[0].text | fromjson'戦略
getStrategies — メトリクス付きの利用可能なALM戦略を取得します。
curl -s -X POST https://api.main.exchange/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"getStrategies","arguments":{}}}' \
| jq '.result.content[0].text | fromjson'getStrategyPositions — ALM戦略におけるユーザーのポジションを取得します。
curl -s -X POST https://api.main.exchange/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"getStrategyPositions","arguments":{"userAddress":"0xYOUR_ADDRESS"}}}' \
| jq '.result.content[0].text | fromjson'enterToStrategy — ALM戦略に参加します。スマートウォレット用のcalldataを返します。デプロイ済みのスマートウォレットが必要です(先にdeploySmartWalletを使用してください)。
curl -s -X POST https://api.main.exchange/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"enterToStrategy","arguments":{"strategyId":"alm-v1","amount0":"500000","amount1":"0","userAddress":"0xYOUR_ADDRESS","duration":86400,"stopLoss":10,"takeProfit":25}}}' \
| jq '.result.content[0].text | fromjson'exitFromStrategy — ALM戦略から離脱します。デプロイ済みのスマートウォレットが必要です。
curl -s -X POST https://api.main.exchange/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"exitFromStrategy","arguments":{"strategyId":"alm-v1","positionId":"5","percentage":10000,"userAddress":"0xYOUR_ADDRESS"}}}' \
| jq '.result.content[0].text | fromjson'increaseStrategy — ALM戦略のポジションを増やします。デプロイ済みのスマートウォレットが必要です。
curl -s -X POST https://api.main.exchange/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"increaseStrategy","arguments":{"strategyId":"alm-v1","positionId":"5","amount0":"500000","amount1":"0","userAddress":"0xYOUR_ADDRESS"}}}' \
| jq '.result.content[0].text | fromjson'ブロードキャスト
broadcastTx — 署名済みトランザクションをブロックチェーンにブロードキャストします。
curl -s -X POST https://api.main.exchange/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"broadcastTx","arguments":{"signedTxHex":"0xSIGNED_TX"}}}' \
| jq '.result.content[0].text | fromjson'This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
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/asdener123/MAIN-MCP-Server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server