Plugin SDK
The mangrove-trader plugin connects Claude Code directly to the MangroveTrader leaderboard. It provides 13 slash commands and access to all 10 MCP tools with automatic payment flow handling.
Installation
# From source git clone https://github.com/MangroveTechnologies/mangrove-trader-plugin.git claude plugin marketplace add ./mangrove-trader-plugin claude plugin install mangrove-trader # Or load for a single session claude --plugin-dir ./mangrove-trader-plugin
No configuration needed. The plugin connects to the MangroveTrader MCP server hosted on GCP Cloud Run.
Commands
All commands are prefixed with /mt-:
| Command | Description | Access |
|---|---|---|
/mt-stats | Your score, rank, and open positions | Free |
/mt-report | Detailed performance breakdown | Free |
/mt-last | Most recent trade | Free |
/mt-leaderboard | Full rankings | x402 $0.25+ |
/mt-search | Find a trader | x402 $0.02 |
/mt-history | Trade history | x402 $0.01/3 trades |
/mt-track | Compose a trade tweet | Free |
/mt-cancel | Cancel last trade (5-min window) | Free |
/mt-watch | Add trader to watchlist | Free |
/mt-unwatch | Remove from watchlist | Free |
/mt-set-handle | Verify your X identity and set your handle | Free |
/mt-status | Server health + tool list | Free |
/mt-help | List all commands | Free |
Note on watchlist: /mt-watch saves the trader to your watchlist. Activity notifications for watched traders are planned but not yet available.
MCP Tool Access
The plugin exposes all 10 MangroveTrader MCP tools. Claude automatically calls them when relevant to your conversation:
"Set up my account" -> Claude calls trader_login -> Returns X OAuth URL — open it, authenticate with X, then set MT_AUTH_TOKEN -> Required before cancel, watch, and unwatch operations "What's my trading score?" -> Claude calls trader_my_stats "Show me the leaderboard" -> Claude calls trader_get_leaderboard -> Presents x402 payment requirements -> On confirmation, completes payment and returns data "Cancel my last trade" -> Claude calls trader_cancel_last -> Returns success or explains the 5-min window expired
Payment Flow
For paid tools, the plugin handles the two-step x402 flow:
- First call -- tool returns
PAYMENT_REQUIREDwith price - Price presented -- Claude shows you the cost and asks for confirmation
- Second call -- tool called with x402 payment, data returned with settlement receipt
For agents with wallets: sign the x402 payment using an EVM wallet with USDC on Base. The MangroveMarkets TypeScript SDK includes an x402 payment client.
For Claude Code users without wallets: free tools work without payment.
Paid data is available via the REST API with an API key (X-API-Key header bypasses x402).
Plugin Architecture
mangrove-trader-plugin/
+-- .claude-plugin/
| +-- plugin.json # Marketplace manifest
| +-- marketplace.json # Marketplace index
+-- .mcp.json # MCP server connection config
+-- commands/ # 13 mt-* slash commands
| +-- mt-stats.md
| +-- mt-report.md
| +-- mt-last.md
| +-- mt-leaderboard.md
| +-- mt-search.md
| +-- mt-history.md
| +-- mt-track.md
| +-- mt-cancel.md
| +-- mt-watch.md
| +-- mt-unwatch.md
| +-- mt-set-handle.md
| +-- mt-status.md
| +-- mt-help.md
+-- hooks/
| +-- hooks.json # Context injection + x402 auto-pay config
| +-- x402_signer.py # Post-tool hook: signs x402 payments automatically
+-- skills/
+-- mangrove-trader/
+-- SKILL.md # Consolidated skill definition The plugin is a pure Claude Code plugin -- no npm packages, no local processes. All business logic lives on the MangroveTrader server.
Source Code
- Repository: github.com/MangroveTechnologies/mangrove-trader-plugin
- License: MIT
- Version: 2.0.5