@splits/cli
CLI和MCP服务器 分裂 平台。
安装
npm install -g @splits/splits-cli这使得 splits 全球可用的命令。
或者,在不安装的情况下运行:
npx @splits/splits-cli 认证
从获取API密钥 团队设置.两种选择:
环境变量 (首选CI和无头上下文):
export SPLITS_API_KEY=sk_...本地配置 (便于MCP和交互式使用):
# Pipe from stdin so the key doesn't land in shell history or tool-call transcripts
echo $SPLITS_API_KEY | splits auth login
# Or, for interactive use only (refused under SPLITS_MCP_MODE=1):
splits auth login --api-key sk_...
# Log out (removes the key and optional URL override; doesn't touch the env var)
splits auth logout优先级是 SPLITS_API_KEY 环境变量→ 已保存本地配置→ 错误。 splits auth whoami 报告 apiKeySource 这样你就可以知道证书是从哪里来的。同一个文件(~/.splits/config.json,模式0600,自动识别)也可以保存本地签名密钥——见下文。
本地签名密钥
CLI可以生成或导入EOA(以太坊外部所有账户),并使用它在本地对未决的多重签名交易进行签名,而不是打开web应用程序进行“签名URL”流。适用于代理、自动化和MCP驱动的工作流。
# Generate a new EOA and save it locally (single key in v1)
splits auth create-key
# Import an existing private key (stdin preferred; flag refused under MCP mode)
echo $PRIVATE_KEY | splits auth import-key
# Remove the local key (does not revoke the on-chain signer)
splits auth delete-key私钥从不出现在任何命令的响应中,只出现派生地址和警告。文件位于 ~/.splits/config.json 是唯一的副本;如果密钥中有资金,请备份。
已注册的EOA签署人
要将EOA用作一个或多个智能帐户的签名者,请先在您的用户下注册它,然后通过以下方式附加返回的id accounts update-signers注册是每个地址的一次性步骤;相同的id可以附加到任意数量的帐户。
# Register the local key (or any address you control) so it can be attached
splits auth register-signer --name "Agent One"
# List registered EOA signers — returns ids needed by update-signers
splits auth signers
# Attach a registered signer to an account (repeat per account as needed)
splits accounts update-signers --add-eoa-signer-ids 注册是幂等的:重新运行 register-signer 使用相同的地址返回相同的id(并保留名字)。
一旦EOA被附加到帐户的签名者集,就对未决的多重签名交易进行签名:
# Auto-submit when this signature meets threshold (default)
splits transactions sign
# Record the signature without submitting the UserOp
splits transactions sign --no-submit用法
交易
# List transactions
splits transactions list
splits transactions list --chain-id 1 --limit 100
splits transactions list --account 0x... --cursor
# Get a specific transaction
splits transactions get
# Update gas estimates for an existing transaction
splits transactions update-gas-estimation
# Sign a pending multisig transaction with the local EOA
splits transactions sign
splits transactions sign --no-submit对于多重签名交易,只有当只剩下一个签名者时,gas才能刷新。 transactions sign 需要本地EOA(请参阅上面的“本地签名密钥”),并且该地址已经是交易智能帐户上的授权签名者。
过滤
splits transactions list 接受与web应用程序中的“记帐”视图相同的筛选器集:
# Filter by inflow / outflow
splits transactions list --direction inbound
splits transactions list --direction outbound
# Filter by USD value range (compared against absolute value)
splits transactions list --min-amount 100 --max-amount 10000
# Filter by date range (endDate is EXCLUSIVE)
splits transactions list --start-date 2026-03-01 --end-date 2026-04-01
# Or use a period shorthand (resolved in your local timezone)
splits transactions list --period thisMonth
splits transactions list --period lastMonth
splits transactions list --period last30Days
# Search by memo (case-insensitive substring; min 3 chars; combine with another filter)
splits transactions list --memo "payroll" --chain-id 8453
# Multi-account: comma-separated addresses
splits transactions list --account 0xa...,0xb...
# Combined: find a ~$5k outbound payment to Acme last month
splits transactions list --period lastMonth --memo "Acme" \
--min-amount 4500 --max-amount 5500 --direction outbound
# Look up a transaction by its on-chain hash (matches both splits-initiated
# transactions and asset transfers; combine with --chain-id when the same hash
# could exist on multiple chains)
splits transactions list --transaction-hash 0xabc...def --chain-id 8453
# Look up a transaction by its ERC-4337 user-op hash
splits transactions list --user-op-hash 0x1dfe...dcf响应中的每一行都包含一个 direction 现场(inbound 或 outbound)因此,您可以验证筛选结果。拆分发起的交易始终 outbound。每行还包括 transactionHash 和 userOpHash (两者都可以为空),因此您可以将拆分记录与探索者和bundler webhooks相关联;返回相同的两个字段 splits transactions get.
--period 与相互排斥 --start-date / --end-date.有效期值: thisWeek, thisMonth, thisYear, lastWeek, lastMonth, lastYear, last30Days, last90Days, last6Months.
账户
# List accounts
splits accounts list
splits accounts list --includeArchived
# Get account details
splits accounts get
# List signers (passkeys + EOAs) and threshold for a subaccount
splits accounts signers
# Archive a subaccount (requires owner-scoped API key)
splits accounts archive
# Unarchive a subaccount (requires owner-scoped API key)
splits accounts unarchive
# Rename a subaccount (requires owner-scoped API key)
splits accounts rename --name "New Name"
# Create a subaccount (requires owner-scoped API key)
# EOAs must be registered first via `splits auth register-signer `.
# Prefer ids when you have them; addresses are accepted as a convenience and
# resolve to ids server-side (each must already be registered to you).
splits accounts create --name "Operations" --passkeyIds , --threshold 1
splits accounts create --name "Ops" --eoaSignerIds , --threshold 2
splits accounts create --name "Bots" --eoaAddresses 0xabc...,0xdef... --threshold 1成员
# List org members
splits members list
# List passkey signers for a member (use for account creation)
splits members signers MCP服务器(克劳德代码)
将CLI注册为MCP服务器,以便Claude可以直接使用Splits工具:
# Using the built-in command (auto-detects Claude Code, Cursor, etc.)
splits mcp add
# Or manually with Claude Code
claude mcp add splits -e SPLITS_API_KEY=sk_read_... -- npx @splits/splits-cli --mcpMCP服务器公开了这些工具:
transactions_list--列出您所在组织的交易记录transactions_get--获取交易详情transactions_update_gas_estimation--更新现有交易的天然气估算accounts_list--列出组织中的帐户accounts_get--按地址获取帐户详细信息accounts_signers--列出子帐户的密钥+EOA签名者和阈值accounts_archive--存档子帐户accounts_unarchive--取消子帐户存档accounts_rename--重命名子帐户accounts_create--创建新的子帐户accounts_update_signers--建议添加/删除签名者(EOA从中添加引用IDauth_register_signer)transactions_sign--与本地EOA签署待处理的多重签名交易auth_whoami-显示组织、API密钥源和本地签名密钥(如果有)auth_login/auth_logout-保存或删除本地API密钥(stdin-referred;--api-key根据MCP,旗帜被拒绝)auth_create_key/auth_delete_key/auth_import_key--管理本地EOA签名密钥auth_register_signer/auth_signers--在代理用户下注册并列出EOA签名者members_list--列出组织成员members_signers--列出成员的密钥签名者
配置
| 变量 | 必填 | 描述 |
|---|---|---|
SPLITS_API_KEY | 没有来自的\* | API密钥 团队设置.优先于 splits auth login. |
SPLITS_API_URL | 否 | 覆盖API基本URL(默认为生产版)。优先于由保存的任何URL auth login --api-url. |
SPLITS_MCP_MODE | 否 | 设置为 1 当作为MCP服务器运行时。拒绝基于标志的秘密(--api-key, --private-key)因此,秘密不会出现在工具调用记录中。 |
\*至少需要一个凭据源:env var或通过保存的密钥 splits auth login.
