{"_id":"@dexterai/dexter-x402","_rev":"2-cfded0146f8c9e5d59e8a7b26096baae","name":"@dexterai/dexter-x402","dist-tags":{"latest":"1.1.1"},"versions":{"1.1.0":{"name":"@dexterai/dexter-x402","version":"1.1.0","keywords":["moltbot","x402","dexter","solana","defi","mcp","oauth","plugin"],"author":{"name":"Dexter AI","email":"dev@dexter.cash"},"license":"MIT","_id":"@dexterai/dexter-x402@1.1.0","maintainers":[{"name":"nrsander","email":"nrsander@gmail.com"}],"homepage":"https://dexter.cash","bugs":{"url":"https://github.com/BranchManager69/moltbot-x402/issues"},"dist":{"shasum":"4df6e9da55488d3fc2a02f35822da83a6bc7c380","tarball":"https://registry.npmjs.org/@dexterai/dexter-x402/-/dexter-x402-1.1.0.tgz","fileCount":7,"integrity":"sha512-7xOVocaSlaUxIubS8Ervdh81FIy5yYh+rudV4chqaureAMqul1FGENO6iVCBuVqVM4hidS8YmfaHFzw9ycQ1QA==","signatures":[{"sig":"MEQCICp6/MVK1VNSKOTgtJo6SR1d+7AAGWZOov9oKetJ9bxsAiBJPaFSv++ME4o4pn74T9jIX3G3oWCYDQoGWjs/5cK4Mg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":42032},"type":"module","gitHead":"34e3861e20ed14cfd794497c0d41f9dd97bcc4ce","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/dexter-x402_1.1.0_1769639813722_0.9055759680562039","host":"s3://npm-registry-packages-npm-production"}},"1.1.1":{"name":"@dexterai/dexter-x402","version":"1.1.1","type":"module","description":"Moltbot plugin for Dexter x402 - 59+ Solana DeFi tools via MCP with OAuth authentication","keywords":["moltbot","x402","dexter","solana","defi","mcp","oauth","plugin"],"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":{"@modelcontextprotocol/sdk":"^1.25.3","@sinclair/typebox":"^0.34.48"},"peerDependencies":{"moltbot":"*"},"_id":"@dexterai/dexter-x402@1.1.1","gitHead":"34e3861e20ed14cfd794497c0d41f9dd97bcc4ce","bugs":{"url":"https://github.com/BranchManager69/moltbot-x402/issues"},"_nodeVersion":"22.19.0","_npmVersion":"10.9.3","dist":{"integrity":"sha512-0lPsQZzuRGcJWf2DMT1WZI5GUtkwlTmgEYIEtbQLlAOrCIjV/ahsjfBMaq2Zv2/ILqpCATVnPynbyhUyClW8kA==","shasum":"4e278b579e8114ce70d3c120c66f6b247972ca80","tarball":"https://registry.npmjs.org/@dexterai/dexter-x402/-/dexter-x402-1.1.1.tgz","fileCount":7,"unpackedSize":42069,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIGSsGbWYugjR+oCO2s7RWO5X5F+uMH8EnjK2oSg0Tu3LAiBbyOqsNCxJBnzSd69y2IxRGQK04BoroKGXdTdDIYKKWg=="}]},"_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/dexter-x402_1.1.1_1769639902680_0.044963141303699494"},"_hasShrinkwrap":false}},"time":{"created":"2026-01-28T22:36:53.577Z","modified":"2026-01-28T22:38:22.997Z","1.1.0":"2026-01-28T22:36:53.909Z","1.1.1":"2026-01-28T22:38:22.866Z"},"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"],"repository":{"type":"git","url":"git+https://github.com/BranchManager69/moltbot-x402.git"},"description":"Moltbot plugin for Dexter x402 - 59+ Solana DeFi tools via MCP with OAuth authentication","maintainers":[{"name":"nrsander","email":"nrsander@gmail.com"}],"readme":"# Dexter x402 Plugin for Moltbot\n\nOfficial Moltbot plugin providing access to **59+ Dexter Solana DeFi tools** via the Model Context Protocol (MCP).\n\n## Overview\n\nThis plugin connects Moltbot to Dexter's MCP server, enabling:\n\n- **Secure OAuth 2.0 Authentication** with PKCE and Dynamic Client Registration\n- **Real-time Tool Discovery** via MCP `tools/list`  \n- **Direct Tool Execution** via MCP `tools/call`\n- **Automatic Token Refresh** for seamless long-running sessions\n\n## Quick Start\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\n1. **Dynamic Client Registration (DCR)**: Plugin registers with Dexter's OAuth server, declaring `http://localhost:51199/oauth-callback` as redirect URI\n2. **PKCE Authorization**: Browser-based OAuth with S256 code challenge\n3. **Token Exchange**: Authorization code exchanged for access + refresh tokens\n4. **Automatic Refresh**: Tokens refreshed automatically before expiry\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\nOptional settings in `~/.moltbot/moltbot.json`:\n\n```json\n{\n  \"plugins\": {\n    \"dexter-x402\": {\n      \"baseUrl\": \"https://mcp.dexter.cash/mcp\",\n      \"autoRefreshTools\": true\n    }\n  }\n}\n```\n\n| Option | Default | Description |\n|--------|---------|-------------|\n| `baseUrl` | `https://mcp.dexter.cash/mcp` | MCP server endpoint |\n| `autoRefreshTools` | `true` | Refresh tool list on connection |\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~/.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 callback fails on remote server\n\nIf you're SSH'd into a remote server, Cursor's port forwarding should handle `localhost:51199` redirects automatically. If not:\n\n1. The plugin shows the OAuth URL\n2. Open it in your local browser\n3. After signing in, you'll see \"Connected to Dexter\"\n4. The callback is received via the forwarded port\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"}