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.

Tutorial de MCP de mónada

Este proyecto demuestra cómo crear un servidor MCP que interactúa con la red de pruebas Monad. El servidor MCP proporciona una herramienta para verificar el saldo de tokens MON en la red de pruebas Monad.

¿Qué es MCP?

El Protocolo de Contexto de Modelo (MCP) es un estándar que permite que los modelos de IA interactúen con herramientas y servicios externos.

En este tutorial, crearemos un servidor MCP que permite al cliente MCP (Claude Desktop) consultar la red de prueba de Monad para verificar el saldo de MON de una cuenta.

Prerrequisitos

  • Node.js (v16 o posterior)
  • npm o yarn
  • Escritorio de Claude

Empezando

  1. Clonar este repositorio
git clone https://github.com/bble/monad-mcp.git
  1. Instalar dependencias:
npm install

Construyendo el servidor MCP

La configuración relacionada con Monad Testnet ya está agregada a index.ts en la carpeta src .

Definir la instancia del servidor

// 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"] });

Definición de la herramienta de 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) }`, }, ], }; } } );

Añadir funcionalidad para consultar el recuento de 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) }`, }, ], }; } } );

Inicializar el transporte y el servidor desde la función 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"); }

Construir el proyecto

npm run build

¡El servidor ya está listo para usarse!

Agregar el servidor MCP a Claude Desktop

  1. Abra "Claude Desktop"

  1. Abrir configuración

Claude > Configuración > Desarrollador

  1. Abra claude_desktop_config.json

  1. Agregue detalles sobre el servidor MCP y guarde el archivo.
{ "mcpServers": { ... "monad-mcp": { "command": "node", "args": [ "/<path-to-project>/build/index.js" ] } } }
  1. Reiniciar "Claude Desktop"

Usando el servidor MCP

Aquí está el resultado final.

Más recursos

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.

Un servidor MCP que permite consultar saldos de tokens MON y recuentos de NFT en la red de prueba de Monad, lo que permite que Claude Desktop interactúe con la cadena de bloques de Monad.

  1. ¿Qué es MCP?
    1. Prerrequisitos
      1. Empezando
        1. Construyendo el servidor MCP
          1. Definir la instancia del servidor
          2. Definición de la herramienta de balance MON
          3. Añadir funcionalidad para consultar el recuento de NFT
          4. Inicializar el transporte y el servidor desde la función main
          5. Construir el proyecto
          6. Agregar el servidor MCP a Claude Desktop
          7. Usando el servidor MCP
        2. Más recursos

          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