Secure API Key Management for Claude: MCP Credential Tools for Self-Hosted AI Agents

One Config Block. Your Claude Agent Now Has a Wallet.

MCP servers are the fastest way to extend Claude's capabilities — and if you want your Claude agent to do anything onchain, you've been stuck wiring up wallet libraries, key management, RPC endpoints, and signing logic by hand. WAIaaS is an MCP server that gives Claude 45 ready-to-use tools for wallets, transactions, DeFi, NFTs, and more. Add one block to claude_desktop_config.json, and your agent can check balances, swap tokens, stake, bridge, and pay for API calls automatically — without you writing a single line of wallet code.

Why This Actually Matters

The gap between "Claude can reason about onchain actions" and "Claude can execute onchain actions" is enormous. You need key management, signing, RPC connections, DeFi protocol integrations, and — critically — guardrails so an autonomous agent doesn't drain a wallet in a runaway loop. Most developers either skip the guardrails (dangerous) or spend weeks building infrastructure before writing any actual agent logic (slow). WAIaaS closes that gap by handling the entire wallet layer as a self-hosted service that speaks MCP natively.

Because it's self-hosted, your private keys never leave your machine. Because it speaks MCP, Claude can use it directly — no custom tool wrappers, no glue code.

What You're Actually Adding

When you register WAIaaS as an MCP server, Claude gets access to 45 tools organized across five capability areas:

Wallet & balance toolsget-balance, get-address, get-assets, get-wallet-info, get-nonce, get-tokens, connect-info

Transaction toolssend-token, send-batch, sign-transaction, sign-message, simulate-transaction, get-transaction, list-transactions, approve-token

DeFi toolsaction-provider, get-defi-positions, get-health-factor, hyperliquid, polymarket, list-offchain-actions

NFT toolslist-nfts, get-nft-metadata, transfer-nft

Infrastructure toolsx402-fetch, wc-connect, wc-disconnect, wc-status, build-userop, sign-userop, call-contract, encode-calldata, erc8004-get-agent-info, erc8004-get-reputation, resolve-asset, get-policies, list-sessions, list-credentials, get-rpc-proxy-url, get-provider-status, list-incoming-transactions, get-incoming-summary, erc8128-sign-request, erc8128-verify-signature, erc8004-get-validation-status

That's the full list — no hidden upsells, no premium tier. All 45 tools are in the open-source codebase.

Step 1: Get WAIaaS Running

Before Claude can use any of these tools, the WAIaaS daemon needs to be running locally. The fastest path is Docker:

git clone https://github.com/minhoyoo-iotrust/WAIaaS.git
cd WAIaaS
docker compose up -d

The daemon starts on 127.0.0.1:3100 by default. That's it for the server side.

If you prefer the CLI approach:

npm install -g @waiaas/cli
waiaas init
waiaas start

On first run, WAIaaS sets a master password. This is the admin credential — it creates wallets, issues session tokens, and configures policies. Keep it safe.

Step 2: Create a Wallet and a Session Token

Claude doesn't use your master password directly. Instead, you create a wallet and issue a session token — a scoped credential that gives Claude access to exactly one wallet with whatever permissions you configure.

# Create a wallet
curl -X POST http://127.0.0.1:3100/v1/wallets \
  -H "Content-Type: application/json" \
  -H "X-Master-Password: my-secret-password" \
  -d '{"name": "trading-wallet", "chain": "solana", "environment": "mainnet"}'

# Create a session token for that wallet
curl -X POST http://127.0.0.1:3100/v1/sessions \
  -H "Content-Type: application/json" \
  -H "X-Master-Password: my-secret-password" \
  -d '{"walletId": "<wallet-uuid>"}'

Or if you want to skip the curl and let the CLI handle everything at once:

waiaas quickset --mode mainnet

quickset creates wallets and MCP sessions in one step, then prints the MCP config JSON you need. Copy it directly into your Claude Desktop config.

Step 3: Add WAIaaS to Claude Desktop

Open ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) and add this block:

{
  "mcpServers": {
    "waiaas": {
      "command": "npx",
      "args": ["-y", "@waiaas/mcp"],
      "env": {
        "WAIAAS_BASE_URL": "http://127.0.0.1:3100",
        "WAIAAS_SESSION_TOKEN": "wai_sess_<your-token>",
        "WAIAAS_DATA_DIR": "~/.waiaas"
      }
    }
  }
}

Restart Claude Desktop. That's the one config block. Claude now has a wallet.

If you want Claude to manage multiple wallets — say, a trading wallet on Solana and a separate one for Ethereum — you can run one MCP server per wallet:

{
  "mcpServers": {
    "waiaas-trading": {
      "command": "npx",
      "args": ["-y", "@waiaas/mcp"],
      "env": {
        "WAIAAS_BASE_URL": "http://127.0.0.1:3100",
        "WAIAAS_AGENT_ID": "019c47d6-51ef-7f43-a76b-d50e875d95f4",
        "WAIAAS_AGENT_NAME": "trading-agent",
        "WAIAAS_DATA_DIR": "~/.waiaas"
      }
    },
    "waiaas-solana": {
      "command": "npx",
      "args": ["-y", "@waiaas/mcp"],
      "env": {
        "WAIAAS_BASE_URL": "http://127.0.0.1:3100",
        "WAIAAS_AGENT_ID": "019c4cd2-86e8-758f-a61e-9c560307c788",
        "WAIAAS_AGENT_NAME": "solana-wallet",
        "WAIAAS_DATA_DIR": "~/.waiaas"
      }
    }
  }
}

