{"id":46638296,"url":"https://github.com/tetherto/wdk-mcp-toolkit","last_synced_at":"2026-03-08T02:13:24.548Z","repository":{"id":334236613,"uuid":"1099552916","full_name":"tetherto/wdk-mcp-toolkit","owner":"tetherto","description":null,"archived":false,"fork":false,"pushed_at":"2026-02-12T17:25:06.000Z","size":617,"stargazers_count":0,"open_issues_count":1,"forks_count":2,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-13T01:05:46.632Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tetherto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-19T06:20:01.000Z","updated_at":"2026-02-12T17:26:12.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/tetherto/wdk-mcp-toolkit","commit_stats":null,"previous_names":["tetherto/wdk-mcp-toolkit"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tetherto/wdk-mcp-toolkit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetherto%2Fwdk-mcp-toolkit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetherto%2Fwdk-mcp-toolkit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetherto%2Fwdk-mcp-toolkit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetherto%2Fwdk-mcp-toolkit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tetherto","download_url":"https://codeload.github.com/tetherto/wdk-mcp-toolkit/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetherto%2Fwdk-mcp-toolkit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30242406,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-08T00:58:18.660Z","status":"online","status_checked_at":"2026-03-08T02:00:06.215Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-03-08T02:13:23.969Z","updated_at":"2026-03-08T02:13:24.535Z","avatar_url":"https://github.com/tetherto.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @tetherto/wdk-mcp-toolkit\n\n\nhttps://github.com/user-attachments/assets/9fc1aa65-b76b-4569-bac0-42f75ccdc1ce\n\n\u003e **Note:** This package is currently in beta. Please test thoroughly in development environments before using in production.\n\nA simple and secure package to expose WDK (Wallet Development Kit) functionality through the Model Context Protocol (MCP). This package provides a clean API for creating MCP servers that enable AI agents to interact with cryptocurrency wallets across multiple blockchains.\n\n## 🔍 About WDK\n\nThis module is part of the WDK (Wallet Development Kit) project, which empowers developers to build secure, non-custodial wallets with unified blockchain access, stateless architecture, and complete user control.\n\nFor detailed documentation about the complete WDK ecosystem, visit [docs.wallet.tether.io](https://docs.wallet.tether.io).\n\n## 🌟 Features\n\n- **MCP Server Extension**: Extends `McpServer` from [@modelcontextprotocol/sdk](https://github.com/modelcontextprotocol/typescript-sdk) with all familiar APIs plus WDK-specific functionality\n- **Multi-Chain Support**: Register wallets for any blockchain supported by WDK wallet modules (EVM chains, Bitcoin, Solana, TON, TRON, and more)\n- **Built-in Tools**: Pre-built MCP tools for wallet operations, pricing data, and transaction history\n- **Extensible \u0026 Modular**: Register only the tools you need, create custom tools, and organize functionality into reusable modules\n- **Secure by Design**: Automatic memory cleanup and secure key disposal\n\n## ⚙️ Requirements\n\n### MCP Client Compatibility\n\nThis toolkit requires an MCP client that supports **tools**. For wallet write operations (sending transactions, signing messages), a client that also supports **elicitations** is required to enable human approval flows before executing sensitive operations.\n\n| Feature | Required For |\n|---------|--------------|\n| Tools support | All operations (read and write) |\n| Elicitations support | Write operations (`sendTransaction`, `transfer`, `sign`, etc.) |\n\nSee the [full list of MCP clients and their capabilities](https://modelcontextprotocol.io/clients).\n\n## ⬇️ Installation\n\nTo install the `@tetherto/wdk-mcp-toolkit` package, follow these instructions:\n\nYou can install it using npm:\n\n```bash\nnpm install @tetherto/wdk-mcp-toolkit @modelcontextprotocol/sdk\n```\n\nYou'll also need to install the wallet modules for your target blockchains:\n\n```bash\nnpm install @tetherto/wdk-wallet-evm @tetherto/wdk-wallet-btc\n```\n\nAdd `\"type\": \"module\"` to your `package.json` for ES module support:\n\n```json\n{\n  \"type\": \"module\"\n}\n```\n\n## 🚀 Quick Start\n\n### Creating a Basic MCP Server\n\n```javascript\nimport { WdkMcpServer, WALLET_TOOLS, PRICING_TOOLS, INDEXER_TOOLS } from '@tetherto/wdk-mcp-toolkit'\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'\nimport WalletManagerEvm from '@tetherto/wdk-wallet-evm'\nimport WalletManagerBtc from '@tetherto/wdk-wallet-btc'\n\nconst server = new WdkMcpServer('my-wallet-server', '1.0.0')\n  .useWdk({ seed: process.env.WDK_SEED })\n  .registerWallet('ethereum', WalletManagerEvm, {\n    provider: 'https://eth-mainnet.g.alchemy.com/v2/your-api-key'\n  })\n  .registerWallet('bitcoin', WalletManagerBtc, {\n    network: 'bitcoin'\n  })\n  .usePricing()\n  .useIndexer({ apiKey: process.env.WDK_INDEXER_API_KEY })\n  .registerTools([...WALLET_TOOLS, ...PRICING_TOOLS, ...INDEXER_TOOLS])\n\nconst transport = new StdioServerTransport()\nawait server.connect(transport)\n\nconsole.error('WDK MCP Server running on stdio')\n```\n\n\u003e **📁 Example:** See [`examples/basic/index.js`](examples/basic/index.js) for a complete working example.\n\n### Example Prompts\n\nHere are example prompts you can use with your AI agent connected to WDK MCP Toolkit:\n\n| Category | Prompt |\n|----------|--------|\n| **Wallet** | \"What's my Ethereum address?\" |\n| **Wallet** | \"Send 0.01 ETH to Vitalik\" |\n| **Wallet** | \"How much USDT do I have on Arbitrum?\" |\n| **Pricing** | \"What's the current price of ETH in USD?\" |\n| **Indexer** | \"Show my recent XAUT transfers on Ethereum\" |\n| **Swap** | \"Swap 100 USDT for XAUT on Ethereum\" |\n| **Bridge** | \"Bridge 50 USDT from Ethereum to Arbitrum\" |\n| **Lending** | \"Supply 100 USDT to Aave on Ethereum\" |\n| **Fiat On-Ramp** | \"Buy $100 worth of ETH with USD\" |\n\n\n### Custom Token Registration\n\nToken registration maps human-readable symbols (like \"USDT\") to contract addresses. This is necessary because:\n\n1. **AI agents work with symbols** — Users say \"send 100 USDT\" not \"send 100 tokens with contract address 0xXYZ\"\n2. **Decimal handling** — Each token has different decimals (USDT uses 6, DAI uses 18). The registry stores this so tools can convert between human amounts and raw values.\n3. **Chain-specific addresses** — USDT has different contract addresses on each chain. The registry resolves the correct address per chain.\n\n```javascript\n// Register additional tokens beyond the defaults\nserver\n  .registerToken('ethereum', 'USDC', {\n    address: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',\n    decimals: 6\n  })\n  .registerToken('ethereum', 'DAI', {\n    address: '0x6b175474e89094c44da98b954eedeac495271d0f',\n    decimals: 18\n  })\n\n// Tools use the registry to resolve symbols\nconst usdc = server.getTokenInfo('ethereum', 'USDC')\nconsole.log('USDC address:', usdc.address)\n```\n\n### Using Read-Only vs Write Tools\n\n```javascript\nimport { WALLET_READ_TOOLS, WALLET_WRITE_TOOLS } from '@tetherto/wdk-mcp-toolkit'\n\n// For read-only access (balance checks, address lookups, fee estimates)\nconst readOnlyServer = new WdkMcpServer('read-only-server', '1.0.0')\n  .useWdk({ seed: process.env.WDK_SEED })\n  .registerWallet('ethereum', WalletManagerEvm, { provider: '...' })\n  .registerTools(WALLET_READ_TOOLS)\n\n// For full access (includes sendTransaction, transfer, sign)\nconst fullAccessServer = new WdkMcpServer('full-access-server', '1.0.0')\n  .useWdk({ seed: process.env.WDK_SEED })\n  .registerWallet('ethereum', WalletManagerEvm, { provider: '...' })\n  .registerTools(WALLET_WRITE_TOOLS)\n```\n\n\u003e **💡 Best Practice:** Register only the tools you need. Large tool sets increase context size, which can lead to slower responses, higher costs, and potential hallucinations where the AI invokes incorrect tools. If you only need to check balances, import and register just that tool:\n\u003e ```javascript\n\u003e import { getBalance } from '@tetherto/wdk-mcp-toolkit'\n\u003e server.registerTools([getBalance])\n\u003e ```\n\n## 🔌 Enabling Capabilities\n\n`WdkMcpServer` uses a capability pattern. The `use*` methods enable capabilities by initializing underlying clients that tools can access:\n\n| Method | Enables | Tools Can Access |\n|--------|---------|------------------|\n| `useWdk(config)` | Wallet operations | `server.wdk` |\n| `usePricing()` | Price data | `server.pricingClient` |\n| `useIndexer(config)` | Transaction history | `server.indexerClient` |\n\n**How it works:**\n\n```javascript\n// 1. Enable capabilities\nconst server = new WdkMcpServer('my-server', '1.0.0')\n  .useWdk({ seed: process.env.WDK_SEED })      // server.wdk is now available\n  .usePricing()                                 // server.pricingClient is now available\n  .useIndexer({ apiKey: process.env.API_KEY }) // server.indexerClient is now available\n\n// 2. Register tools that use those capabilities\nserver.registerTools(WALLET_TOOLS)   // These tools call server.wdk.*\nserver.registerTools(PRICING_TOOLS)  // These tools call server.pricingClient.*\nserver.registerTools(INDEXER_TOOLS)  // These tools call server.indexerClient.*\n```\n\n**Writing custom tools:**\n\nYou can register tools directly using `registerTool()` from the MCP SDK, or use our `registerTools()` utility for bulk registration.\n\n**Single tool with `registerTool()` (MCP SDK method):**\n\n```javascript\nimport { z } from 'zod'\n\nconst chains = server.getChains()\n\nserver.registerTool(\n  'getAllTokenBalances',\n  {\n    title: 'Get All Token Balances',\n    description: 'Get balances for all registered tokens on a chain.',\n    inputSchema: z.object({\n      chain: z.enum(chains).describe('The blockchain to query')\n    }),\n    annotations: {\n      readOnlyHint: true,\n      destructiveHint: false\n    }\n  },\n  async ({ chain }) =\u003e {\n    try {\n      const account = await server.wdk.getAccount(chain, 0)\n      const symbols = server.getRegisteredTokens(chain)\n      const balances = {}\n\n      for (const symbol of symbols) {\n        const token = server.getTokenInfo(chain, symbol)\n        const rawBalance = await account.getTokenBalance(token.address)\n        const balance = Number(rawBalance) / Math.pow(10, token.decimals)\n        balances[symbol] = balance.toString()\n      }\n\n      return {\n        content: [{\n          type: 'text',\n          text: JSON.stringify(balances, null, 2)\n        }],\n        structuredContent: balances\n      }\n    } catch (error) {\n      return {\n        isError: true,\n        content: [{\n          type: 'text',\n          text: `Error getting token balances: ${error.message}`\n        }]\n      }\n    }\n  }\n)\n```\n\n**Multiple tools with `registerTools()` (WdkMcpServer utility):**\n\nThe `registerTools()` method is a utility we added on top of the MCP SDK. It accepts an array of tool registration functions, making it easy to organize tools into modules and register them in bulk:\n\n```javascript\n// Tool defined as a registration function\nfunction getAllTokenBalances (server) {\n  const chains = server.getChains()\n  \n  server.registerTool(\n    'getAllTokenBalances',\n    { /* schema */ },\n    async ({ chain }) =\u003e { /* handler */ }\n  )\n}\n\nfunction getPortfolioValue (server) {\n  server.registerTool(\n    'getPortfolioValue',\n    { /* schema */ },\n    async (params) =\u003e { /* handler */ }\n  )\n}\n\n// Register multiple tools at once\nserver.registerTools([getAllTokenBalances, getPortfolioValue])\n```\n\nThis pattern allows you to:\n- Organize tools into separate files/modules\n- Conditionally include tools based on enabled capabilities\n- Mix custom tools with built-in tool arrays\n- Keep tool counts minimal to reduce context bloat\n\n**Capability dependencies:**\n\nIf a tool requires a capability that wasn't enabled, it will fail at runtime. The built-in tools check for this:\n\n- `WALLET_TOOLS` require `useWdk()` and `registerWallet()`\n- `PRICING_TOOLS` require `usePricing()`\n- `INDEXER_TOOLS` require `useIndexer()`\n- `SWAP_TOOLS` require `useWdk()` and `registerProtocol()` with a swap protocol\n- `BRIDGE_TOOLS` require `useWdk()` and `registerProtocol()` with a bridge protocol\n- `LENDING_TOOLS` require `useWdk()` and `registerProtocol()` with a lending protocol\n- `FIAT_TOOLS` require `useWdk()` and `registerProtocol()` with a fiat protocol\n\n## 🖥️ Using with VS Code GitHub Copilot Chat\n\nYou can use this MCP server with [VS Code GitHub Copilot Chat](https://code.visualstudio.com/docs/copilot/chat/mcp-servers).\n\n### Quick Setup (Recommended)\n\nThe easiest way to get started is using the setup wizard:\n\n```bash\ngit clone https://github.com/tetherto/wdk-mcp-toolkit.git\ncd wdk-mcp-toolkit\nnpm install\nnpm run setup\n```\n\nThe wizard will guide you through:\n\n1. **Seed phrase** (required) — Your BIP-39 wallet seed phrase\n2. **WDK Indexer API key** (optional) — For transaction history features ([get one here](https://wdk-api.tether.io/register))\n3. **MoonPay credentials** (optional) — For fiat on/off-ramp features ([MoonPay Dashboard](https://dashboard.moonpay.com/))\n\nAfter setup, the wizard will:\n- Install required dependencies automatically\n- Generate `.vscode/mcp.json` with your credentials\n- Open VS Code ready to start the server\n\n\u003e **🔒 Security:** Your seed phrase is stored locally in `.vscode/mcp.json` which is gitignored. We recommend using a dedicated development wallet.\n\n### Manual Configuration\n\nIf you prefer manual setup, create `.vscode/mcp.json` in the project root:\n\n```json\n{\n  \"servers\": {\n    \"wdk\": {\n      \"type\": \"stdio\",\n      \"command\": \"node\",\n      \"args\": [\"examples/basic/index.js\"],\n      \"env\": {\n        \"WDK_SEED\": \"your twelve word seed phrase here\",\n        \"WDK_INDEXER_API_KEY\": \"optional - get at https://wdk-api.tether.io/register\",\n        \"MOONPAY_API_KEY\": \"optional - get at https://dashboard.moonpay.com/\",\n        \"MOONPAY_SECRET_KEY\": \"optional - get at https://dashboard.moonpay.com/\"\n      }\n    }\n  }\n}\n```\n\nThen install the required dependencies:\n\n```bash\nnpm install @tetherto/wdk-wallet-btc @tetherto/wdk-wallet-evm\nnpm install @tetherto/wdk-protocol-swap-velora-evm @tetherto/wdk-protocol-bridge-usdt0-evm\nnpm install @tetherto/wdk-protocol-lending-aave-evm @tetherto/wdk-protocol-fiat-moonpay\n```\n\n### Starting the Server\n\n1. Open `.vscode/mcp.json` in VS Code\n2. Click the **Start** button that appears above the server configuration\n3. Open GitHub Copilot Chat and select **Agent** mode\n4. Click **Tools** to verify the MCP server tools are available\n\n### Example Conversations\n\n```\nYou: What's my ethereum address?\nCopilot: Your Ethereum address is 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045\n\nYou: Check my ETH balance\nCopilot: Your ETH balance is 1.5 ETH\n\nYou: What's the current price of BTC?\nCopilot: The current price of BTC is $98,450.00 USD\n\nYou: Send 1 USDT to vitalik.eth\nCopilot: I'll transfer 1 USDT to vitalik.eth.\n         [Requests approval via elicitation]\n         Transaction sent! Hash: 0xabc123...\n```\n\n### Optional Capabilities\n\nThe server conditionally enables capabilities based on which environment variables are set:\n\n| Capability | Environment Variables | Tools |\n|------------|----------------------|-------|\n| Wallet, Pricing, Swap, Bridge, Lending | `WDK_SEED` (required) | Always enabled |\n| Transaction History | `WDK_INDEXER_API_KEY` | `INDEXER_TOOLS` |\n| Fiat On/Off-Ramp | `MOONPAY_API_KEY` + `MOONPAY_SECRET_KEY` | `FIAT_TOOLS` |\n\nRe-run `npm run setup` to change your configuration or enable additional capabilities.\n\n## 📚 API Reference\n\n### Table of Contents\n\n| Class | Description |\n|-------|-------------|\n| [WdkMcpServer](#wdkmcpserver) | Main class for creating MCP servers with WDK functionality. Extends `McpServer` from `@modelcontextprotocol/sdk`. |\n| [CHAINS](#chains) | Convenience constants for chains with pre-configured token addresses. |\n| [DEFAULT_TOKENS](#default_tokens) | Pre-configured token addresses for all supported chains. |\n\n### WdkMcpServer\n\nThe main class for creating MCP servers with WDK wallet functionality. Extends `McpServer` from `@modelcontextprotocol/sdk/server/mcp.js`, providing all standard MCP server methods plus WDK-specific functionality.\n\n#### Constructor\n\n```javascript\nnew WdkMcpServer(name, version)\n```\n\n**Parameters:**\n\n- `name` (string): The server name\n- `version` (string): The server version\n\n**Example:**\n\n```javascript\nconst server = new WdkMcpServer('my-wallet-server', '1.0.0')\n```\n\n#### Methods\n\n| Method | Description | Returns |\n|--------|-------------|---------|\n| `useWdk(config)` | Initializes the WDK with a seed phrase | `WdkMcpServer` |\n| `registerWallet(blockchain, WalletManager, config)` | Registers a wallet for a blockchain | `WdkMcpServer` |\n| `useIndexer(config)` | Enables the WDK Indexer client for transaction history | `WdkMcpServer` |\n| `usePricing()` | Enables the Bitfinex pricing client | `WdkMcpServer` |\n| `registerProtocol(chain, label, Protocol, config)` | Registers a DeFi protocol (swap, bridge, lending, fiat) | `WdkMcpServer` |\n| `getSwapChains()` | Returns chains with swap protocols registered | `string[]` |\n| `getSwapProtocols(chain)` | Returns swap protocol labels for a chain | `string[]` |\n| `getBridgeChains()` | Returns chains with bridge protocols registered | `string[]` |\n| `getBridgeProtocols(chain)` | Returns bridge protocol labels for a chain | `string[]` |\n| `getLendingChains()` | Returns chains with lending protocols registered | `string[]` |\n| `getLendingProtocols(chain)` | Returns lending protocol labels for a chain | `string[]` |\n| `getFiatChains()` | Returns chains with fiat protocols registered | `string[]` |\n| `getFiatProtocols(chain)` | Returns fiat protocol labels for a chain | `string[]` |\n| `registerToken(chain, symbol, token)` | Registers a token address mapping | `WdkMcpServer` |\n| `getTokenInfo(chain, symbol)` | Returns token info for a symbol | `TokenInfo \\| undefined` |\n| `getRegisteredTokens(chain)` | Returns all registered token symbols | `string[]` |\n| `getChains()` | Returns all registered blockchain names | `string[]` |\n| `registerTools(tools)` | Bulk registers tools from an array of functions | `WdkMcpServer` |\n| `close()` | Closes the server and disposes WDK securely | `Promise\u003cvoid\u003e` |\n\n#### useWdk(config)\n\nEnables wallet capabilities by initializing the Wallet Development Kit. After calling this, `server.wdk` becomes available for tools to use.\n\n**Parameters:**\n\n- `config` (object): Configuration object\n  - `seed` (string, optional): BIP-39 seed phrase. Falls back to `WDK_SEED` environment variable.\n\n**Returns:** `WdkMcpServer` - The server instance for chaining\n\n**Throws:** `Error` - If no seed is provided\n\n**Example:**\n\n```javascript\nserver.useWdk({ seed: 'your twelve word seed phrase here' })\n// OR use environment variable\nserver.useWdk({}) // Uses process.env.WDK_SEED\n\n// Now tools can access server.wdk\nconst account = await server.wdk.getAccount('ethereum', 0)\n```\n\n#### registerWallet(blockchain, WalletManager, config)\n\nRegisters a wallet module for a specific blockchain. Automatically registers default tokens (USDT) for the chain if available.\n\n**Parameters:**\n\n- `blockchain` (string): The blockchain name (e.g., \"ethereum\", \"bitcoin\")\n- `WalletManager` (class): The wallet manager class from a WDK wallet package\n- `config` (object): Configuration object specific to the wallet manager\n\n**Returns:** `WdkMcpServer` - The server instance for chaining\n\n**Throws:** `Error` - If `useWdk()` has not been called\n\n**Example:**\n\n```javascript\nserver.registerWallet('ethereum', WalletManagerEvm, {\n  provider: 'https://eth-mainnet.g.alchemy.com/v2/your-api-key'\n})\n\nserver.registerWallet('bitcoin', WalletManagerBtc, {\n  network: 'bitcoin',\n  host: 'electrum.blockstream.info',\n  port: 50001\n})\n```\n\n#### registerProtocol(chain, label, Protocol, config)\n\nRegisters a DeFi protocol for a blockchain. Protocols enable swap, bridge, lending, and fiat on/off-ramp functionality. The protocol type is automatically detected from the class inheritance.\n\n**Parameters:**\n\n- `chain` (string): The blockchain name (e.g., \"ethereum\")\n- `label` (string): The protocol label (e.g., \"velora\", \"aave\", \"moonpay\")\n- `Protocol` (class): The protocol class (must extend SwapProtocol, BridgeProtocol, LendingProtocol, or FiatProtocol)\n- `config` (object, optional): Protocol-specific configuration\n\n**Returns:** `WdkMcpServer` - The server instance for chaining\n\n**Throws:** `Error` - If `useWdk()` has not been called, or if unknown protocol type\n\n**Example:**\n\n```javascript\nimport VeloraProtocolEvm from '@tetherto/wdk-protocol-swap-velora-evm'\nimport Usdt0ProtocolEvm from '@tetherto/wdk-protocol-bridge-usdt0-evm'\nimport AaveProtocolEvm from '@tetherto/wdk-protocol-lending-aave-evm'\nimport MoonPayProtocol from '@tetherto/wdk-protocol-fiat-moonpay'\n\nserver\n  // Swap protocol - enables token swaps\n  .registerProtocol('ethereum', 'velora', VeloraProtocolEvm)\n\n  // Bridge protocol - enables cross-chain transfers\n  .registerProtocol('ethereum', 'usdt0', Usdt0ProtocolEvm)\n\n  // Lending protocol - enables supply, borrow, withdraw, repay\n  .registerProtocol('ethereum', 'aave', AaveProtocolEvm)\n\n  // Fiat protocol - enables buy/sell crypto with fiat\n  .registerProtocol('ethereum', 'moonpay', MoonPayProtocol, {\n    secretKey: process.env.MOONPAY_SECRET_KEY,\n    apiKey: process.env.MOONPAY_API_KEY\n  })\n```\n\n**Learn more about protocols:**\n- [Swap Modules](https://docs.wallet.tether.io/sdk/swap-modules)\n- [Bridge Modules](https://docs.wallet.tether.io/sdk/bridge-modules)\n- [Lending Modules](https://docs.wallet.tether.io/sdk/lending-modules)\n- [Fiat Modules](https://docs.wallet.tether.io/sdk/fiat-modules)\n\n#### useIndexer(config)\n\nEnables transaction history capabilities by initializing the WDK Indexer client. After calling this, `server.indexerClient` becomes available for tools to use.\n\n**Parameters:**\n\n- `config` (object): Configuration object\n  - `apiKey` (string): WDK Indexer API key\n\n**Returns:** `WdkMcpServer` - The server instance for chaining\n\n**Throws:** `Error` - If no apiKey is provided\n\n**Example:**\n\n```javascript\nserver.useIndexer({ apiKey: process.env.WDK_INDEXER_API_KEY })\n\n// Now tools can access server.indexerClient\nconst transfers = await server.indexerClient.getTokenTransfers('ethereum', 'usdt', address)\nconst balance = await server.indexerClient.getTokenBalance('ethereum', 'usdt', address)\n```\n\n#### usePricing()\n\nEnables pricing capabilities by initializing the Bitfinex pricing client. After calling this, `server.pricingClient` becomes available for tools to use.\n\n**Returns:** `WdkMcpServer` - The server instance for chaining\n\n**Example:**\n\n```javascript\nserver.usePricing()\n\n// Now tools can access server.pricingClient\nconst price = await server.pricingClient.getCurrentPrice('BTC', 'USD')\n```\n\n#### registerToken(chain, symbol, token)\n\nRegisters a token symbol to contract address mapping for a blockchain.\n\n**Parameters:**\n\n- `chain` (string): The blockchain name\n- `symbol` (string): The token symbol (e.g., \"USDT\", \"USDC\")\n- `token` (object): Token information\n  - `address` (string): Token contract address\n  - `decimals` (number): Number of decimal places\n\n**Returns:** `WdkMcpServer` - The server instance for chaining\n\n**Example:**\n\n```javascript\nserver.registerToken('ethereum', 'USDC', {\n  address: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',\n  decimals: 6\n})\n```\n\n#### getTokenInfo(chain, symbol)\n\nReturns token information for a symbol on a blockchain.\n\n**Parameters:**\n\n- `chain` (string): The blockchain name\n- `symbol` (string): The token symbol (case-insensitive)\n\n**Returns:** `TokenInfo | undefined` - The token info or undefined if not found\n\n**Example:**\n\n```javascript\nconst usdt = server.getTokenInfo('ethereum', 'USDT')\n// { address: '0xdAC17F958D2ee523a2206206994597C13D831ec7', decimals: 6 }\n```\n\n#### getRegisteredTokens(chain)\n\nReturns all registered token symbols for a blockchain.\n\n**Parameters:**\n\n- `chain` (string): The blockchain name\n\n**Returns:** `string[]` - Array of token symbols\n\n**Example:**\n\n```javascript\nconst tokens = server.getRegisteredTokens('ethereum')\n// ['USDT', 'USDC', 'DAI']\n```\n\n#### getChains()\n\nReturns all registered blockchain names.\n\n**Returns:** `string[]` - Array of blockchain names\n\n**Example:**\n\n```javascript\nconst chains = server.getChains()\n// ['ethereum', 'polygon', 'bitcoin']\n```\n\n#### registerTools(tools)\n\nUtility method for bulk tool registration. This is a convenience wrapper we added on top of the MCP SDK's `registerTool()` method. Each function in the array receives the server instance and should call `server.registerTool()` internally.\n\n**Parameters:**\n\n- `tools` (array): Array of tool registration functions with signature `(server: WdkMcpServer) =\u003e void`\n\n**Returns:** `WdkMcpServer` - The server instance for chaining\n\n**Example:**\n\n```javascript\nimport { WALLET_TOOLS, PRICING_TOOLS } from '@tetherto/wdk-mcp-toolkit'\n\n// Register built-in tool arrays\nserver.registerTools([...WALLET_TOOLS, ...PRICING_TOOLS])\n\n// Or mix with custom tools\nserver.registerTools([\n  ...WALLET_TOOLS,\n  myCustomTool,\n  anotherCustomTool\n])\n```\n\n**Note:** For registering a single tool, you can use `registerTool()` directly (inherited from McpServer).\n\n#### close()\n\nCloses the server and securely disposes the WDK instance, clearing sensitive data from memory.\n\n**Returns:** `Promise\u003cvoid\u003e`\n\n**Example:**\n\n```javascript\nawait server.close()\n```\n\n### CHAINS\n\nConvenience constants for blockchain names that have pre-configured USDT token addresses. Using these constants triggers automatic token registration via `DEFAULT_TOKENS`.\n\n**Note:** You can register any blockchain name you want. `CHAINS` is purely for convenience. If you use a name not in `CHAINS`, simply register your tokens manually:\n\n```javascript\n// Using a custom chain name works fine\nserver.registerWallet('zksync', WalletManagerEvm, {\n  provider: 'https://mainnet.era.zksync.io'\n})\n\n// Just register tokens yourself since there's no default\nserver.registerToken('zksync', 'USDT', {\n  address: '0x493257fD37EDB34451f62EDf8D2a0C418852bA4C',\n  decimals: 6\n})\n```\n\n### DEFAULT_TOKENS\n\nPre-configured USDT token addresses for common chains. These are automatically registered when you call `registerWallet()` with a matching chain name.\n\n| Chain | USDT Address | Decimals |\n|-------|--------------|----------|\n| Ethereum | `0xdAC17F958D2ee523a2206206994597C13D831ec7` | 6 |\n| Polygon | `0xc2132D05D31c914a87C6611C10748AEb04B58e8F` | 6 |\n| Arbitrum | `0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9` | 6 |\n| Optimism | `0x94b008aA00579c1307B0EF2c499aD98a8ce58e58` | 6 |\n| Base | `0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2` | 6 |\n| Avalanche | `0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7` | 6 |\n| BNB | `0x55d398326f99059fF775485246999027B3197955` | 18 |\n| Plasma | `0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb` | 6 |\n| TRON | `TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t` | 6 |\n| TON | `EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs` | 6 |\n| Solana | `Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB` | 6 |\n\n## 🔧 Built-in Tools\n\n### Wallet Tools\n\n| Tool | Category | Description |\n|------|----------|-------------|\n| `getAddress` | Read | Get wallet address for a blockchain |\n| `getBalance` | Read | Get native token balance |\n| `getTokenBalance` | Read | Get ERC20/token balance |\n| `getFeeRates` | Read | Get current network fee rates |\n| `getMaxSpendableBtc` | Read | Get maximum spendable Bitcoin amount |\n| `quoteSendTransaction` | Read | Estimate fee for a transaction |\n| `quoteTransfer` | Read | Estimate fee for a token transfer |\n| `sendTransaction` | Write | Send native tokens |\n| `transfer` | Write | Transfer ERC20/tokens |\n| `sign` | Write | Sign a message |\n| `verify` | Write | Verify a message signature |\n\n### Pricing Tools\n\n| Tool | Description |\n|------|-------------|\n| `getCurrentPrice` | Get current price for a trading pair |\n| `getHistoricalPrice` | Get historical price data |\n\n### Indexer Tools\n\n| Tool | Description |\n|------|-------------|\n| `getTokenTransfers` | Get token transfer history for an address |\n| `getIndexerTokenBalance` | Get token balance via indexer API |\n\n### Swap Tools\n\nEnable token swaps through registered swap protocols (e.g., Velora). See [Swap Modules](https://docs.wallet.tether.io/sdk/swap-modules) for available protocols.\n\n| Tool | Category | Description |\n|------|----------|-------------|\n| `quoteSwap` | Read | Get a quote for swapping tokens |\n| `swap` | Write | Execute a token swap |\n\n### Bridge Tools\n\nEnable cross-chain token transfers through registered bridge protocols (e.g., USDT0). See [Bridge Modules](https://docs.wallet.tether.io/sdk/bridge-modules) for available protocols.\n\n| Tool | Category | Description |\n|------|----------|-------------|\n| `quoteBridge` | Read | Get a quote for bridging tokens |\n| `bridge` | Write | Execute a cross-chain bridge transfer |\n\n### Lending Tools\n\nEnable DeFi lending operations through registered lending protocols (e.g., Aave). See [Lending Modules](https://docs.wallet.tether.io/sdk/lending-modules) for available protocols.\n\n| Tool | Category | Description |\n|------|----------|-------------|\n| `quoteSupply` | Read | Get a quote for supplying tokens |\n| `supply` | Write | Supply tokens to a lending protocol |\n| `quoteWithdraw` | Read | Get a quote for withdrawing tokens |\n| `withdraw` | Write | Withdraw tokens from a lending protocol |\n| `quoteBorrow` | Read | Get a quote for borrowing tokens |\n| `borrow` | Write | Borrow tokens from a lending protocol |\n| `quoteRepay` | Read | Get a quote for repaying borrowed tokens |\n| `repay` | Write | Repay borrowed tokens |\n\n### Fiat Tools\n\nEnable fiat on/off-ramp operations through registered fiat protocols (e.g., MoonPay). See [Fiat Modules](https://docs.wallet.tether.io/sdk/fiat-modules) for available protocols.\n\n| Tool | Category | Description |\n|------|----------|-------------|\n| `quoteBuy` | Read | Get a quote for buying crypto with fiat |\n| `buy` | Write | Execute a fiat-to-crypto purchase |\n| `quoteSell` | Read | Get a quote for selling crypto for fiat |\n| `sell` | Write | Execute a crypto-to-fiat sale |\n| `getTransactionDetail` | Read | Get details of a fiat transaction |\n| `getSupportedCryptoAssets` | Read | Get list of supported cryptocurrencies |\n| `getSupportedFiatCurrencies` | Read | Get list of supported fiat currencies |\n| `getSupportedCountries` | Read | Get list of supported countries |\n\n## 🔒 Security Considerations\n\n- **Seed Phrase Security**: Always store your seed phrase securely and never share it. Use environment variables (`WDK_SEED`) instead of hardcoding.\n- **API Key Security**: Store API keys in environment variables, never in source code.\n- **Memory Cleanup**: The `close()` method automatically calls `dispose()` on the WDK instance to clear private keys from memory.\n- **Read vs Write Tools**: Use `WALLET_READ_TOOLS` for read-only access when write operations are not needed.\n- **Elicitations for Write Operations**: For maximum safety, use an MCP client that supports elicitations (like VS Code GitHub Copilot or Cursor) for write operations to ensure human approval before transactions execute.\n- **MCP Transport Security**: Use secure transports (stdio, SSE with TLS) in production environments.\n- **Tool Annotations**: All tools include proper `readOnlyHint` and `destructiveHint` annotations for MCP clients.\n\n## 🛠️ Development\n\n### Building\n\n```bash\n# Install dependencies\nnpm install\n\n# Lint code\nnpm run lint\n\n# Fix linting issues\nnpm run lint:fix\n```\n\n### Testing\n\n```bash\n# Run tests\nnpm test\n\n# Run tests with coverage\nnpm run test:coverage\n```\n\n### Project Structure\n\n```\nsrc/\n├── server.js              # WdkMcpServer class, CHAINS, DEFAULT_TOKENS\n├── utils/                 # Utility functions\n│   └── amount.js          # Amount parsing and formatting\n└── tools/\n    ├── wallet/            # Wallet operation tools\n    │   ├── index.js       # Tool exports\n    │   ├── getAddress.js\n    │   ├── getBalance.js\n    │   ├── getTokenBalance.js\n    │   ├── getFeeRates.js\n    │   ├── getMaxSpendableBtc.js\n    │   ├── quoteSendTransaction.js\n    │   ├── quoteTransfer.js\n    │   ├── sendTransaction.js\n    │   ├── transfer.js\n    │   ├── sign.js\n    │   └── verify.js\n    ├── pricing/           # Price data tools\n    │   ├── index.js\n    │   ├── getCurrentPrice.js\n    │   └── getHistoricalPrice.js\n    ├── indexer/           # Transaction history tools\n    │   ├── index.js\n    │   ├── getTokenTransfers.js\n    │   └── getTokenBalance.js\n    ├── swap/              # Token swap tools\n    │   ├── index.js\n    │   ├── quoteSwap.js\n    │   └── swap.js\n    ├── bridge/            # Cross-chain bridge tools\n    │   ├── index.js\n    │   ├── quoteBridge.js\n    │   └── bridge.js\n    ├── lending/           # DeFi lending tools\n    │   ├── index.js\n    │   ├── quoteSupply.js\n    │   ├── supply.js\n    │   ├── quoteWithdraw.js\n    │   ├── withdraw.js\n    │   ├── quoteBorrow.js\n    │   ├── borrow.js\n    │   ├── quoteRepay.js\n    │   └── repay.js\n    └── fiat/              # Fiat on/off-ramp tools\n        ├── index.js\n        ├── quoteBuy.js\n        ├── buy.js\n        ├── quoteSell.js\n        ├── sell.js\n        ├── getTransactionDetail.js\n        ├── getSupportedCryptoAssets.js\n        ├── getSupportedFiatCurrencies.js\n        └── getSupportedCountries.js\n```\n\n## 📜 License\n\nThis project is licensed under the Apache License 2.0 - see the LICENSE file for details.\n\n## 🤝 Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## 🆘 Support\n\nFor support, please open an issue on the GitHub repository.\n\n## 📖 Learn More\n\n- **WDK Documentation**: [docs.wallet.tether.io](https://docs.wallet.tether.io)\n- **MCP SDK**: [github.com/modelcontextprotocol/typescript-sdk](https://github.com/modelcontextprotocol/typescript-sdk)\n- **MCP Specification**: [modelcontextprotocol.io/specification/2025-11-25](https://modelcontextprotocol.io/specification/2025-11-25)\n- **MCP Clients**: [modelcontextprotocol.io/clients](https://modelcontextprotocol.io/clients)\n- **VS Code Copilot MCP**: [Using MCP servers in VS Code](https://code.visualstudio.com/docs/copilot/chat/mcp-servers)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftetherto%2Fwdk-mcp-toolkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftetherto%2Fwdk-mcp-toolkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftetherto%2Fwdk-mcp-toolkit/lists"}