Repository files navigation

SEI MCP Server

License: MITEVM NetworksTypeScriptViem

Sei Model Context Protocol (Sei MCP) server provides blockchain services for Sei blockchain. This server enables AI assistants and agents to interact via unified interface.

📋 Contents

🔭 Overview

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

  • Reading blockchain state (balances, transactions, blocks, etc.)
  • Interacting with smart contracts
  • Transferring tokens (native, ERC20, ERC721, ERC1155)
  • Querying token metadata and balances

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.

✨ Features

Blockchain Data Access

  • Chain information including blockNumber, chainId, and RPCs
  • Block data access by number, hash, or latest
  • Transaction details and receipts with decoded logs
  • Address balances for native tokens and all token standards

Token services

  • ERC20 Tokens

    • Get token metadata (name, symbol, decimals, supply)
    • Check token balances
    • Transfer tokens between addresses
    • Approve spending allowances
  • NFTs (ERC721)

    • Get collection and token metadata
    • Verify token ownership
    • Transfer NFTs between addresses
    • Retrieve token URIs and count holdings
  • Multi-tokens (ERC1155)

    • Get token balances and metadata
    • Transfer tokens with quantity
    • Access token URIs

Smart Contract Interactions

  • Read contract state through view/pure functions
  • Write services with private key signing
  • Contract verification to distinguish from EOAs
  • Event logs retrieval and filtering

Comprehensive Transaction Support

  • Native token transfers across all supported networks
  • Gas estimation for transaction planning
  • Transaction status and receipt information
  • Error handling with descriptive messages

🌐 Supported Networks

  • Sei Mainnet
  • Sei Testnet
  • Sei Devnet

🛠️ Prerequisites

  • Bun 1.0.0 or higher
  • Node.js 18.0.0 or higher (if not using Bun)

📦 Installation

# Clone the repository
git clone https://github.com/sei-protocol/sei-mcp-server.git
cd sei-mcp-server
# Install dependencies with Bun
bun install
# Or with npm
npm install

⚙️ Server Configuration

The server uses the following default configuration:

  • Default Chain ID: 1329 (Sei Mainnet)
  • Server Port: 3001
  • Server Host: 0.0.0.0 (accessible from any network interface)

These values are hardcoded in the application. If you need to modify them, you can edit the following files:

  • For chain configuration: src/core/chains.ts
  • For server configuration: src/server/http-server.ts

Environment Variables

The server supports loading configuration from environment variables:

  • PRIVATE_KEY: Required private key for any blockchain operations that involve signing transactions (e.g., transferring tokens, interacting with smart contracts that modify state). This is the sole method for providing a private key. If this environment variable is not set when a transaction-signing tool is invoked, the tool will return an error message instructing the AI assistant to ask the user to set the PRIVATE_KEY environment variable and restart the MCP server.

Create a .env file in the root directory based on the .env.example template:

# .env.example
PRIVATE_KEY=your_private_key_here

SECURITY WARNING: Never commit your actual private key to version control. The .env file is included in .gitignore by default.

🚀 Usage

Using with Claude Desktop

  1. Install the Claude Desktop.
  2. Go to Settings > Developer > Edit Config.
  3. Add the following to the mcpServers section:
{
"mcpServers": {
"sei": {
"command": "npx",
"args": [
"-y",
"@sei-protocol/sei-mcp-server"
],
"env": {
"PRIVATE_KEY": "your_private_key_here"
}
}
}
}
  1. Save the configuration file and restart Claude. When done, Claude will add new prompts, resources and tools. To access prompts, click "+" button in the bottom left corner. And then "Add from sei".

Sei Prompts

From there, click "Add from sei" to and for example, add a "my_wallet_address" prompt. Claude should invoke now get_address_from_private_key tool and return the wallet address. Sometimes, model may fail to understand tbe prompt or random question. Try to add a bit more context or retry with extensive thinking option.

All tools available could be found by clicking "Search And Tools" button and then "sei".

Claude Search And ToolsSei Tools

Using npx (No Installation Required)

You can run the Sei MCP Server directly without installation using npx:

# Run the server in stdio mode (for CLI tools)
npx @sei-protocol/sei-mcp-server
# Run the server in HTTP mode (for web applications)
npx @sei-protocol/sei-mcp-server --http

Running the Server Locally

Start the server using stdio (for embedding in CLI tools):

# Start the stdio server
bun start
# Development mode with auto-reload
bun dev

Or start the HTTP server with SSE for web applications:

# Start the HTTP server
bun start:http
# Development mode with auto-reload
bun dev:http

Connecting to the Server

Connect to this MCP server using any MCP-compatible client. For testing and debugging, you can use the MCP Inspector.

Connecting from Cursor

To connect to the MCP server from Cursor:

  1. Open Cursor and go to Settings (gear icon in the bottom left)
  2. Scroll down to "MCP" section
  3. Click "Add new Global MCP server"
  4. In mcp.json tab add the following configuration
{
"mcpServers": {
"sei-mcp-server": {
"command": "npx",
"args": [
"-y",
"@sei-protocol/sei-mcp-server"
],
"env": {
"PRIVATE_KEY": "your_private_key_here"
}
}
}
}

Example: HTTP Mode with SSE

If you're developing a web application and want to connect to the HTTP server with Server-Sent Events (SSE), you can use this configuration:

{
"mcpServers": {
"sei-mcp-sse": {
"url": "http://localhost:3001/sse"
}
}
}

This connects directly to the HTTP server's SSE endpoint, which is useful for:

  • Web applications that need to connect to the MCP server from the browser
  • Environments where running local commands isn't ideal
  • Sharing a single MCP server instance among multiple users or applications

To use this configuration:

  1. Create a .cursor directory in your project root if it doesn't exist
  2. Save the above JSON as mcp.json in the .cursor directory
  3. Restart Cursor or open your project
  4. Cursor will detect the configuration and offer to enable the server(s)

Example: Using the MCP Server in Cursor

After configuring the MCP server with mcp.json, you can easily use it in Cursor. Here's an example workflow:

  1. Create a new JavaScript/TypeScript file in your project:
// blockchain-example.jsasyncfunctionmain(){try{// Get Sei balance for an addressconsole.log("Getting Sei balance for 0x1234...");// When using with Cursor, you can simply ask Cursor to:// "Check the Sei balance of 0x1234 on mainnet"// Or "Transfer 0.1 Sei from my wallet to 0x1234"// Cursor will use the MCP server to execute these operations // without requiring any additional code from you// This is the power of the MCP integration - your AI assistant// can directly interact with blockchain data and operations}catch(error){console.error("Error:",error.message);}}main();
  1. With the file open in Cursor, you can ask Cursor to:

    • "Check the current Sei balance of 0x1234 on mainnet"
    • "Show me the latest block on Sei"
    • "Check if 0x1234... is a contract address"
  2. Cursor will use the MCP server to execute these operations and return the results directly in your conversation.

The MCP server handles all the blockchain communication while allowing Cursor to understand and execute blockchain-related tasks through natural language.

Connecting using Claude CLI

If you're using Claude CLI, you can connect to the MCP server with just two commands:

# Add the MCP server
claude mcp add evm-mcp-server npx @sei-protocol/sei-mcp-server
# Start Claude with the MCP server enabled
claude

Example: Getting a Token Balance

// Example of using the MCP client to check a token balanceconstmcp=newMcpClient("http://localhost:3000");constresult=awaitmcp.invokeTool("get-token-balance",{tokenAddress: "0x3894085ef7ff0f0aedf52e2a2704928d1ec074f1",// USDC on SeiownerAddress: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",network: "sei"});console.log(result);// {// tokenAddress: "0x3894085ef7ff0f0aedf52e2a2704928d1ec074f1",// owner: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",// network: "sei",// raw: "1000000000",// formatted: "1000",// symbol: "USDC",// decimals: 6// }

📚 API Reference

Tools

The server provides the following MCP tools for agents.

Token services

Tool NameDescriptionKey Parameters
get-token-infoGet ERC20 token metadatatokenAddress (address), network
get-token-balanceCheck ERC20 token balancetokenAddress (address), ownerAddress (address), network
transfer-tokenTransfer ERC20 tokenstokenAddress (address), toAddress (address), amount, network
approve-token-spendingApprove token allowancestokenAddress (address), spenderAddress (address), amount, network
get-nft-infoGet NFT metadatatokenAddress (address), tokenId, network
check-nft-ownershipVerify NFT ownershiptokenAddress (address), tokenId, ownerAddress (address), network
get-nft-balanceCount NFTs ownedtokenAddress (address), ownerAddress (address), network
get-erc1155-token-uriGet ERC1155 metadatatokenAddress (address), tokenId, network
get-erc1155-balanceCheck ERC1155 balancetokenAddress (address), tokenId, ownerAddress (address), network
transfer-erc1155Transfer ERC1155 tokenstokenAddress (address), tokenId, amount, toAddress (address), network

Blockchain services

Tool NameDescriptionKey Parameters
get-chain-infoGet network informationnetwork
get-balanceGet native token balanceaddress (address), network
transfer-seiSend native tokensto (address), amount, network
get-transactionGet transaction detailstxHash, network
read-contractRead smart contract statecontractAddress (address), abi, functionName, args (optional), network
write-contractWrite to smart contractcontractAddress (address), abi, functionName, args (optional), network
is-contractCheck if address is a contractaddress (address), network

Resources

The server exposes blockchain data through the following MCP resource URIs.

Blockchain Resources

Resource URI PatternDescription
evm://{network}/chainChain information for a specific network
evm://chainSei mainnet chain information
evm://{network}/block/{blockNumber}Block data by number
evm://{network}/block/latestLatest block data
evm://{network}/address/{address}/balanceNative token balance
evm://{network}/tx/{txHash}Transaction details
evm://{network}/tx/{txHash}/receiptTransaction receipt with logs

Token Resources

Resource URI PatternDescription
evm://{network}/token/{tokenAddress}ERC20 token information
evm://{network}/token/{tokenAddress}/balanceOf/{address}ERC20 token balance
evm://{network}/nft/{tokenAddress}/{tokenId}NFT (ERC721) token information
evm://{network}/nft/{tokenAddress}/{tokenId}/isOwnedBy/{address}NFT ownership verification
evm://{network}/erc1155/{tokenAddress}/{tokenId}/uriERC1155 token URI
evm://{network}/erc1155/{tokenAddress}/{tokenId}/balanceOf/{address}ERC1155 token balance

🔒 Security Considerations

  • Private keys are used only for transaction signing and are never stored by the server
  • Consider implementing additional authentication mechanisms for production use
  • Use HTTPS for the HTTP server in production environments
  • Implement rate limiting to prevent abuse
  • For high-value services, consider adding confirmation steps

📁 Project Structure

mcp-evm-server/
├── src/
│ ├── index.ts # Main stdio server entry point
│ ├── server/ # Server-related files
│ │ ├── http-server.ts # HTTP server with SSE
│ │ └── server.ts # General server setup
│ ├── core/
│ │ ├── chains.ts # Chain definitions and utilities
│ │ ├── config.ts # MCP configuration
│ │ ├── resources.ts # MCP resources implementation
│ │ ├── tools.ts # MCP tools implementation
│ │ ├── prompts.ts # MCP prompts implementation
│ │ └── services/ # Core blockchain services
│ │ ├── index.ts # Operation exports
│ │ ├── balance.ts # Balance services
│ │ ├── transfer.ts # Token transfer services
│ │ ├── utils.ts # Utility functions
│ │ ├── tokens.ts # Token metadata services
│ │ ├── contracts.ts # Contract interactions
│ │ ├── transactions.ts # Transaction services
│ │ └── blocks.ts # Block services
│ │ └── clients.ts # RPC client utilities
├── package.json
├── tsconfig.json
└── README.md

🛠️ Development

To modify or extend the server:

  1. Add new services in the appropriate file under src/core/services/
  2. Register new tools in src/core/tools.ts
  3. Register new resources in src/core/resources.ts
  4. Add new network support in src/core/chains.ts
  5. To change server configuration, edit the hardcoded values in src/server/http-server.ts

📄 License

This project is licensed under the terms of the MIT License.

About

MCP server that provides LLM with tools for interacting with Sei network

Resources

Stars

