My First MCP Server
In this post, I’ll walk through how I built a simple MCP server that lets Claude interact with a smart contract counter. The contract itself isn’t stablecoin-based, but it could be with minimal changes.
👉 View the code here (opens in a new tab)
Why I Built This
I’ve spent the past month deep in the stablecoin world — reading posts, testing products, and deploying smart contracts on testnets to get a hands-on sense of how things work.
One of the most compelling stablecoin use cases is agent-to-agent commerce on the web. Just as self-driving cars tend to be electric, intelligent agents will likely transact in stablecoins.
Rather than just reading the hype on X, I wanted to see it work. Most of the coding here was done using Cursor’s agent, so I could focus on the plumbing — the part I actually care about.
Step 1: Set Up a Test Wallet
- Create a new wallet in Metamask (opens in a new tab) for testing only.
- Add the Base Sepolia testnet using this guide (opens in a new tab).
- Fund it with free test tokens using the Coinbase Developer Platform Faucet (opens in a new tab).
At this point, you’ve got a test wallet and some monopoly money to play with.
Step 2: Deploy a Counter Smart Contract
We’ll deploy a simple counter on Base Sepolia using Hardhat’s getting started guide (opens in a new tab).
It’s surprisingly satisfying to go from an idea to a live on-chain contract in minutes.
👉 See my counter contract here (opens in a new tab)
💡 What’s a smart contract?
Think of it as a set of functions deployed on the blockchain. Anyone on the network can call those functions.
Step 3: Build the MCP Server
With the contract live, I built an MCP server in Node.js using the TypeScript SDK. This lets Claude call on-chain functions like incrementing or reading the counter.
💡 What’s an MCP server?
It’s essentially an API with built-in documentation, designed so AI agents can discover and call your endpoints automatically.
Step 4: Connect It to Claude
Claude’s desktop app makes it easy to connect to a local MCP server.
In Claude → Developer → Edit Config, add your server config:
{
"mcpServers": {
"counter": {
"command": "node",
"args": [
"/Users/sean/Documents/code/sandboxes/base_network_sandbox/mcp-server/src/index.js"
]
}
}
}
You then need to restart Claude for it to recognize the change.
Once that’s all setup you can now ask Claude things like increment my counter by 7
and watch it call the tools you provided it. You can confirm the transaction was successful using the base sepolia chain explorer.
Conclusion
Building this MCP server was a small but meaningful experiment — proof that agents can already read from and write to the blockchain with minimal friction. The next frontier is trust and value exchange: connecting these systems to stablecoins so agents can transact autonomously, securely, and at scale.
The combination of on-chain logic, AI reasoning, and stable-value assets feels inevitable.
It’s not just a demo — it’s a glimpse of how digital agents will coordinate in the real economy.