Skip to content

Commit b20a12d

Browse files
committed
fix: following standard naming, fixed SSE server
1 parent befc357 commit b20a12d

14 files changed

+102
-90
lines changed

README.md

+16-16
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
![TypeScript](https://img.shields.io/badge/TypeScript-5.0+-3178C6)
66
![Viem](https://img.shields.io/badge/Viem-1.0+-green)
77

8-
A comprehensive Model Context Protocol (MCP) server that provides blockchain operations across multiple EVM-compatible networks. This server enables AI agents to interact with Ethereum, Optimism, Arbitrum, Base, Polygon, and many other EVM chains with a unified interface.
8+
A comprehensive Model Context Protocol (MCP) server that provides blockchain services across multiple EVM-compatible networks. This server enables AI agents to interact with Ethereum, Optimism, Arbitrum, Base, Polygon, and many other EVM chains with a unified interface.
99

1010
## 📋 Contents
1111

@@ -26,16 +26,16 @@ A comprehensive Model Context Protocol (MCP) server that provides blockchain ope
2626

2727
## 🔭 Overview
2828

29-
The MCP EVM Server leverages the Model Context Protocol to provide blockchain operations to AI agents. It supports a wide range of operations including:
29+
The MCP EVM Server leverages the Model Context Protocol to provide blockchain services to AI agents. It supports a wide range of services including:
3030

3131
- Reading blockchain state (balances, transactions, blocks, etc.)
3232
- Interacting with smart contracts
3333
- Transferring tokens (native, ERC20, ERC721, ERC1155)
3434
- Querying token metadata and balances
35-
- Chain-specific operations across 30+ EVM networks
35+
- Chain-specific services across 30+ EVM networks
3636
- **ENS name resolution** for all address parameters (use human-readable names like 'vitalik.eth' instead of addresses)
3737

38-
All operations are exposed through a consistent interface of MCP tools and resources, making it easy for AI agents to discover and use blockchain functionality. **Every tool that accepts Ethereum addresses also supports ENS names**, automatically resolving them to addresses behind the scenes.
38+
All services are exposed through a consistent interface of MCP tools and resources, making it easy for AI agents to discover and use blockchain functionality. **Every tool that accepts Ethereum addresses also supports ENS names**, automatically resolving them to addresses behind the scenes.
3939

4040
## ✨ Features
4141

@@ -48,7 +48,7 @@ All operations are exposed through a consistent interface of MCP tools and resou
4848
- **Address balances** for native tokens and all token standards
4949
- **ENS resolution** for human-readable Ethereum addresses (use 'vitalik.eth' instead of '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045')
5050

51-
### Token Operations
51+
### Token services
5252

5353
- **ERC20 Tokens**
5454
- Get token metadata (name, symbol, decimals, supply)
@@ -70,7 +70,7 @@ All operations are exposed through a consistent interface of MCP tools and resou
7070
### Smart Contract Interactions
7171

7272
- **Read contract state** through view/pure functions
73-
- **Write operations** with private key signing
73+
- **Write services** with private key signing
7474
- **Contract verification** to distinguish from EOAs
7575
- **Event logs** retrieval and filtering
7676

@@ -279,7 +279,7 @@ console.log(result);
279279

280280
The server provides the following MCP tools for agents. **All tools that accept address parameters support both Ethereum addresses and ENS names.**
281281

282-
#### Token Operations
282+
#### Token services
283283

284284
| Tool Name | Description | Key Parameters |
285285
|-----------|-------------|----------------|
@@ -295,7 +295,7 @@ The server provides the following MCP tools for agents. **All tools that accept
295295
| `get-erc1155-balance` | Check ERC1155 balance | `tokenAddress` (address/ENS), `tokenId`, `ownerAddress` (address/ENS), `network` |
296296
| `transfer-erc1155` | Transfer ERC1155 tokens | `privateKey`, `tokenAddress` (address/ENS), `tokenId`, `amount`, `toAddress` (address/ENS), `network` |
297297

298-
#### Blockchain Operations
298+
#### Blockchain services
299299

300300
| Tool Name | Description | Key Parameters |
301301
|-----------|-------------|----------------|
@@ -341,7 +341,7 @@ The server exposes blockchain data through the following MCP resource URIs. All
341341
- Consider implementing additional authentication mechanisms for production use
342342
- Use HTTPS for the HTTP server in production environments
343343
- Implement rate limiting to prevent abuse
344-
- For high-value operations, consider adding confirmation steps
344+
- For high-value services, consider adding confirmation steps
345345

346346
## 📁 Project Structure
347347

@@ -357,15 +357,15 @@ mcp-evm-server/
357357
│ │ ├── resources.ts # MCP resources implementation
358358
│ │ ├── tools.ts # MCP tools implementation
359359
│ │ ├── prompts.ts # MCP prompts implementation
360-
│ │ └── operations/ # Core blockchain operations
360+
│ │ └── services/ # Core blockchain services
361361
│ │ ├── index.ts # Operation exports
362-
│ │ ├── balance.ts # Balance operations
363-
│ │ ├── transfer.ts # Token transfer operations
362+
│ │ ├── balance.ts # Balance services
363+
│ │ ├── transfer.ts # Token transfer services
364364
│ │ ├── utils.ts # Utility functions
365-
│ │ ├── tokens.ts # Token metadata operations
365+
│ │ ├── tokens.ts # Token metadata services
366366
│ │ ├── contracts.ts # Contract interactions
367-
│ │ ├── transactions.ts # Transaction operations
368-
│ │ └── blocks.ts # Block operations
367+
│ │ ├── transactions.ts # Transaction services
368+
│ │ └── blocks.ts # Block services
369369
│ │ └── clients.ts # RPC client utilities
370370
├── package.json
371371
├── tsconfig.json
@@ -376,7 +376,7 @@ mcp-evm-server/
376376

377377
To modify or extend the server:
378378

379-
1. Add new operations in the appropriate file under `src/core/operations/`
379+
1. Add new services in the appropriate file under `src/core/services/`
380380
2. Register new tools in `src/core/tools.ts`
381381
3. Register new resources in `src/core/resources.ts`
382382
4. Add new network support in `src/core/chains.ts`

src/core/resources.ts

+28-28
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { McpServer, ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";
22
import { getSupportedNetworks, getRpcUrl } from "./chains.js";
3-
import * as operations from "./operations/index.js";
3+
import * as services from "./services/index.js";
44
import type { Address, Hash } from "viem";
55

66
/**
@@ -15,8 +15,8 @@ export function registerEVMResources(server: McpServer) {
1515
async (uri, params) => {
1616
try {
1717
const network = params.network as string;
18-
const chainId = await operations.getChainId(network);
19-
const blockNumber = await operations.getBlockNumber(network);
18+
const chainId = await services.getChainId(network);
19+
const blockNumber = await services.getBlockNumber(network);
2020
const rpcUrl = getRpcUrl(network);
2121

2222
return {
@@ -48,8 +48,8 @@ export function registerEVMResources(server: McpServer) {
4848
async (uri) => {
4949
try {
5050
const network = "ethereum";
51-
const chainId = await operations.getChainId(network);
52-
const blockNumber = await operations.getBlockNumber(network);
51+
const chainId = await services.getChainId(network);
52+
const blockNumber = await services.getBlockNumber(network);
5353
const rpcUrl = getRpcUrl(network);
5454

5555
return {
@@ -82,12 +82,12 @@ export function registerEVMResources(server: McpServer) {
8282
try {
8383
const network = params.network as string;
8484
const blockNumber = params.blockNumber as string;
85-
const block = await operations.getBlockByNumber(parseInt(blockNumber), network);
85+
const block = await services.getBlockByNumber(parseInt(blockNumber), network);
8686

8787
return {
8888
contents: [{
8989
uri: uri.href,
90-
text: operations.helpers.formatJson(block)
90+
text: services.helpers.formatJson(block)
9191
}]
9292
};
9393
} catch (error) {
@@ -109,12 +109,12 @@ export function registerEVMResources(server: McpServer) {
109109
try {
110110
const network = params.network as string;
111111
const blockHash = params.blockHash as string;
112-
const block = await operations.getBlockByHash(blockHash as Hash, network);
112+
const block = await services.getBlockByHash(blockHash as Hash, network);
113113

114114
return {
115115
contents: [{
116116
uri: uri.href,
117-
text: operations.helpers.formatJson(block)
117+
text: services.helpers.formatJson(block)
118118
}]
119119
};
120120
} catch (error) {
@@ -135,12 +135,12 @@ export function registerEVMResources(server: McpServer) {
135135
async (uri, params) => {
136136
try {
137137
const network = params.network as string;
138-
const block = await operations.getLatestBlock(network);
138+
const block = await services.getLatestBlock(network);
139139

140140
return {
141141
contents: [{
142142
uri: uri.href,
143-
text: operations.helpers.formatJson(block)
143+
text: services.helpers.formatJson(block)
144144
}]
145145
};
146146
} catch (error) {
@@ -161,12 +161,12 @@ export function registerEVMResources(server: McpServer) {
161161
async (uri) => {
162162
try {
163163
const network = "ethereum";
164-
const block = await operations.getLatestBlock(network);
164+
const block = await services.getLatestBlock(network);
165165

166166
return {
167167
contents: [{
168168
uri: uri.href,
169-
text: operations.helpers.formatJson(block)
169+
text: services.helpers.formatJson(block)
170170
}]
171171
};
172172
} catch (error) {
@@ -188,7 +188,7 @@ export function registerEVMResources(server: McpServer) {
188188
try {
189189
const network = params.network as string;
190190
const address = params.address as string;
191-
const balance = await operations.getETHBalance(address as Address, network);
191+
const balance = await services.getETHBalance(address as Address, network);
192192

193193
return {
194194
contents: [{
@@ -222,7 +222,7 @@ export function registerEVMResources(server: McpServer) {
222222
try {
223223
const network = "ethereum";
224224
const address = params.address as string;
225-
const balance = await operations.getETHBalance(address as Address, network);
225+
const balance = await services.getETHBalance(address as Address, network);
226226

227227
return {
228228
contents: [{
@@ -258,7 +258,7 @@ export function registerEVMResources(server: McpServer) {
258258
const address = params.address as string;
259259
const tokenAddress = params.tokenAddress as string;
260260

261-
const balance = await operations.getERC20Balance(
261+
const balance = await services.getERC20Balance(
262262
tokenAddress as Address,
263263
address as Address,
264264
network
@@ -300,7 +300,7 @@ export function registerEVMResources(server: McpServer) {
300300
const address = params.address as string;
301301
const tokenAddress = params.tokenAddress as string;
302302

303-
const balance = await operations.getERC20Balance(
303+
const balance = await services.getERC20Balance(
304304
tokenAddress as Address,
305305
address as Address,
306306
network
@@ -340,12 +340,12 @@ export function registerEVMResources(server: McpServer) {
340340
try {
341341
const network = params.network as string;
342342
const txHash = params.txHash as string;
343-
const tx = await operations.getTransaction(txHash as Hash, network);
343+
const tx = await services.getTransaction(txHash as Hash, network);
344344

345345
return {
346346
contents: [{
347347
uri: uri.href,
348-
text: operations.helpers.formatJson(tx)
348+
text: services.helpers.formatJson(tx)
349349
}]
350350
};
351351
} catch (error) {
@@ -367,12 +367,12 @@ export function registerEVMResources(server: McpServer) {
367367
try {
368368
const network = "ethereum";
369369
const txHash = params.txHash as string;
370-
const tx = await operations.getTransaction(txHash as Hash, network);
370+
const tx = await services.getTransaction(txHash as Hash, network);
371371

372372
return {
373373
contents: [{
374374
uri: uri.href,
375-
text: operations.helpers.formatJson(tx)
375+
text: services.helpers.formatJson(tx)
376376
}]
377377
};
378378
} catch (error) {
@@ -422,7 +422,7 @@ export function registerEVMResources(server: McpServer) {
422422
const network = params.network as string;
423423
const tokenAddress = params.tokenAddress as Address;
424424

425-
const tokenInfo = await operations.getERC20TokenInfo(tokenAddress, network);
425+
const tokenInfo = await services.getERC20TokenInfo(tokenAddress, network);
426426

427427
return {
428428
contents: [{
@@ -455,7 +455,7 @@ export function registerEVMResources(server: McpServer) {
455455
const tokenAddress = params.tokenAddress as Address;
456456
const address = params.address as Address;
457457

458-
const balance = await operations.getERC20Balance(tokenAddress, address, network);
458+
const balance = await services.getERC20Balance(tokenAddress, address, network);
459459

460460
return {
461461
contents: [{
@@ -492,12 +492,12 @@ export function registerEVMResources(server: McpServer) {
492492
const tokenAddress = params.tokenAddress as Address;
493493
const tokenId = BigInt(params.tokenId as string);
494494

495-
const nftInfo = await operations.getERC721TokenMetadata(tokenAddress, tokenId, network);
495+
const nftInfo = await services.getERC721TokenMetadata(tokenAddress, tokenId, network);
496496

497497
// Get owner separately
498498
let owner = "Unknown";
499499
try {
500-
const isOwner = await operations.isNFTOwner(tokenAddress, params.address as Address, tokenId, network);
500+
const isOwner = await services.isNFTOwner(tokenAddress, params.address as Address, tokenId, network);
501501
if (isOwner) {
502502
owner = params.address as string;
503503
}
@@ -539,7 +539,7 @@ export function registerEVMResources(server: McpServer) {
539539
const tokenId = BigInt(params.tokenId as string);
540540
const address = params.address as Address;
541541

542-
const isOwner = await operations.isNFTOwner(tokenAddress, address, tokenId, network);
542+
const isOwner = await services.isNFTOwner(tokenAddress, address, tokenId, network);
543543

544544
return {
545545
contents: [{
@@ -574,7 +574,7 @@ export function registerEVMResources(server: McpServer) {
574574
const tokenAddress = params.tokenAddress as Address;
575575
const tokenId = BigInt(params.tokenId as string);
576576

577-
const tokenURI = await operations.getERC1155TokenURI(tokenAddress, tokenId, network);
577+
const tokenURI = await services.getERC1155TokenURI(tokenAddress, tokenId, network);
578578

579579
return {
580580
contents: [{
@@ -609,7 +609,7 @@ export function registerEVMResources(server: McpServer) {
609609
const tokenId = BigInt(params.tokenId as string);
610610
const address = params.address as Address;
611611

612-
const balance = await operations.getERC1155Balance(tokenAddress, address, tokenId, network);
612+
const balance = await services.getERC1155Balance(tokenAddress, address, tokenId, network);
613613

614614
return {
615615
contents: [{
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/core/operations/index.ts src/core/services/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Export all operations
1+
// Export all services
22
export * from './clients.js';
33
export * from './balance.js';
44
export * from './transfer.js';
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)