Add Sei MCP Server as new package#249
Conversation
🦋 Changeset detectedLatest commit: 467bb3b The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Pull Request Overview
Adds a new @sei-js/mcp-server package to provide an MCP server for Sei/EVM networks, including a stdio entrypoint, core blockchain service utilities, and a suite of LLM prompts.
- Introduces
src/index.tsto launch the server over stdio - Implements core services (clients, transactions, tokens, contracts, blocks, balance, utils)
- Registers a variety of EVM-related prompts and configures environment/chain mappings
Reviewed Changes
Copilot reviewed 39 out of 39 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/mcp-server/src/index.ts | Server startup entrypoint using StdioServerTransport |
| packages/mcp-server/src/core/services/utils.ts | Utility functions for parsing, formatting, and address validation |
| packages/mcp-server/src/core/services/clients.ts | Public and wallet client creation with caching |
| packages/mcp-server/src/core/services/transactions.ts | Transaction retrieval and gas estimation |
| packages/mcp-server/src/core/services/tokens.ts | ERC20, ERC721, ERC1155 token data readers |
| packages/mcp-server/src/core/services/contracts.ts | Contract read/write, logs, and contract detection |
| packages/mcp-server/src/core/services/blocks.ts | Block retrieval utilities |
| packages/mcp-server/src/core/services/balance.ts | Balance queries and NFT ownership checks |
| packages/mcp-server/src/core/services/index.ts | Aggregates and re-exports all services and common types |
| packages/mcp-server/src/core/prompts.ts | Registration of EVM-related LLM prompts |
| packages/mcp-server/src/core/config.ts | Environment variable loading and key formatting |
| packages/mcp-server/src/core/chains.ts | Chain ID and RPC URL resolution mappings |
| packages/mcp-server/package.json | Package metadata, dependencies, scripts, and publish config |
| packages/mcp-server/jest.config.js | Jest setup |
| packages/mcp-server/LICENSE | MIT License |
| packages/mcp-server/.npmignore | Files to exclude from npm package |
| packages/mcp-server/.gitignore | Files to ignore in git |
| packages/mcp-server/.env.example | Example environment variables |
| .changeset/thirty-results-thank.md | Initial release changeset |
Comments suppressed due to low confidence (4)
packages/mcp-server/src/index.ts:10
- The startup message refers to "EVM MCP Server" but this package is called
sei-js/mcp-server. Consider updating the log to "Sei MCP Server running on stdio" for consistency.
console.error("EVM MCP Server running on stdio");
packages/mcp-server/src/core/services/balance.ts:182
- The
as Promise<bigint>assertion is incorrect: theawaitunwraps the promise, so you should assert the result asbigint(or remove the assertion entirely).
return await readContract({ address: validatedTokenAddress, abi: erc721Abi, functionName: 'balanceOf', args: [validatedOwnerAddress] }, network) as Promise<bigint>;
packages/mcp-server/src/core/services/utils.ts:14
- The
formatJsonandvalidateAddressutilities are untested. Consider adding unit tests to cover big-int JSON formatting and address validation logic.
formatJson: (obj: unknown): string => JSON.stringify(obj, (_, value) =>
packages/mcp-server/package.json:6
- The
binfield points to./bin/cli.js, but no such file exists in the package. Add the CLI script or remove/update thebinentry to prevent publish errors.
"bin": "./bin/cli.js",
dssei
left a comment
There was a problem hiding this comment.
lgtm, We need to update the readme with correct repo and mcp configs
|
|
||
| ## 🛠️ Prerequisites | ||
|
|
||
| - [Bun](https://bun.sh/) 1.0.0 or higher |
There was a problem hiding this comment.
We probably do not need that anymore?
|
|
||
| ```bash | ||
| # Clone the repository | ||
| git clone https://github.com/sei-protocol/sei-mcp-server.git |
| "command": "npx", | ||
| "args": [ | ||
| "-y", | ||
| "@sei-protocol/sei-mcp-server" |
| /** | ||
| * Read from a contract for a specific network | ||
| */ | ||
| export async function readContract(params: ReadContractParameters, network = 'sei') { |
There was a problem hiding this comment.
this change seems to lack the latest changes https://github.com/sei-protocol/sei-mcp-server/blob/main/src/core/services/contracts.ts#L16
There was a problem hiding this comment.
Pulled them all in now and updated the tests
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #249 +/- ##
========================================
+ Coverage 6.18% 7.18% +0.99%
========================================
Files 271 284 +13
Lines 48957 49484 +527
Branches 17117 17235 +118
========================================
+ Hits 3030 3557 +527
Misses 45927 45927 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a new package, @sei-js/mcp-server, which provides an MCP server designed for interacting with EVM-compatible networks via both stdio and HTTP modes. Key changes include the initialization of a Stdio server transport, the implementation of various blockchain service functions (such as transaction, balance, token, contract, and block handling), and the registration of multiple prompts using zod validation.
Reviewed Changes
Copilot reviewed 40 out of 40 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/mcp-server/src/index.ts | Initializes the MCP server and connects it to a Stdio transport. |
| packages/mcp-server/src/core/services/*.ts | Implements various blockchain service functions and helper utils. |
| packages/mcp-server/src/core/prompts.ts | Registers multiple EVM-related prompts using zod for input schema. |
| packages/mcp-server/src/core/config.ts, chains.ts | Sets up environment variables, network mappings, and RPC URLs. |
| Other files (package.json, jest.config.js, etc.) | Provide package metadata, build configuration, and supporting files. |
| * @returns Transaction hash | ||
| * @throws Error if no private key is available | ||
| */ | ||
| export async function writeContract(params: Record<string, any>, network = DEFAULT_NETWORK): Promise<Hash> { |
There was a problem hiding this comment.
Consider defining a specific type for the 'params' parameter in writeContract instead of using Record<string, any> to enhance type safety and clarity.
| export async function writeContract(params: Record<string, any>, network = DEFAULT_NETWORK): Promise<Hash> { | |
| export async function writeContract(params: WriteContractParameters, network = DEFAULT_NETWORK): Promise<Hash> { |
- Fixed formatting issues according to Biome - Fixed Typescript warnings line non-null assertions
- Added test cases for everything
- Fixed windsurf MCP issues - Removed CT changeset as it is delayed
…nto feature/mcp-server
Sei MCP Server
This PR adds a new package called
@sei-js/mcp-serverfor use with LLM's. It is a fork of a more generalized EVM MCP and will be improved moving forwards. See the README for local development. This package uses the same build tools and release workflows as every other @sei-js package.This MCP server contains a variety of prompts and tools included and works in stdio or http mode.
Adding to Claude
Claude > Settings > Developer > Edit Settings