Skip to main content
Glama
warpdex-mcp

warpdex-mcp

Official
README.md
<div align="center">
  <img src="https://avatars.githubusercontent.com/u/363115046?v=4" alt="WarpDEX Logo" width="96" height="96" />

  <h1>WarpDEX CLI &amp; MCP Server</h1>

  <p><strong>Model Context Protocol (MCP) Server &amp; Command-Line Interface for Robinhood Mainnet (<code>#4663</code>)</strong></p>

  <p>
    <a href="https://github.com/warpdexproject/warpdex-mcp/actions/workflows/ci.yml"><img src="https://github.com/warpdexproject/warpdex-mcp/actions/workflows/ci.yml/badge.svg" alt="WarpDEX MCP &amp; CLI CI" /></a>
    <a href="https://robin.etherscan.io/address/0xfD17b82C7896329De26617eC1593c05721d14513#code"><img src="https://img.shields.io/badge/WarpdexAggregator-Verified%20%234663-10b981?style=flat-square" alt="Verified Contract" /></a>
    <a href="./LICENSE"><img src="https://img.shields.io/badge/License-MIT-f59e0b?style=flat-square" alt="License" /></a>
  </p>
</div>

Official portal: [https://warpdex.site](https://warpdex.site) · SDK: [warpdex-agent-kit](https://github.com/warpdexproject/warpdex-agent-kit) · Contracts: [warpdex-contracts](https://github.com/warpdexproject/warpdex-contracts)

---

## Overview

`@warpdex/mcp` exposes **Robinhood Mainnet (`Chain ID 4663`)** swap quotes, token safety intelligence, balance checks, and deterministic `WarpdexAggregator` calldata builders as:

1. **An MCP (`2024-11-05` stdio JSON-RPC) server** (`warpdex-mcp`) for AI assistants, IDE agents, and autonomous trading pipelines.
2. **A lightweight CLI tool** (`warpdex`) for terminal scripting, quote inspection, unsigned tx building, and opt-in local RAM signing.

All constructed swap transactions route through the verified **`WarpdexAggregator`** (`0xfD17b82C7896329De26617eC1593c05721d14513`) with atomic **`0.20%` (`20 bps`)** protocol fee accounting.

---

## MCP Setup

### 1. Claude Desktop / Claude Code / Cursor / Windsurf (`stdio` via `npx`)

Connect directly with zero manual install (requires Node.js `>= 20`):

```json
{
  "mcpServers": {
    "warpdex": {
      "command": "npx",
      "args": ["-y", "github:warpdexproject/warpdex-mcp"],
      "env": {
        "WARPDEX_API_URL": "https://warpdex.site",
        "ROBINHOOD_RPC_URL": "https://rpc.mainnet.chain.robinhood.com",
        "WARPDEX_ALLOW_BROADCAST": "false"
      }
    }
  }
}
```

### 2. ChatGPT Remote MCP / OpenAI Responses API (`--http` Streamable HTTP)

ChatGPT Web/Connectors require a public HTTPS MCP endpoint (`POST /mcp`). Run `warpdex-mcp` in HTTP mode behind HTTPS (e.g. `https://warpdex.site/mcp`):

```bash
npx -y github:warpdexproject/warpdex-mcp -- --http --host 0.0.0.0 --port 3333
```

Then connect your ChatGPT Connector or API `mcp` tool URL to **`https://your-domain/mcp`** (health endpoint: `GET /health`).

### Exposed MCP Tools

| Tool Name | Purpose | Network |
| :--- | :--- | :--- |
| `warpdex_contracts` | Verified `#4663` contract registry & fee spec | Local |
| `warpdex_search_tokens` | Search tokens & tokenized stocks | `GET /api/v1/markets/tokens` |
| `warpdex_token_intel` | Security score, tax probe & liquidity check | `GET /api/v1/agent/tokens/:address/intel` |
| `warpdex_quote_swap` | Live multi-DEX aggregator quote (`ETH`, `WETH`, `USDG`, `0x...`) | `POST /api/v1/swaps/quote` |
| `warpdex_build_swap_tx` | Build unsigned `{ to, data, value }` transaction | `POST /api/v1/swaps/build` |
| `warpdex_quote_agent_route` | Build Pons / V3 / MetaRouter snipe route | `POST /api/v1/agent/quote-route` |
| `warpdex_encode_aggregator_tx` | Offline deterministic `WarpdexAggregator` encoder | Local |
| `warpdex_check_balance` | Live ETH & ERC20 balance on `#4663` | JSON-RPC `#4663` |
| `warpdex_broadcast_tx` | Local RAM tx broadcast *(disabled unless `WARPDEX_ALLOW_BROADCAST=true`)* | JSON-RPC `#4663` |

---

## CLI Quickstart

```bash
# Install globally or run straight via npx
npm install -g github:warpdexproject/warpdex-mcp

# 1. Inspect verified #4663 contracts
warpdex contracts

# 2. Check ETH & USDG balance on Robinhood Mainnet
warpdex balance 0xa7b5b1c1743625c4ad33cbb3d1b666413c6aed80 USDG

# 3. Fetch live swap quote (ETH -> USDG)
warpdex quote --in ETH --out USDG --amount 0.01 --slippage 50

# 4. Build unsigned WarpdexAggregator transaction JSON
warpdex build --in ETH --out USDG --amount 0.01 --account 0xa7b5b1c1743625c4ad33cbb3d1b666413c6aed80

# 5. Offline deterministic calldata encoding (Uniswap V3 buy via WarpdexAggregator)
warpdex encode --venue v3 --side buy --eth 1000000000000000 --token-out 0x5fc5360d0400a0fd4f2af552add042d716f1d168 --recipient 0xa7b5b1c1743625c4ad33cbb3d1b666413c6aed80

# 6. Execute locally using WARPDEX_PRIVATE_KEY from environment
WARPDEX_PRIVATE_KEY=0x... warpdex swap --in ETH --out USDG --amount 0.001 --account 0x... --execute
```

---

## Security

- Private keys are **never** accepted as MCP tool arguments or CLI flags—only read from local `process.env.WARPDEX_PRIVATE_KEY` when execution is explicitly requested.
- Target transaction addresses are validated against `ALLOWED_EXECUTION_TARGETS` before building or signing.
- See [SECURITY.md](./SECURITY.md) for disclosure policy.

---

## Running Tests

```bash
npm install
npm test
```

---

## Maintainer

Maintained by **warpdex** ([https://warpdex.site](https://warpdex.site)) under the [MIT License](./LICENSE).