Monad MCP

Monad MCP

An MCP server that allows querying MON token balances and NFT counts on the Monad testnet, enabling Claude Desktop to interact with the Monad blockchain.

Category
Visit Server

Tools

get-mon-balance

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

get-nft-count

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

README

Monad MCP Tutorial

This project demonstrates how to create a MCP server that interacts with the Monad testnet. The MCP server provides a tool for checking MON token balances on the Monad testnet.

What is MCP?

The Model Context Protocol (MCP) is a standard that allows AI models to interact with external tools and services.

In this tutorial, we're creating an MCP server that allows MCP Client (Claude Desktop) to query Monad testnet to check MON balance of an account.

Prerequisites

  • Node.js (v16 or later)
  • npm or yarn
  • Claude Desktop

Getting Started

  1. Clone this repository
git clone https://github.com/bble/monad-mcp.git
  1. Install dependencies:
npm install

Building the MCP server

Monad Testnet related configuration is already added to index.ts in the src folder.

Define the server instance

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

Defining the MON balance tool

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)
                        }`,
                    },
                ],
            };
        }
    }
);

Add functionality to query NFT count

### 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)
                        }`,
                    },
                ],
            };
        }
    }
);

Initialize the transport and server from the main function

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

Build the project

npm run build

The server is now ready to use!

Adding the MCP server to Claude Desktop

  1. Open "Claude Desktop"

claude desktop

  1. Open Settings

Claude > Settings > Developer

claude settings

  1. Open claude_desktop_config.json

claude config

  1. Add details about the MCP server and save the file.
{
  "mcpServers": {
    ...
    "monad-mcp": {
      "command": "node",
      "args": [
        "/<path-to-project>/build/index.js"
      ]
    }
  }
}
  1. Restart "Claude Desktop"

Using the MCP server

Here's the final result

final result

Further Resources

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured