{"_id":"@dexterai/moltbot-x402","_rev":"7-5579657a27b3e14d296a7d0352be8fec","name":"@dexterai/moltbot-x402","dist-tags":{"latest":"2.3.0"},"versions":{"1.0.0":{"name":"@dexterai/moltbot-x402","version":"1.0.0","keywords":["moltbot","x402","dexter","solana","defi","mcp","oauth","plugin"],"author":{"name":"Dexter AI","email":"dev@dexter.cash"},"license":"MIT","_id":"@dexterai/moltbot-x402@1.0.0","maintainers":[{"name":"nrsander","email":"nrsander@gmail.com"}],"homepage":"https://dexter.cash","bugs":{"url":"https://github.com/dexterai/moltbot-x402/issues"},"dist":{"shasum":"2c10aeec2ed9d009a2bd319070c702ae52b62060","tarball":"https://registry.npmjs.org/@dexterai/moltbot-x402/-/moltbot-x402-1.0.0.tgz","fileCount":7,"integrity":"sha512-JTghOUuCPE3kiqfsND3+wdluEacntGdjTTZnAprFiRJNY5z09bc8zbHNSgMyFT+RHR3YyZWz7xaZTcuTyu46/Q==","signatures":[{"sig":"MEUCIE2UsVYsumQUDlZNtSWaXd77X1TJ73dN4NBe90wy3jimAiEAsrnKN12IIqon6dBGzxuHo/lWml5sVNqfKGKU40y80n4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":41990},"type":"module","moltbot":{"extensions":["./index.ts"]},"_npmUser":{"name":"nrsander","email":"nrsander@gmail.com"},"repository":{"url":"git+https://github.com/dexterai/moltbot-x402.git","type":"git"},"_npmVersion":"10.9.3","description":"Moltbot plugin for Dexter x402 - 59+ Solana DeFi tools via MCP with OAuth authentication","directories":{},"_nodeVersion":"22.19.0","dependencies":{"@modelcontextprotocol/sdk":"^1.25.3"},"_hasShrinkwrap":false,"peerDependencies":{"moltbot":"*"},"_npmOperationalInternal":{"tmp":"tmp/moltbot-x402_1.0.0_1769639401901_0.7471545153976165","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@dexterai/moltbot-x402","version":"1.0.1","keywords":["moltbot","x402","dexter","solana","defi","mcp","oauth","plugin"],"author":{"name":"Dexter AI","email":"dev@dexter.cash"},"license":"MIT","_id":"@dexterai/moltbot-x402@1.0.1","maintainers":[{"name":"nrsander","email":"nrsander@gmail.com"}],"homepage":"https://dexter.cash","bugs":{"url":"https://github.com/BranchManager69/moltbot-x402/issues"},"dist":{"shasum":"0ca076ab105bf413b0f2369eeb413a3f2f982434","tarball":"https://registry.npmjs.org/@dexterai/moltbot-x402/-/moltbot-x402-1.0.1.tgz","fileCount":7,"integrity":"sha512-gVMkA/Dj9SVXXjzhQzBGL1djUzbHAfNM0jsqiqs1kfe3xs2I6bmbKaWze5M5JvENX8Xm5zGgADaCfdHEHHed2g==","signatures":[{"sig":"MEYCIQDcUjmMfGP7KKPVjCUpcVE9BbwuokIz2R6FwPJDvH1JkgIhAPB/KXCBmNvvz83uafKTFssE+yBDqrR7HvrX3qmFsdh2","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":42033},"type":"module","gitHead":"e47531de729d4244ede049fac70a4bb31f4306a3","moltbot":{"extensions":["./index.ts"]},"_npmUser":{"name":"nrsander","email":"nrsander@gmail.com"},"repository":{"url":"git+https://github.com/BranchManager69/moltbot-x402.git","type":"git"},"_npmVersion":"10.9.3","description":"Moltbot plugin for Dexter x402 - 59+ Solana DeFi tools via MCP with OAuth authentication","directories":{},"_nodeVersion":"22.19.0","dependencies":{"@modelcontextprotocol/sdk":"^1.25.3"},"_hasShrinkwrap":false,"peerDependencies":{"moltbot":"*"},"_npmOperationalInternal":{"tmp":"tmp/moltbot-x402_1.0.1_1769639559785_0.5724599878166239","host":"s3://npm-registry-packages-npm-production"}},"2.0.0":{"name":"@dexterai/moltbot-x402","version":"2.0.0","keywords":["moltbot","x402","dexter","solana","defi","mcp","oauth","plugin","payments","usdc","base"],"author":{"name":"Dexter AI","email":"dev@dexter.cash"},"license":"MIT","_id":"@dexterai/moltbot-x402@2.0.0","maintainers":[{"name":"nrsander","email":"nrsander@gmail.com"}],"homepage":"https://dexter.cash","bugs":{"url":"https://github.com/BranchManager69/moltbot-x402/issues"},"dist":{"shasum":"b81d760bfca82480383633aea2d16da046c1060e","tarball":"https://registry.npmjs.org/@dexterai/moltbot-x402/-/moltbot-x402-2.0.0.tgz","fileCount":7,"integrity":"sha512-EeNtBsfAHYTVzYmN8H50Lq970OzJj6ZX1Yi88ic6lDzj60u8AISPHATdo+Jm0S0CqiQn2qfeuC77XFtomZAWXQ==","signatures":[{"sig":"MEQCIC9vsC7LNJOu4IbRQydRcMrdn5efdqgA3FNaON1IN9c6AiBCzlVfEODz3umVGbR7t8n2AAvQFYZOfv4lRUoFM2jLqA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":62858},"type":"module","gitHead":"745352af3c7e2912cd60433b101e25ad1b0017a5","moltbot":{"extensions":["./index.ts"]},"_npmUser":{"name":"nrsander","email":"nrsander@gmail.com"},"repository":{"url":"git+https://github.com/BranchManager69/moltbot-x402.git","type":"git"},"_npmVersion":"10.9.3","description":"Moltbot plugin for x402 payments - generic x402_pay/x402_search tools PLUS 59+ Dexter MCP tools via OAuth","directories":{},"_nodeVersion":"22.19.0","dependencies":{"@dexterai/x402":"^1.4.0","@sinclair/typebox":"^0.32.0","@modelcontextprotocol/sdk":"^1.25.3"},"_hasShrinkwrap":false,"peerDependencies":{"moltbot":"*"},"_npmOperationalInternal":{"tmp":"tmp/moltbot-x402_2.0.0_1769643030326_0.21646060882738216","host":"s3://npm-registry-packages-npm-production"}},"2.2.0":{"name":"@dexterai/moltbot-x402","version":"2.2.0","keywords":["moltbot","x402","dexter","solana","defi","mcp","oauth","plugin","payments","usdc","base"],"author":{"name":"Dexter AI","email":"dev@dexter.cash"},"license":"MIT","_id":"@dexterai/moltbot-x402@2.2.0","maintainers":[{"name":"nrsander","email":"nrsander@gmail.com"}],"homepage":"https://dexter.cash","bugs":{"url":"https://github.com/BranchManager69/moltbot-x402/issues"},"dist":{"shasum":"18c23778f3e38e0fbc350aefdec4f477daf1a6cf","tarball":"https://registry.npmjs.org/@dexterai/moltbot-x402/-/moltbot-x402-2.2.0.tgz","fileCount":7,"integrity":"sha512-GSq18knUf49P7dTEYkNvfXE60a6ugjIL0WmqcxaIQ8zBm2s6D/2g7z5VN90+CovztsgjpVPkFZ2YLsFSSBDDtA==","signatures":[{"sig":"MEUCIBJ6ozu2KMLwVUNZwce91JlVoHLDWrpmG7kJTfrcsknhAiEAhzQUe8BNVYBijezGvHpfJm7dZdQ8Ymu5/fuXSJIlUaA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":70025},"type":"module","gitHead":"1e6d188eef82f9f35b5ffb2c6607b455dab9843d","moltbot":{"extensions":["./index.ts"]},"_npmUser":{"name":"nrsander","email":"nrsander@gmail.com"},"repository":{"url":"git+https://github.com/BranchManager69/moltbot-x402.git","type":"git"},"_npmVersion":"10.9.3","description":"Moltbot plugin for x402 payments - generic x402_pay/x402_search tools PLUS 59+ Dexter MCP tools via OAuth","directories":{},"_nodeVersion":"22.19.0","dependencies":{"@dexterai/x402":"^1.4.0","@sinclair/typebox":"^0.32.0","@modelcontextprotocol/sdk":"^1.25.3"},"_hasShrinkwrap":false,"peerDependencies":{"moltbot":"*"},"_npmOperationalInternal":{"tmp":"tmp/moltbot-x402_2.2.0_1769647192102_0.268040282543506","host":"s3://npm-registry-packages-npm-production"}},"2.2.1":{"name":"@dexterai/moltbot-x402","version":"2.2.1","keywords":["moltbot","x402","dexter","solana","defi","mcp","oauth","plugin","payments","usdc","base"],"author":{"name":"Dexter AI","email":"dev@dexter.cash"},"license":"MIT","_id":"@dexterai/moltbot-x402@2.2.1","maintainers":[{"name":"nrsander","email":"nrsander@gmail.com"}],"homepage":"https://dexter.cash","bugs":{"url":"https://github.com/BranchManager69/moltbot-x402/issues"},"dist":{"shasum":"495fb49d0b940ebde3393c337b922021b55bc60a","tarball":"https://registry.npmjs.org/@dexterai/moltbot-x402/-/moltbot-x402-2.2.1.tgz","fileCount":7,"integrity":"sha512-AJ5VtAlEsqR3IhY0TyYAI2r+iwj3PKmPRzYTzqjLRfnSdrqGM4adL7nPprta0vVf3zJf7Px2zP9GxF/juNHnog==","signatures":[{"sig":"MEUCICh2b3bSz0fWtYUpzrgBha+ylnw2dbCgauN4rYeRJYD6AiEA3dk99nJk/Rk/HCmGFIpCs7RWqq8ALYSCrTHd8qFF5Uc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":67618},"type":"module","gitHead":"e5460b048f22010a6973f09f5fd1335163126f57","moltbot":{"extensions":["./index.ts"]},"_npmUser":{"name":"nrsander","email":"nrsander@gmail.com"},"repository":{"url":"git+https://github.com/BranchManager69/moltbot-x402.git","type":"git"},"_npmVersion":"10.9.3","description":"Moltbot plugin for x402 payments - generic x402_pay/x402_search tools PLUS 59+ Dexter MCP tools via OAuth","directories":{},"_nodeVersion":"22.19.0","dependencies":{"@dexterai/x402":"^1.4.0","@sinclair/typebox":"^0.32.0","@modelcontextprotocol/sdk":"^1.25.3"},"_hasShrinkwrap":false,"peerDependencies":{"moltbot":"*"},"_npmOperationalInternal":{"tmp":"tmp/moltbot-x402_2.2.1_1769657945461_0.36716546975615194","host":"s3://npm-registry-packages-npm-production"}},"2.2.2":{"name":"@dexterai/moltbot-x402","version":"2.2.2","keywords":["moltbot","x402","dexter","solana","defi","mcp","oauth","plugin","payments","usdc","base"],"author":{"name":"Dexter AI","email":"dev@dexter.cash"},"license":"MIT","_id":"@dexterai/moltbot-x402@2.2.2","maintainers":[{"name":"nrsander","email":"nrsander@gmail.com"}],"homepage":"https://dexter.cash","bugs":{"url":"https://github.com/BranchManager69/moltbot-x402/issues"},"dist":{"shasum":"3bb1371b06e55581ce7b552a8efefe8479bd6f46","tarball":"https://registry.npmjs.org/@dexterai/moltbot-x402/-/moltbot-x402-2.2.2.tgz","fileCount":7,"integrity":"sha512-09ne56bNM8xVI+yICYnR6M0ODAmv+XDqqp5fWkPsqjv5HvIlB6IFnDzKNRKw16JIrbAYEhXcaX/NWhVK/6mSpA==","signatures":[{"sig":"MEQCIE04zlY2pArSNEqGJJYgbxMLFgbyf24XHbdzSB5uRu8TAiBBu9Hrp8zc9B6bGA8Plib44USg00oN4Fi/lrkySAdxeA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":67619},"type":"module","gitHead":"dc1b9285da45eda74d581710f30e57dad5cbef47","moltbot":{"extensions":["./index.ts"]},"_npmUser":{"name":"nrsander","email":"nrsander@gmail.com"},"repository":{"url":"git+https://github.com/BranchManager69/moltbot-x402.git","type":"git"},"_npmVersion":"10.9.3","description":"Moltbot plugin for x402 payments - generic x402_pay/x402_search tools PLUS 59+ Dexter MCP tools via OAuth","directories":{},"_nodeVersion":"22.19.0","dependencies":{"@dexterai/x402":"^1.4.0","@sinclair/typebox":"^0.32.0","@modelcontextprotocol/sdk":"^1.25.3"},"_hasShrinkwrap":false,"peerDependencies":{"moltbot":"*"},"_npmOperationalInternal":{"tmp":"tmp/moltbot-x402_2.2.2_1769668727843_0.9010201666832494","host":"s3://npm-registry-packages-npm-production"}},"2.3.0":{"name":"@dexterai/moltbot-x402","version":"2.3.0","type":"module","description":"Moltbot plugin for x402 payments - generic x402_pay/x402_search tools PLUS 59+ Dexter MCP tools via OAuth","keywords":["moltbot","x402","dexter","solana","defi","mcp","oauth","plugin","payments","usdc","base"],"author":{"name":"Dexter AI","email":"dev@dexter.cash"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/BranchManager69/moltbot-x402.git"},"homepage":"https://dexter.cash","moltbot":{"extensions":["./index.ts"]},"dependencies":{"@dexterai/x402":"^1.4.0","@modelcontextprotocol/sdk":"^1.25.3","@sinclair/typebox":"^0.32.0"},"peerDependencies":{"moltbot":"*"},"_id":"@dexterai/moltbot-x402@2.3.0","gitHead":"dc1b9285da45eda74d581710f30e57dad5cbef47","bugs":{"url":"https://github.com/BranchManager69/moltbot-x402/issues"},"_nodeVersion":"22.19.0","_npmVersion":"10.9.3","dist":{"integrity":"sha512-+mj7vkMGzl0TSR+Mw2R4uk87p98zVTsFt6M7YGE/NdjV4HN1xkOuI7zM+wJdwsZ2R1Avhf47fvWlciX3sSbiKg==","shasum":"47ce0c2deaea7f54fb05b7a58eaf4470b750e7a2","tarball":"https://registry.npmjs.org/@dexterai/moltbot-x402/-/moltbot-x402-2.3.0.tgz","fileCount":7,"unpackedSize":67593,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDxsqmJNXvmwQecd7u/peziWJy7iR/9CZ0vAZYOWQ1RGAIgBHFDoaW8WSAVG0YLQJDv97guzypuy26J8vc68VP1A8Q="}]},"_npmUser":{"name":"nrsander","email":"nrsander@gmail.com"},"directories":{},"maintainers":[{"name":"nrsander","email":"nrsander@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/moltbot-x402_2.3.0_1769788367626_0.338974554039575"},"_hasShrinkwrap":false}},"time":{"created":"2026-01-28T22:30:01.813Z","modified":"2026-01-30T15:52:47.900Z","1.0.0":"2026-01-28T22:30:02.058Z","1.0.1":"2026-01-28T22:32:39.962Z","2.0.0":"2026-01-28T23:30:30.472Z","2.2.0":"2026-01-29T00:39:52.244Z","2.2.1":"2026-01-29T03:39:05.598Z","2.2.2":"2026-01-29T06:38:47.987Z","2.3.0":"2026-01-30T15:52:47.762Z"},"bugs":{"url":"https://github.com/BranchManager69/moltbot-x402/issues"},"author":{"name":"Dexter AI","email":"dev@dexter.cash"},"license":"MIT","homepage":"https://dexter.cash","keywords":["moltbot","x402","dexter","solana","defi","mcp","oauth","plugin","payments","usdc","base"],"repository":{"type":"git","url":"git+https://github.com/BranchManager69/moltbot-x402.git"},"description":"Moltbot plugin for x402 payments - generic x402_pay/x402_search tools PLUS 59+ Dexter MCP tools via OAuth","maintainers":[{"name":"nrsander","email":"nrsander@gmail.com"}],"readme":"# Dexter x402 Plugin for Moltbot\n\nThe most comprehensive x402 payment plugin for Moltbot. Provides:\n\n1. **Generic x402 Payments** (`x402_pay`) - Call ANY x402-enabled paid API with automatic USDC payment\n2. **x402 Directory Search** (`x402_search`) - Discover paid APIs across multiple networks\n3. **59+ Dexter DeFi Tools** (`dexter_x402`) - Authenticated access to Dexter's MCP tools\n\n## Overview\n\n### Generic x402 Tools (No Auth Required)\n\nConfigure your wallet keys and start making paid API calls immediately:\n\n- **`x402_pay`** - Make paid requests to any x402 endpoint (Solana, Base, Polygon, Arbitrum, Optimism, Avalanche)\n- **`x402_search`** - Search the aggregated directory of 2600+ paid APIs\n\n### Dexter MCP Tools (OAuth Required)\n\nConnect to Dexter's 59+ Solana DeFi tools via OAuth:\n\n- **`dexter_x402`** - Gateway to wallet management, trading, analytics, games, and more\n\n## Quick Start\n\n### Option A: Generic x402 (No Auth - Config Only)\n\nAdd your wallet keys to `~/.moltbot/moltbot.json`:\n\n```json\n{\n  \"plugins\": {\n    \"dexter-x402\": {\n      \"svmPrivateKey\": \"YOUR_SOLANA_PRIVATE_KEY\",\n      \"evmPrivateKey\": \"0xYOUR_EVM_PRIVATE_KEY\",\n      \"maxPaymentUSDC\": \"0.50\"\n    }\n  }\n}\n```\n\nThen use:\n```bash\n# Search for paid APIs\nmoltbot agent -m \"Use x402_search to find weather APIs\"\n\n# Call a paid endpoint\nmoltbot agent -m \"Use x402_pay to call https://example.com/api/data\"\n```\n\n### Option B: Dexter Tools (OAuth Required)\n\n#### 1. Authenticate\n\n```bash\nmoltbot models auth login --provider dexter-x402\n```\n\nThis opens OAuth flow in your browser. Sign in with your Dexter account and authorize Moltbot.\n\n### 2. Use Tools\n\nThe plugin exposes a single gateway tool `dexter_x402` that provides access to all 59+ Dexter capabilities:\n\n```bash\n# List available tools\nmoltbot agent --local --session-id demo -m \"Use dexter_x402 with action='list'\"\n\n# Call a specific tool\nmoltbot agent --local --session-id demo -m \"Use dexter_x402 to check trending Solana tokens\"\n```\n\nOr simply ask naturally:\n\n```bash\nmoltbot agent --local --session-id demo -m \"What's trending on Solana right now?\"\n```\n\n## Available Tools (59+)\n\n### 💼 Wallet Management\n| Tool | Description |\n|------|-------------|\n| `resolve_wallet` | Resolve the effective managed wallet for this session |\n| `list_my_wallets` | List all wallets linked to your Dexter account |\n| `set_session_wallet_override` | Override wallet for the current session |\n| `auth_info` | Diagnostics for wallet resolution and token state |\n\n### 💱 Solana Trading\n| Tool | Description |\n|------|-------------|\n| `solana_resolve_token` | Resolve token metadata by name, ticker, or address |\n| `solana_send` | Transfer SOL, USDC, DEXTER, PAYAI, or any SPL token |\n| `solana_swap_preview` | Preview a token swap before execution |\n| `solana_swap_execute` | Execute a previewed swap |\n| `jupiter_quote_preview` | Get Jupiter DEX swap quote |\n| `jupiter_quote_pro` | Jupiter quote with pro-tier features |\n\n### 📊 Analytics & Research\n| Tool | Description |\n|------|-------------|\n| `search` | Web search with real-time results |\n| `fetch` | Retrieve and summarize web pages |\n| `pumpstream_live_summary` | Live pump.fun stream analytics |\n| `markets_fetch_ohlcv` | Birdeye OHLCV candle data |\n| `onchain_activity_overview` | On-chain analytics for tokens/wallets |\n| `onchain_entity_insight` | Deep analysis of wallets, tokens, or signatures |\n| `solscan_trending_tokens` | Solscan trending tokens snapshot |\n| `slippage_sentinel` | Volatility analysis & optimal slippage calculation |\n| `twitter_topic_analysis` | Twitter sentiment and conversation analysis |\n\n### 🎬 Creative & Media (x402 Paid)\n| Tool | Description |\n|------|-------------|\n| `sora_video_job` | Generate video clips with OpenAI Sora |\n| `meme_generator_job` | AI-powered meme and image generation |\n| `studio_breaking_news` | Create newscast videos and infographics |\n| `studio_news_status` | Check breaking news job status |\n\n### 🎮 Games\n| Tool | Description |\n|------|-------------|\n| `pokedexter_create_challenge` | Create wagered Pokémon battle ($1-$25) |\n| `pokedexter_accept_challenge` | Accept a battle challenge |\n| `pokedexter_make_move` | Submit battle action |\n| `pokedexter_get_battle_state` | Get current battle state |\n| `pokedexter_join_queue` | Join quick match queue |\n| `games_king_usurp` | Become King of Dexter ($0.01) |\n| `games_king_state` | View current King state |\n| `games_story_append` | Add to the Infinite Story ($0.01) |\n| `games_story_read` | Read the Infinite Story |\n\n### 🚀 Hyperliquid (Perpetuals)\n| Tool | Description |\n|------|-------------|\n| `hyperliquid_markets` | List tradable perp symbols |\n| `hyperliquid_opt_in` | Provision agent wallet for perp trading |\n| `hyperliquid_fund` | Bridge SOL → USDC → Hyperliquid |\n| `hyperliquid_bridge_deposit` | Deposit from Arbitrum |\n| `hyperliquid_perp_trade` | Submit perpetual orders |\n\n### 🔧 Codex Sessions\n| Tool | Description |\n|------|-------------|\n| `codex_start` | Begin a new Codex conversation |\n| `codex_reply` | Follow-up to existing Codex session |\n| `codex_exec` | Run Codex with optional JSON schema |\n\n### 🏭 Studio (Superadmin)\n| Tool | Description |\n|------|-------------|\n| `studio_create` | Start a Studio agent task |\n| `studio_status` | Check job status |\n| `studio_cancel` | Cancel running job |\n| `studio_inspect` | Full job details |\n| `studio_list` | List recent jobs |\n\n### 📺 Stream Engagement\n| Tool | Description |\n|------|-------------|\n| `stream_public_shout` | Submit shout-out for live stream |\n| `stream_shout_feed` | Get latest public shouts |\n\n## Architecture\n\n```\n┌─────────────────┐     OAuth 2.0 + PKCE      ┌──────────────────┐\n│    Moltbot      │◄─────────────────────────►│  Dexter OAuth    │\n│  (dexter-x402    │                           │  (dexter-api)    │\n│    plugin)      │                           └──────────────────┘\n└────────┬────────┘\n         │\n         │  MCP Protocol (JSON-RPC over HTTP)\n         │  - tools/list\n         │  - tools/call\n         ▼\n┌─────────────────┐     Internal      ┌──────────────────┐\n│   Dexter x402    │◄─────────────────►│  Dexter Backend  │\n│    Server       │                   │  (59+ tools)     │\n│ mcp.dexter.cash │                   │                  │\n└─────────────────┘                   └──────────────────┘\n```\n\n### Authentication Flow\n\n**Primary (Desktop/CLI):**\n1. **Link Request**: Plugin creates a tracking code via `api.dexter.cash/api/moltbot/link/create`\n2. **DCR**: Plugin registers with Dexter's OAuth server using remote callback (`dexter.cash/moltbot/link/callback`)\n3. **PKCE Authorization**: Browser-based OAuth with S256 code challenge\n4. **Remote Callback**: OAuth redirects to `dexter.cash`, backend stores tokens\n5. **Poll Completion**: Plugin polls for tokens, retrieves them when ready\n6. **Automatic Refresh**: Tokens refreshed automatically before expiry\n\n**Fallback (Telegram/Remote):**\n1. **Device Code**: Plugin creates link code, displays to user\n2. **Manual Auth**: User visits `dexter.cash/moltbot/link?code=XXXX`, signs in\n3. **Poll Completion**: Plugin polls until user completes auth\n\n### MCP Integration\n\nThe plugin uses the official `@modelcontextprotocol/sdk` to:\n\n1. Establish `StreamableHTTPClientTransport` connection to `mcp.dexter.cash/mcp`\n2. Send `tools/list` JSON-RPC requests to discover available tools\n3. Execute `tools/call` JSON-RPC requests for tool invocation\n4. Handle response content (text, JSON, images)\n\n## Configuration\n\nFull configuration in `~/.moltbot/moltbot.json`:\n\n```json\n{\n  \"plugins\": {\n    \"dexter-x402\": {\n      \"svmPrivateKey\": \"base58_solana_private_key\",\n      \"evmPrivateKey\": \"0x_hex_evm_private_key\",\n      \"defaultNetwork\": \"solana\",\n      \"maxPaymentUSDC\": \"0.50\",\n      \"baseUrl\": \"https://mcp.dexter.cash/mcp\",\n      \"directoryUrl\": \"https://api.dexter.cash/api/x402/directory\",\n      \"autoRefreshTools\": true,\n      \"disableTelemetry\": false\n    }\n  }\n}\n```\n\n### Config Options\n\n| Option | Type | Default | Description |\n|--------|------|---------|-------------|\n| `svmPrivateKey` | string | - | Solana private key (base58) for x402 payments |\n| `evmPrivateKey` | string | - | EVM private key (hex) for Base/Polygon/etc payments |\n| `defaultNetwork` | string | `\"solana\"` | Preferred network: solana, base, polygon, arbitrum, optimism, avalanche |\n| `maxPaymentUSDC` | string | `\"0.50\"` | Maximum payment per request (e.g., \"0.50\" = $0.50) |\n| `baseUrl` | string | `https://mcp.dexter.cash/mcp` | Dexter MCP server (for authenticated tools) |\n| `directoryUrl` | string | `https://x402.dexter.cash/api/x402/directory` | x402 directory API |\n| `autoRefreshTools` | boolean | `true` | Refresh Dexter tool list on connection |\n| `disableTelemetry` | boolean | `false` | Disable anonymous usage telemetry |\n\n## Tools Reference\n\n### x402_pay (Generic Payments)\n\nCall ANY x402-enabled paid API with automatic USDC payment. No authentication required - just configure wallet keys.\n\n**Supported Networks:** Solana, Base, Polygon, Arbitrum, Optimism, Avalanche\n\n**Parameters:**\n| Param | Type | Required | Description |\n|-------|------|----------|-------------|\n| `url` | string | Yes | The x402-enabled endpoint URL |\n| `method` | string | No | HTTP method (default: GET) |\n| `params` | object | No | Query params (GET) or JSON body (POST) |\n| `headers` | object | No | Custom HTTP headers |\n\n**Example:**\n```bash\nmoltbot agent -m \"Use x402_pay to call https://x402.dexter.cash/api/onchain/activity/overview with params {\\\"entityId\\\": \\\"SOL\\\"}\"\n```\n\n**How it works:**\n1. Makes request to the URL\n2. If 402 returned, SDK automatically signs USDC payment\n3. Retries request with payment proof\n4. Returns response data\n\n### x402_search (Directory Search)\n\nSearch the aggregated directory of x402-enabled paid APIs. Combines Dexter's catalog with external sources.\n\n**Parameters:**\n| Param | Type | Required | Description |\n|-------|------|----------|-------------|\n| `query` | string | No | Search term (searches url, description) |\n| `network` | string | No | Filter: solana, base, polygon, arbitrum, optimism, avalanche |\n| `verified` | boolean | No | Only show verified endpoints |\n| `limit` | number | No | Max results (default: 10, max: 50) |\n\n**Example:**\n```bash\nmoltbot agent -m \"Use x402_search to find Solana analytics APIs\"\n```\n\n**Response includes:**\n- Endpoint URL and method\n- Network and pricing\n- Description and verification status\n- Success rate (when available)\n\n### dexter_x402 (Authenticated Dexter Tools)\n\n## How It Works\n\n### The `dexter_x402` Gateway\n\nRather than registering 59+ individual tools (which would overwhelm the agent's context), this plugin exposes a single `dexter_x402` gateway with two actions:\n\n```typescript\n{\n  action: \"list\" | \"call\",\n  tool?: string,      // Tool name (required for \"call\")\n  args?: string       // JSON arguments for the tool\n}\n```\n\n**List tools:**\n```json\n{ \"action\": \"list\" }\n```\n\n**Call a tool:**\n```json\n{ \n  \"action\": \"call\", \n  \"tool\": \"solscan_trending_tokens\",\n  \"args\": \"{\\\"limit\\\": 10}\"\n}\n```\n\n### Credential Storage\n\nOAuth credentials are stored in:\n```\n~/.moltbot/auth-profiles.json\n# or legacy location:\n~/.clawdbot/agents/main/agent/auth-profiles.json\n```\n\nFormat:\n```json\n{\n  \"version\": 1,\n  \"profiles\": {\n    \"dexter-x402:default\": {\n      \"type\": \"oauth\",\n      \"provider\": \"dexter-x402\",\n      \"access\": \"eyJ...\",\n      \"refresh\": \"...\",\n      \"expires\": 1769639417118,\n      \"baseUrl\": \"https://mcp.dexter.cash/mcp\"\n    }\n  }\n}\n```\n\n## Troubleshooting\n\n### \"Not connected to Dexter\"\n\nThe tool couldn't find valid credentials. Run:\n```bash\nmoltbot models auth login --provider dexter-x402\n```\n\n### OAuth on Telegram or remote server\n\nThe plugin automatically uses device code flow for Telegram and remote environments:\n\n1. Plugin displays a link code (e.g., `ABC12345`)\n2. Visit `dexter.cash/moltbot/link?code=ABC12345` in any browser\n3. Sign in to Dexter and click \"Connect\"\n4. Return to Moltbot - it will detect the auth automatically\n\nNo localhost or port forwarding needed.\n\n### Token expired\n\nTokens auto-refresh. If refresh fails, re-authenticate:\n```bash\nmoltbot models auth login --provider dexter-x402\n```\n\n### MCP connection errors\n\nCheck that `mcp.dexter.cash` is accessible:\n```bash\ncurl https://mcp.dexter.cash/mcp/health\n```\n\n### Tools not appearing\n\nEnsure the plugin is enabled:\n```bash\ncat ~/.moltbot/moltbot.json | jq '.plugins'\n```\n\n## Development\n\n### Building\n\n```bash\ncd /path/to/moltbot-research\npnpm build\n```\n\n### Testing OAuth Flow\n\n```bash\n./moltbot.mjs models auth login --provider dexter-x402\n```\n\n### Testing Tool Execution\n\n```bash\nexport ANTHROPIC_API_KEY=\"sk-ant-...\"\n./moltbot.mjs agent --local --session-id test -m \"Use dexter_x402 with action='list'\"\n```\n\n## Dependencies\n\n- `@modelcontextprotocol/sdk` - Official MCP client SDK\n- `@sinclair/typebox` - Runtime type validation\n\n## Links\n\n- [Dexter](https://dexter.cash) - Main website\n- [Dexter x402](https://mcp.dexter.cash) - MCP server\n- [MCP Specification](https://modelcontextprotocol.io) - Protocol documentation\n- [Discord](https://discord.gg/dexter) - Community support\n\n## License\n\nMIT\n","readmeFilename":"README.md"}