Plugin SDK

The mangrove-trader plugin connects Claude Code directly to the MangroveTrader leaderboard. It provides 12 slash commands and access to all 9 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-:

CommandDescriptionAccess
/mt-statsYour score, rank, and open positionsFree
/mt-reportDetailed performance breakdownFree
/mt-lastMost recent tradeFree
/mt-leaderboardFull rankingsx402 $0.25+
/mt-searchFind a traderx402 $0.02
/mt-historyTrade historyx402 $0.01/3 trades
/mt-trackCompose a trade tweetFree
/mt-cancelCancel last trade (5-min window)Free
/mt-watchAdd trader to watchlistFree
/mt-unwatchRemove from watchlistFree
/mt-statusServer health + tool listFree
/mt-helpList all commandsFree

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 9 MangroveTrader MCP tools. Claude automatically calls them when relevant to your conversation:

"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:

  1. First call -- tool returns PAYMENT_REQUIRED with price
  2. Price presented -- Claude shows you the cost and asks for confirmation
  3. 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/                # 12 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-status.md
|   +-- mt-help.md
+-- hooks/
|   +-- hooks.json           # Context injection config
|   +-- context.json         # Injected tool summary
+-- 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