13 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

Repository files navigation

SEI MCP Server

License: MITEVM NetworksTypeScriptViem

Sei Model Context Protocol (Sei MCP) server provides blockchain services for Sei blockchain. This server enables AI assistants and agents to interact via unified interface.

📋 Contents

🔭 Overview

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

  • Reading blockchain state (balances, transactions, blocks, etc.)
  • Interacting with smart contracts
  • Transferring tokens (native, ERC20, ERC721, ERC1155)
  • Querying token metadata and balances

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.

✨ Features

Blockchain Data Access

  • Chain information including blockNumber, chainId, and RPCs
  • Block data access by number, hash, or latest
  • Transaction details and receipts with decoded logs
  • Address balances for native tokens and all token standards

Token services

  • ERC20 Tokens

    • Get token metadata (name, symbol, decimals, supply)
    • Check token balances
    • Transfer tokens between addresses
    • Approve spending allowances
  • NFTs (ERC721)

    • Get collection and token metadata
    • Verify token ownership
    • Transfer NFTs between addresses
    • Retrieve token URIs and count holdings
  • Multi-tokens (ERC1155)

    • Get token balances and metadata
    • Transfer tokens with quantity
    • Access token URIs

Smart Contract Interactions

  • Read contract state through view/pure functions
  • Write services with private key signing
  • Contract verification to distinguish from EOAs
  • Event logs retrieval and filtering

Comprehensive Transaction Support

  • Native token transfers across all supported networks
  • Gas estimation for transaction planning
  • Transaction status and receipt information
  • Error handling with descriptive messages

🌐 Supported Networks

  • Sei Mainnet
  • Sei Testnet
  • Sei Devnet

🛠️ Prerequisites

  • Bun 1.0.0 or higher
  • Node.js 18.0.0 or higher (if not using Bun)

📦 Installation

# Clone the repository
git clone https://github.com/sei-protocol/sei-mcp-server.git
cd sei-mcp-server
# Install dependencies with Bun
bun install
# Or with npm
npm install

⚙️ Server Configuration

The server uses the following default configuration:

  • Default Chain ID: 1329 (Sei Mainnet)
  • Server Port: 3001
  • Server Host: 0.0.0.0 (accessible from any network interface)

These values are hardcoded in the application. If you need to modify them, you can edit the following files:

  • For chain configuration: src/core/chains.ts
  • For server configuration: src/server/http-server.ts

Environment Variables

The server supports loading configuration from environment variables:

  • PRIVATE_KEY: Required private key for any blockchain operations that involve signing transactions (e.g., transferring tokens, interacting with smart contracts that modify state). This is the sole method for providing a private key. If this environment variable is not set when a transaction-signing tool is invoked, the tool will return an error message instructing the AI assistant to ask the user to set the PRIVATE_KEY environment variable and restart the MCP server.

Create a .env file in the root directory based on the .env.example template:

# .env.example
PRIVATE_KEY=your_private_key_here

SECURITY WARNING: Never commit your actual private key to version control. The .env file is included in .gitignore by default.

🚀 Usage

Using with Claude Desktop

  1. Install the Claude Desktop.
  2. Go to Settings > Developer > Edit Config.
  3. Add the following to the mcpServers section:
{
"mcpServers": {
"sei": {
"command": "npx",
"args": [
"-y",
"@sei-protocol/sei-mcp-server"
],
"env": {
"PRIVATE_KEY": "your_private_key_here"
}
}
}
}
  1. Save the configuration file and restart Claude. When done, Claude will add new prompts, resources and tools. To access prompts, click "+" button in the bottom left corner. And then "Add from sei".

Sei Prompts

From there, click "Add from sei" to and for example, add a "my_wallet_address" prompt. Claude should invoke now get_address_from_private_key tool and return the wallet address. Sometimes, model may fail to understand tbe prompt or random question. Try to add a bit more context or retry with extensive thinking option.

All tools available could be found by clicking "Search And Tools" button and then "sei".

Claude Search And ToolsSei Tools

Using npx (No Installation Required)

You can run the Sei MCP Server directly without installation using npx:

# Run the server in stdio mode (for CLI tools)
npx @sei-protocol/sei-mcp-server
# Run the server in HTTP mode (for web applications)
npx @sei-protocol/sei-mcp-server --http

Running the Server Locally

Start the server using stdio (for embedding in CLI tools):

# Start the stdio server
bun start
# Development mode with auto-reload
bun dev

Or start the HTTP server with SSE for web applications:

# Start the HTTP server
bun start:http
# Development mode with auto-reload
bun dev:http

Connecting to the Server

Connect to this MCP server using any MCP-compatible client. For testing and debugging, you can use the MCP Inspector.

Connecting from Cursor

To connect to the MCP server from Cursor:

  1. Open Cursor and go to Settings (gear icon in the bottom left)
  2. Scroll down to "MCP" section
  3. Click "Add new Global MCP server"
  4. In mcp.json tab add the following configuration
{
"mcpServers": {
"sei-mcp-server": {
"command": "npx",
"args": [
"-y",
"@sei-protocol/sei-mcp-server"
],
"env": {
"PRIVATE_KEY": "your_private_key_here"
}
}
}
}

Example: HTTP Mode with SSE

If you're developing a web application and want to connect to the HTTP server with Server-Sent Events (SSE), you can use this configuration:

{
"mcpServers": {
"sei-mcp-sse": {
"url": "http://localhost:3001/sse"
}
}
}

This connects directly to the HTTP server's SSE endpoint, which is useful for:

  • Web applications that need to connect to the MCP server from the browser
  • Environments where running local commands isn't ideal
  • Sharing a single MCP server instance among multiple users or applications

To use this configuration:

  1. Create a .cursor directory in your project root if it doesn't exist
  2. Save the above JSON as mcp.json in the .cursor directory
  3. Restart Cursor or open your project
  4. Cursor will detect the configuration and offer to enable the server(s)

Example: Using the MCP Server in Cursor

After configuring the MCP server with mcp.json, you can easily use it in Cursor. Here's an example workflow:

  1. Create a new JavaScript/TypeScript file in your project:
// blockchain-example.jsasyncfunctionmain(){try{// Get Sei balance for an addressconsole.log("Getting Sei balance for 0x1234...");// When using with Cursor, you can simply ask Cursor to:// "Check the Sei balance of 0x1234 on mainnet"// Or "Transfer 0.1 Sei from my wallet to 0x1234"// Cursor will use the MCP server to execute these operations // without requiring any additional code from you// This is the power of the MCP integration - your AI assistant// can directly interact with blockchain data and operations}catch(error){console.error("Error:",error.message);}}main();
  1. With the file open in Cursor, you can ask Cursor to:

    • "Check the current Sei balance of 0x1234 on mainnet"
    • "Show me the latest block on Sei"
    • "Check if 0x1234... is a contract address"
  2. Cursor will use the MCP server to execute these operations and return the results directly in your conversation.

The MCP server handles all the blockchain communication while allowing Cursor to understand and execute blockchain-related tasks through natural language.

Connecting using Claude CLI

If you're using Claude CLI, you can connect to the MCP server with just two commands:

# Add the MCP server
claude mcp add evm-mcp-server npx @sei-protocol/sei-mcp-server
# Start Claude with the MCP server enabled
claude

Example: Getting a Token Balance

// Example of using the MCP client to check a token balanceconstmcp=newMcpClient("http://localhost:3000");constresult=awaitmcp.invokeTool("get-token-balance",{tokenAddress: "0x3894085ef7ff0f0aedf52e2a2704928d1ec074f1",// USDC on SeiownerAddress: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",network: "sei"});console.log(result);// {// tokenAddress: "0x3894085ef7ff0f0aedf52e2a2704928d1ec074f1",// owner: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",// network: "sei",// raw: "1000000000",// formatted: "1000",// symbol: "USDC",// decimals: 6// }

📚 API Reference

Tools

The server provides the following MCP tools for agents.

Token services

Tool NameDescriptionKey Parameters
get-token-infoGet ERC20 token metadatatokenAddress (address), network
get-token-balanceCheck ERC20 token balancetokenAddress (address), ownerAddress (address), network
transfer-tokenTransfer ERC20 tokenstokenAddress (address), toAddress (address), amount, network
approve-token-spendingApprove token allowancestokenAddress (address), spenderAddress (address), amount, network
get-nft-infoGet NFT metadatatokenAddress (address), tokenId, network
check-nft-ownershipVerify NFT ownershiptokenAddress (address), tokenId, ownerAddress (address), network
get-nft-balanceCount NFTs ownedtokenAddress (address), ownerAddress (address), network
get-erc1155-token-uriGet ERC1155 metadatatokenAddress (address), tokenId, network
get-erc1155-balanceCheck ERC1155 balancetokenAddress (address), tokenId, ownerAddress (address), network
transfer-erc1155Transfer ERC1155 tokenstokenAddress (address), tokenId, amount, toAddress (address), network

Blockchain services

Tool NameDescriptionKey Parameters
get-chain-infoGet network informationnetwork
get-balanceGet native token balanceaddress (address), network
transfer-seiSend native tokensto (address), amount, network
get-transactionGet transaction detailstxHash, network
read-contractRead smart contract statecontractAddress (address), abi, functionName, args (optional), network
write-contractWrite to smart contractcontractAddress (address), abi, functionName, args (optional), network
is-contractCheck if address is a contractaddress (address), network

Resources

The server exposes blockchain data through the following MCP resource URIs.

Blockchain Resources

Resource URI PatternDescription
evm://{network}/chainChain information for a specific network
evm://chainSei mainnet chain information
evm://{network}/block/{blockNumber}Block data by number
evm://{network}/block/latestLatest block data
evm://{network}/address/{address}/balanceNative token balance
evm://{network}/tx/{txHash}Transaction details
evm://{network}/tx/{txHash}/receiptTransaction receipt with logs

Token Resources

Resource URI PatternDescription
evm://{network}/token/{tokenAddress}ERC20 token information
evm://{network}/token/{tokenAddress}/balanceOf/{address}ERC20 token balance
evm://{network}/nft/{tokenAddress}/{tokenId}NFT (ERC721) token information
evm://{network}/nft/{tokenAddress}/{tokenId}/isOwnedBy/{address}NFT ownership verification
evm://{network}/erc1155/{tokenAddress}/{tokenId}/uriERC1155 token URI
evm://{network}/erc1155/{tokenAddress}/{tokenId}/balanceOf/{address}ERC1155 token balance

🔒 Security Considerations

  • Private keys are used only for transaction signing and are never stored by the server
  • Consider implementing additional authentication mechanisms for production use
  • Use HTTPS for the HTTP server in production environments
  • Implement rate limiting to prevent abuse
  • For high-value services, consider adding confirmation steps

📁 Project Structure

mcp-evm-server/
├── src/
│ ├── index.ts # Main stdio server entry point
│ ├── server/ # Server-related files
│ │ ├── http-server.ts # HTTP server with SSE
│ │ └── server.ts # General server setup
│ ├── core/
│ │ ├── chains.ts # Chain definitions and utilities
│ │ ├── config.ts # MCP configuration
│ │ ├── resources.ts # MCP resources implementation
│ │ ├── tools.ts # MCP tools implementation
│ │ ├── prompts.ts # MCP prompts implementation
│ │ └── services/ # Core blockchain services
│ │ ├── index.ts # Operation exports
│ │ ├── balance.ts # Balance services
│ │ ├── transfer.ts # Token transfer services
│ │ ├── utils.ts # Utility functions
│ │ ├── tokens.ts # Token metadata services
│ │ ├── contracts.ts # Contract interactions
│ │ ├── transactions.ts # Transaction services
│ │ └── blocks.ts # Block services
│ │ └── clients.ts # RPC client utilities
├── package.json
├── tsconfig.json
└── README.md

🛠️ Development

To modify or extend the server:

  1. Add new services in the appropriate file under src/core/services/
  2. Register new tools in src/core/tools.ts
  3. Register new resources in src/core/resources.ts
  4. Add new network support in src/core/chains.ts
  5. To change server configuration, edit the hardcoded values in src/server/http-server.ts

📄 License

This project is licensed under the terms of the MIT License.

About

MCP server that provides LLM with tools for interacting with Sei network

Resources

