Monad MCP

by bble

Integrations

  • Enables querying Monad testnet for token balances and NFT holdings, allowing users to check MON balances for specific addresses and count NFTs held by an address in a specified contract.

모나드 MCP 튜토리얼

이 프로젝트는 Monad 테스트넷과 연동되는 MCP 서버를 만드는 방법을 보여줍니다. MCP 서버는 Monad 테스트넷에서 MON 토큰 잔액을 확인하는 도구를 제공합니다.

MCP란 무엇인가요?

MCP(Model Context Protocol)는 AI 모델이 외부 도구 및 서비스와 상호 작용할 수 있도록 하는 표준입니다.

이 튜토리얼에서는 MCP 클라이언트(Claude Desktop)가 Monad 테스트넷에 쿼리를 보내 계정의 MON 잔액을 확인할 수 있는 MCP 서버를 만들어 보겠습니다.

필수 조건

  • Node.js(v16 이상)
  • npm 또는 yarn
  • 클로드 데스크탑

시작하기

  1. 이 저장소를 복제하세요

지엑스피1

  1. 종속성 설치:
npm install

MCP 서버 구축

Monad Testnet 관련 구성은 이미 src 폴더의 index.ts 에 추가되었습니다.

서버 인스턴스를 정의합니다

// Create a new MCP server instance const server = new McpServer({ name: "monad-testnet", version: "0.0.1", // Array of supported tool names that clients can call capabilities: ["get-mon-balance"] });

MON 잔액 도구 정의

server.tool( // Tool ID "get-mon-balance", // Description of what the tool does "Get MON balance for an address on Monad testnet", // Input schema { address: z.string().describe("Monad testnet address to check balance for"), }, // Tool implementation async ({ address }) => { try { // Check MON balance for the input address const balance = await publicClient.getBalance({ address: address as `0x${string}`, }); // Return a human friendly message indicating the balance. return { content: [ { type: "text", text: `Balance for ${address}: ${formatUnits(balance, 18)} MON`, }, ], }; } catch (error) { // If the balance check process fails, return a graceful message back to the MCP client indicating a failure. return { content: [ { type: "text", text: `Failed to retrieve balance for address: ${address}. Error: ${ error instanceof Error ? error.message : String(error) }`, }, ], }; } } );

NFT 개수를 쿼리하는 기능 추가

### Add functionality to query NFT count server.tool( // Function identifier "get-nft-count", // Function description "Query the number of NFTs held by an address on the Monad testnet", // Parameter definition { address: z.string().describe("The Monad testnet address to query"), nftContract: z.string().describe("NFT contract address") }, // Function implementation async ({ address, nftContract }) => { try { // Call the contract's balanceOf method to get the NFT count const balance = await publicClient.readContract({ address: nftContract as `0x${string}`, abi: [ { inputs: [{ name: "owner", type: "address" }], name: "balanceOf", outputs: [{ name: "", type: "uint256" }], stateMutability: "view", type: "function" } ], functionName: "balanceOf", args: [address as `0x${string}`] }); // Return the formatted query result return { content: [ { type: "text", text: `The address ${address} holds ${balance.toString()} NFTs in contract ${nftContract}.`, }, ], }; } catch (error) { // Error handling return { content: [ { type: "text", text: `Failed to query NFT count for address ${address}: ${ error instanceof Error ? error.message : String(error) }`, }, ], }; } } );

main 함수에서 전송 및 서버를 초기화합니다.

async function main() { // Create a transport layer using standard input/output const transport = new StdioServerTransport(); // Connect the server to the transport await server.connect(transport); console.error("Monad testnet MCP Server running on stdio"); }

프로젝트를 빌드하세요

npm run build

이제 서버를 사용할 준비가 되었습니다!

Claude Desktop에 MCP 서버 추가

  1. "Claude Desktop"을 엽니다

  1. 설정 열기

Claude > 설정 > 개발자

  1. claude_desktop_config.json 엽니다.

  1. MCP 서버에 대한 세부 정보를 추가하고 파일을 저장합니다.
{ "mcpServers": { ... "monad-mcp": { "command": "node", "args": [ "/<path-to-project>/build/index.js" ] } } }
  1. "Claude Desktop"을 다시 시작하세요

MCP 서버 사용

최종 결과는 다음과 같습니다.

추가 자료

You must be authenticated.

A
security – no known vulnerabilities
F
license - not found
A
quality - confirmed to work

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

Monad 테스트넷에서 MON 토큰 잔액과 NFT 수량을 쿼리할 수 있는 MCP 서버로, Claude Desktop이 Monad 블록체인과 상호 작용할 수 있도록 지원합니다.

  1. MCP란 무엇인가요?
    1. 필수 조건
      1. 시작하기
        1. MCP 서버 구축
          1. 서버 인스턴스를 정의합니다
          2. MON 잔액 도구 정의
          3. NFT 개수를 쿼리하는 기능 추가
          4. main 함수에서 전송 및 서버를 초기화합니다.
          5. 프로젝트를 빌드하세요
          6. Claude Desktop에 MCP 서버 추가
          7. MCP 서버 사용
        2. 추가 자료

          Related MCP Servers

          • -
            security
            F
            license
            -
            quality
            An MCP server that connects Claude for Desktop with blockchain functionality, allowing users to check balances and send tokens on EVM and Solana chains through natural language interactions.
            Last updated -
            TypeScript
            • Apple
          • -
            security
            A
            license
            -
            quality
            Enables interaction with the Monad testnet to check balances, examine transaction details, get gas prices, and retrieve block information.
            Last updated -
            TypeScript
            MIT License
            • Linux
          • -
            security
            -
            license
            -
            quality
            A server that retrieves NFT-related data on the Monad testnet, allowing users to check NFT holders, calculate portfolio values, view collections, and track top-selling NFTs by volume and sales across different time periods.
            Last updated -
            TypeScript
          • -
            security
            F
            license
            -
            quality
            An MCP server that helps users create NFT collections, deploy smart contracts to the Monad blockchain, and generate mint websites with Claude AI integration.
            Last updated -
            JavaScript

          View all related MCP servers

          ID: 0x1j181lqw