Manages environment variables needed for secure configuration of the Monad MCP server
Supports cloning the repository to set up the Monad MCP server
Hosts the repository for the Monad MCP server code
Monad MCP Server
This MCP (Model Context Protocol) server is designed to interact with the Monad testnet. It provides a suite of tools and capabilities for developers to engage with the Monad blockchain, including checking MON token balances, sending transactions, deploying smart contracts, and monitoring blockchain events.
What is MCP?
The Model Context Protocol (MCP) is a standardized interface that enables AI models to securely and effectively interact with external tools, services, and data sources. This server implements MCP to expose Monad blockchain functionalities to compatible AI agents or applications.
Project Structure
The project is organized as follows:
Key Components
src/index.ts
: This is the main entry point for the server. It initializes the MCP server instance and registers all available tools (wallet, contract, NFT, block).src/config/server.ts
: This file handles the core server configuration. It sets up theMcpServer
instance with its name, version, and a list of capabilities. It also initializes theViem
public client for interacting with the Monad testnet and provides a function to create aViem
wallet client using a private key from environment variables. The server usesStdioServerTransport
for communication.src/tools/
: This directory contains the implementations for various MCP tools. Each subdirectory typically focuses on a specific aspect of Monad interaction:walletProvider
: Manages MON token balances and transactions.contractProvider
: Handles smart contract deployment and event watching.nftProvider
: Provides functionality for querying NFTs on the Monad network.blockProvider
: Offers tools to retrieve block information.
Prerequisites
Before you begin, ensure you have the following installed:
- Node.js (version 16 or later)
- A Node.js package manager:
npm
,yarn
, orpnpm
(this project usespnpm
in its examples) - Claude Desktop (or any MCP-compatible client) to interact with the server.
Environment Variables (.env)
This project uses environment variables to manage sensitive information, primarily your Monad account's private key.
- Copy the example file: Create a copy of
.env.example
and rename it to.env
. - Edit
.env
: Open the newly created.env
file in a text editor. - Set
PRIVATE_KEY
: Fill in thePRIVATE_KEY
variable with your Monad account's private key. This key is necessary for operations like sending transactions or deploying contracts.Important: Ensure your private key starts with0x
. - Security: Never commit your
.env
file to a Git repository. The.gitignore
file is already configured to prevent this, but always be mindful of protecting your private keys.
Getting Started
Follow these steps to set up and run the Monad MCP server:
- Clone the Repository:If you haven't already, clone the project from GitHub:
- Install Dependencies:Use
pnpm
(or your preferred package manager) to install the project dependencies listed inpackage.json
: - Build the Project:The server is written in TypeScript and needs to be compiled into JavaScript. Run the build script:This command will use
tsc
(the TypeScript compiler) as defined inpackage.json
to compile the source files from thesrc
directory into thebuild
directory.
The server is now built and ready to be used by an MCP client.
Server Capabilities
As defined in src/config/server.ts
, the server exposes the following capabilities:
get-mon-balance
: Retrieve the MON token balance for an account.send-mon-transaction
: Send MON tokens from one account to another.deploy-mon-contract
: Deploy a smart contract to the Monad testnet.watch-contract-events
: Monitor and report events emitted by a specific smart contract.query-mon-nft
: Query information about Non-Fungible Tokens on the Monad network.get-latest-block
: Fetch details of the most recent block on the Monad testnet.get-block-by-number
: Retrieve a specific block by its block number.
Adding the MCP Server Configuration to Your Client
To use this server with an MCP-compatible client (like Claude Desktop), you'll need to add its configuration to the client's settings. The exact method may vary depending on the client, but typically involves specifying how to run the server.
Here's an example configuration snippet:
Explanation of Configuration Fields:
"monad-mcp"
: A unique name you assign to this server configuration within your client."command": "node"
: Specifies that the server is a Node.js application."args"
: An array of arguments to pass to thenode
command.- The first argument is the path to the compiled entry point of the server:
/absolute/path/to/your/project/monad-mcp-server/build/index.js
. Replace/absolute/path/to/your/project/
with the actual absolute path to where you cloned themonad-mcp-server
repository.
- The first argument is the path to the compiled entry point of the server:
"env"
: An object to set environment variables for the server process."PRIVATE_KEY"
: You can set your private key here. However, it's generally recommended to use the.env
file for better security. If set here, it might override the value in.env
depending on the client's behavior and the server's environment variable loading order.
Note: Ensure the path in "args"
is correct and points to the build/index.js
file within your project directory.
Further Resources
For more detailed information on the technologies used and concepts involved, refer to the following official documentation:
- Model Context Protocol (MCP) Documentation
- Monad Documentation
- Viem Documentation (Viem is the Ethereum/Monad client library used in this project)
This comprehensive README should provide a solid understanding of the Monad MCP Server, its setup, and usage.
You must be authenticated.
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Tools
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.
Related MCP Servers
- AsecurityAlicenseAqualityA Model Context Protocol server that enables AI agents to interact with 30+ Ethereum-compatible blockchain networks, providing services like token transfers, contract interactions, and ENS resolution through a unified interface.Last updated -2894146TypeScriptMIT License
- -securityFlicense-qualityA Model Context Protocol server that enables AI assistants to access Flow blockchain data and perform operations such as checking balances, resolving domains, executing scripts, and submitting transactions.Last updated -JavaScript
- -securityFlicense-qualityA Model Context Protocol server that enables AI agents to interact with the Flow blockchain through RPC calls, supporting account balances, script execution, transactions, domain resolution, and contract interactions.Last updated -82JavaScript
- -securityAlicense-qualityA production-ready Model Context Protocol server implementation that connects AI assistants to the TON blockchain, allowing them to query wallet balances, transaction details, smart contracts, and other blockchain data.Last updated -TypeScriptMIT License