stx402-agent 标志

stx402-agent

组织
aibtcdev

Bitcoin-native MCP server for AI agents: BTC/STX wallets, DeFi yield, sBTC peg, NFTs, and x402 payments.

发布者aibtcdev
代码仓库aibtc-mcp-server
语言TypeScript
复刻数
47
星标数
10
可用工具
66
传输类型stdio
分类
链接
  • 将工具接入 AI 工作流

    stx402-agent 提供 MCP 功能,可供兼容的 AI 客户端和智能体使用。

  • 66 个可用工具

    浏览下方可调用的操作;如果服务器提供了名称和描述,也会一并显示。

  • 可直接复制的配置

    使用安装配置片段,在您首选的 MCP 客户端中配置此服务器。

  • 开源社区热度

    关联的代码仓库有 10 个星标和 47 个复刻。

@aibtc/mcp-server

npm version License: MIT

Bitcoin-native MCP server for AI agents: BTC/STX wallets, DeFi yield, sBTC peg, NFTs, and x402 payments.

Features

  • Bitcoin L1 - Check balances, send BTC, manage UTXOs via mempool.space
  • Agent's Own Wallet - Agents get their own wallet to perform blockchain transactions
  • Secure Storage - Wallets encrypted with AES-256-GCM and stored locally
  • 350+ Tools - Bitcoin L1 + comprehensive Stacks L2 operations
  • sBTC Support - Native Bitcoin on Stacks operations
  • Token Operations - SIP-010 fungible token transfers and queries
  • NFT Support - SIP-009 NFT holdings, transfers, and metadata
  • DeFi Trading - ALEX DEX swaps and Zest Protocol lending/borrowing
  • Stacking/PoX-5 - Stake STX with a signer manager, extend, unstake, claim sBTC rewards
  • BNS Domains - .btc domain lookups and management (V1 + V2)
  • x402 Payments - Automatic payment handling for paid APIs

Quick Start

Claude Code (Terminal)

bash
npx @aibtc/mcp-server@latest --install

That's it! This automatically configures Claude Code. Restart your terminal and start chatting.

Claude Desktop (App)

bash
npx @aibtc/mcp-server@latest --install --desktop

This detects your OS and writes to the correct Claude Desktop config file:

OSConfig Path
macOS~/Library/Application Support/Claude/claude_desktop_config.json
Linux~/.config/Claude/claude_desktop_config.json
Windows%APPDATA%/Claude/claude_desktop_config.json

Restart Claude Desktop after installing.

Other MCP Clients

This is a standard stdio MCP server, so it works with any MCP-compatible client. Claude Code is the default --install target; select another client with a flag:

bash
npx @aibtc/mcp-server@latest --install --cursor     # Cursor
npx @aibtc/mcp-server@latest --install --windsurf   # Windsurf
npx @aibtc/mcp-server@latest --install --gemini     # Gemini CLI
npx @aibtc/mcp-server@latest --install --codex      # OpenAI Codex CLI
npx @aibtc/mcp-server@latest --install --vscode     # VS Code (writes ./.vscode/mcp.json)
FlagClientConfig written
(none)Claude Code~/.claude.json
--desktopClaude Desktopclaude_desktop_config.json (see path table above)
--cursorCursor~/.cursor/mcp.json
--windsurfWindsurf~/.codeium/windsurf/mcp_config.json
--geminiGemini CLI~/.gemini/settings.json
--codexOpenAI Codex CLI~/.codex/config.toml
--vscodeVS Code (Copilot agent)./.vscode/mcp.json (project-scoped)

Each installer merges into the existing config — it won't clobber other servers or settings. Restart the client afterward.

OpenRouter (any model)

The clients above are MCP hosts — they connect to this server for you. To drive the tools with an OpenRouter model instead, the server ships a built-in bridge: it spawns itself in server mode, exposes the tools to the model as function tools, and runs the tool-call loop. This is the client-side pattern from OpenRouter's MCP cookbook, packaged into the binary.

bash
export OPENROUTER_API_KEY=sk-or-...
npx @aibtc/mcp-server@latest bridge "what's the STX balance of SP3...?"

Safety flags (this server moves real funds, so the bridge defaults to nothing extra and lets you constrain it):

FlagEffect
--read-onlyExpose only read-only tools (no transfer/swap/deploy/etc.)
--allow a,bForce-allow specific tool names (added to the set)
--block a,bForce-remove specific tool names (wins over --allow)
--max-spend-ustx <n> / --max-spend-sats <n>Cap spend via the server's spend-limit rail (enforced before signing)
--list-toolsPrint the exposed tool set and exit (no API key needed)
--model <id>OpenRouter model (default anthropic/claude-3.5-haiku)
--network <net>mainnet or testnet (default mainnet)
--max-turns <n>Tool-call loop cap (default 10)
bash
# Preview what a read-only session would expose, no key needed:
npx @aibtc/mcp-server@latest bridge --read-only --list-tools

# Read-only chat, plus one explicitly allowed write tool:
npx @aibtc/mcp-server@latest bridge --read-only --allow transfer_stx "send 1 STX to SP3..."

