@achswap/mcp-sdk
v1.2.0
Published
Local signer SDK for Achswap AI agents — private keys never leave your machine.
Readme
@achswap/mcp-sdk
Local signer for Achswap AI agents. Your private key stays on your machine; the remote MCP server never sees it.
Install
npm install -g @achswap/mcp-sdkQuick Start
# 1. Create an encrypted wallet
achswap init
# 2. Show your address without unlocking
achswap address
# 3. Check your native USDC balance
achswap balance
# 4. Run the local MCP signer
achswap passphrase set # optional second factor
achswap serveAuto-config for AI clients
One command writes the MCP entry into each client’s config (uses npx -y @achswap/mcp-sdk serve):
# 1. Install CLI (once)
npm install -g @achswap/mcp-sdk
# 2. Wallet (sealed by the OS credential store — no flag needed)
achswap init
# 3. Defaults are already: autoSign=true, autoPassword=true
# Opt out only if you want manual control:
# achswap set autoSign false
# achswap set autoPassword false
# 4. Wire up the AI (pick one or more)
achswap install claude # Claude Desktop / Claude Code
achswap install cursor
achswap install opencode
achswap install codexThen restart that AI app.
| Client | Config file written |
|--------|---------------------|
| claude | %APPDATA%\Claude\claude_desktop_config.json (Windows), or ~/.claude.json |
| cursor | ~/.cursor/mcp.json |
| opencode | ~/.config/opencode/opencode.json (or OPENCODE_CONFIG) |
| codex | ~/.codex/config.toml (or CODEX_HOME) |
Signing from the AI process. By default the AI can read and build transactions but not broadcast them: writes queue and you approve them.
achswap pending
achswap approve <pending_id>A default device-mode vault needs no environment variable at all — achswap approve
unlocks via the OS credential store.
If you want the agent to sign without a terminal step, that is opt-in and requires two separate switches:
achswap set autoSign true # agent signs immediately
# or, to let it approve its own queued items:
achswap set allowAiConfirm true # AND ACHSWAP_PASSPHRASE must be set for that processDo not put
ACHSWAP_PASSPHRASEin a client config file. Those files (~/.cursor/mcp.json,~/.codex/config.toml, …) are plaintext application data — precisely what an attacker sweeps up.achswap installdeliberately writes only mode and flags. If you need a passphrase in the agent's environment, launch the client from a shell that has it exported, and prefer adevice-mode vault plus terminal approval instead.
Manual config example (Cursor / Claude)
{
"mcpServers": {
"achswap": {
"command": "npx",
"args": ["-y", "@achswap/mcp-sdk", "serve"],
"env": {
"ACHSWAP_MODE": "remote",
"ACHSWAP_AUTO_SIGN": "false"
}
}
}
}Environment Variables
| Variable | Required | Description |
|----------|----------|-------------|
| ACHSWAP_PASSPHRASE | No* | Owner passphrase for the vault |
| ACHSWAP_PASSWORD | No | Deprecated alias for ACHSWAP_PASSPHRASE |
| ACHSWAP_AUTO_SIGN | No | true to sign with no human step (default false) |
| ACHSWAP_DEVICE_UNLOCK | No | false forces a passphrase prompt (default true) |
| ACHSWAP_ALLOW_AI_CONFIRM | No | Allow AI self-approval; needs ACHSWAP_PASSPHRASE too (default false) |
| ACHSWAP_RPC_URL | No | ARC RPC URL (default: https://rpc.testnet.arc.network) |
| ACHSWAP_CHAIN_ID | No | Chain ID (default: 5042002) |
| ACHSWAP_MCP_SERVER_URL | No | Remote keyless MCP backend URL |
| ACHSWAP_BUILDER_TOKEN | No | Token for gated builder endpoints |
* Only needed when the vault requires a passphrase (achswap passphrase set), or to
let the AI self-approve. A default device-mode vault unlocks from the OS credential
store with no environment variable at all.
Files and where secrets live
| Path | Contents |
|------|----------|
| ~/.achswap/keystore.json | V3 keystore, encrypted with a 256-bit random password |
| ~/.achswap/vault.json | AES-256-GCM envelope holding that password |
| OS credential store | The device secret that helps unlock the vault — not on disk |
| Your memory | The optional passphrase — not on disk |
Windows paths use %USERPROFILE%\.achswap\. Files are created 0o600 on Unix;
chmod is a no-op on Windows, so the design does not rely on file permissions.
Nothing in ~/.achswap is sufficient to decrypt the wallet on its own.
CLI Commands
| Command | Description |
|---------|-------------|
| achswap init | Create a wallet sealed by the OS credential store |
| achswap security | Show how the wallet is protected; flag anything weak |
| achswap passphrase set\|remove\|status | Manage the second unlock factor |
| achswap export-recovery <path> | Portable passphrase-sealed backup |
| achswap import-recovery <path> | Restore from that backup on any machine |
| achswap recover -m "<phrase>" | Restore from the 12-word phrase |
| achswap migrate | Upgrade a pre-vault wallet off .session-pw |
| achswap backup [dir] | Copy keystore + vault (machine-bound) |
| achswap approve <id> | Approve and broadcast a queued transaction |
| achswap address | Show wallet address without unlocking |
| achswap balance | Show native USDC balance |
| achswap serve | Start the local MCP signer server (stdio) |
| achswap serve --http | Start the local MCP signer server (HTTP) |
| achswap (no args) | Full control panel: settings, processes, kill, install |
| achswap status | Wallet, config, and short MCP running summary |
| achswap running (alias ps) | List running Achswap MCP processes |
| achswap running --kill <n\|pid> | Kill one process by list number or PID |
| achswap running --kill-all | Kill all detected Achswap MCP processes |
Security
- Private keys are generated locally and never leave the machine.
- The keystore is encrypted with a 256-bit random password, not a guessable one.
- That password is sealed in a vault whose key comes from the OS credential store
and/or your passphrase — never from anything stored in
~/.achswap. - On Windows the vault is additionally DPAPI-bound to your logon session.
- Keys are decrypted only for a single signing call and never cached.
autoSignisfalseby default: writes wait forachswap approve <id>.- AI self-approval requires both
ACHSWAP_ALLOW_AI_CONFIRM=trueand an explicitACHSWAP_PASSPHRASE; device unlock alone is never treated as authorization. - The remote MCP server builds unsigned transactions but never sees your key.
Run achswap security to audit your own install.
See the top-level SECURITY.md for the threat model, recovery paths, and known limitations.
