Skip to main content
In this guide, you will learn how to build a Model Context Protocol (MCP) server that allows an MCP Client (Claude Desktop) to query Monad Testnet to check the MON balance of an account.

What is MCP?

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

Prerequisites

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

Getting started

  1. Clone the monad-mcp-tutorial repository. This repository has some code that can help you get started quickly.
  1. Install dependencies:

Building the MCP server

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

Define the server instance

src/index.ts

Define the MON balance tool

Below is the scaffold of the get-mon-balance tool:
src/index.ts
Let’s add the MON balance check implementation to the tool:
src/index.ts

Initialize the transport and server from the main function

src/index.ts

Build the project

The server is now ready to use!

Add 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.
claude_desktop_config.json
  1. Restart “Claude Desktop”

Use the MCP server

You should now be able to see the tools in Claude! tools Here’s the final result final result

Further resources