Before any agent loop runs (and on --list-tools), the bridge prints a compact safety receipt to stderr — network, read-only mode, exposed/write/blocked tool counts, the session spend cap, and the number of known x402 endpoints — so the configured execution boundaries are visible up front. It reports boundaries only; it never claims any value moved.

The allowlist is re-enforced at execution time, so a model can never call a tool outside the exposed set. Any MCP-capable agent framework (@openrouter/agent, OpenAI Agents SDK, Claude Agent SDK) can also point at this server directly — the bridge is for driving it through OpenRouter's raw API without adopting a framework.

Testnet Mode

Add --testnet to any install command:

bash
npx @aibtc/mcp-server@latest --install --testnet            # Claude Code, testnet
npx @aibtc/mcp-server@latest --install --cursor --testnet   # Cursor, testnet

Why npx? Using npx @aibtc/mcp-server@latest ensures you always get the newest version automatically. Global installs (npm install -g) won't auto-update.

Manual Configuration

If you prefer to configure manually, add the following to your client's config file. The -y flag stops npx from prompting for confirmation.

Claude Code / Claude Desktop / Cursor / Windsurf / Gemini CLI — mcpServers JSON:

json
{
  "mcpServers": {
    "aibtc": {
      "command": "npx",
      "args": ["-y", "@aibtc/mcp-server@latest"],
      "env": {
        "NETWORK": "mainnet"
      }
    }
  }
}

VS Code (.vscode/mcp.json) — uses a servers key and a typed entry:

json
{
  "servers": {
    "aibtc": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@aibtc/mcp-server@latest"],
      "env": { "NETWORK": "mainnet" }
    }
  }
}

OpenAI Codex CLI (~/.codex/config.toml) — TOML, not JSON:

toml
[mcp_servers.aibtc]
command = "npx"
args = ["-y", "@aibtc/mcp-server@latest"]

[mcp_servers.aibtc.env]
NETWORK = "mainnet"

Zed (settings.json) — uses a context_servers key:

json
{
  "context_servers": {
    "aibtc": {
      "source": "custom",
      "command": "npx",
      "args": ["-y", "@aibtc/mcp-server@latest"],
      "env": { "NETWORK": "mainnet" }
    }
  }
}

Cline / Roo Code (VS Code extension) — add the same mcpServers JSON block above via the extension's MCP settings panel (the exact cline_mcp_settings.json path varies by OS and VS Code build).

Any other MCP client works too — point it at npx -y @aibtc/mcp-server@latest over stdio with NETWORK in the env.

Giving Claude a Wallet

When you first use @aibtc/mcp-server, Claude doesn't have a wallet. Here's the smooth onboarding flow:

Example Conversation

You: What's your wallet address?

Claude: I don't have a wallet yet. Would you like to assign me one?
        I can either create a fresh wallet or you can import an existing one.

You: Create a new wallet called "agent-wallet"

Claude: What password should I use to protect the wallet?

You: use "secure123password"

Claude: I now have a wallet! My address is ST1ABC...XYZ

        IMPORTANT: Please save this recovery phrase securely:
        "word1 word2 word3 ... word24"

        This phrase will NOT be shown again. It's the only way to recover
        the wallet if the password is forgotten.

You: Send 10 STX to ST2DEF...

Claude: Done! I've sent 10 STX to ST2DEF...
        Transaction: 0x123...

Wallet States

StateWhat Claude SaysWhat To Do
No wallet"I don't have a wallet yet"Use wallet_create or wallet_import
Locked"My wallet is locked"Use wallet_unlock with password
Ready"My address is ST..."Claude can perform transactions

Session Management

  • By default, the wallet auto-locks after 15 minutes
  • You can change this with wallet_set_timeout (set to 0 to disable)
  • Use wallet_lock to manually lock the wallet
  • Use wallet_unlock when you need Claude to transact again

Wallet Storage

Claude's wallets are stored locally on your machine:

~/.aibtc/
├── wallets.json       # Wallet index (names, addresses - no secrets)
├── config.json        # Active wallet, settings
└── wallets/
    └── [wallet-id]/
        └── keystore.json  # Encrypted mnemonic (AES-256-GCM + Scrypt)

Security:

  • AES-256-GCM encryption with Scrypt key derivation
  • Password required to unlock
  • Mnemonics never stored in plaintext
  • File permissions set to owner-only (0600)

Bitcoin L1 Support

Each wallet automatically derives both a Stacks address and a Bitcoin address from the same mnemonic using BIP39/BIP32 standards.

Derivation Paths (BIP84):

  • Mainnet: m/84'/0'/0'/0/0 (Bitcoin coin type 0)
  • Testnet: m/84'/1'/0'/0/0 (Bitcoin testnet coin type 1)

Address Format:

  • Mainnet: bc1q... (Native SegWit P2WPKH)
  • Testnet: tb1q... (Native SegWit P2WPKH)

Capabilities:

  • Full Bitcoin L1 transaction support (send BTC)
  • Balance and UTXO queries via mempool.space API
  • Fee estimation (fast/medium/slow)
  • P2WPKH (native SegWit) transactions for optimal fees

Example:

You: Create a wallet called "my-wallet"
Claude: I've created a wallet with:
        Stacks address: ST1ABC...
        Bitcoin address: bc1q...

You: Send 50000 sats to bc1q...
Claude: Done! Transaction broadcast: abc123...

Both addresses are derived from the same recovery phrase, making it easy to manage both Layer 1 (Bitcoin) and Layer 2 (Stacks) assets.

Available Tools (350+ total)

Wallet Management

ToolDescription
wallet_createCreate a new wallet for Claude
wallet_importImport an existing wallet for Claude
wallet_unlockUnlock Claude's wallet
wallet_lockLock Claude's wallet
wallet_listList Claude's available wallets
wallet_switchSwitch Claude to a different wallet
wallet_deleteDelete a wallet
wallet_exportExport wallet mnemonic
wallet_statusCheck if Claude's wallet is ready (includes Stacks and Bitcoin addresses)
wallet_set_timeoutSet how long wallet stays unlocked

Bitcoin L1

ToolDescription
get_btc_balanceGet BTC balance (total, confirmed, unconfirmed)
get_btc_feesGet fee estimates (fast, medium, slow)
get_btc_utxosList UTXOs for an address
transfer_btcSend BTC to a recipient
get_cardinal_utxosUTXOs safe to spend (no inscriptions)
get_ordinal_utxosUTXOs containing inscriptions

Mempool Watch (Bitcoin)

ToolDescription
get_btc_mempool_infoGet current Bitcoin mempool statistics (tx count, vsize, fees, fee histogram)
get_btc_transaction_statusGet confirmation status and details for a Bitcoin transaction by txid
get_btc_address_txsGet recent transaction history for a Bitcoin address (last 25 transactions)

Bitcoin Inscriptions

ToolDescription
get_taproot_addressGet wallet's Taproot (P2TR) address
estimate_inscription_feeCalculate inscription cost
inscribeCreate inscription commit transaction
inscribe_revealComplete inscription reveal transaction
get_inscriptionFetch inscription content from reveal tx
get_inscriptions_by_addressList inscriptions owned by address

PSBT & Ordinals Trading

ToolDescription
psbt_create_ordinal_buyBuild a buyer-side PSBT for ordinal purchase
psbt_signSign selected PSBT inputs with active wallet keys
psbt_decodeDecode PSBT inputs/outputs/signature status
psbt_broadcastFinalize and broadcast a fully-signed PSBT

Message Signing

ToolDescription
sip018_signSign structured Clarity data (SIP-018)
sip018_verifyVerify SIP-018 signature
sip018_hashCompute SIP-018 hash without signing
stacks_sign_messageSign plain text (SIWS-compatible)
stacks_verify_messageVerify Stacks message signature
btc_sign_messageSign with Bitcoin key (BIP-137)
btc_verify_messageVerify BIP-137 signature

Wallet & Balance

ToolDescription
get_wallet_infoGet Claude's wallet addresses (Stacks + Bitcoin) and status
get_stx_balanceGet STX balance for any address
get_stx_feesGet STX fee estimates (low, medium, high)

STX Transfers

ToolDescription
transfer_stxSend STX to a recipient
broadcast_transactionBroadcast a pre-signed transaction

sBTC Operations

ToolDescription
sbtc_get_balanceGet sBTC balance
sbtc_transferSend sBTC
sbtc_initiate_withdrawalInitiate sBTC peg-out to BTC L1
sbtc_withdrawAlias for withdrawal initiation
sbtc_withdrawal_statusCheck withdrawal request status
sbtc_get_deposit_infoGet BTC deposit instructions
sbtc_depositBuild, sign, and broadcast BTC→sBTC deposit
sbtc_deposit_statusCheck deposit status via Emily API
sbtc_get_peg_infoGet peg ratio and TVL

Token Operations (SIP-010)

ToolDescription
get_token_balanceGet balance of any SIP-010 token
transfer_tokenSend any SIP-010 token
get_token_infoGet token metadata
list_user_tokensList tokens owned by an address
get_token_holdersGet top holders of a token

NFT Operations (SIP-009)

ToolDescription
get_nft_holdingsList NFTs owned by an address
get_nft_metadataGet NFT metadata
transfer_nftSend an NFT
get_nft_ownerGet NFT owner
get_collection_infoGet NFT collection details
get_nft_historyGet NFT transfer history

Stacking / PoX

ToolDescription
get_pox_infoCurrent PoX-5 cycle, burn height, prepare phase
get_stacking_statusLocked amount, signer manager, unlock height
list_stacking_signersSigner managers in the next cycle's signer set
stack_stxLock STX with a signer manager
extend_stackingExtend, increase, switch signer or payout (stake-update)
unstake_stxStop early; unlocks next cycle
get_stacking_rewardsUnclaimed sBTC rewards for a cycle
claim_stacking_rewardsClaim a cycle's rewards through the signer manager

BNS Domains (V1 + V2)

ToolDescription
lookup_bns_nameResolve .btc domain to address
reverse_bns_lookupGet .btc domain for an address
get_bns_infoGet domain details
check_bns_availabilityCheck if domain is available
get_bns_priceGet registration price
list_user_domainsList domains owned
preorder_bns_namePreorder a .btc domain (step 1 of 2)
register_bns_nameRegister a .btc domain (step 2 of 2)

