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