Skip to main content
Glama

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.

Related MCP server: KaiaFun MCP

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"

Claude Desktop

  1. Abrir configuración

Claude > Configuración > Desarrollador

configuraciones de Claude

  1. Abra claude_desktop_config.json

configuración de Claude

  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.

resultado final

Más recursos

Available Tools

2 tools
get-mon-balanceB

查询 Monad 测试网地址的 MON 代币余额

ParametersJSON Schema
NameRequiredDescriptionDefault
addressYes需要查询的 Monad 测试网地址

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. While it states this is a query operation (implying read-only), it doesn't specify whether this requires authentication, has rate limits, returns real-time or cached data, or what happens with invalid addresses. For a tool with zero annotation coverage, this leaves significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's appropriately sized for a simple query tool and front-loads the essential information. Every word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (single parameter, no annotations, no output schema), the description is minimally adequate. It tells what the tool does but lacks important context about behavioral characteristics, usage scenarios, and output format. For a balance query tool, users would benefit from knowing what the return value looks like (numeric balance, units, etc.) and any constraints.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, with the single parameter 'address' fully documented in the schema as '需要查询的 Monad 测试网地址' (Monad testnet address to query). The description doesn't add any additional parameter information beyond what's already in the schema, such as address format examples or validation rules. With complete schema coverage, the baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: '查询 Monad 测试网地址的 MON 代币余额' (Query MON token balance for a Monad testnet address). It specifies the verb (query), resource (MON token balance), and target (Monad testnet address). However, it doesn't explicitly differentiate from its sibling tool 'get-nft-count', which appears to serve a different purpose (NFT count vs token balance).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention the sibling tool 'get-nft-count' or any other potential tools for querying different types of balances or addresses. There's no indication of prerequisites, limitations, or when this tool would be preferred over other methods.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get-nft-countC

查询 Monad 测试网地址持有的 NFT 数量

ParametersJSON Schema
NameRequiredDescriptionDefault
addressYes需要查询的 Monad 测试网地址
nftContractYesNFT 合约地址

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden for behavioral disclosure. It only states what the tool does (query NFT count) without mentioning whether this is a read-only operation, if it requires authentication, rate limits, error conditions, or what format the response takes. For a tool with zero annotation coverage, this is insufficient behavioral context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise - a single sentence that directly states the tool's function. There's no wasted language or unnecessary elaboration. It's appropriately sized for a simple query tool and gets straight to the point without any structural issues.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description is incomplete for proper tool usage. While it states the basic purpose, it doesn't cover important contextual information like response format, error handling, network specifics (Monad testnet limitations), or how this differs from the sibling balance tool. For a blockchain query tool, more context would be helpful.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the input schema already fully documents both parameters (address and nftContract). The description doesn't add any additional parameter semantics beyond what's in the schema descriptions. It mentions both parameters implicitly through the function description but provides no extra details about format, validation, or usage patterns.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose as '查询 Monad 测试网地址持有的 NFT 数量' (Query the NFT count held by a Monad testnet address). It specifies both the verb (query) and resource (NFT count), but doesn't differentiate from its sibling tool 'get-mon-balance' which presumably handles token balances rather than NFTs. The purpose is specific but lacks sibling distinction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention the sibling tool 'get-mon-balance' or any other potential tools for querying NFT-related data. There's no indication of prerequisites, constraints, or typical use cases beyond the basic function stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

TDQS

B3.1/5.0
Disambiguation5/5

The two tools have completely distinct purposes: one queries token balances, while the other queries NFT counts. There is no overlap in functionality, and an agent can easily differentiate between them based on their clear, specific descriptions.

Naming Consistency5/5

Both tools follow a consistent verb_noun pattern with 'get' as the verb and hyphen-separated nouns ('mon-balance', 'nft-count'). The naming is uniform and predictable across the set.

Tool Count2/5

With only two tools, the server feels thin for a blockchain domain like Monad, which typically involves more operations such as transaction queries, contract interactions, or token transfers. The scope is too limited for practical agent workflows.

Completeness2/5

The toolset is severely incomplete for a blockchain server; it lacks essential operations like sending transactions, checking transaction status, querying contract data, or interacting with tokens beyond balances. This will cause significant agent failures in handling typical blockchain tasks.

Maintenance

ActivityInactive
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    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.
  • A
    license
    A
    quality
    D
    maintenance
    A Model Context Protocol server that enables AI models to interact with the Monad testnet for checking token balances, sending transactions, and deploying smart contracts.
    7
    Apache 2.0
  • -
    license
    Not graded
    quality
    Not graded
    maintenance
    An MCP server that allows Claude Desktop to query Monad testnet for MON token balances of accounts.

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/bble/monad-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server