Smart Contracts

ToolDescription
call_contractCall a smart contract function
deploy_contractDeploy a Clarity smart contract
get_transaction_statusCheck transaction status
call_read_only_functionCall read-only function

DeFi - ALEX DEX (Mainnet)

Uses the official alex-sdk for swap operations. Supports simple token symbols like "STX", "ALEX".

ToolDescription
alex_list_poolsDiscover all available trading pools
alex_get_swap_quoteGet expected output for a token swap
alex_swapExecute a token swap (SDK handles routing)
alex_get_pool_infoGet liquidity pool reserves

DeFi - Zest Protocol (Mainnet)

Supports 10 assets: sBTC, aeUSDC, stSTX, wSTX, USDH, sUSDT, USDA, DIKO, ALEX, stSTX-BTC

ToolDescription
zest_list_assetsList all supported lending assets
zest_get_positionGet user's supply/borrow position
zest_supplySupply assets to earn interest
zest_withdrawWithdraw supplied assets
zest_borrowBorrow against collateral
zest_repayRepay borrowed assets

DeFi - Bitflow DEX (Mainnet)

DEX aggregator that routes trades across multiple liquidity sources.

Units: Bitflow tools default to human units (amountUnit: "human"). Pass "2" to swap 2 STX, not "2000000". Set amountUnit: "base" only when working with raw on-chain integers. See Units & Decimals guide for details and common pitfalls.

ToolDescription
bitflow_get_tickerGet market data (no API key needed)
bitflow_get_quoteGet swap quote
bitflow_swapExecute token swap

Pillar Smart Wallet

sBTC smart wallet with Zest Protocol integration and passkey authentication.

ToolDescription
pillar_connectConnect to Pillar wallet
pillar_sendSend sBTC to BNS names or addresses
pillar_boostCreate leveraged sBTC position
pillar_positionView wallet and Zest position

For autonomous agents, use pillar_direct_* tools (no browser needed).

Blockchain Queries

ToolDescription
get_account_infoGet account nonce, balance
get_account_transactionsList transaction history
get_block_infoGet block details
get_mempool_infoGet pending transactions
get_contract_infoGet contract ABI and source
get_contract_eventsGet contract event history
get_network_statusGet network health status

Yield Hunter (Autonomous)

ToolDescription
yield_hunter_startStart autonomous sBTC→Zest deposits
yield_hunter_stopStop yield hunting
yield_hunter_statusCheck yield hunter status
yield_hunter_configureAdjust threshold, reserve, interval

x402 API Endpoints

ToolDescription
list_x402_endpointsDiscover x402 endpoints
execute_x402_endpointExecute x402 endpoint with auto-payment
scaffold_x402_endpointGenerate x402 Cloudflare Worker project
scaffold_x402_ai_endpointGenerate x402 AI API with OpenRouter

Usage Examples

Wallet management:

"What's your wallet address?" "Create a wallet for yourself" "Unlock your wallet" "Keep your wallet unlocked for 1 hour"

Check balances:

"How much STX do you have?" "What's your sBTC balance?"

Transfer tokens:

"Send 2 STX to ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM" "Transfer 0.001 sBTC to muneeb.btc"

NFTs:

"What NFTs do you own?" "Send this NFT to alice.btc"

BNS domains:

"What address is satoshi.btc?" "Is myname.btc available?"

DeFi trading (mainnet):

"What pools are available on ALEX?" "Swap 0.1 STX for ALEX" "Get a quote for 100 STX to ALEX" "What assets can I lend on Zest?" "Supply 100 stSTX to Zest" "Borrow 50 aeUSDC from Zest" "Check my Zest position"

x402 endpoints:

"Get trending liquidity pools" "Tell me a dad joke"

Supported Tokens

Well-known tokens can be referenced by symbol:

  • sBTC - Native Bitcoin on Stacks
  • USDCx - USD Coin on Stacks
  • ALEX - ALEX governance token
  • wSTX - Wrapped STX

ALEX DEX tokens: STX, ALEX, and any token from alex_list_pools

Zest Protocol assets: sBTC, aeUSDC, stSTX, wSTX, USDH, sUSDT, USDA, DIKO, ALEX, stSTX-BTC

Or use any SIP-010 token by contract ID: SP2X...::token-name

Configuration

Environment VariableDescriptionDefault
NETWORKmainnet or testnetmainnet
API_URLDefault x402 API base URLhttps://x402.biwas.xyz
CLIENT_MNEMONIC(Optional) Pre-configured mnemonic-
HIRO_API_KEY(Optional) Hiro API key for higher rate limits-
SPEND_LIMIT_ENABLEDSet false to disable the wallet spending limittrue
SPEND_LIMIT_DAILY_USTX / SPEND_LIMIT_SESSION_USTXSTX spend cap per day / per unlock (micro-STX)10000000 (10 STX)
SPEND_LIMIT_DAILY_SATS / SPEND_LIMIT_SESSION_SATSBTC spend cap per day / per unlock (sats)50000