Stars

13 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

SEI MCP Server

License: MITEVM NetworksTypeScriptViem

Sei Model Context Protocol (Sei MCP) server provides blockchain services for Sei blockchain. This server enables AI assistants and agents to interact via unified interface.

📋 Contents

🔭 Overview

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

  • Reading blockchain state (balances, transactions, blocks, etc.)
  • Interacting with smart contracts
  • Transferring tokens (native, ERC20, ERC721, ERC1155)
  • Querying token metadata and balances

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.

✨ Features

Blockchain Data Access

  • Chain information including blockNumber, chainId, and RPCs
  • Block data access by number, hash, or latest
  • Transaction details and receipts with decoded logs
  • Address balances for native tokens and all token standards

Token services

  • ERC20 Tokens

    • Get token metadata (name, symbol, decimals, supply)
    • Check token balances
    • Transfer tokens between addresses
    • Approve spending allowances
  • NFTs (ERC721)

    • Get collection and token metadata
    • Verify token ownership
    • Transfer NFTs between addresses
    • Retrieve token URIs and count holdings
  • Multi-tokens (ERC1155)

    • Get token balances and metadata
    • Transfer tokens with quantity
    • Access token URIs

Smart Contract Interactions

  • Read contract state through view/pure functions
  • Write services with private key signing
  • Contract verification to distinguish from EOAs
  • Event logs retrieval and filtering

Comprehensive Transaction Support

  • Native token transfers across all supported networks
  • Gas estimation for transaction planning
  • Transaction status and receipt information
  • Error handling with descriptive messages

🌐 Supported Networks

  • Sei Mainnet
  • Sei Testnet
  • Sei Devnet

🛠️ Prerequisites

  • Bun 1.0.0 or higher
  • Node.js 18.0.0 or higher (if not using Bun)

📦 Installation

# Clone the repository
git clone https://github.com/sei-protocol/sei-mcp-server.git
cd sei-mcp-server
# Install dependencies with Bun
bun install
# Or with npm
npm install

⚙️ Server Configuration

The server uses the following default configuration:

  • Default Chain ID: 1329 (Sei Mainnet)
  • Server Port: 3001
  • Server Host: 0.0.0.0 (accessible from any network interface)

These values are hardcoded in the application. If you need to modify them, you can edit the following files:

  • For chain configuration: src/core/chains.ts
  • For server configuration: src/server/http-server.ts

Environment Variables

The server supports loading configuration from environment variables:

  • PRIVATE_KEY: Required private key for any blockchain operations that involve signing transactions (e.g., transferring tokens, interacting with smart contracts that modify state). This is the sole method for providing a private key. If this environment variable is not set when a transaction-signing tool is invoked, the tool will return an error message instructing the AI assistant to ask the user to set the PRIVATE_KEY environment variable and restart the MCP server.

Create a .env file in the root directory based on the .env.example template:

# .env.example
PRIVATE_KEY=your_private_key_here

SECURITY WARNING: Never commit your actual private key to version control. The .env file is included in .gitignore by default.

🚀 Usage

Using with Claude Desktop

  1. Install the Claude Desktop.
  2. Go to Settings > Developer > Edit Config.
  3. Add the following to the mcpServers section:
{
"mcpServers": {
"sei": {
"command": "npx",
"args": [
"-y",
"@sei-protocol/sei-mcp-server"
],
"env": {
"PRIVATE_KEY": "your_private_key_here"
}
}
}
}
  1. Save the configuration file and restart Claude. When done, Claude will add new prompts, resources and tools. To access prompts, click "+" button in the bottom left corner. And then "Add from sei".

Sei Prompts

From there, click "Add from sei" to and for example, add a "my_wallet_address" prompt. Claude should invoke now get_address_from_private_key tool and return the wallet address. Sometimes, model may fail to understand tbe prompt or random question. Try to add a bit more context or retry with extensive thinking option.

All tools available could be found by clicking "Search And Tools" button and then "sei".

Claude Search And ToolsSei Tools

Using npx (No Installation Required)

You can run the Sei MCP Server directly without installation using npx:

# Run the server in stdio mode (for CLI tools)
npx @sei-protocol/sei-mcp-server
# Run the server in HTTP mode (for web applications)
npx @sei-protocol/sei-mcp-server --http

Running the Server Locally

Start the server using stdio (for embedding in CLI tools):

# Start the stdio server
bun start
# Development mode with auto-reload
bun dev

Or start the HTTP server with SSE for web applications:

# Start the HTTP server
bun start:http
# Development mode with auto-reload
bun dev:http

Connecting to the Server

Connect to this MCP server using any MCP-compatible client. For testing and debugging, you can use the MCP Inspector.

Connecting from Cursor

To connect to the MCP server from Cursor:

  1. Open Cursor and go to Settings (gear icon in the bottom left)
  2. Scroll down to "MCP" section
  3. Click "Add new Global MCP server"
  4. In mcp.json tab add the following configuration
{
"mcpServers": {
"sei-mcp-server": {
"command": "npx",
"args": [
"-y",
"@sei-protocol/sei-mcp-server"
],
"env": {
"PRIVATE_KEY": "your_private_key_here"
}
}
}
}

Example: HTTP Mode with SSE

If you're developing a web application and want to connect to the HTTP server with Server-Sent Events (SSE), you can use this configuration:

{
"mcpServers": {
"sei-mcp-sse": {
"url": "http://localhost:3001/sse"
}
}
}

This connects directly to the HTTP server's SSE endpoint, which is useful for:

  • Web applications that need to connect to the MCP server from the browser
  • Environments where running local commands isn't ideal
  • Sharing a single MCP server instance among multiple users or applications

To use this configuration:

  1. Create a .cursor directory in your project root if it doesn't exist
  2. Save the above JSON as mcp.json in the .cursor directory
  3. Restart Cursor or open your project
  4. Cursor will detect the configuration and offer to enable the server(s)

Example: Using the MCP Server in Cursor

After configuring the MCP server with mcp.json, you can easily use it in Cursor. Here's an example workflow:

  1. Create a new JavaScript/TypeScript file in your project:
// blockchain-example.jsasyncfunctionmain(){try{// Get Sei balance for an addressconsole.log("Getting Sei balance for 0x1234...");// When using with Cursor, you can simply ask Cursor to:// "Check the Sei balance of 0x1234 on mainnet"// Or "Transfer 0.1 Sei from my wallet to 0x1234"// Cursor will use the MCP server to execute these operations // without requiring any additional code from you// This is the power of the MCP integration - your AI assistant// can directly interact with blockchain data and operations}catch(error){console.error("Error:",error.message);}}main();
  1. With the file open in Cursor, you can ask Cursor to:

    • "Check the current Sei balance of 0x1234 on mainnet"
    • "Show me the latest block on Sei"
    • "Check if 0x1234... is a contract address"
  2. Cursor will use the MCP server to execute these operations and return the results directly in your conversation.

The MCP server handles all the blockchain communication while allowing Cursor to understand and execute blockchain-related tasks through natural language.

Connecting using Claude CLI

If you're using Claude CLI, you can connect to the MCP server with just two commands:

# Add the MCP server
claude mcp add evm-mcp-server npx @sei-protocol/sei-mcp-server
# Start Claude with the MCP server enabled
claude

Example: Getting a Token Balance

// Example of using the MCP client to check a token balanceconstmcp=newMcpClient("http://localhost:3000");constresult=awaitmcp.invokeTool("get-token-balance",{tokenAddress: "0x3894085ef7ff0f0aedf52e2a2704928d1ec074f1",// USDC on SeiownerAddress: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",network: "sei"});console.log(result);// {// tokenAddress: "0x3894085ef7ff0f0aedf52e2a2704928d1ec074f1",// owner: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",// network: "sei",// raw: "1000000000",// formatted: "1000",// symbol: "USDC",// decimals: 6// }

📚 API Reference

Tools

The server provides the following MCP tools for agents.

Token services

Tool NameDescriptionKey Parameters
get-token-infoGet ERC20 token metadatatokenAddress (address), network
get-token-balanceCheck ERC20 token balancetokenAddress (address), ownerAddress (address), network
transfer-tokenTransfer ERC20 tokenstokenAddress (address), toAddress (address), amount, network
approve-token-spendingApprove token allowancestokenAddress (address), spenderAddress (address), amount, network
get-nft-infoGet NFT metadatatokenAddress (address), tokenId, network
check-nft-ownershipVerify NFT ownershiptokenAddress (address), tokenId, ownerAddress (address), network
get-nft-balanceCount NFTs ownedtokenAddress (address), ownerAddress (address), network
get-erc1155-token-uriGet ERC1155 metadatatokenAddress (address), tokenId, network
get-erc1155-balanceCheck ERC1155 balancetokenAddress (address), tokenId, ownerAddress (address), network
transfer-erc1155Transfer ERC1155 tokenstokenAddress (address), tokenId, amount, toAddress (address), network

Blockchain services

Tool NameDescriptionKey Parameters
get-chain-infoGet network informationnetwork
get-balanceGet native token balanceaddress (address), network
transfer-seiSend native tokensto (address), amount, network
get-transactionGet transaction detailstxHash, network
read-contractRead smart contract statecontractAddress (address), abi, functionName, args (optional), network
write-contractWrite to smart contractcontractAddress (address), abi, functionName, args (optional), network
is-contractCheck if address is a contractaddress (address), network

Resources

The server exposes blockchain data through the following MCP resource URIs.

Blockchain Resources

Resource URI PatternDescription
evm://{network}/chainChain information for a specific network
evm://chainSei mainnet chain information
evm://{network}/block/{blockNumber}Block data by number
evm://{network}/block/latestLatest block data
evm://{network}/address/{address}/balanceNative token balance
evm://{network}/tx/{txHash}Transaction details
evm://{network}/tx/{txHash}/receiptTransaction receipt with logs

Token Resources

Resource URI PatternDescription
evm://{network}/token/{tokenAddress}ERC20 token information
evm://{network}/token/{tokenAddress}/balanceOf/{address}ERC20 token balance
evm://{network}/nft/{tokenAddress}/{tokenId}NFT (ERC721) token information
evm://{network}/nft/{tokenAddress}/{tokenId}/isOwnedBy/{address}NFT ownership verification
evm://{network}/erc1155/{tokenAddress}/{tokenId}/uriERC1155 token URI
evm://{network}/erc1155/{tokenAddress}/{tokenId}/balanceOf/{address}ERC1155 token balance

🔒 Security Considerations

  • Private keys are used only for transaction signing and are never stored by the server
  • Consider implementing additional authentication mechanisms for production use
  • Use HTTPS for the HTTP server in production environments
  • Implement rate limiting to prevent abuse
  • For high-value services, consider adding confirmation steps

📁 Project Structure

mcp-evm-server/
├── src/
│ ├── index.ts # Main stdio server entry point
│ ├── server/ # Server-related files
│ │ ├── http-server.ts # HTTP server with SSE
│ │ └── server.ts # General server setup
│ ├── core/
│ │ ├── chains.ts # Chain definitions and utilities
│ │ ├── config.ts # MCP configuration
│ │ ├── resources.ts # MCP resources implementation
│ │ ├── tools.ts # MCP tools implementation
│ │ ├── prompts.ts # MCP prompts implementation
│ │ └── services/ # Core blockchain services
│ │ ├── index.ts # Operation exports
│ │ ├── balance.ts # Balance services
│ │ ├── transfer.ts # Token transfer services
│ │ ├── utils.ts # Utility functions
│ │ ├── tokens.ts # Token metadata services
│ │ ├── contracts.ts # Contract interactions
│ │ ├── transactions.ts # Transaction services
│ │ └── blocks.ts # Block services
│ │ └── clients.ts # RPC client utilities
├── package.json
├── tsconfig.json
└── README.md

🛠️ Development

To modify or extend the server:

  1. Add new services in the appropriate file under src/core/services/
  2. Register new tools in src/core/tools.ts
  3. Register new resources in src/core/resources.ts
  4. Add new network support in src/core/chains.ts
  5. To change server configuration, edit the hardcoded values in src/server/http-server.ts

📄 License

This project is licensed under the terms of the MIT License.

About

MCP server that provides LLM with tools for interacting with Sei network

Resources

Stars

13 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

SEI MCP Server

License: MITEVM NetworksTypeScriptViem

Sei Model Context Protocol (Sei MCP) server provides blockchain services for Sei blockchain. This server enables AI assistants and agents to interact via unified interface.

📋 Contents

🔭 Overview

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

  • Reading blockchain state (balances, transactions, blocks, etc.)
  • Interacting with smart contracts
  • Transferring tokens (native, ERC20, ERC721, ERC1155)
  • Querying token metadata and balances

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.

✨ Features

Blockchain Data Access

  • Chain information including blockNumber, chainId, and RPCs
  • Block data access by number, hash, or latest
  • Transaction details and receipts with decoded logs
  • Address balances for native tokens and all token standards

Token services

  • ERC20 Tokens

    • Get token metadata (name, symbol, decimals, supply)
    • Check token balances
    • Transfer tokens between addresses
    • Approve spending allowances
  • NFTs (ERC721)

    • Get collection and token metadata
    • Verify token ownership
    • Transfer NFTs between addresses
    • Retrieve token URIs and count holdings
  • Multi-tokens (ERC1155)

    • Get token balances and metadata
    • Transfer tokens with quantity
    • Access token URIs

Smart Contract Interactions

  • Read contract state through view/pure functions
  • Write services with private key signing
  • Contract verification to distinguish from EOAs
  • Event logs retrieval and filtering

Comprehensive Transaction Support

  • Native token transfers across all supported networks
  • Gas estimation for transaction planning
  • Transaction status and receipt information
  • Error handling with descriptive messages

🌐 Supported Networks

  • Sei Mainnet
  • Sei Testnet
  • Sei Devnet

🛠️ Prerequisites

  • Bun 1.0.0 or higher
  • Node.js 18.0.0 or higher (if not using Bun)

📦 Installation

# Clone the repository
git clone https://github.com/sei-protocol/sei-mcp-server.git
cd sei-mcp-server
# Install dependencies with Bun
bun install
# Or with npm
npm install

⚙️ Server Configuration

The server uses the following default configuration:

  • Default Chain ID: 1329 (Sei Mainnet)
  • Server Port: 3001
  • Server Host: 0.0.0.0 (accessible from any network interface)

These values are hardcoded in the application. If you need to modify them, you can edit the following files:

  • For chain configuration: src/core/chains.ts
  • For server configuration: src/server/http-server.ts

Environment Variables

The server supports loading configuration from environment variables:

  • PRIVATE_KEY: Required private key for any blockchain operations that involve signing transactions (e.g., transferring tokens, interacting with smart contracts that modify state). This is the sole method for providing a private key. If this environment variable is not set when a transaction-signing tool is invoked, the tool will return an error message instructing the AI assistant to ask the user to set the PRIVATE_KEY environment variable and restart the MCP server.

Create a .env file in the root directory based on the .env.example template:

# .env.example
PRIVATE_KEY=your_private_key_here

SECURITY WARNING: Never commit your actual private key to version control. The .env file is included in .gitignore by default.

🚀 Usage

Using with Claude Desktop

  1. Install the Claude Desktop.
  2. Go to Settings > Developer > Edit Config.
  3. Add the following to the mcpServers section:
{
"mcpServers": {
"sei": {
"command": "npx",
"args": [
"-y",
"@sei-protocol/sei-mcp-server"
],
"env": {
"PRIVATE_KEY": "your_private_key_here"
}
}
}
}
  1. Save the configuration file and restart Claude. When done, Claude will add new prompts, resources and tools. To access prompts, click "+" button in the bottom left corner. And then "Add from sei".

Sei Prompts

From there, click "Add from sei" to and for example, add a "my_wallet_address" prompt. Claude should invoke now get_address_from_private_key tool and return the wallet address. Sometimes, model may fail to understand tbe prompt or random question. Try to add a bit more context or retry with extensive thinking option.

All tools available could be found by clicking "Search And Tools" button and then "sei".

Claude Search And ToolsSei Tools

Using npx (No Installation Required)

You can run the Sei MCP Server directly without installation using npx:

# Run the server in stdio mode (for CLI tools)
npx @sei-protocol/sei-mcp-server
# Run the server in HTTP mode (for web applications)
npx @sei-protocol/sei-mcp-server --http

Running the Server Locally

Start the server using stdio (for embedding in CLI tools):

# Start the stdio server
bun start
# Development mode with auto-reload
bun dev

Or start the HTTP server with SSE for web applications:

# Start the HTTP server
bun start:http
# Development mode with auto-reload
bun dev:http

Connecting to the Server

Connect to this MCP server using any MCP-compatible client. For testing and debugging, you can use the MCP Inspector.

Connecting from Cursor

To connect to the MCP server from Cursor:

  1. Open Cursor and go to Settings (gear icon in the bottom left)
  2. Scroll down to "MCP" section
  3. Click "Add new Global MCP server"
  4. In mcp.json tab add the following configuration
{
"mcpServers": {
"sei-mcp-server": {
"command": "npx",
"args": [
"-y",
"@sei-protocol/sei-mcp-server"
],
"env": {
"PRIVATE_KEY": "your_private_key_here"
}
}
}
}

Example: HTTP Mode with SSE

If you're developing a web application and want to connect to the HTTP server with Server-Sent Events (SSE), you can use this configuration:

{
"mcpServers": {
"sei-mcp-sse": {
"url": "http://localhost:3001/sse"
}
}
}

This connects directly to the HTTP server's SSE endpoint, which is useful for:

  • Web applications that need to connect to the MCP server from the browser
  • Environments where running local commands isn't ideal
  • Sharing a single MCP server instance among multiple users or applications

To use this configuration:

  1. Create a .cursor directory in your project root if it doesn't exist
  2. Save the above JSON as mcp.json in the .cursor directory
  3. Restart Cursor or open your project
  4. Cursor will detect the configuration and offer to enable the server(s)

Example: Using the MCP Server in Cursor

After configuring the MCP server with mcp.json, you can easily use it in Cursor. Here's an example workflow:

  1. Create a new JavaScript/TypeScript file in your project:
// blockchain-example.jsasyncfunctionmain(){try{// Get Sei balance for an addressconsole.log("Getting Sei balance for 0x1234...");// When using with Cursor, you can simply ask Cursor to:// "Check the Sei balance of 0x1234 on mainnet"// Or "Transfer 0.1 Sei from my wallet to 0x1234"// Cursor will use the MCP server to execute these operations // without requiring any additional code from you// This is the power of the MCP integration - your AI assistant// can directly interact with blockchain data and operations}catch(error){console.error("Error:",error.message);}}main();
  1. With the file open in Cursor, you can ask Cursor to:

    • "Check the current Sei balance of 0x1234 on mainnet"
    • "Show me the latest block on Sei"
    • "Check if 0x1234... is a contract address"
  2. Cursor will use the MCP server to execute these operations and return the results directly in your conversation.

The MCP server handles all the blockchain communication while allowing Cursor to understand and execute blockchain-related tasks through natural language.

Connecting using Claude CLI

If you're using Claude CLI, you can connect to the MCP server with just two commands:

# Add the MCP server
claude mcp add evm-mcp-server npx @sei-protocol/sei-mcp-server
# Start Claude with the MCP server enabled
claude

Example: Getting a Token Balance

// Example of using the MCP client to check a token balanceconstmcp=newMcpClient("http://localhost:3000");constresult=awaitmcp.invokeTool("get-token-balance",{tokenAddress: "0x3894085ef7ff0f0aedf52e2a2704928d1ec074f1",// USDC on SeiownerAddress: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",network: "sei"});console.log(result);// {// tokenAddress: "0x3894085ef7ff0f0aedf52e2a2704928d1ec074f1",// owner: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",// network: "sei",// raw: "1000000000",// formatted: "1000",// symbol: "USDC",// decimals: 6// }

📚 API Reference

Tools

The server provides the following MCP tools for agents.

Token services

Tool NameDescriptionKey Parameters
get-token-infoGet ERC20 token metadatatokenAddress (address), network
get-token-balanceCheck ERC20 token balancetokenAddress (address), ownerAddress (address), network
transfer-tokenTransfer ERC20 tokenstokenAddress (address), toAddress (address), amount, network
approve-token-spendingApprove token allowancestokenAddress (address), spenderAddress (address), amount, network
get-nft-infoGet NFT metadatatokenAddress (address), tokenId, network
check-nft-ownershipVerify NFT ownershiptokenAddress (address), tokenId, ownerAddress (address), network
get-nft-balanceCount NFTs ownedtokenAddress (address), ownerAddress (address), network
get-erc1155-token-uriGet ERC1155 metadatatokenAddress (address), tokenId, network
get-erc1155-balanceCheck ERC1155 balancetokenAddress (address), tokenId, ownerAddress (address), network
transfer-erc1155Transfer ERC1155 tokenstokenAddress (address), tokenId, amount, toAddress (address), network

Blockchain services

Tool NameDescriptionKey Parameters
get-chain-infoGet network informationnetwork
get-balanceGet native token balanceaddress (address), network
transfer-seiSend native tokensto (address), amount, network
get-transactionGet transaction detailstxHash, network
read-contractRead smart contract statecontractAddress (address), abi, functionName, args (optional), network
write-contractWrite to smart contractcontractAddress (address), abi, functionName, args (optional), network
is-contractCheck if address is a contractaddress (address), network

Resources

The server exposes blockchain data through the following MCP resource URIs.

Blockchain Resources

Resource URI PatternDescription
evm://{network}/chainChain information for a specific network
evm://chainSei mainnet chain information
evm://{network}/block/{blockNumber}Block data by number
evm://{network}/block/latestLatest block data
evm://{network}/address/{address}/balanceNative token balance
evm://{network}/tx/{txHash}Transaction details
evm://{network}/tx/{txHash}/receiptTransaction receipt with logs

Token Resources

Resource URI PatternDescription
evm://{network}/token/{tokenAddress}ERC20 token information
evm://{network}/token/{tokenAddress}/balanceOf/{address}ERC20 token balance
evm://{network}/nft/{tokenAddress}/{tokenId}NFT (ERC721) token information
evm://{network}/nft/{tokenAddress}/{tokenId}/isOwnedBy/{address}NFT ownership verification
evm://{network}/erc1155/{tokenAddress}/{tokenId}/uriERC1155 token URI
evm://{network}/erc1155/{tokenAddress}/{tokenId}/balanceOf/{address}ERC1155 token balance

🔒 Security Considerations

  • Private keys are used only for transaction signing and are never stored by the server
  • Consider implementing additional authentication mechanisms for production use
  • Use HTTPS for the HTTP server in production environments
  • Implement rate limiting to prevent abuse
  • For high-value services, consider adding confirmation steps

📁 Project Structure

mcp-evm-server/
├── src/
│ ├── index.ts # Main stdio server entry point
│ ├── server/ # Server-related files
│ │ ├── http-server.ts # HTTP server with SSE
│ │ └── server.ts # General server setup
│ ├── core/
│ │ ├── chains.ts # Chain definitions and utilities
│ │ ├── config.ts # MCP configuration
│ │ ├── resources.ts # MCP resources implementation
│ │ ├── tools.ts # MCP tools implementation
│ │ ├── prompts.ts # MCP prompts implementation
│ │ └── services/ # Core blockchain services
│ │ ├── index.ts # Operation exports
│ │ ├── balance.ts # Balance services
│ │ ├── transfer.ts # Token transfer services
│ │ ├── utils.ts # Utility functions
│ │ ├── tokens.ts # Token metadata services
│ │ ├── contracts.ts # Contract interactions
│ │ ├── transactions.ts # Transaction services
│ │ └── blocks.ts # Block services
│ │ └── clients.ts # RPC client utilities
├── package.json
├── tsconfig.json
└── README.md

🛠️ Development

To modify or extend the server:

  1. Add new services in the appropriate file under src/core/services/
  2. Register new tools in src/core/tools.ts
  3. Register new resources in src/core/resources.ts
  4. Add new network support in src/core/chains.ts
  5. To change server configuration, edit the hardcoded values in src/server/http-server.ts

📄 License

This project is licensed under the terms of the MIT License.

About

MCP server that provides LLM with tools for interacting with Sei network

Resources

Stars

13 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

