@kasarlabs/starkgate-mcp
v0.1.2
Published
MCP server for StarkGate bridge operations between Ethereum L1 and Starknet L2
Downloads
9
Readme
StarkGate Bridge MCP
MCP server for StarkGate bridge operations between Ethereum L1 and Starknet L2.
Features
- Bridge ETH and ERC20 tokens (USDC, USDT, WBTC, STRK) from Ethereum L1 to Starknet L2
- Bridge ETH and ERC20 tokens from Starknet L2 to Ethereum L1
- Automatic ERC20 token approval handling
- Token balance and allowance verification
- Secure environment variable-based configuration
- No private keys exposed in tool schemas
Installation
pnpm install
pnpm buildConfiguration
Create a .env file based on .env.example:
cp .env.example .envRequired Environment Variables
For Starknet L2 Operations:
STARKNET_RPC_URL: Your Starknet RPC endpointSTARKNET_PRIVATE_KEY: Your Starknet account private keySTARKNET_ACCOUNT_ADDRESS: Your Starknet account address
For Ethereum L1 Operations:
ETHEREUM_RPC_URL: Your Ethereum RPC endpointETHEREUM_PRIVATE_KEY: Your Ethereum wallet private key
Available Tools
bridge_l1_to_l2
Bridge ETH or ERC20 tokens from Ethereum L1 to Starknet L2.
Parameters:
l1chain(string): The L1 chain to bridge from (e.g., "ethereum")toAddress(string): The Starknet address to receive the fundsamount(string): The amount to bridge (in token units, e.g., "0.001" for ETH or "1.0" for USDC)symbol(string): Token symbol (ETH, USDC, USDT, WBTC, STRK)
Supported Tokens:
- ETH (18 decimals)
- USDC (6 decimals)
- USDT (6 decimals)
- WBTC (8 decimals)
- STRK (18 decimals)
Example (ETH):
{
"l1chain": "ethereum",
"toAddress": "0x01fbe320049F84A38FbcB21B4Ae1a4aab89e4aB3c825d38d35202Ee873439E7D",
"amount": "0.001",
"symbol": "ETH"
}Example (USDC):
{
"l1chain": "ethereum",
"toAddress": "0x01fbe320049F84A38FbcB21B4Ae1a4aab89e4aB3c825d38d35202Ee873439E7D",
"amount": "10.0",
"symbol": "USDC"
}Note: For ERC20 tokens, the bridge will automatically:
- Check your token balance
- Check current allowance for the bridge contract
- Approve the bridge to spend tokens if needed (requires 1 transaction)
- Execute the bridge deposit (requires 1 transaction)
bridge_l2_to_l1
Bridge ETH or ERC20 tokens from Starknet L2 to Ethereum L1.
Parameters:
l1chain(string): The L1 chain to bridge to (e.g., "ethereum")toAddress(string): The Ethereum address to receive the fundsamount(string): The amount to withdraw (in token units, e.g., "0.001" for ETH or "1.0" for USDC)symbol(string): Token symbol (ETH, USDC, USDT, WBTC, STRK)
Supported Tokens:
- ETH (18 decimals)
- USDC (6 decimals)
- USDT (6 decimals)
- WBTC (8 decimals)
- STRK (18 decimals)
Example (ETH):
{
"l1chain": "ethereum",
"toAddress": "0x8283a06f328eff7d505f475b0930260058066388",
"amount": "0.001",
"symbol": "ETH"
}Example (USDC):
{
"l1chain": "ethereum",
"toAddress": "0x8283a06f328eff7d505f475b0930260058066388",
"amount": "10.0",
"symbol": "USDC"
}Note: L2 to L1 withdrawals typically take 4-12 hours to finalize on Ethereum due to Starknet's withdrawal mechanism.
Security Notes
- Never commit your
.envfile to version control - Private keys are loaded from environment variables only
- No sensitive data is exposed in tool schemas or logs
- Uses
onchainWritepattern from@kasarlabs/ask-starknet-core
Development
# Build the project
pnpm build
# Clean build artifacts
pnpm clean
# Start the MCP server
pnpm startArchitecture
This MCP follows the same pattern as other MCPs in the ask-starknet project:
- Tools: Bridge operation functions in src/tools/bridgeTools.ts
- Schemas: Zod schemas for input validation in src/schemas/
- Utils: Environment configuration helpers in src/lib/utils.ts
- Main: MCP server setup in src/index.ts
License
MIT