Note on NETWORK: The --install command writes NETWORK=mainnet by default (pass --testnet to use testnet). If you omit NETWORK from your config entirely, the runtime fallback is also mainnet.

Note on spending limits: A default-on safety rail meters every outbound spend (transfer_stx, transfer_btc, x402/L402 auto-payments) against a cumulative per-session and per-day cap, so a single bad instruction or a malicious endpoint can't drain the wallet. A spend over the cap is blocked and reports the remaining budget. Raise the caps via the env vars above, or disable with SPEND_LIMIT_ENABLED=false. See SECURITY.md.

Note: CLIENT_MNEMONIC is optional. The recommended approach is to let Claude create its own wallet. HIRO_API_KEY is optional but recommended for production use — without it, you may hit Hiro's public rate limits (429 responses). Get a key at platform.hiro.so.

Architecture

You ←→ Claude ←→ aibtc-mcp-server
                        ↓
              Claude's Wallet (~/.aibtc/)
                        ↓
              ┌─────────┴─────────┐
              ↓                   ↓
        Hiro Stacks API    x402 Endpoints
              ↓                   ↓
        Stacks Blockchain  Paid API Services

Security Notes

  • Claude's wallet is stored encrypted on YOUR machine
  • Password is never stored - only the encrypted keystore
  • Mnemonics shown only once at creation
  • Auto-lock after 15 minutes (configurable)
  • Transactions signed locally before broadcast
  • Spending limit (default-on): outbound spends are capped per session and per day so a single bad instruction can't drain the wallet — see Configuration
  • Secret-scanning pre-commit hook: contributors get a hook (auto-installed via npm install) that blocks committing a seed phrase or private key
  • For mainnet: Fund with small amounts first

See SECURITY.md for the full wallet-key protection model and key-leak recovery steps.

Advanced: Pre-configured Mnemonic

For automated setups where Claude needs immediate wallet access, add the CLIENT_MNEMONIC environment variable to your MCP server config (in ~/.claude.json for Claude Code, or claude_desktop_config.json for Claude Desktop):

json
{
  "mcpServers": {
    "aibtc": {
      "command": "npx",
      "args": ["@aibtc/mcp-server@latest"],
      "env": {
        "CLIENT_MNEMONIC": "your twenty four word mnemonic phrase",
        "NETWORK": "testnet"
      }
    }
  }
}

This bypasses the wallet creation flow - Claude has immediate access to transact.

Agent Skill

This package includes an Agent Skills compatible skill that teaches any LLM how to use the Bitcoin wallet capabilities effectively.

What is it?

The aibtc-bitcoin-wallet skill provides:

  • Structured workflows for Bitcoin L1 operations (balance, send, fees)
  • Reference guides for Pillar smart wallets and Stacks L2 DeFi
  • LLM-agnostic instructions that work with Claude Code, Cursor, Codex, and 20+ other tools

Using the Skill

The skill is automatically included when you install the MCP server. Find it at:

  • Local: node_modules/@aibtc/mcp-server/skill/SKILL.md
  • ClawHub: clawhub.ai/skills - search for aibtc-bitcoin-wallet

Skill Structure

skill/
├── SKILL.md                        # Bitcoin L1 core workflows
└── references/
    ├── at-stake.md                 # El Salvador prediction market & side legions
    ├── genesis-lifecycle.md        # Agent registration & check-in
    ├── inscription-workflow.md     # Bitcoin inscription guide
    ├── pillar-wallet.md            # Pillar smart wallet guide
    ├── stacks-defi.md              # Stacks L2 / DeFi operations
    ├── troubleshooting.md          # Common issues and solutions
    └── x402-inbox.md               # x402 inbox messaging

Development

bash
git clone https://github.com/aibtcdev/aibtc-mcp-server.git
cd aibtc-mcp-server
npm install
npm run build
npm run dev       # Run with tsx (development)

Releases

This repo uses Release Please for automated releases:

  1. Merge PRs with conventional commits (feat:, fix:, etc.)
  2. Release Please creates a Release PR with changelog
  3. Merge the Release PR to publish

Repository Secrets (Maintainers)

SecretDescription
NPM_TOKENnpm publish token for @aibtc scope
CLAWHUB_API_TOKENClawHub API token for skill publishing

To obtain a ClawHub API token, visit clawhub.ai and create an account.

License

MIT

安装

TypingMind
{
  "mcpServers": {
    "aibtc-mcp-server": {
      "command": "npx",
      "args": [
        "stx402-agent@latest"
      ]
    }
  }
}

