MonDeployer
MonDeployer is a tool for deploying Solidity contracts to the Monad testnet. Users need to set their private key and use Solidity version 0.8.x. It also provides solutions for JSON parsing errors, making debugging easier.
GitHub Stars
1
User Rating
Not Rated
Forks
0
Issues
0
Views
0
Favorites
0
MonDeployer - Monad Contract Deployment Tool
This repository provides tools for compiling and deploying Solidity contracts to the Monad testnet.
⚠️ Solidity Version Note
Use Solidity 0.8.x & up only. Monad is compatible with standard EVM 0.8.x series. For best results, keep your contracts simple and tested.
🛠 Getting Started
- Create a file named
env.jsin the root directory and add your private key like this:
// env.js
exports.PRIVATE_KEY = 'your_private_key_here';
- Write your contract using the correct pragma:
// SPDX-License-Identifier: MIT
pragma solidity 0.8.28;
contract YourContract {
// ...
}
🔧 Solution to JSON Parsing Errors
If you see errors like:
MCP monad-mcp: Unexpected token 'L', "Looking fo"... is not valid JSON
MCP monad-mcp: Unexpected token 'D', "Deploying "... is not valid JSON
MCP monad-mcp: Unexpected token 'M', "Monad MCP "... is not valid JSON
We have multiple solutions for you:
1. Ultra-Simple Mock MCP Plugin (Most Reliable)
For fastest debugging, use our ultra-simple MCP plugin that always returns a mock success:
npm run start-simple-mcp
This plugin ignores your contract and always returns a successful deployment response.
🧠 Claude MCP Integration
{
"mcpServers": {
"monad-mcp": {
"command": "node",
"args": [
"/path/to/yourfiles/monad-mcp/multi-tool-plugin-v2.cjs"
]
}
}
}
To start the MCP server manually:
cd monad-mcp && node multi-tool-plugin-v2.cjs
2. Strict MCP Plugin (Auto-Fixes Solidity Version)
For actual contract deployment with version auto-fixing:
npm run start-strict-mcp
This plugin automatically fixes ANY Solidity version to 0.8.28 and redirects all non-JSON output to stderr.
Configure Claude Desktop with:
{
"mcpServers": {
"monad-mcp": {
"command": "node",
"args": [
"/path/to/DropFlow/monad-mcp/strict-mcp-plugin.js"
]
}
}
}
🚀 Fastest Option: Just Deploy a Simple Contract
Skip Claude entirely and deploy a simple storage contract directly:
npm run simple-deploy
This deploys a pre-configured SimpleStorage contract using Solidity 0.8.28.
Example Deployments
The repository includes several examples:
# Deploy the SimpleStorage contract (simplest)
npm run deploy-storage
# Deploy the SimpleToken contract
npm run deploy-token
# Alternative clean deployment script with better error handling
npm run deploy-token-clean
Custom Contract Deployment
To deploy a custom contract:
- Create your contract file with
pragma solidity 0.8.28 - Use the deployment utility in your script:
const { compileAndDeploy } = require('./src/utils/contract-deployer');
const fs = require('fs');
const { PRIVATE_KEY } = require('./env.js');
const contractSource = fs.readFileSync('path/to/your/contract.sol', 'utf8');
async function deploy() {
const result = await compileAndDeploy(
contractSource,
PRIVATE_KEY,
[], // constructor args
{ solcVersion: '0.8.28', saveArtifacts: true }
);
console.log(`Contract deployed at: ${result.address}`);
}
deploy();
Troubleshooting
If you encounter JSON parsing errors like:
MCP monad-mcp: Unexpected token 'S', "Starting c"... is not valid JSON
Try these solutions in order:
- Use the ultra-simple MCP plugin:
npm run start-simple-mcp(always succeeds with mock data) - Use the strict MCP plugin:
npm run start-strict-mcp(fixes version issues automatically) - Check your contract's pragma version:
npm run check-solidity examples/YourContract.sol - Use the clean deployment script:
npm run deploy-token-clean - Fix your contract's Solidity version:
npm run fix-solidity YourContract.sol - Deploy directly without Claude:
npm run simple-deploy
Always check your contract's pragma version first:
pragma solidity 0.8.x; // Must be exact version ^0.8.0 or similar
Template Contract
A template contract is available at monad-mcp/solidity-template.sol that you can use as a starting point for any new contracts.
Security Note
- Always keep your
env.jsfile secure and never commit it to version control. - The private key is never hardcoded, printed, or exposed in logs or code.