Skip to main content
Glama

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/mcp

Related MCP server: paean-dex-mcp

MCPプロトコル

本サーバーは、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/health

x402決済

一部のツールは、x402プロトコルを介したUSDC決済を必要とします。有料ツールが決済なしで呼び出された場合、サーバーは決済要件(金額、受取人、ネットワーク)を含むJSON-RPCエラーを返します。x402互換クライアントはこれを自動的に処理します。

有料ツール: createPool, launchToken, getPoolsTerminal, getPoolTerminal, getTokenTerminal, getTokenHolders, getTokenSentiment, getForecastSummary

ツール

トークン

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'

getTokenTerminal (x402経由で有料) — api-terminalから詳細なトークン情報を取得します:価格、時価総額、供給量、流動性、取引高、トランザクション、価格変動、ソーシャルリンク。

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":"getTokenTerminal","arguments":{"tokenAddress":"0x4200000000000000000000000000000000000006"}}}' \
  | jq '.result.content[0].text | fromjson'

getTokenHolders (x402経由で有料) — api-terminalからトークンの上位100保有者を取得します:アドレス、ラベル、数量、割合、USD価値。

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":"getTokenHolders","arguments":{"tokenAddress":"0x4200000000000000000000000000000000000006"}}}' \
  | jq '.result.content[0].text | fromjson'

getTokenSentiment (x402経由で有料) — api-terminalからトークンのセンチメント分析を取得します:ナラティブ(概要、カタリスト、リスク)およびコミュニティの言及(ムード、センチメントの内訳、X/Twitterの投稿)。

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":"getTokenSentiment","arguments":{"symbol":"WETH"}}}' \
  | jq '.result.content[0].text | fromjson'

getForecastSummary (x402経由で有料) — api-terminalから資産(BTC、ETH、SOL)の価格予測サマリーを取得します:見通し、予測価格、サポート/レジスタンスレベル、確率分布。

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":"getForecastSummary","arguments":{"asset":"BTC","horizon":"24h"}}}' \
  | 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'

プール

getPoolsTerminal (x402経由で有料) — api-terminalからBase上のプールリストを市場データ付きで取得します:TVL、24時間取引高、トークン価格、価格変動。

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":"getPoolsTerminal","arguments":{}}}' \
  | jq '.result.content[0].text | fromjson'

getPoolTerminal (x402経由で有料) — api-terminalから特定のプールの詳細情報を取得します(トークンのメタデータ:シンボル、名前、画像を含む)。

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":"getPoolTerminal","arguments":{"poolAddress":"0x70acdf2ad0bf2402c957154f944c19ef4e1cbae1"}}}' \
  | 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'

Related MCP Connectors

Related MCP Servers