可用工具

  • get_wallet_info

    Get the agent's wallet address and status. If the agent doesn't have a wallet yet, provides guidance on how to assign one.

  • get_stx_balance

    Get the STX balance for a wallet address.

  • wallet_create

    Create a new wallet for the agent with a generated BIP39 24-word mnemonic. The wallet is encrypted locally and stored in ~/.stx402/. IMPORTANT: Save the mnemonic securely - it will only be shown once!

  • wallet_import

    Import an existing wallet for the agent using a BIP39 mnemonic phrase. The wallet is encrypted locally and stored in ~/.stx402/.

  • wallet_unlock

    Unlock the agent's wallet to enable transactions. If no wallet ID is provided, unlocks the active wallet.

  • wallet_lock

    Lock the agent's wallet, clearing sensitive data from memory.

  • wallet_list

    List all wallets available for the agent to use.

  • wallet_switch

    Switch to a different wallet. Note: The new wallet will need to be unlocked before use.

  • wallet_delete

    Permanently delete a wallet. WARNING: This cannot be undone! Make sure you have backed up your mnemonic.

  • wallet_export

    Export the mnemonic phrase for a wallet. WARNING: Only use this in a secure environment! Anyone with the mnemonic can access your funds.

  • wallet_set_timeout

    Set how long the agent's wallet stays unlocked before automatically locking. Set to 0 to disable auto-lock.

  • wallet_status

    Get the agent's wallet status - whether it has a wallet, if it's unlocked, and what it can do.

  • transfer_stx

    Transfer STX tokens to a recipient address. Signs and broadcasts the transaction.

    Example: To send 2 STX, use amount "2000000" (micro-STX). 1 STX = 1,000,000 micro-STX

  • broadcast_transaction

    Broadcast a pre-signed Stacks transaction to the network.

  • call_contract

    Call a function on a Stacks smart contract. Signs and broadcasts the transaction.

    For typed arguments, use objects like {type: 'uint', value: 100} or {type: 'principal', value: 'SP...'}

  • deploy_contract

    Deploy a Clarity smart contract to the Stacks blockchain.

  • get_transaction_status

    Check the status of a Stacks transaction by its txid.

  • call_read_only_function

    Call a read-only function on a smart contract (no signing required).

  • sbtc_get_balance

    Get the sBTC balance for a wallet address.

  • sbtc_transfer

    Transfer sBTC tokens to a recipient address.

    sBTC uses 8 decimals (same as Bitcoin). Example: To send 0.001 sBTC, use amount "100000" (satoshis).

  • sbtc_get_deposit_info

    Get information about how to deposit BTC to receive sBTC.

  • sbtc_get_peg_info

    Get sBTC peg information including total supply and peg ratio.

  • get_token_balance

    Get the balance of any SIP-010 token for a wallet address.

    Supports well-known tokens by symbol: sBTC, USDCx, ALEX, DIKO Or use the full contract ID: address.contract-name

  • transfer_token

    Transfer any SIP-010 token to a recipient address.

    Supports well-known tokens by symbol: sBTC, USDCx, ALEX, DIKO Or use the full contract ID.

  • get_token_info

    Get metadata for a SIP-010 token (name, symbol, decimals, supply).

  • list_user_tokens

    List all fungible tokens owned by an address.

  • get_token_holders

    Get the top holders of a SIP-010 token.

  • get_nft_holdings

    List all NFTs owned by an address.

  • get_nft_metadata

    Get metadata for a specific NFT (SIP-016).

  • transfer_nft

    Transfer an NFT (SIP-009) to a recipient address.

  • get_nft_owner

    Get the current owner of a specific NFT.

  • get_collection_info

    Get information about an NFT collection.

  • get_nft_history

    Get the transfer history of NFTs in a collection.

  • get_pox_info

    Get current Proof of Transfer (PoX) cycle information.

  • get_stacking_status

    Check if an address is currently stacking STX.

  • stack_stx

    Lock STX for stacking to earn BTC rewards.

    Requires a Bitcoin address (hash) for receiving rewards.

  • extend_stacking

    Extend an existing stacking lock period.

  • lookup_bns_name

    Resolve a .btc domain name to its Stacks address.

  • reverse_bns_lookup

    Get the BNS domain names owned by an address.

  • get_bns_info

    Get detailed information about a BNS domain name.

  • check_bns_availability

    Check if a BNS domain name is available for registration.

  • get_bns_price

    Get the registration price for a BNS domain name.

  • list_user_domains

    List all BNS domains owned by an address.

  • get_account_info

    Get detailed account information including nonce and balance.

  • get_account_transactions

    Get transaction history for an account.

  • get_block_info

    Get information about a specific block.

  • get_mempool_info

    Get pending transactions in the mempool.

  • get_contract_info

    Get information about a smart contract including its ABI.

  • get_contract_events

    Get events emitted by a smart contract.

  • get_network_status

    Get the current status of the Stacks network.

  • list_x402_endpoints

    List known x402 API endpoints from x402.biwas.xyz and stx402.com.

    The agent can:

    1. Execute x402 endpoints from these sources (paid API calls with automatic payment handling)
    2. Execute direct Stacks transactions (transfer STX, call contracts, deploy contracts)

    Sources:

    • x402.biwas.xyz: DeFi analytics, market data, wallet analysis, Zest/ALEX protocols
    • stx402.com: AI services, cryptography, storage, utilities, agent registry
  • execute_x402_endpoint

    Execute an x402 API endpoint. Payment is handled automatically.

    Supported sources:

    • x402.biwas.xyz (default): Use path like "/api/pools/trending"
    • stx402.com: Use apiUrl="https://stx402.com" with path like "/api/ai/dad-joke"

    Use list_x402_endpoints to discover available endpoints.

  • alex_get_swap_quote

    Get a swap quote from ALEX DEX.

    Returns the expected output amount for swapping tokenX to tokenY. Use full contract IDs for tokens (e.g., 'SP3K8BC0PPEVCV7NZ6QSRWPQ2JE9E5B6N3PA0KBR9.token-wstx-v2').

    Note: ALEX DEX is only available on mainnet.

  • alex_swap

    Execute a token swap on ALEX DEX.

    Swaps tokenX for tokenY using the ALEX AMM. Use full contract IDs for tokens.

    Note: ALEX DEX is only available on mainnet.

  • alex_get_pool_info

    Get liquidity pool information from ALEX DEX.

    Returns reserve balances and pool details for a token pair.

    Note: ALEX DEX is only available on mainnet.

  • alex_list_pools

    List all available trading pools on ALEX DEX.

    Discovers all token pairs that can be swapped directly. Returns pool ID, token pair, and factor (fee tier) for each pool.

    Use this to find which tokens can be swapped before calling alex_swap.

    Note: ALEX DEX is only available on mainnet.

  • zest_list_assets

    List all supported assets on Zest Protocol.

    Returns the list of assets that can be supplied, borrowed, or used as collateral. Each asset includes its symbol, name, and contract ID.

    Use this to discover available assets before supplying or borrowing.

    Note: Zest Protocol is only available on mainnet.

  • zest_get_position

    Get user's lending position on Zest Protocol.

    Returns supplied and borrowed amounts for a specific asset. You can use the asset symbol (e.g., 'stSTX') or full contract ID.

    Note: Zest Protocol is only available on mainnet.

  • zest_supply

    Supply assets to Zest Protocol lending pool.

    Deposits assets to earn interest from borrowers. You can use the asset symbol (e.g., 'stSTX') or full contract ID.

    Note: Zest Protocol is only available on mainnet.

  • zest_withdraw

    Withdraw assets from Zest Protocol lending pool.

    Redeems supplied assets plus earned interest. You can use the asset symbol (e.g., 'stSTX') or full contract ID.

    Note: Zest Protocol is only available on mainnet.

  • zest_borrow

    Borrow assets from Zest Protocol.

    Borrows assets against your supplied collateral. Ensure you have sufficient collateral to maintain a healthy position. You can use the asset symbol (e.g., 'aeUSDC') or full contract ID.

    Note: Zest Protocol is only available on mainnet.

  • zest_repay

    Repay borrowed assets to Zest Protocol.

    Repays borrowed assets plus accrued interest. You can use the asset symbol (e.g., 'aeUSDC') or full contract ID.

    Note: Zest Protocol is only available on mainnet.

  • scaffold_x402_endpoint

    Generate a complete Cloudflare Worker project with x402 payment integration.

    Creates a ready-to-deploy Hono.js application that accepts payments in STX, sBTC, or USDCx.

    Output Files

    • src/index.ts - Hono app with x402-protected endpoints
    • src/x402-middleware.ts - Payment verification middleware
    • wrangler.jsonc - Cloudflare Worker configuration
    • package.json - Dependencies and scripts
    • tsconfig.json - TypeScript configuration
    • .env.example - Environment variable template
    • .gitignore - Standard ignores
    • README.md - Documentation

    After Generation

    1. cd into the project directory
    2. Run: npm install
    3. Copy .env.example to .env and add Cloudflare credentials
    4. Set recipient address as secret: wrangler secret put RECIPIENT_ADDRESS
    5. Run: npm run dev (local development)
    6. Run: npm run deploy (deploy to Cloudflare)

    Payment Flow

    The generated endpoints implement the x402 payment protocol:

    1. Client requests endpoint without payment → receives 402 with payment requirem
  • scaffold_x402_ai_endpoint

    Generate a complete Cloudflare Worker project with x402 payment + OpenRouter AI integration.

    Creates a ready-to-deploy Hono.js application that:

    • Accepts payments in STX, sBTC, or USDCx
    • Calls OpenRouter AI models (Claude, GPT-4, Llama, etc.)
    • Returns AI-generated responses after payment

    AI Types

    • chat: General chat/Q&A endpoint
    • completion: Text completion/continuation
    • summarize: Summarize provided text
    • translate: Translate text to target language
    • custom: Custom system prompt

    Output Files

    • src/index.ts - Hono app with x402-protected AI endpoints
    • src/x402-middleware.ts - Payment verification middleware
    • src/openrouter.ts - OpenRouter API client
    • wrangler.jsonc - Cloudflare Worker configuration
    • package.json, tsconfig.json, .env.example, README.md

    After Generation

    1. cd into the project directory
    2. npm install
    3. Set secrets: wrangler secret put RECIPIENT_ADDRESS
    4. Set secrets: wrangler secret put OPENROUTER_API_KEY
    5. For local dev
  • openrouter_integration_guide

    Get OpenRouter integration examples and code patterns for implementing AI features.

    Use this tool when you need to add AI capabilities to any project. Returns:

    • Code examples for different environments (Node.js, Cloudflare Workers, browser)
    • API patterns and best practices
    • Model recommendations
    • Error handling patterns

    This is a reference tool - use the returned code as a template for implementation.

  • openrouter_models

    Get list of popular OpenRouter models with capabilities and context lengths.

    Use this to choose the right model for your use case. For latest pricing, check openrouter.ai/models

