Skip to content

stakeme-team/sei-agent-kit

Repository files navigation

Sei

Sei Agent Kit

All-in-one MCP toolkit for the Sei blockchain — dual-stack EVM + Cosmos, in TypeScript.

Wallet operations · local-only signing · EVM & Cosmos transfers · native staking · IBC · contract deploy & verify · full chain exploration — from Claude Code, Cursor, Codex, or directly via the Vercel AI SDK.

Built for humans. Perfect for AI.

MCP Sei Docs License

Node TypeScript viem cosmjs Docker

Works with   Claude Code Cursor Codex Vercel AI SDK


Why Sei Agent Kit

Sei is dual-stack. One chain, two address spaces and two transaction surfaces: EVM (0x...) and Cosmos (sei...). This kit speaks both. A single secp256k1 key derives both addresses — Sei's account-association model.

Your private key never leaves your machine. MCP only prepares unsigned transactions — signing happens locally (viem for EVM, cosmjs for Cosmos), and the key is never sent to the AI model or a remote server.

Two protection levels.

  • Simple — a guard hook blocks the agent from reading .env.
  • Secure — encrypted keystore + a signing daemon in a separate, isolated process; the agent only ever receives the signed transaction.

Two ways to use.

  • Subscription (free) — connect MCP to Claude Code / Cursor / Codex and use your existing subscription.
  • AI SDK (developers) — programmatic agents via the Vercel AI SDK with Claude or OpenAI.

Sei-native. Beyond plain EVM: native Cosmos staking (cosmos_prepare_delegate), governance, IBC transfers (cosmos_prepare_ibc_transfer), CW-20/721, and the EVM↔Cosmos pointer registry (get_pointer_mapping).

⚠️ Mainnet — real funds. The default network is Sei pacific-1 (EVM chainId 1329). /send, /stake, /ibc and /deploy move real SEI — fund your address from an exchange/bridge. Prefer secure mode with manual approval (npm run signer -- --manual) so every signature needs your y/n.


Architecture

┌─────────────────────────────────┐
│  You (chat or code)             │
├─────────────────────────────────┤
│  AI Agent (Claude / GPT)        │
│                                 │
│  Sees: EVM + Cosmos addresses,  │
│        MCP tool results         │
│  Never sees: private key        │
├───────────────┬─────────────────┤
│ local signing │  MCP Server     │
│ (your machine)│  (remote)       │
│               │                 │
│ EVM:  viem    │  prepare_* /    │
│ Cosmos: cosmjs│  cosmos_prepare_*│
│               │  broadcast      │
│ Key in .env   │  query / stake  │
│ or keystore   │  ibc / verify   │
└───────────────┴─────────────────┘

Key principle: the private key NEVER leaves your machine. MCP prepares the unsigned tx → you sign locally → the signed tx is broadcast back through MCP.


Quick Start — Claude Code (subscription)

# Clone
git clone https://github.com/stakeme-team/sei-agent-kit
cd sei-agent-kit

# Install
npm install

# Create a wallet (one key → EVM 0x... AND Cosmos sei...)
npm run wallet:simple

# Open Claude Code
claude

Claude Code auto-detects .mcp.json and connects to the Sei MCP server. Then just chat:

"Show my Sei balances on both the EVM and Cosmos sides, then delegate 1 SEI to the validator with the lowest commission."

See also: Cursor setup · Codex setup · ready-made prompts


Quick Start — AI SDK (programmatic)

git clone https://github.com/stakeme-team/sei-agent-kit
cd sei-agent-kit
npm install

cp .env.example .env
npm run wallet:simple
# Edit .env: add ANTHROPIC_API_KEY or OPENAI_API_KEY

npm run demo:wallet    # show EVM + Cosmos addresses & balances (read-only)
npm run demo:send      # send a little SEI on the Cosmos side
npm run demo:stake     # delegate to a validator (Cosmos-native)
npm run demo:ibc       # IBC transfer (set IBC_TO + IBC_CHANNEL)
npm run demo:deploy    # deploy & verify an EVM contract

Switch model provider in .env:

AI_PROVIDER=anthropic   # or openai

Skills

Built-in Claude Code / Cursor skills (slash commands):

Skill What it does
/wallet Show EVM + Cosmos addresses and balances
/send Send SEI on the EVM side (0x...) or Cosmos side (sei...)
/stake Delegate SEI to a validator (Cosmos-native), or review validators
/ibc IBC-transfer SEI to another Cosmos chain
/deploy Deploy and verify an EVM smart contract

Security

Simple mode (default)

Private key in .env, protected by a guard hook that blocks the agent from reading it.

npm run wallet:simple
npm run security-test
# ✓ cat .env            → BLOCKED
# ✓ grep PRIVATE .env   → BLOCKED
# ✓ echo $PRIVATE_KEY   → BLOCKED
# ✓ python3 read .env   → BLOCKED
# ... 29/29 passed ✓

Secure mode (signing daemon)

Private key encrypted in a keystore, decrypted only inside a separate daemon process. The agent physically cannot reach the key. The daemon signs both EVM and Cosmos transactions.

# Create an encrypted wallet
npm run wallet:secure

# Start the daemon (separate terminal)
npm run signer              # auto-approve
npm run signer -- --manual  # ask y/n per transaction
┌───────────────────┐     ┌────────────────────┐
│  Agent            │     │  Signer Daemon      │
│  (no key access)  │────▶│  (key in memory)    │
│                   │unix │  EVM: viem          │
│  Gets: signed tx  │◀────│  Cosmos: cosmjs     │
└───────────────────┘sock └────────────────────┘