Repository files navigation

SEI MCP Server

License: MITEVM NetworksTypeScriptViem

Sei Model Context Protocol (Sei MCP) server provides blockchain services for Sei blockchain. This server enables AI assistants and agents to interact via unified interface.

📋 Contents

🔭 Overview

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

  • Reading blockchain state (balances, transactions, blocks, etc.)
  • Interacting with smart contracts
  • Transferring tokens (native, ERC20, ERC721, ERC1155)
  • Querying token metadata and balances

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.

✨ Features

Blockchain Data Access

  • Chain information including blockNumber, chainId, and RPCs
  • Block data access by number, hash, or latest
  • Transaction details and receipts with decoded logs
  • Address balances for native tokens and all token standards

Token services

  • ERC20 Tokens

    • Get token metadata (name, symbol, decimals, supply)
    • Check token balances
    • Transfer tokens between addresses
    • Approve spending allowances
  • NFTs (ERC721)

    • Get collection and token metadata
    • Verify token ownership
    • Transfer NFTs between addresses
    • Retrieve token URIs and count holdings
  • Multi-tokens (ERC1155)

    • Get token balances and metadata
    • Transfer tokens with quantity
    • Access token URIs

Smart Contract Interactions

  • Read contract state through view/pure functions
  • Write services with private key signing
  • Contract verification to distinguish from EOAs
  • Event logs retrieval and filtering

Comprehensive Transaction Support

  • Native token transfers across all supported networks
  • Gas estimation for transaction planning
  • Transaction status and receipt information
  • Error handling with descriptive messages

🌐 Supported Networks

  • Sei Mainnet
  • Sei Testnet
  • Sei Devnet

🛠️ Prerequisites

  • Bun 1.0.0 or higher
  • Node.js 18.0.0 or higher (if not using Bun)

📦 Installation

# Clone the repository
git clone https://github.com/sei-protocol/sei-mcp-server.git
cd sei-mcp-server
# Install dependencies with Bun
bun install
# Or with npm
npm install

⚙️ Server Configuration

The server uses the following default configuration:

  • Default Chain ID: 1329 (Sei Mainnet)
  • Server Port: 3001
  • Server Host: 0.0.0.0 (accessible from any network interface)

These values are hardcoded in the application. If you need to modify them, you can edit the following files:

  • For chain configuration: src/core/chains.ts
  • For server configuration: src/server/http-server.ts

Environment Variables

The server supports loading configuration from environment variables:

  • PRIVATE_KEY: Required private key for any blockchain operations that involve signing transactions (e.g., transferring tokens, interacting with smart contracts that modify state). This is the sole method for providing a private key. If this environment variable is not set when a transaction-signing tool is invoked, the tool will return an error message instructing the AI assistant to ask the user to set the PRIVATE_KEY environment variable and restart the MCP server.

Create a .env file in the root directory based on the .env.example template:

# .env.example
PRIVATE_KEY=your_private_key_here

SECURITY WARNING: Never commit your actual private key to version control. The .env file is included in .gitignore by default.

🚀 Usage

Using with Claude Desktop

  1. Install the Claude Desktop.
  2. Go to Settings > Developer > Edit Config.
  3. Add the following to the mcpServers section:
{
"mcpServers": {
"sei": {
"command": "npx",
"args": [
"-y",
"@sei-protocol/sei-mcp-server"
],
"env": {
"PRIVATE_KEY": "your_private_key_here"
}
}
}
}
  1. Save the configuration file and restart Claude. When done, Claude will add new prompts, resources and tools. To access prompts, click "+" button in the bottom left corner. And then "Add from sei".

Sei Prompts

From there, click "Add from sei" to and for example, add a "my_wallet_address" prompt. Claude should invoke now get_address_from_private_key tool and return the wallet address. Sometimes, model may fail to understand tbe prompt or random question. Try to add a bit more context or retry with extensive thinking option.

All tools available could be found by clicking "Search And Tools" button and then "sei".

Claude Search And ToolsSei Tools

Using npx (No Installation Required)

You can run the Sei MCP Server directly without installation using npx:

# Run the server in stdio mode (for CLI tools)
npx @sei-protocol/sei-mcp-server
# Run the server in HTTP mode (for web applications)
npx @sei-protocol/sei-mcp-server --http

Running the Server Locally

Start the server using stdio (for embedding in CLI tools):

# Start the stdio server
bun start
# Development mode with auto-reload
bun dev

Or start the HTTP server with SSE for web applications:

# Start the HTTP server
bun start:http
# Development mode with auto-reload
bun dev:http

Connecting to the Server

Connect to this MCP server using any MCP-compatible client. For testing and debugging, you can use the MCP Inspector.

Connecting from Cursor

To connect to the MCP server from Cursor:

  1. Open Cursor and go to Settings (gear icon in the bottom left)
  2. Scroll down to "MCP" section
  3. Click "Add new Global MCP server"
  4. In mcp.json tab add the following configuration
{
"mcpServers": {
"sei-mcp-server": {
"command": "npx",
"args": [
"-y",
"@sei-protocol/sei-mcp-server"
],
"env": {
"PRIVATE_KEY": "your_private_key_here"
}
}
}
}

Example: HTTP Mode with SSE

If you're developing a web application and want to connect to the HTTP server with Server-Sent Events (SSE), you can use this configuration:

{
"mcpServers": {
"sei-mcp-sse": {
"url": "http://localhost:3001/sse"
}
}
}

This connects directly to the HTTP server's SSE endpoint, which is useful for:

  • Web applications that need to connect to the MCP server from the browser
  • Environments where running local commands isn't ideal
  • Sharing a single MCP server instance among multiple users or applications

To use this configuration:

  1. Create a .cursor directory in your project root if it doesn't exist
  2. Save the above JSON as mcp.json in the .cursor directory
  3. Restart Cursor or open your project
  4. Cursor will detect the configuration and offer to enable the server(s)

Example: Using the MCP Server in Cursor

After configuring the MCP server with mcp.json, you can easily use it in Cursor. Here's an example workflow:

  1. Create a new JavaScript/TypeScript file in your project:
// blockchain-example.jsasyncfunctionmain(){try{// Get Sei balance for an addressconsole.log("Getting Sei balance for 0x1234...");// When using with Cursor, you can simply ask Cursor to:// "Check the Sei balance of 0x1234 on mainnet"// Or "Transfer 0.1 Sei from my wallet to 0x1234"// Cursor will use the MCP server to execute these operations // without requiring any additional code from you// This is the power of the MCP integration - your AI assistant// can directly interact with blockchain data and operations}catch(error){console.error("Error:",error.message);}}main();
  1. With the file open in Cursor, you can ask Cursor to:

    • "Check the current Sei balance of 0x1234 on mainnet"
    • "Show me the latest block on Sei"
    • "Check if 0x1234... is a contract address"
  2. Cursor will use the MCP server to execute these operations and return the results directly in your conversation.

The MCP server handles all the blockchain communication while allowing Cursor to understand and execute blockchain-related tasks through natural language.

Connecting using Claude CLI

If you're using Claude CLI, you can connect to the MCP server with just two commands:

# Add the MCP server
claude mcp add evm-mcp-server npx @sei-protocol/sei-mcp-server
# Start Claude with the MCP server enabled
claude

Example: Getting a Token Balance

// Example of using the MCP client to check a token balanceconstmcp=newMcpClient("http://localhost:3000");constresult=awaitmcp.invokeTool("get-token-balance",{tokenAddress: "0x3894085ef7ff0f0aedf52e2a2704928d1ec074f1",// USDC on SeiownerAddress: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",network: "sei"});console.log(result);// {// tokenAddress: "0x3894085ef7ff0f0aedf52e2a2704928d1ec074f1",// owner: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",// network: "sei",// raw: "1000000000",// formatted: "1000",// symbol: "USDC",// decimals: 6// }

📚 API Reference

Tools

The server provides the following MCP tools for agents.

Token services

Tool NameDescriptionKey Parameters
get-token-infoGet ERC20 token metadatatokenAddress (address), network
get-token-balanceCheck ERC20 token balancetokenAddress (address), ownerAddress (address), network
transfer-tokenTransfer ERC20 tokenstokenAddress (address), toAddress (address), amount, network
approve-token-spendingApprove token allowancestokenAddress (address), spenderAddress (address), amount, network
get-nft-infoGet NFT metadatatokenAddress (address), tokenId, network
check-nft-ownershipVerify NFT ownershiptokenAddress (address), tokenId, ownerAddress (address), network
get-nft-balanceCount NFTs ownedtokenAddress (address), ownerAddress (address), network
get-erc1155-token-uriGet ERC1155 metadatatokenAddress (address), tokenId, network
get-erc1155-balanceCheck ERC1155 balancetokenAddress (address), tokenId, ownerAddress (address), network
transfer-erc1155Transfer ERC1155 tokenstokenAddress (address), tokenId, amount, toAddress (address), network

Blockchain services

Tool NameDescriptionKey Parameters
get-chain-infoGet network informationnetwork
get-balanceGet native token balanceaddress (address), network
transfer-seiSend native tokensto (address), amount, network
get-transactionGet transaction detailstxHash, network
read-contractRead smart contract statecontractAddress (address), abi, functionName, args (optional), network
write-contractWrite to smart contractcontractAddress (address), abi, functionName, args (optional), network
is-contractCheck if address is a contractaddress (address), network

Resources

The server exposes blockchain data through the following MCP resource URIs.

Blockchain Resources

Resource URI PatternDescription
evm://{network}/chainChain information for a specific network
evm://chainSei mainnet chain information
evm://{network}/block/{blockNumber}Block data by number
evm://{network}/block/latestLatest block data
evm://{network}/address/{address}/balanceNative token balance
evm://{network}/tx/{txHash}Transaction details
evm://{network}/tx/{txHash}/receiptTransaction receipt with logs

Token Resources

Resource URI PatternDescription
evm://{network}/token/{tokenAddress}ERC20 token information
evm://{network}/token/{tokenAddress}/balanceOf/{address}ERC20 token balance
evm://{network}/nft/{tokenAddress}/{tokenId}NFT (ERC721) token information
evm://{network}/nft/{tokenAddress}/{tokenId}/isOwnedBy/{address}NFT ownership verification
evm://{network}/erc1155/{tokenAddress}/{tokenId}/uriERC1155 token URI
evm://{network}/erc1155/{tokenAddress}/{tokenId}/balanceOf/{address}ERC1155 token balance

🔒 Security Considerations

  • Private keys are used only for transaction signing and are never stored by the server
  • Consider implementing additional authentication mechanisms for production use
  • Use HTTPS for the HTTP server in production environments
  • Implement rate limiting to prevent abuse
  • For high-value services, consider adding confirmation steps

📁 Project Structure

mcp-evm-server/
├── src/
│ ├── index.ts # Main stdio server entry point
│ ├── server/ # Server-related files
│ │ ├── http-server.ts # HTTP server with SSE
│ │ └── server.ts # General server setup
│ ├── core/
│ │ ├── chains.ts # Chain definitions and utilities
│ │ ├── config.ts # MCP configuration
│ │ ├── resources.ts # MCP resources implementation
│ │ ├── tools.ts # MCP tools implementation
│ │ ├── prompts.ts # MCP prompts implementation
│ │ └── services/ # Core blockchain services
│ │ ├── index.ts # Operation exports
│ │ ├── balance.ts # Balance services
│ │ ├── transfer.ts # Token transfer services
│ │ ├── utils.ts # Utility functions
│ │ ├── tokens.ts # Token metadata services
│ │ ├── contracts.ts # Contract interactions
│ │ ├── transactions.ts # Transaction services
│ │ └── blocks.ts # Block services
│ │ └── clients.ts # RPC client utilities
├── package.json
├── tsconfig.json
└── README.md

🛠️ Development

To modify or extend the server:

  1. Add new services in the appropriate file under src/core/services/
  2. Register new tools in src/core/tools.ts
  3. Register new resources in src/core/resources.ts
  4. Add new network support in src/core/chains.ts
  5. To change server configuration, edit the hardcoded values in src/server/http-server.ts

📄 License

This project is licensed under the terms of the MIT License.

About

MCP server that provides LLM with tools for interacting with Sei network

Resources

Stars