将 stx402-agent MCP 与多个 AI 模型配合使用

TypingMind 在工作区级别连接 MCP 工具,因此连接 stx402-agent 后,您就可以在 TypingMind 中搭配不同的 AI 模型使用,无需为每个模型单独设置。 此 MCP 通过您设备上的 TypingMind MCP 连接器在本地运行。

本地连接器设置指南

如果 MCP 服务器需要访问您电脑上的本地文件、应用或私有资源,请选择此方式。

1

打开 MCP 设置

在 TypingMind 中,依次前往“设置”、“高级设置”和“模型上下文协议”,然后选择“设置连接器”。

  1. 在您的浏览器中打开 TypingMind。
  2. 点击“设置”图标。
  3. 进入“高级设置”。
  4. 打开“模型上下文协议”部分。
  5. 点击“设置连接器”,然后选择“此设备”。
TypingMind MCP 连接器设置界面,已选择“此设备”
2

运行连接器命令

选择“此设备”,从 TypingMind 复制命令并在终端中运行。使用 MCP 时,请保持该进程运行。

  1. 复制 TypingMind 显示的设置命令。
  2. 在 macOS 上打开“终端”,或在 Windows 上打开 Windows Terminal。
  3. 粘贴并运行命令。
  4. 如果终端询问您是否继续,请确认安装软件包。
  5. 使用 MCP 工具时,请勿关闭终端窗口或停止其中的连接器进程。
3

将 stx402-agent 添加为服务器

当连接器状态为“就绪”时,点击“编辑服务器”,然后粘贴 MCP 服务器配置。

  1. 等待连接器状态显示为“就绪”。
  2. 点击“编辑服务器”。
  3. 粘贴 stx402-agent MCP 服务器配置。
  4. 保存服务器列表。
  5. 如需确认连接器是否仍处于就绪状态,请刷新。
TypingMind MCP 设置界面,显示正在运行的服务器和“编辑服务器”按钮
{
  "mcpServers": {
    "aibtc-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "stx402-agent"
      ]
    }
  }
}
4

在不同模型中使用同一连接

保存服务器列表,打开“插件”,启用 stx402-agent MCP 工具,然后在 TypingMind 中选择任意受支持的 AI 模型,即可在聊天中使用这些工具,或将其分配给智能体。

  1. 在 TypingMind 中打开“插件”页面。
  2. 启用 stx402-agent MCP 工具。
  3. 开始聊天并选择您想使用的 AI 模型。
  4. 在聊天中使用 MCP 工具,或将其分配给 AI 智能体。
  5. 根据需要随时切换到其他 AI 模型,无需重新连接 MCP。
在 TypingMind 聊天中使用已启用的 MCP 工具和选定的 AI 模型
您能使用 stx402-agent 帮我完成这项任务吗?
stx402-agent
当然,我看过了。
以下是我使用 stx402-agent 得到的结果。

常见问题

stx402-agent MCP 服务器有什么用途?

stx402-agent 是一个 MCP 服务器,可让兼容的 AI 客户端连接外部工具并获取上下文。在 TypingMind 中,只需添加一次此 MCP 服务器,即可在您的 AI 工作区中使用其工具。

可以在 TypingMind 中让多个 AI 模型使用 stx402-agent MCP 吗?

可以。TypingMind 在工作区层面连接 MCP 工具,因此您无需为每个模型单独配置 MCP 服务器,就能在 Claude、ChatGPT、Gemini 或您在 TypingMind 中配置的其他 AI 模型中使用 stx402-agent。

为什么在 TypingMind 中使用 stx402-agent MCP?

TypingMind 将多个 AI 模型、提示词、插件、AI 智能体、API 密钥和 MCP 工具整合到同一个工作区中,是最出色的大语言模型聊天前端之一。连接 stx402-agent 后,您可以在偏好的不同模型中使用其 MCP 工具,同时在 TypingMind 中井然有序地管理聊天工作流程。

如何将 stx402-agent MCP 连接到 TypingMind?

stx402-agent 通过 TypingMind 本地 MCP 连接器运行。当 MCP 服务器需要访问您计算机上的本地文件、桌面应用、命令行工具或私有资源时,这种方式最合适。

stx402-agent MCP 在 TypingMind 中提供哪些工具?

stx402-agent 提供 66 个 MCP 工具,您可以在 TypingMind 的插件页面启用这些工具,然后在聊天中使用,或将其分配给 AI 智能体。

使用 stx402-agent MCP 需要向 TypingMind 提供我的 API 密钥吗?

不需要。TypingMind 采用本地优先的设计,让您自行选择模型提供商,并自行管理 API 密钥、提示词和 MCP 配置。如果 stx402-agent 需要身份验证,请在创建连接时,为该 MCP 服务器添加所需的请求头、OAuth 设置或本地配置。

相关 MCP 服务器

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