Tap to Trade in Gate Square, Win up to 50 GT & Merch!
Click the trading widget in Gate Square content, complete a transaction, and take home 50 GT, Position Experience Vouchers, or exclusive Spring Festival merchandise.
Click the registration link to join
https://www.gate.com/questionnaire/7401
Enter Gate Square daily and click any trading pair or trading card within the content to complete a transaction. The top 10 users by trading volume will win GT, Gate merchandise boxes, position experience vouchers, and more.
The top prize: 50 GT.
 is an open protocol introduced by Anthropic that provides a standardized way for large language models to securely access external tools, data sources, and services. Unlike traditional plugin systems, MCP adopts a client-server architecture, achieving seamless integration between the model and external systems through standardized protocol interfaces.
The core advantages of MCP
Standardized Interface: MCP defines a unified protocol specification, avoiding the problem of each application needing to develop its own integration solution.
Security: Ensure safe access to external tools through strict permission control and sandbox mechanisms.
Scalability: Supports a wide range of tool types, from simple API calls to complex data processing workflows.
Interoperability: Any client that supports MCP can use compatible services, achieving true cross-platform compatibility.
Application scenarios of Web3 + MCP
In the Web3 space, MCP can provide rich blockchain interaction capabilities for large language models:
This article will build a simple Web3 MCP service using nodejs and typescript, guiding you to understand the working principle of MCP and best practices.
1. Create Project
![Web3 Beginner Series: Complete Transaction in One Sentence - MCP]###https://img.gateio.im/social/moments-f87a5b038d951e1b5cd33312207c694d(
![Web3 Beginner Series: Complete Transaction in One Sentence with MCP])https://img.gateio.im/social/moments-8ce45d7277465f5ca61b517b3dd2cfdd(
![Web3 Beginner Series: Complete Transactions in One Sentence])https://img.gateio.im/social/moments-d74d958bde3d30e94a64dd4549b8856251f8a7-2223-4b35-82cf-dca331917746(
![Web3 Beginner Series: Complete Transaction in One Sentence with MCP])https://img.gateio.im/social/moments-382d6309975116932a73eaa2c492467c51f8a7-2223-4b35-82cf-dca331917746(
2. Writing the server
Quickly create tools through server.tool. Here, we will write a tool using the getBalance of the sepolia testnet as an example.
![Web3 Beginner Series: Complete Transaction in One Sentence with MCP])https://img.gateio.im/social/moments-2a22fc6fe9275e00574d15ee82bda6ff51f8a7-2223-4b35-82cf-dca331917746(
![Web3 Beginner Series: MCP completes a transaction in one sentence])https://img.gateio.im/social/moments-615ea54f0f284913c075844a610ba8c051f8a7-2223-4b35-82cf-dca331917746(
![Web3 Beginner Series: Complete Transactions in One Sentence])https://img.gateio.im/social/moments-72654c76f5e2b0e18ef9baef130abe4751f8a7-2223-4b35-82cf-dca331917746(
A minimal MCP service has been completed.
3. Debugging Services
At this stage, we need to package the js output and then execute modelcontextprotocol/inspector to start debugging.
![Web3 Beginner Series: Complete Transaction in One Sentence])https://img.gateio.im/social/moments-4437e5c4dea9778e71cf99088825a61151f8a7-2223-4b35-82cf-dca331917746(
4. Improve logic and reference it in Cursor
Improve more logic and methods, such as: support for multiple EVM networks, querying gas, sending transactions, querying token information, and token trading, among other common methods, which can be referenced in Cursor after packaging. Cursor is a brand new smart IDE that seamlessly integrates AI technology. Built on VSCode, Cursor is easy to use and can significantly enhance your work efficiency. At the same time, it is also an application that supports MCP integration.
![Web3 Beginner Series: MCP completes a transaction in one sentence])https://img.gateio.im/social/moments-6f1b10d2ec93edac82f0b0a6855d468e51f8a7-2223-4b35-82cf-dca331917746(
![Web3 Beginner Series: Complete Transaction in One Sentence])https://img.gateio.im/social/moments-69dbed0c9be828245711735ac4fe12c651f8a7-2223-4b35-82cf-dca331917746(
5. Usage
Then you can happily use it in chat~ (chat is Cursor’s AI assistant, which is located in the sidebar and can interact with the codebase through natural language.)
For example, “Check the balance of this address 0xE21E97Ad8B527acb90F0b148EfaFbA46625382cE on sepolia:”
![Web3 Beginner Series: MCP completes a transaction in one sentence])https://img.gateio.im/social/moments-8290f9c794e61d66b4ba9853d4aa941951f8a7-2223-4b35-82cf-dca331917746(
Another example is “0x2c1d9ef7ccede70d77e6038701cd63138dd920a0 to this address to transfer 0.1 ETH”:
![Web3 Beginner Series: Complete Transaction in One Sentence])https://img.gateio.im/social/moments-b78fcd12b8866cf46645c17229f5ec9c51f8a7-2223-4b35-82cf-dca331917746(
VI. Final Thoughts
There is still a lot of room for our imagination. This article has explained the overall process, so what else can we do next? For example, supporting multiple chains (Bitcoin, Solana, Tron), and we can also integrate cross-chain capabilities. In the chat, we could say, “Convert my USDT on this chain to another chain’s?” The combination of Web3 and MCP has opened up a new world full of possibilities for us. Whether it’s DeFi protocol integration, NFT market operations, or complex cross-chain asset management, all of these can be achieved through simple conversations.
Friends who are interested, come and give it a try!