13 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

SEI MCP Server

License: MITEVM NetworksTypeScriptViem

Sei Model Context Protocol (Sei MCP) server provides blockchain services for Sei blockchain. This server enables AI assistants and agents to interact via unified interface.

📋 Contents

🔭 Overview

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

  • Reading blockchain state (balances, transactions, blocks, etc.)
  • Interacting with smart contracts
  • Transferring tokens (native, ERC20, ERC721, ERC1155)
  • Querying token metadata and balances

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.

✨ Features

Blockchain Data Access

  • Chain information including blockNumber, chainId, and RPCs
  • Block data access by number, hash, or latest
  • Transaction details and receipts with decoded logs
  • Address balances for native tokens and all token standards

Token services

  • ERC20 Tokens

    • Get token metadata (name, symbol, decimals, supply)
    • Check token balances
    • Transfer tokens between addresses
    • Approve spending allowances
  • NFTs (ERC721)

    • Get collection and token metadata
    • Verify token ownership
    • Transfer NFTs between addresses
    • Retrieve token URIs and count holdings
  • Multi-tokens (ERC1155)

    • Get token balances and metadata
    • Transfer tokens with quantity
    • Access token URIs

Smart Contract Interactions

  • Read contract state through view/pure functions
  • Write services with private key signing
  • Contract verification to distinguish from EOAs
  • Event logs retrieval and filtering

Comprehensive Transaction Support

  • Native token transfers across all supported networks
  • Gas estimation for transaction planning
  • Transaction status and receipt information
  • Error handling with descriptive messages

🌐 Supported Networks

  • Sei Mainnet
  • Sei Testnet
  • Sei Devnet

🛠️ Prerequisites

  • Bun 1.0.0 or higher
  • Node.js 18.0.0 or higher (if not using Bun)

📦 Installation

# Clone the repository
git clone https://github.com/sei-protocol/sei-mcp-server.git
cd sei-mcp-server
# Install dependencies with Bun
bun install
# Or with npm
npm install

⚙️ Server Configuration

The server uses the following default configuration:

  • Default Chain ID: 1329 (Sei Mainnet)
  • Server Port: 3001
  • Server Host: 0.0.0.0 (accessible from any network interface)

These values are hardcoded in the application. If you need to modify them, you can edit the following files:

  • For chain configuration: src/core/chains.ts
  • For server configuration: src/server/http-server.ts

Environment Variables

The server supports loading configuration from environment variables:

  • PRIVATE_KEY: Required private key for any blockchain operations that involve signing transactions (e.g., transferring tokens, interacting with smart contracts that modify state). This is the sole method for providing a private key. If this environment variable is not set when a transaction-signing tool is invoked, the tool will return an error message instructing the AI assistant to ask the user to set the PRIVATE_KEY environment variable and restart the MCP server.

Create a .env file in the root directory based on the .env.example template:

# .env.example
PRIVATE_KEY=your_private_key_here

SECURITY WARNING: Never commit your actual private key to version control. The .env file is included in .gitignore by default.

🚀 Usage

Using with Claude Desktop

  1. Install the Claude Desktop.
  2. Go to Settings > Developer > Edit Config.
  3. Add the following to the mcpServers section:
{
"mcpServers": {
"sei": {
"command": "npx",
"args": [
"-y",
"@sei-protocol/sei-mcp-server"
],
"env": {
"PRIVATE_KEY": "your_private_key_here"
}
}
}
}
  1. Save the configuration file and restart Claude. When done, Claude will add new prompts, resources and tools. To access prompts, click "+" button in the bottom left corner. And then "Add from sei".

Sei Prompts

From there, click "Add from sei" to and for example, add a "my_wallet_address" prompt. Claude should invoke now get_address_from_private_key tool and return the wallet address. Sometimes, model may fail to understand tbe prompt or random question. Try to add a bit more context or retry with extensive thinking option.

All tools available could be found by clicking "Search And Tools" button and then "sei".

Claude Search And ToolsSei Tools

Using npx (No Installation Required)

You can run the Sei MCP Server directly without installation using npx:

# Run the server in stdio mode (for CLI tools)
npx @sei-protocol/sei-mcp-server
# Run the server in HTTP mode (for web applications)
npx @sei-protocol/sei-mcp-server --http

Running the Server Locally

Start the server using stdio (for embedding in CLI tools):

# Start the stdio server
bun start
# Development mode with auto-reload
bun dev

Or start the HTTP server with SSE for web applications:

# Start the HTTP server
bun start:http
# Development mode with auto-reload
bun dev:http

Connecting to the Server

Connect to this MCP server using any MCP-compatible client. For testing and debugging, you can use the MCP Inspector.

Connecting from Cursor

To connect to the MCP server from Cursor:

  1. Open Cursor and go to Settings (gear icon in the bottom left)
  2. Scroll down to "MCP" section
  3. Click "Add new Global MCP server"
  4. In mcp.json tab add the following configuration
{
"mcpServers": {
"sei-mcp-server": {
"command": "npx",
"args": [
"-y",
"@sei-protocol/sei-mcp-server"
],
"env": {
"PRIVATE_KEY": "your_private_key_here"
}
}
}
}

Example: HTTP Mode with SSE

If you're developing a web application and want to connect to the HTTP server with Server-Sent Events (SSE), you can use this configuration:

{
"mcpServers": {
"sei-mcp-sse": {
"url": "http://localhost:3001/sse"
}
}
}

This connects directly to the HTTP server's SSE endpoint, which is useful for:

  • Web applications that need to connect to the MCP server from the browser
  • Environments where running local commands isn't ideal
  • Sharing a single MCP server instance among multiple users or applications

To use this configuration:

  1. Create a .cursor directory in your project root if it doesn't exist
  2. Save the above JSON as mcp.json in the .cursor directory
  3. Restart Cursor or open your project
  4. Cursor will detect the configuration and offer to enable the server(s)

Example: Using the MCP Server in Cursor

After configuring the MCP server with mcp.json, you can easily use it in Cursor. Here's an example workflow:

  1. Create a new JavaScript/TypeScript file in your project:
// blockchain-example.jsasyncfunctionmain(){try{// Get Sei balance for an addressconsole.log("Getting Sei balance for 0x1234...");// When using with Cursor, you can simply ask Cursor to:// "Check the Sei balance of 0x1234 on mainnet"// Or "Transfer 0.1 Sei from my wallet to 0x1234"// Cursor will use the MCP server to execute these operations // without requiring any additional code from you// This is the power of the MCP integration - your AI assistant// can directly interact with blockchain data and operations}catch(error){console.error("Error:",error.message);}}main();
  1. With the file open in Cursor, you can ask Cursor to:

    • "Check the current Sei balance of 0x1234 on mainnet"
    • "Show me the latest block on Sei"
    • "Check if 0x1234... is a contract address"
  2. Cursor will use the MCP server to execute these operations and return the results directly in your conversation.

The MCP server handles all the blockchain communication while allowing Cursor to understand and execute blockchain-related tasks through natural language.

Connecting using Claude CLI

If you're using Claude CLI, you can connect to the MCP server with just two commands:

# Add the MCP server
claude mcp add evm-mcp-server npx @sei-protocol/sei-mcp-server
# Start Claude with the MCP server enabled
claude

Example: Getting a Token Balance

// Example of using the MCP client to check a token balanceconstmcp=newMcpClient("http://localhost:3000");constresult=awaitmcp.invokeTool("get-token-balance",{tokenAddress: "0x3894085ef7ff0f0aedf52e2a2704928d1ec074f1",// USDC on SeiownerAddress: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",network: "sei"});console.log(result);// {// tokenAddress: "0x3894085ef7ff0f0aedf52e2a2704928d1ec074f1",// owner: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",// network: "sei",// raw: "1000000000",// formatted: "1000",// symbol: "USDC",// decimals: 6// }

📚 API Reference

Tools

The server provides the following MCP tools for agents.

Token services

Tool NameDescriptionKey Parameters
get-token-infoGet ERC20 token metadatatokenAddress (address), network
get-token-balanceCheck ERC20 token balancetokenAddress (address), ownerAddress (address), network
transfer-tokenTransfer ERC20 tokenstokenAddress (address), toAddress (address), amount, network
approve-token-spendingApprove token allowancestokenAddress (address), spenderAddress (address), amount, network
get-nft-infoGet NFT metadatatokenAddress (address), tokenId, network
check-nft-ownershipVerify NFT ownershiptokenAddress (address), tokenId, ownerAddress (address), network
get-nft-balanceCount NFTs ownedtokenAddress (address), ownerAddress (address), network
get-erc1155-token-uriGet ERC1155 metadatatokenAddress (address), tokenId, network
get-erc1155-balanceCheck ERC1155 balancetokenAddress (address), tokenId, ownerAddress (address), network
transfer-erc1155Transfer ERC1155 tokenstokenAddress (address), tokenId, amount, toAddress (address), network

Blockchain services

Tool NameDescriptionKey Parameters
get-chain-infoGet network informationnetwork
get-balanceGet native token balanceaddress (address), network
transfer-seiSend native tokensto (address), amount, network
get-transactionGet transaction detailstxHash, network
read-contractRead smart contract statecontractAddress (address), abi, functionName, args (optional), network
write-contractWrite to smart contractcontractAddress (address), abi, functionName, args (optional), network
is-contractCheck if address is a contractaddress (address), network

Resources

The server exposes blockchain data through the following MCP resource URIs.

Blockchain Resources

Resource URI PatternDescription
evm://{network}/chainChain information for a specific network
evm://chainSei mainnet chain information
evm://{network}/block/{blockNumber}Block data by number
evm://{network}/block/latestLatest block data
evm://{network}/address/{address}/balanceNative token balance
evm://{network}/tx/{txHash}Transaction details
evm://{network}/tx/{txHash}/receiptTransaction receipt with logs

Token Resources

Resource URI PatternDescription
evm://{network}/token/{tokenAddress}ERC20 token information
evm://{network}/token/{tokenAddress}/balanceOf/{address}ERC20 token balance
evm://{network}/nft/{tokenAddress}/{tokenId}NFT (ERC721) token information
evm://{network}/nft/{tokenAddress}/{tokenId}/isOwnedBy/{address}NFT ownership verification
evm://{network}/erc1155/{tokenAddress}/{tokenId}/uriERC1155 token URI
evm://{network}/erc1155/{tokenAddress}/{tokenId}/balanceOf/{address}ERC1155 token balance

🔒 Security Considerations

  • Private keys are used only for transaction signing and are never stored by the server
  • Consider implementing additional authentication mechanisms for production use
  • Use HTTPS for the HTTP server in production environments
  • Implement rate limiting to prevent abuse
  • For high-value services, consider adding confirmation steps

📁 Project Structure

mcp-evm-server/
├── src/
│ ├── index.ts # Main stdio server entry point
│ ├── server/ # Server-related files
│ │ ├── http-server.ts # HTTP server with SSE
│ │ └── server.ts # General server setup
│ ├── core/
│ │ ├── chains.ts # Chain definitions and utilities
│ │ ├── config.ts # MCP configuration
│ │ ├── resources.ts # MCP resources implementation
│ │ ├── tools.ts # MCP tools implementation
│ │ ├── prompts.ts # MCP prompts implementation
│ │ └── services/ # Core blockchain services
│ │ ├── index.ts # Operation exports
│ │ ├── balance.ts # Balance services
│ │ ├── transfer.ts # Token transfer services
│ │ ├── utils.ts # Utility functions
│ │ ├── tokens.ts # Token metadata services
│ │ ├── contracts.ts # Contract interactions
│ │ ├── transactions.ts # Transaction services
│ │ └── blocks.ts # Block services
│ │ └── clients.ts # RPC client utilities
├── package.json
├── tsconfig.json
└── README.md

🛠️ Development

To modify or extend the server:

  1. Add new services in the appropriate file under src/core/services/
  2. Register new tools in src/core/tools.ts
  3. Register new resources in src/core/resources.ts
  4. Add new network support in src/core/chains.ts
  5. To change server configuration, edit the hardcoded values in src/server/http-server.ts

📄 License

This project is licensed under the terms of the MIT License.

About

MCP server that provides LLM with tools for interacting with Sei network

Resources

Stars

13 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

SEI MCP Server

License: MITEVM NetworksTypeScriptViem

Sei Model Context Protocol (Sei MCP) server provides blockchain services for Sei blockchain. This server enables AI assistants and agents to interact via unified interface.

📋 Contents

🔭 Overview

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

  • Reading blockchain state (balances, transactions, blocks, etc.)
  • Interacting with smart contracts
  • Transferring tokens (native, ERC20, ERC721, ERC1155)
  • Querying token metadata and balances

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.

✨ Features

Blockchain Data Access

  • Chain information including blockNumber, chainId, and RPCs
  • Block data access by number, hash, or latest
  • Transaction details and receipts with decoded logs
  • Address balances for native tokens and all token standards

Token services

  • ERC20 Tokens

    • Get token metadata (name, symbol, decimals, supply)
    • Check token balances
    • Transfer tokens between addresses
    • Approve spending allowances
  • NFTs (ERC721)

    • Get collection and token metadata
    • Verify token ownership
    • Transfer NFTs between addresses
    • Retrieve token URIs and count holdings
  • Multi-tokens (ERC1155)

    • Get token balances and metadata
    • Transfer tokens with quantity
    • Access token URIs

Smart Contract Interactions

  • Read contract state through view/pure functions
  • Write services with private key signing
  • Contract verification to distinguish from EOAs
  • Event logs retrieval and filtering

Comprehensive Transaction Support

  • Native token transfers across all supported networks
  • Gas estimation for transaction planning
  • Transaction status and receipt information
  • Error handling with descriptive messages

🌐 Supported Networks

  • Sei Mainnet
  • Sei Testnet
  • Sei Devnet

🛠️ Prerequisites

  • Bun 1.0.0 or higher
  • Node.js 18.0.0 or higher (if not using Bun)

📦 Installation

# Clone the repository
git clone https://github.com/sei-protocol/sei-mcp-server.git
cd sei-mcp-server
# Install dependencies with Bun
bun install
# Or with npm
npm install

⚙️ Server Configuration

The server uses the following default configuration:

  • Default Chain ID: 1329 (Sei Mainnet)
  • Server Port: 3001
  • Server Host: 0.0.0.0 (accessible from any network interface)

These values are hardcoded in the application. If you need to modify them, you can edit the following files:

  • For chain configuration: src/core/chains.ts
  • For server configuration: src/server/http-server.ts

Environment Variables

The server supports loading configuration from environment variables:

  • PRIVATE_KEY: Required private key for any blockchain operations that involve signing transactions (e.g., transferring tokens, interacting with smart contracts that modify state). This is the sole method for providing a private key. If this environment variable is not set when a transaction-signing tool is invoked, the tool will return an error message instructing the AI assistant to ask the user to set the PRIVATE_KEY environment variable and restart the MCP server.

Create a .env file in the root directory based on the .env.example template:

# .env.example
PRIVATE_KEY=your_private_key_here

SECURITY WARNING: Never commit your actual private key to version control. The .env file is included in .gitignore by default.

🚀 Usage

Using with Claude Desktop

  1. Install the Claude Desktop.
  2. Go to Settings > Developer > Edit Config.
  3. Add the following to the mcpServers section:
{
"mcpServers": {
"sei": {
"command": "npx",
"args": [
"-y",
"@sei-protocol/sei-mcp-server"
],
"env": {
"PRIVATE_KEY": "your_private_key_here"
}
}
}
}
  1. Save the configuration file and restart Claude. When done, Claude will add new prompts, resources and tools. To access prompts, click "+" button in the bottom left corner. And then "Add from sei".

Sei Prompts

From there, click "Add from sei" to and for example, add a "my_wallet_address" prompt. Claude should invoke now get_address_from_private_key tool and return the wallet address. Sometimes, model may fail to understand tbe prompt or random question. Try to add a bit more context or retry with extensive thinking option.

All tools available could be found by clicking "Search And Tools" button and then "sei".

Claude Search And ToolsSei Tools

Using npx (No Installation Required)

You can run the Sei MCP Server directly without installation using npx:

# Run the server in stdio mode (for CLI tools)
npx @sei-protocol/sei-mcp-server
# Run the server in HTTP mode (for web applications)
npx @sei-protocol/sei-mcp-server --http

Running the Server Locally

Start the server using stdio (for embedding in CLI tools):

# Start the stdio server
bun start
# Development mode with auto-reload
bun dev

Or start the HTTP server with SSE for web applications:

# Start the HTTP server
bun start:http
# Development mode with auto-reload
bun dev:http

Connecting to the Server

Connect to this MCP server using any MCP-compatible client. For testing and debugging, you can use the MCP Inspector.

Connecting from Cursor

To connect to the MCP server from Cursor:

  1. Open Cursor and go to Settings (gear icon in the bottom left)
  2. Scroll down to "MCP" section
  3. Click "Add new Global MCP server"
  4. In mcp.json tab add the following configuration
{
"mcpServers": {
"sei-mcp-server": {
"command": "npx",
"args": [
"-y",
"@sei-protocol/sei-mcp-server"
],
"env": {
"PRIVATE_KEY": "your_private_key_here"
}
}
}
}

Example: HTTP Mode with SSE

If you're developing a web application and want to connect to the HTTP server with Server-Sent Events (SSE), you can use this configuration:

{
"mcpServers": {
"sei-mcp-sse": {
"url": "http://localhost:3001/sse"
}
}
}

This connects directly to the HTTP server's SSE endpoint, which is useful for:

  • Web applications that need to connect to the MCP server from the browser
  • Environments where running local commands isn't ideal
  • Sharing a single MCP server instance among multiple users or applications

To use this configuration:

  1. Create a .cursor directory in your project root if it doesn't exist
  2. Save the above JSON as mcp.json in the .cursor directory
  3. Restart Cursor or open your project
  4. Cursor will detect the configuration and offer to enable the server(s)

Example: Using the MCP Server in Cursor

After configuring the MCP server with mcp.json, you can easily use it in Cursor. Here's an example workflow:

  1. Create a new JavaScript/TypeScript file in your project:
// blockchain-example.jsasyncfunctionmain(){try{// Get Sei balance for an addressconsole.log("Getting Sei balance for 0x1234...");// When using with Cursor, you can simply ask Cursor to:// "Check the Sei balance of 0x1234 on mainnet"// Or "Transfer 0.1 Sei from my wallet to 0x1234"// Cursor will use the MCP server to execute these operations // without requiring any additional code from you// This is the power of the MCP integration - your AI assistant// can directly interact with blockchain data and operations}catch(error){console.error("Error:",error.message);}}main();
  1. With the file open in Cursor, you can ask Cursor to:

    • "Check the current Sei balance of 0x1234 on mainnet"
    • "Show me the latest block on Sei"
    • "Check if 0x1234... is a contract address"
  2. Cursor will use the MCP server to execute these operations and return the results directly in your conversation.

The MCP server handles all the blockchain communication while allowing Cursor to understand and execute blockchain-related tasks through natural language.

Connecting using Claude CLI

If you're using Claude CLI, you can connect to the MCP server with just two commands:

# Add the MCP server
claude mcp add evm-mcp-server npx @sei-protocol/sei-mcp-server
# Start Claude with the MCP server enabled
claude

Example: Getting a Token Balance

// Example of using the MCP client to check a token balanceconstmcp=newMcpClient("http://localhost:3000");constresult=awaitmcp.invokeTool("get-token-balance",{tokenAddress: "0x3894085ef7ff0f0aedf52e2a2704928d1ec074f1",// USDC on SeiownerAddress: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",network: "sei"});console.log(result);// {// tokenAddress: "0x3894085ef7ff0f0aedf52e2a2704928d1ec074f1",// owner: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",// network: "sei",// raw: "1000000000",// formatted: "1000",// symbol: "USDC",// decimals: 6// }

📚 API Reference

Tools

The server provides the following MCP tools for agents.

Token services

Tool NameDescriptionKey Parameters
get-token-infoGet ERC20 token metadatatokenAddress (address), network
get-token-balanceCheck ERC20 token balancetokenAddress (address), ownerAddress (address), network
transfer-tokenTransfer ERC20 tokenstokenAddress (address), toAddress (address), amount, network
approve-token-spendingApprove token allowancestokenAddress (address), spenderAddress (address), amount, network
get-nft-infoGet NFT metadatatokenAddress (address), tokenId, network
check-nft-ownershipVerify NFT ownershiptokenAddress (address), tokenId, ownerAddress (address), network
get-nft-balanceCount NFTs ownedtokenAddress (address), ownerAddress (address), network
get-erc1155-token-uriGet ERC1155 metadatatokenAddress (address), tokenId, network
get-erc1155-balanceCheck ERC1155 balancetokenAddress (address), tokenId, ownerAddress (address), network
transfer-erc1155Transfer ERC1155 tokenstokenAddress (address), tokenId, amount, toAddress (address), network

Blockchain services

Tool NameDescriptionKey Parameters
get-chain-infoGet network informationnetwork
get-balanceGet native token balanceaddress (address), network
transfer-seiSend native tokensto (address), amount, network
get-transactionGet transaction detailstxHash, network
read-contractRead smart contract statecontractAddress (address), abi, functionName, args (optional), network
write-contractWrite to smart contractcontractAddress (address), abi, functionName, args (optional), network
is-contractCheck if address is a contractaddress (address), network

Resources

The server exposes blockchain data through the following MCP resource URIs.

Blockchain Resources

Resource URI PatternDescription
evm://{network}/chainChain information for a specific network
evm://chainSei mainnet chain information
evm://{network}/block/{blockNumber}Block data by number
evm://{network}/block/latestLatest block data
evm://{network}/address/{address}/balanceNative token balance
evm://{network}/tx/{txHash}Transaction details
evm://{network}/tx/{txHash}/receiptTransaction receipt with logs

Token Resources

Resource URI PatternDescription
evm://{network}/token/{tokenAddress}ERC20 token information
evm://{network}/token/{tokenAddress}/balanceOf/{address}ERC20 token balance
evm://{network}/nft/{tokenAddress}/{tokenId}NFT (ERC721) token information
evm://{network}/nft/{tokenAddress}/{tokenId}/isOwnedBy/{address}NFT ownership verification
evm://{network}/erc1155/{tokenAddress}/{tokenId}/uriERC1155 token URI
evm://{network}/erc1155/{tokenAddress}/{tokenId}/balanceOf/{address}ERC1155 token balance

🔒 Security Considerations

  • Private keys are used only for transaction signing and are never stored by the server
  • Consider implementing additional authentication mechanisms for production use
  • Use HTTPS for the HTTP server in production environments
  • Implement rate limiting to prevent abuse
  • For high-value services, consider adding confirmation steps

📁 Project Structure

mcp-evm-server/
├── src/
│ ├── index.ts # Main stdio server entry point
│ ├── server/ # Server-related files
│ │ ├── http-server.ts # HTTP server with SSE
│ │ └── server.ts # General server setup
│ ├── core/
│ │ ├── chains.ts # Chain definitions and utilities
│ │ ├── config.ts # MCP configuration
│ │ ├── resources.ts # MCP resources implementation
│ │ ├── tools.ts # MCP tools implementation
│ │ ├── prompts.ts # MCP prompts implementation
│ │ └── services/ # Core blockchain services
│ │ ├── index.ts # Operation exports
│ │ ├── balance.ts # Balance services
│ │ ├── transfer.ts # Token transfer services
│ │ ├── utils.ts # Utility functions
│ │ ├── tokens.ts # Token metadata services
│ │ ├── contracts.ts # Contract interactions
│ │ ├── transactions.ts # Transaction services
│ │ └── blocks.ts # Block services
│ │ └── clients.ts # RPC client utilities
├── package.json
├── tsconfig.json
└── README.md

🛠️ Development

To modify or extend the server:

  1. Add new services in the appropriate file under src/core/services/
  2. Register new tools in src/core/tools.ts
  3. Register new resources in src/core/resources.ts
  4. Add new network support in src/core/chains.ts
  5. To change server configuration, edit the hardcoded values in src/server/http-server.ts

📄 License

This project is licensed under the terms of the MIT License.

About

MCP server that provides LLM with tools for interacting with Sei network

Resources

Stars

13 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

Repository files navigation