In --manual mode every signing request prints the tx details (EVM tx or Cosmos msgs) and waits for your y/n — ideal on mainnet.

Docker isolation

docker compose run --rm install                  # install deps in a container
docker compose run --rm dev npx tsx examples/02-send-tokens.ts
docker compose up signer                          # signer daemon, NO network access

Wallets — one key, two addresses

npm run wallet:simple generates a single secp256k1 key and derives:

  • an EVM address 0x... (keccak256 of the pubkey — viem), and
  • a Cosmos address sei... (bech32 of ripemd160(sha256(pubkey)) — cosmjs).

This mirrors Sei's account-association model. The two addresses become linked on-chain only after each side's first activity, so a freshly funded EVM address and its sei... counterpart may show as unassociated until you transact.

npm run wallet:import <0xKEY> imports an existing key; npm run wallet:show prints both configured addresses.


MCP Tools

The Sei MCP server at https://api.seistream.app/mcp exposes ~150 read tools across both stacks plus the write tools below:

Category Tools
EVM transactions (write) prepare_native_transfer, prepare_erc20_transfer, prepare_token_approval, prepare_contract_write, prepare_transaction, broadcast_signed_raw_transaction, wait_for_transaction
EVM balances / accounts get_balance, get_token_balance, get_evm_account_by_address, get_account_token_summary, get_account_transactions
EVM blocks / txs list_evm_blocks, get_evm_block_by_height, list_evm_transactions, get_evm_transaction_by_hash
EVM contracts read_evm_contract, get_evm_contract_code, get_evm_compiler_versions, verify_evm_contract_standard_json, verify_evm_contract_flattened
EVM tokens / NFTs list_erc20_tokens, get_erc20_token_by_address, list_erc721_tokens, list_erc1155_tokens
Cosmos transactions (write) cosmos_prepare_send, cosmos_prepare_delegate, cosmos_prepare_undelegate, cosmos_prepare_claim_rewards, cosmos_prepare_ibc_transfer, cosmos_simulate_tx, cosmos_broadcast_signed_tx
Cosmos accounts / staking cosmos_get_balance, cosmos_get_account, get_cosmos_account_delegations, get_cosmos_account_rewards, list_cosmos_validators, get_cosmos_validator_by_address
Cosmos governance / IBC list_cosmos_proposals, get_cosmos_proposal_by_id, list_cosmos_relayers, list_ibc_packets, get_ibc_packet
Cosmos tokens list_cw20_tokens, list_cw721_tokens, list_ibc_tokens, list_wasm_contracts
Sei-specific get_pointer_mapping, list_pointer_mappings, explorer_search, get_chain_network, get_chain_tokenomics

Project Structure

sei-agent-kit/
├── CLAUDE.md                    # Agent instructions for Sei (dual-stack)
├── .mcp.json                    # Claude Code MCP config
├── .cursor/mcp.json             # Cursor MCP config
├── .codex/config.toml           # Codex MCP config (via mcp-remote)
│
├── .claude/
│   ├── settings.json            # Guard hook config
│   └── skills/                  # /wallet · /send · /stake · /ibc · /deploy
│
├── scripts/
│   ├── wallet-manager.ts        # Create / import wallet (EVM + Cosmos)
│   ├── sign-tx.ts               # Sign EVM tx (stdin → stdout)
│   ├── sign-cosmos-tx.ts        # Sign Cosmos tx (stdin → stdout)
│   ├── signer-daemon.ts         # Signing daemon, both stacks (secure mode)
│   ├── guard.sh                 # Block agent from reading keys
│   ├── security-test.ts         # Test the guard (29 vectors)
│   └── run-stake-flow.ts        # Scripted Cosmos delegate flow
│
├── src/                         # AI SDK core library
│   ├── mcp-client.ts            # MCP client factory
│   ├── derive.ts                # One key → EVM + Cosmos addresses
│   ├── wallet.ts                # Local signing (EVM + Cosmos), simple/secure
│   ├── cosmos-signing.ts        # cosmjs Direct signing of prepared txs
│   ├── signing-bridge.ts        # Auto-sign prepare_* / cosmos_prepare_* results
│   ├── agent.ts                 # Agent factory (Claude + OpenAI)
│   └── utils.ts                 # Env, MCP result parsing, helpers
│
├── test/                        # node:test suite (derivation, signing, bridge, MCP smoke)
├── examples/                    # AI SDK demos (wallet · send · stake · ibc · deploy)
├── contracts/                   # SimpleStorage.sol (+ compiled)
├── docs/                        # setup guides + prompts
├── Dockerfile
└── docker-compose.yml

Tests

npm test            # derivation vectors, EVM + Cosmos signing, bridge, live MCP smoke
npm run security-test  # guard hook attack vectors (29/29)

The derivation tests pin known-answer vectors (the EVM address for key=1 is the canonical 0x7E5F…Bdf; the Cosmos address bech32-decodes to the standard ripemd160(sha256(pubkey)) hash), cross-checked against independent implementations. The signing tests verify a real EVM EIP-1559 signature recovers to the wallet address and a Cosmos SIGN_MODE_DIRECT signature verifies against the public key — neither broadcasts.


Requirements

  • Node.js 20+ and npm
  • Docker — optional, recommended for supply-chain-isolated installs and the network-less signer
  • Subscription path: Claude Pro/Max, Cursor Pro, or ChatGPT Pro
  • AI SDK path: an Anthropic or OpenAI API key

License

MIT


Powered by Sei

Built by Stakeme · explorer at seistream.app

About

MCP toolkit for Sei with local-only signing - wallet, staking, contract deploy from Claude Code / Cursor / Codex

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages