--- name: tchcash-onboarding description: >- Set up ThaiChain wallet for your agent — create wallet, fund, and pay for MPP/x402 APIs automatically. Use when setting up ThaiChain agent wallets, giving an AI agent the ability to pay for paid APIs on ThaiChain, checking TCH balance, or making paid API requests using MPP payment protocol via tchcash MCP server. homepage: https://mpp.thaichain.org metadata: author: thaichain version: 1 --- # tchcash - ThaiChain Agent Wallet tchcash is an MCP server that runs locally on your machine, acting as a wallet client for AI agents. It enables agents to automatically pay for MPP/x402 APIs on ThaiChain without manual intervention. ## IMPORTANT: Automatic Setup on First Use When you first use tchcash, you MUST immediately do the following **before** making any paid API calls: 1. **Create wallet** — call `setup_wallet` to generate a new wallet 2. **Fund wallet** — tell the user to transfer TCH to the wallet address (recommended: 10 TCH) 3. **Check balance** — call `check_balance` to verify funds are available 4. **Only after balance is confirmed**, proceed with paid API calls Do NOT skip these steps. The wallet must be funded before making any paid requests. ## Important Files | File | URL | | ------------------------ | -------------------------------------- | | **skill.md** (this file) | `https://mpp.thaichain.org/SKILL.md` | | **tchmpp server** | `https://mpp.thaichain.org` | | **npm package** | `https://www.npmjs.com/package/tchcash`| **Check for updates:** Re-fetch this file anytime to see new commands or breaking changes. ## Installation Install tchcash globally: ```bash # Using npm npm install -g tchcash # Using pnpm pnpm add -g tchcash ``` Or run directly with npx (no install required): ```bash npx tchcash ``` ## MCP Configuration Add tchcash to your MCP client configuration: **Claude Desktop** (`claude_desktop_config.json`): ```json { "mcpServers": { "tchcash": { "command": "tchcash" } } } ``` **Cursor** (`.cursor/mcp.json`): ```json { "mcpServers": { "tchcash": { "command": "tchcash" } } } ``` **ZCode** (`.mcp.json` in project): ```json { "tchcash": { "command": "tchcash" } } ``` ## Available Tools ### `setup_wallet` Creates a new ThaiChain wallet or loads an existing one. The wallet is automatically saved to `.tchcash/wallet.json` on your local machine. **Parameters:** - `force_new` (optional, boolean) — If true, creates a new wallet even if one exists **Example:** ```json { "name": "setup_wallet", "arguments": {} } ``` **Response:** ```json { "status": "wallet_loaded", "address": "0x...", "privateKey": "0x...", "wallet_file": ".tchcash/wallet.json", "next_steps": [ "Tell user to transfer TCH to the address (recommended 10 TCH)", "Check balance with check_balance tool", "Call paid APIs with fetch_market_data, fetch_weather, etc." ], "chain": { "name": "ThaiChain", "chainId": 7, "rpc": "https://rpc.thaichain.org", "explorer": "https://exp.thaichain.org/address/0x..." } } ``` **What you (the agent) do:** After calling `setup_wallet`, you MUST display the wallet address prominently to the user and instruct them to transfer TCH to that address. Do NOT display the private key to the user unless explicitly requested. ### `check_balance` Checks the TCH balance of the wallet saved in `.tchcash/wallet.json`. **Parameters:** None **Example:** ```json { "name": "check_balance", "arguments": {} } ``` **Response:** ```json { "status": "ready", "address": "0x...", "balance": { "TCH": "10.000000", "raw": "10000000" }, "recommendation": "Ready to use" } ``` ### `fetch_market_data` Fetches crypto market data (BTC, ETH, TCH prices) from tchmpp server. tchcash automatically pays $0.01 from the wallet. **Parameters:** None **Example:** ```json { "name": "fetch_market_data", "arguments": {} } ``` **Response:** ```json { "message": "Payment verified! Here is your market data.", "data": { "BTC": { "price": 67500.5, "change24h": 2.3 }, "ETH": { "price": 3450.75, "change24h": -1.2 }, "TCH": { "price": 1.0, "change24h": 5.8 }, "timestamp": "2026-07-31T..." } } ``` ### `fetch_weather` Fetches weather data for Bangkok, Thailand. tchcash automatically pays $0.005 from the wallet. **Parameters:** None **Example:** ```json { "name": "fetch_weather", "arguments": {} } ``` ### `fetch_data` Fetches sample data. tchcash automatically pays $0.01 from the wallet. **Parameters:** None **Example:** ```json { "name": "fetch_data", "arguments": {} } ``` ### `fetch_url` Calls any paid API on tchmpp server. tchcash automatically pays from the wallet. **Parameters:** - `path` (string, required) — URL path (e.g., `/api/v1/market` or `/api/v1/generate`) - `method` (optional, string) — HTTP method (GET, POST), default: GET - `body` (optional, string) — Request body (JSON string) for POST requests **Example:** ```json { "name": "fetch_url", "arguments": { "path": "/api/v1/generate", "method": "POST", "body": "{\"prompt\":\"Hello\"}" } } ``` ## Available APIs | Endpoint | Method | Price | Description | |----------|--------|-------|-------------| | `/api/v1/market` | GET | $0.01 | Crypto market data (BTC, ETH, TCH) | | `/api/v1/weather` | GET | $0.005 | Weather data for Bangkok | | `/api/v1/data` | GET | $0.01 | Sample data | | `/api/v1/generate` | POST | $0.05 | Generate content from prompt | | `/api/proxy/llm` | POST | $0.10 | LLM API proxy | | `/api/proxy/image/{id}` | GET | $0.02 | Image proxy | ## Architecture ``` ┌─────────┐ ┌──────────────────┐ ┌──────────────┐ │ Agent │ ───► │ tchcash MCP │ ───► │ tchmpp │ │ (Claude)│ stdio│ - wallet store │ HTTP │ (Cloudflare) │ │ │ ◄─── │ - mppx SDK │ ◄─── │ │ └─────────┘ └──────────────────┘ └──────────────┘ Handles 402 challenge Signs + broadcasts TX Sends proof back ``` ## Security - Private key is saved to `.tchcash/wallet.json` on your local machine - **NEVER** commit this file to Git (it's in `.gitignore`) - tchcash does NOT send private keys to external servers - mppx SDK handles payment locally on your machine only ## Chain Information - **Name:** ThaiChain - **Chain ID:** 7 - **CAIP-2:** eip155:7 - **RPC:** https://rpc.thaichain.org - **Explorer:** https://exp.thaichain.org - **Token:** TCH (TIP-20, 6 decimals) ## Example Conversation **User:** Check Bitcoin price for me **Agent:** [calls `fetch_market_data`] **Agent:** Current Bitcoin price is $67,500.50 (+2.3%) ## Notes - tchcash uses mppx SDK to handle MPP payment flow - Supports only ThaiChain (chainId: 7) and TCH token - Wallet is created and stored locally on your machine only - Recommended to have at least 10 TCH for usage - tchcash automatically handles 402 Payment Required challenges ## Links - **tchmpp Server:** https://mpp.thaichain.org - **ThaiChain Explorer:** https://exp.thaichain.org - **npm Package:** https://www.npmjs.com/package/tchcash - **GitHub:** https://github.com/thaichain/tchcash