Or just let the CLI wire all of this up automatically:

waiaas mcp setup --all

What Claude Can Actually Do Now

Once the MCP server is registered, Claude uses the tools naturally in conversation. Some examples of what that looks like in practice:

Balance check:

"Check my wallet balance" → Claude calls get_balance → returns current balance

Token swap:

"Swap 0.1 SOL for USDC on Jupiter" → Claude calls action_provider with the jupiter-swap provider, inputMint, outputMint, and amount

DeFi positions:

"Show my DeFi positions across all protocols" → Claude calls get_defi_positions → returns lending, staking, and liquidity positions

Simulate before sending:

"What would happen if I sent 1 SOL to this address?" → Claude calls simulate_transaction with dryRun: true — no funds move, you see the outcome

The 15 integrated DeFi protocols cover a wide range of what you'd actually want an agent to do: Aave v3, Across, D'CENT swap, Drift, Hyperliquid, Jito staking, Jupiter swap, Kamino, Lido staking, LI.FI, Pendle, Polymarket, XRPL DEX, and 0x swap.

The Part You Shouldn't Skip: Policies

Giving an AI agent a live wallet without guardrails is a bad idea. WAIaaS has a policy engine with 21 policy types and a default-deny stance — transactions are blocked unless you explicitly allow them.

The most important policy to set up is SPENDING_LIMIT. It assigns every transaction to one of four security tiers based on amount:

curl -X POST http://127.0.0.1:3100/v1/policies \
  -H "Content-Type: application/json" \
  -H "X-Master-Password: my-secret-password" \
  -d '{
    "walletId": "<wallet-uuid>",
    "type": "SPENDING_LIMIT",
    "rules": {
      "instant_max_usd": 100,
      "notify_max_usd": 500,
      "delay_max_usd": 2000,
      "delay_seconds": 900,
      "daily_limit_usd": 5000
    }
  }'

With this policy active:

The APPROVAL tier routes through WalletConnect, Telegram, or push notification, depending on how you've configured your signing channel. You approve or reject from your phone.

You can also lock down which tokens the agent can transfer and which contracts it can call:

# Only allow USDC transfers — everything else is denied
-d '{"walletId": "<wallet-uuid>", "type": "ALLOWED_TOKENS", "rules": {"tokens": [{"address": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", "symbol": "USDC", "chain": "solana"}]}}'
# Only allow calls to Jupiter — block all other contracts
-d '{"walletId": "<wallet-uuid>", "type": "CONTRACT_WHITELIST", "rules": {"contracts": [{"address": "JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4", "name": "Jupiter", "chain": "solana"}]}}'

The policy engine also has DeFi-specific limits: PERP_MAX_LEVERAGE to cap leverage on perpetual futures, LENDING_LTV_LIMIT to prevent dangerous loan-to-value ratios on lending protocols, and PERP_MAX_POSITION_USD to cap position sizes. These are purpose-built for the reality that AI agents will be making DeFi decisions autonomously.

x402: Claude Pays for API Calls Automatically

One of the more interesting tools in the set is x402-fetch. The x402 protocol lets HTTP APIs require micropayments — an agent hits an endpoint, gets a 402 response, and pays automatically before retrying. The x402-fetch MCP tool handles this entire flow without any intervention from you or Claude's conversation layer.

You can control which domains Claude is allowed to auto-pay using the X402_ALLOWED_DOMAINS policy:

-d '{"type": "X402_ALLOWED_DOMAINS", "rules": {"domains": ["api.example.com", "*.openai.com"]}}'

Domains not on the list are blocked. Claude can't authorize payments to arbitrary endpoints.

The Interactive API Docs Are Available Too

If you want to explore the full API surface — all 39 REST route modules — WAIaaS serves an OpenAPI 3.0 spec and interactive docs locally:

# Download the spec
curl http://127.0.0.1:3100/doc -o openapi.json

# Open the interactive reference in your browser
open http://127.0.0.1:3100/reference

The interactive reference at /reference uses the Scalar API UI — you can try endpoints directly from the browser, which is useful when you're figuring out what parameters a DeFi action needs before asking Claude to call it.

Quick Start Summary

  1. Run the daemondocker compose up -d or waiaas start
  2. Create a wallet and sessionwaiaas quickset --mode mainnet handles both and prints your MCP config
  3. Set a spending limit policy — before funding the wallet, configure a SPENDING_LIMIT policy with appropriate thresholds for your use case
  4. Add the MCP config block to claude_desktop_config.json and restart Claude Desktop
  5. Ask Claude to check your balance — confirm the tools are working before funding the wallet

What's Next

The 45 MCP tools cover the most common agent workflows, but there's a lot of depth in the policy engine and DeFi integrations worth exploring once you've got the basics running. The WAIaaS GitHub repository has the full source, and the official site has documentation covering the complete policy reference and all supported networks.

If you run into issues or want to discuss use cases, the repository issues page is the right place — the project is actively maintained and the codebase has 683+ test files, so if something breaks, it's probably worth filing a report.