SEI MCP Server

License: MITEVM NetworksTypeScriptViem

Sei Model Context Protocol (Sei MCP) server provides blockchain services for Sei blockchain. This server enables AI assistants and agents to interact via unified interface.

📋 Contents

🔭 Overview

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

  • Reading blockchain state (balances, transactions, blocks, etc.)
  • Interacting with smart contracts
  • Transferring tokens (native, ERC20, ERC721, ERC1155)
  • Querying token metadata and balances

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.

✨ Features

Blockchain Data Access

  • Chain information including blockNumber, chainId, and RPCs
  • Block data access by number, hash, or latest
  • Transaction details and receipts with decoded logs
  • Address balances for native tokens and all token standards

Token services

  • ERC20 Tokens

    • Get token metadata (name, symbol, decimals, supply)
    • Check token balances
    • Transfer tokens between addresses
    • Approve spending allowances
  • NFTs (ERC721)

    • Get collection and token metadata
    • Verify token ownership
    • Transfer NFTs between addresses
    • Retrieve token URIs and count holdings
  • Multi-tokens (ERC1155)

    • Get token balances and metadata
    • Transfer tokens with quantity
    • Access token URIs

Smart Contract Interactions

  • Read contract state through view/pure functions
  • Write services with private key signing
  • Contract verification to distinguish from EOAs
  • Event logs retrieval and filtering

Comprehensive Transaction Support

  • Native token transfers across all supported networks
  • Gas estimation for transaction planning
  • Transaction status and receipt information
  • Error handling with descriptive messages

🌐 Supported Networks

  • Sei Mainnet
  • Sei Testnet
  • Sei Devnet

🛠️ Prerequisites

  • Bun 1.0.0 or higher
  • Node.js 18.0.0 or higher (if not using Bun)

📦 Installation

# Clone the repository
git clone https://github.com/sei-protocol/sei-mcp-server.git
cd sei-mcp-server
# Install dependencies with Bun
bun install
# Or with npm
npm install

⚙️ Server Configuration

The server uses the following default configuration:

  • Default Chain ID: 1329 (Sei Mainnet)
  • Server Port: 3001
  • Server Host: 0.0.0.0 (accessible from any network interface)

These values are hardcoded in the application. If you need to modify them, you can edit the following files:

  • For chain configuration: src/core/chains.ts
  • For server configuration: src/server/http-server.ts

Environment Variables

The server supports loading configuration from environment variables:

  • PRIVATE_KEY: Required private key for any blockchain operations that involve signing transactions (e.g., transferring tokens, interacting with smart contracts that modify state). This is the sole method for providing a private key. If this environment variable is not set when a transaction-signing tool is invoked, the tool will return an error message instructing the AI assistant to ask the user to set the PRIVATE_KEY environment variable and restart the MCP server.

Create a .env file in the root directory based on the .env.example template:

# .env.example
PRIVATE_KEY=your_private_key_here

SECURITY WARNING: Never commit your actual private key to version control. The .env file is included in .gitignore by default.

🚀 Usage

Using with Claude Desktop

  1. Install the Claude Desktop.
  2. Go to Settings > Developer > Edit Config.
  3. Add the following to the mcpServers section:
{
"mcpServers": {
"sei": {
"command": "npx",
"args": [
"-y",
"@sei-protocol/sei-mcp-server"
],
"env": {
"PRIVATE_KEY": "your_private_key_here"
}
}
}
}
  1. Save the configuration file and restart Claude. When done, Claude will add new prompts, resources and tools. To access prompts, click "+" button in the bottom left corner. And then "Add from sei".

Sei Prompts

From there, click "Add from sei" to and for example, add a "my_wallet_address" prompt. Claude should invoke now get_address_from_private_key tool and return the wallet address. Sometimes, model may fail to understand tbe prompt or random question. Try to add a bit more context or retry with extensive thinking option.

All tools available could be found by clicking "Search And Tools" button and then "sei".

Claude Search And ToolsSei Tools

Using npx (No Installation Required)

You can run the Sei MCP Server directly without installation using npx:

# Run the server in stdio mode (for CLI tools)
npx @sei-protocol/sei-mcp-server
# Run the server in HTTP mode (for web applications)
npx @sei-protocol/sei-mcp-server --http

Running the Server Locally

Start the server using stdio (for embedding in CLI tools):

# Start the stdio server
bun start
# Development mode with auto-reload
bun dev

Or start the HTTP server with SSE for web applications:

# Start the HTTP server
bun start:http
# Development mode with auto-reload
bun dev:http

Connecting to the Server

Connect to this MCP server using any MCP-compatible client. For testing and debugging, you can use the MCP Inspector.

Connecting from Cursor

To connect to the MCP server from Cursor:

  1. Open Cursor and go to Settings (gear icon in the bottom left)
  2. Scroll down to "MCP" section
  3. Click "Add new Global MCP server"
  4. In mcp.json tab add the following configuration
{
"mcpServers": {
"sei-mcp-server": {
"command": "npx",
"args": [
"-y",
"@sei-protocol/sei-mcp-server"
],
"env": {
"PRIVATE_KEY": "your_private_key_here"
}
}
}
}

Example: HTTP Mode with SSE

If you're developing a web application and want to connect to the HTTP server with Server-Sent Events (SSE), you can use this configuration:

{
"mcpServers": {
"sei-mcp-sse": {
"url": "http://localhost:3001/sse"
}
}
}

This connects directly to the HTTP server's SSE endpoint, which is useful for:

  • Web applications that need to connect to the MCP server from the browser
  • Environments where running local commands isn't ideal
  • Sharing a single MCP server instance among multiple users or applications

To use this configuration:

  1. Create a .cursor directory in your project root if it doesn't exist
  2. Save the above JSON as mcp.json in the .cursor directory
  3. Restart Cursor or open your project
  4. Cursor will detect the configuration and offer to enable the server(s)

Example: Using the MCP Server in Cursor

After configuring the MCP server with mcp.json, you can easily use it in Cursor. Here's an example workflow:

  1. Create a new JavaScript/TypeScript file in your project:
// blockchain-example.jsasyncfunctionmain(){try{// Get Sei balance for an addressconsole.log("Getting Sei balance for 0x1234...");// When using with Cursor, you can simply ask Cursor to:// "Check the Sei balance of 0x1234 on mainnet"// Or "Transfer 0.1 Sei from my wallet to 0x1234"// Cursor will use the MCP server to execute these operations // without requiring any additional code from you// This is the power of the MCP integration - your AI assistant// can directly interact with blockchain data and operations}catch(error){console.error("Error:",error.message);}}main();
  1. With the file open in Cursor, you can ask Cursor to:

    • "Check the current Sei balance of 0x1234 on mainnet"
    • "Show me the latest block on Sei"
    • "Check if 0x1234... is a contract address"
  2. Cursor will use the MCP server to execute these operations and return the results directly in your conversation.

The MCP server handles all the blockchain communication while allowing Cursor to understand and execute blockchain-related tasks through natural language.

Connecting using Claude CLI

If you're using Claude CLI, you can connect to the MCP server with just two commands:

# Add the MCP server
claude mcp add evm-mcp-server npx @sei-protocol/sei-mcp-server
# Start Claude with the MCP server enabled
claude

Example: Getting a Token Balance

// Example of using the MCP client to check a token balanceconstmcp=newMcpClient("http://localhost:3000");constresult=awaitmcp.invokeTool("get-token-balance",{tokenAddress: "0x3894085ef7ff0f0aedf52e2a2704928d1ec074f1",// USDC on SeiownerAddress: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",network: "sei"});console.log(result);// {// tokenAddress: "0x3894085ef7ff0f0aedf52e2a2704928d1ec074f1",// owner: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",// network: "sei",// raw: "1000000000",// formatted: "1000",// symbol: "USDC",// decimals: 6// }

📚 API Reference

Tools

The server provides the following MCP tools for agents.

Token services

Tool NameDescriptionKey Parameters
get-token-infoGet ERC20 token metadatatokenAddress (address), network
get-token-balanceCheck ERC20 token balancetokenAddress (address), ownerAddress (address), network
transfer-tokenTransfer ERC20 tokenstokenAddress (address), toAddress (address), amount, network
approve-token-spendingApprove token allowancestokenAddress (address), spenderAddress (address), amount, network
get-nft-infoGet NFT metadatatokenAddress (address), tokenId, network
check-nft-ownershipVerify NFT ownershiptokenAddress (address), tokenId, ownerAddress (address), network
get-nft-balanceCount NFTs ownedtokenAddress (address), ownerAddress (address), network
get-erc1155-token-uriGet ERC1155 metadatatokenAddress (address), tokenId, network
get-erc1155-balanceCheck ERC1155 balancetokenAddress (address), tokenId, ownerAddress (address), network
transfer-erc1155Transfer ERC1155 tokenstokenAddress (address), tokenId, amount, toAddress (address), network

Blockchain services

Tool NameDescriptionKey Parameters
get-chain-infoGet network informationnetwork
get-balanceGet native token balanceaddress (address), network
transfer-seiSend native tokensto (address), amount, network
get-transactionGet transaction detailstxHash, network
read-contractRead smart contract statecontractAddress (address), abi, functionName, args (optional), network
write-contractWrite to smart contractcontractAddress (address), abi, functionName, args (optional), network
is-contractCheck if address is a contractaddress (address), network

Resources

The server exposes blockchain data through the following MCP resource URIs.

Blockchain Resources

Resource URI PatternDescription
evm://{network}/chainChain information for a specific network
evm://chainSei mainnet chain information
evm://{network}/block/{blockNumber}Block data by number
evm://{network}/block/latestLatest block data
evm://{network}/address/{address}/balanceNative token balance
evm://{network}/tx/{txHash}Transaction details
evm://{network}/tx/{txHash}/receiptTransaction receipt with logs

Token Resources

Resource URI PatternDescription
evm://{network}/token/{tokenAddress}ERC20 token information
evm://{network}/token/{tokenAddress}/balanceOf/{address}ERC20 token balance
evm://{network}/nft/{tokenAddress}/{tokenId}NFT (ERC721) token information
evm://{network}/nft/{tokenAddress}/{tokenId}/isOwnedBy/{address}NFT ownership verification
evm://{network}/erc1155/{tokenAddress}/{tokenId}/uriERC1155 token URI
evm://{network}/erc1155/{tokenAddress}/{tokenId}/balanceOf/{address}ERC1155 token balance

🔒 Security Considerations

  • Private keys are used only for transaction signing and are never stored by the server
  • Consider implementing additional authentication mechanisms for production use
  • Use HTTPS for the HTTP server in production environments
  • Implement rate limiting to prevent abuse
  • For high-value services, consider adding confirmation steps

📁 Project Structure

mcp-evm-server/
├── src/
│ ├── index.ts # Main stdio server entry point
│ ├── server/ # Server-related files
│ │ ├── http-server.ts # HTTP server with SSE
│ │ └── server.ts # General server setup
│ ├── core/
│ │ ├── chains.ts # Chain definitions and utilities
│ │ ├── config.ts # MCP configuration
│ │ ├── resources.ts # MCP resources implementation
│ │ ├── tools.ts # MCP tools implementation
│ │ ├── prompts.ts # MCP prompts implementation
│ │ └── services/ # Core blockchain services
│ │ ├── index.ts # Operation exports
│ │ ├── balance.ts # Balance services
│ │ ├── transfer.ts # Token transfer services
│ │ ├── utils.ts # Utility functions
│ │ ├── tokens.ts # Token metadata services
│ │ ├── contracts.ts # Contract interactions
│ │ ├── transactions.ts # Transaction services
│ │ └── blocks.ts # Block services
│ │ └── clients.ts # RPC client utilities
├── package.json
├── tsconfig.json
└── README.md

🛠️ Development

To modify or extend the server:

  1. Add new services in the appropriate file under src/core/services/
  2. Register new tools in src/core/tools.ts
  3. Register new resources in src/core/resources.ts
  4. Add new network support in src/core/chains.ts
  5. To change server configuration, edit the hardcoded values in src/server/http-server.ts

📄 License

This project is licensed under the terms of the MIT License.

About

MCP server that provides LLM with tools for interacting with Sei network

Resources

Stars

13 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages