Skip to main content
Glama
dex-cex-spread

dex-cex-spread

by tordagaz-ops

dex-cex-spread

An MCP server that measures the gap between a token's price on a DEX and the same token on a centralised exchange — and refuses to answer when the DEX contract is not the token you asked for.

DEX pool  ──►  identity check  ──►  exact-price comparison  ──►  costs  ──►  verdict

Documentation: English · Español · Русский


The problem this server exists for

Every "DEX vs CEX spread" tool starts from a ticker. A ticker is not an asset.

On 2026-11-26 a search for WIF on DexScreener returned 23 different contracts, all called WIF, priced from $0.00000064 to $0.13 — a 200,000× range. The deepest of them was worth $2,668 and quoted the token at $0.1334, while Binance quoted the real WIF at $0.1365. A naive tool prints a 227 bps opportunity. In reality that pool is a copycat on Cronos, and a $10,000 order into it would move the price 3.75× — the honest answer is −7,885 bps.

So this server does three things in a fixed order, and never reorders them:

  1. Resolve. Turn the query into one specific contract address, preferring a verified pin, and confirm the pool's price agrees with the exchange price within ±25 %.

  2. Refuse if it does not. A refused call returns the candidates it found, so the caller can see what the ticker turned into — and gets no spread at all.

  3. Compare only then, at the exact size asked for, with the pool's own constant-product price impact and both legs' fees deducted.

A wrong answer here costs money on two sides at once, so an empty answer is the cheaper failure.


Related MCP server: bsc-dex-spread

The five tools

Tool

What it answers

resolve_token

Which contract is this ticker, on which chain, and does its pool price agree with the exchange?

compare_price

For one token: the gap in bps on every venue, with impact, gross, net, direction and a verdict.

scan_spreads

The same comparison across a watchlist, ranked by net bps, in one upstream round.

pool_liquidity

Every pool for a token, deepest first, with depth, 24 h volume, turnover and price impact at $1k / $10k / $100k / $1M.

list_venues

Which centralised venues are reachable right now, how many symbols each returns, and which ones failed.

All five are read-only (readOnlyHint) and open-world (openWorldHint). None of them requires an argument, so an MCP host can list and call them without a schema of its own. Every one returns a dict; a tool never raises.

Every parameter name and every message is translated into English, Spanish and Russian, and the tool descriptions are sent in the language the caller asked for — see Languages.


Install

git clone https://github.com/tordagaz-ops/dex-cex-spread
cd dex-cex-spread
python -m venv .venv
.venv\Scripts\activate        # Windows
pip install -e .

Python 3.10 or newer. The only runtime dependencies are mcp and httpx (pydantic arrives with mcp), both installed by the line above. The same install also puts a dex-cex-spread command on the path, which is the same entry point as python -m mcp_dex_cex_spread.

Run

stdio — what an MCP host (Claude Desktop, Cursor, Smithery, MCPize) launches:

python -m mcp_dex_cex_spread
{
  "mcpServers": {
    "dex-cex-spread": {
      "command": "C:\\AI\\Bots\\Paid\\dex-cex-spread\\.venv\\Scripts\\python.exe",
      "args": ["-m", "mcp_dex_cex_spread"]
    }
  }
}

HTTP / SSE — for a shared instance:

MCP_TRANSPORT=http python -m mcp_dex_cex_spread

MCP_TRANSPORT accepts stdio (default), sse, http and streamable-http.

Docker:

docker build -t dex-cex-spread .
docker run --rm -i dex-cex-spread

The image runs as a non-root user, listens on stdio by default and needs no writable volume.


Calling it

A ticker that resolves honestly. ETH is pinned to 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 (WETH) on Ethereum; the pool and the venue disagree by 0.03 %, so the spread is reported:

{"query": "ETH", "size_usd": 10000}
{
  "status": "resolved",
  "token": {"symbol": "ETH", "identity": "pinned", "chain": "ethereum"},
  "comparisons": [{"venue": "okx", "mid_spread_bps": 3.64, "impact_bps": 3.47,
                   "gross_bps": 0.14, "net_bps": -39.86,
                   "direction": "cex_to_dex", "verdict": "no_edge"}],
  "best": {"venue": "okx", "net_bps": -39.86},
  "verdict": "no_edge"
}

A ticker that does not. Ask for WIF with an explicit chain that has no real WIF pool and the call comes back refused, with the candidates attached and no numbers to trade on:

{
  "status": "refused",
  "refused_because": "identity_mismatch",
  "comparisons": [],
  "candidates": [{"chain": "cronos", "address": "0x25e8...f12f", "price_usd": 0.1334}],
  "notes": ["Identity could not be confirmed, so no spread is reported."]
}

The watchlist scan defaults to twelve tickers — BTC, ETH, SOL, PEPE, LINK, UNI, JUP, WIF, BONK, RAY, DOGE, XRP — and returns one ranked list:

{"symbols": "SOL,ETH,BTC", "size_usd": 25000, "limit": 5}

Pool depth for a token answers "how much can I actually move":

{"query": "ETH", "limit": 3}

How a number is built

Depth. liquidity.base from DexScreener is denominated in the pool's own base token, so a memecoin pool and a WETH pool cannot be compared by that field. The server prices the base side with the token's own price and takes depth_usd = min(base_side_usd, quote_side_usd) — the smaller side is what a round trip can actually use. A pool that quotes in a stablecoin is preferred on a tie, because the quote side is then already dollars.

Impact. Constant product, at the size you asked for: impact_bps ≈ size_usd / quote_side_usd × 10,000. It is reported at $1k, $10k, $100k and $1M in pool_liquidity, so a caller can see where a pool stops being usable instead of discovering it from a fill.

Gross and net. gross_bps is the round trip at the impacted price, not at the quoted mid — buying into the pool at the average fill and selling on the venue's bid (or the other way round). net_bps = gross_bps − dex_fee_bps − cex_fee_bps, 40 bps by default (30 + 10). In every row of the measurement tables below, net = gross − 40.00.

Breakeven. breakeven_usd is the largest order that still nets zero at the given fees. When it is smaller than the size you asked for, the trade is too big for the pool, not merely unprofitable.

Verdicts. capturable_in_theory (net > 10 bps), marginal (0…10 bps), no_edge (< 0) and unverified (identity not proven — never a number).

Flags. thin_pool (depth below min_depth_usd, 50,000 by default), not_stable_quoted (the pool quotes in a volatile token, so its dollar depth is a snapshot), wide_venue_spread, identity_gap.


Measurements

Recorded on 2026-11-26 against the live APIs; every figure below is reproducible from _diag/app5_measure.json in this repository.

Identity, before any spread

Query

Contract

Chain

Pool price

Exchange mid

Gap

Identity

Depth, USD

PEPE

0x6982...1933

ethereum

3.481e-06

3.4864e-06

-0.15 %

pinned

11,526,240

ETH

0xC02a...6Cc2

ethereum

1,690.56

1,690.04

+0.03 %

pinned

17,161,066

BTC

0x2260...C599

ethereum

60,651.90

60,594.25

+0.10 %

pinned

14,804,752

SOL

So1111...1112

solana

70.69

70.97

-0.40 %

pinned

7,166,764

LINK

0x5149...86CA

ethereum

9.18

9.21

-0.29 %

pinned

4,789,215

UNI

0x1f98...F984

ethereum

4.63

4.64

-0.23 %

pinned

1,962,576

WIF

0x25e8...f12f

cronos

0.1334

0.1365

-2.27 %

price match

2,668

Six pins passed the ±25 % band, the worst of them at 0.40 %. WIF is not pinned: the check fell back to price agreement and accepted the Cronos pool at 2.27 % — which is exactly why the depth column, and not the ticker, decides what happens next.

The comparison, seven tokens, three venues

Token

Venue

Bid

Ask

Mid spread, bps

Impact at $10k, bps

Gross, bps

Net, bps

Direction

Verdict

SOL

bybit

70.98

70.99

-41.56

13.92

27.07

-12.93

DEX→CEX

no edge

okx

70.97

70.98

-40.15

13.92

25.65

-14.35

DEX→CEX

no edge

binance

70.97

70.98

-40.15

13.92

25.65

-14.35

DEX→CEX

no edge

LINK

bybit

9.21

9.21

-28.78

16.60

11.70

-28.30

DEX→CEX

no edge

binance

9.20

9.21

-26.62

16.60

9.53

-30.47

DEX→CEX

no edge

okx

9.20

9.20

-25.53

16.60

8.44

-31.56

DEX→CEX

no edge

PEPE

okx

3.4862e-06

3.4866e-06

-15.49

8.67

6.26

-33.74

DEX→CEX

no edge

bybit

3.485e-06

3.486e-06

-12.91

8.67

2.82

-37.18

DEX→CEX

no edge

binance

3.48e-06

3.49e-06

-11.48

8.67

-11.53

-51.53

DEX→CEX

no edge

BTC

binance

60,590.22

60,590.23

10.18

4.03

6.14

-33.86

CEX→DEX

no edge

bybit

60,594.20

60,594.30

9.51

4.03

5.47

-34.53

CEX→DEX

no edge

okx

60,597.40

60,597.50

8.99

4.03

4.94

-35.06

CEX→DEX

no edge

ETH

okx

1,689.94

1,689.95

3.64

3.47

0.14

-39.86

CEX→DEX

no edge

binance

1,689.95

1,689.96

3.58

3.47

0.08

-39.92

CEX→DEX

no edge

bybit

1,690.03

1,690.04

3.11

3.47

-0.39

-40.39

CEX→DEX

no edge

UNI

okx

4.64

4.64

-22.63

50.95

-29.20

-69.20

DEX→CEX

no edge

binance

4.64

4.64

-22.63

50.95

-29.20

-69.20

DEX→CEX

no edge

bybit

4.64

4.64

-21.55

50.95

-31.35

-71.35

DEX→CEX

no edge

WIF

binance

0.1365

0.1366

-230.68

37,484.56

-7,845.11

-7,885.11

DEX→CEX

no edge

bybit

0.1364

0.1366

-227.11

37,484.56

-7,846.69

-7,886.69

DEX→CEX

no edge

okx

0.1364

0.1366

-227.11

37,484.56

-7,846.69

-7,886.69

DEX→CEX

no edge

A blank token cell continues the token above it.

The numbers say what a serious trader suspects: on liquid pairs the raw gap is 15–42 bps, the 40 bps of round-trip fees eat all of it, and the best row in the whole sweep — SOL on Bybit — still ends at −12.93 bps. WIF is in the table only to be a warning: the raw gap reads 227 bps and the executable answer is −7,885 bps.

The scan, twelve tickers in one call

Token

Venue

Mid spread, bps

Impact at $10k, bps

Net, bps

Depth, USD

Verdict

SOL

bybit

-37.35

13.92

-17.17

7,166,764

no edge

okx

-37.35

13.92

-17.17

7,166,764

no edge

binance

-35.94

13.92

-18.58

7,166,764

no edge

LINK

bybit

-26.08

16.60

-31.56

4,789,215

no edge

BTC

binance

12.32

4.03

-31.71

14,804,752

no edge

bybit

11.96

4.03

-32.08

14,804,752

no edge

requested 12, distinct tickers compared 12, venue rows 35, refused 0, unlisted 0, truncated true

The scan and the comparison above are separate calls minutes apart, so quotes moved between them; both are honest snapshots, neither is a promise.

Depth of the ETH pools, deepest first

Pool

Quoted in

Depth, USD

Liquidity, USD

Volume 24h, USD

Turn

Impact $1k, bps

Impact $1M, bps

uniswap/0x8ad5...e6D8

USDC

17,161,066

45,939,469

9,677,490

0.564

0.58

582.71

uniswap/0x88e6...5640

USDC

12,392,040

68,820,862

41,969,688

3.387

0.81

806.97

uniswap/0xB4e1...C9Dc

USDC

8,359,774

16,719,548

883,387

0.106

1.20

1,196.20

uniswap/0x4e68...Fa36

USDT

8,138,808

60,316,890

17,692,355

2.174

1.23

1,228.68

uniswap/0x0d4a...1852

USDT

6,038,336

12,076,672

624,144

0.103

1.66

1,656.09

curve/0xf5f5...6Cc2

USDT

3,373,143

6,749,169

529,530

0.157

2.96

2,962.06

uniswap/0xA478...eB11

DAI

3,189,093

6,378,187

277,661

0.087

3.14

3,135.69

metric/0xE9c1...11Da

USDC

3,138,069

6,276,139

21,694,042

6.913

3.19

3,186.67

Note the third row against the second: $16.7M of liquidity and $883k of daily volume is a pool that barely trades, while the $68.8M pool behind it turned $42M in a day. Ranked by liquidity alone they would look comparable; ranked by depth and turnover, they are not.

Latency, median of three cold calls

Call

Median, ms

Samples, ms

list_venues

1,617

1,968, 1,617, 1,169

compare_price pepe

1,408

1,408, 2,322, 927

compare_price eth

955

955, 926, 1,423

scan_spreads default

1,804

1,289, 2,038, 1,804

pool_liquidity eth

1,418

920, 1,418, 1,619

resolve_token wif

1,446

1,671, 1,446, 1,170

A twelve-ticker scan costs one round to three venues plus one search per ticker, in parallel — 1.8 s, not twelve times 1.4 s. No key, no account, no rate-limit plan is involved.

Coverage

Venue

USDT pairs

Kept

Leveraged dropped

Symbols

bybit

389

389

0

389

okx

500

498

0

498

binance

789

531

48

531

The leverage filter is worth a note, because the obvious implementation is wrong. Matching UP, DOWN, BULL or BEAR as a substring deletes JUP (Jupiter), which is a real token listed on all three venues. The filter therefore only drops a symbol when the mark is a suffix and the remaining stem is itself a listed underlying — plus the 3L / 3S suffixes, which never occur by accident. Measured effect on Binance: 48 leveraged tokens removed, JUP kept on all three venues.

The refusal, replayed offline

status = refused, because = identity_mismatch, comparisons = 0, candidates shown = 1


What it refuses to claim

  • No spread without identity. A ±25 % price band or a verified pin. 1.24× passes, 1.26× is refused; both are pinned by tests.

  • No liquidity you cannot use. Depth is the smaller side of the pool, priced in dollars, and pool_liquidity shows the impact curve instead of one number.

  • No volume-derived honesty. Sales plus purchases are the volume by definition, so a turnover figure is reported and not decorated.

  • No key, no wallet, no order. All five tools are read-only. Nothing here executes, signs or advises; the verdict is arithmetic on public quotes.

  • No silent zeros. A memecoin at 2.4e-06 is printed as 2.4e-06; prices are formatted at ten significant digits precisely so a small number never becomes 0.00.

Languages

The server speaks English, Spanish and Russian, English by default:

MCP_LOCALE=es python -m mcp_dex_cex_spread
MCP_LOCALE=ru python -m mcp_dex_cex_spread

MCP_LOCALE also accepts a full locale such as es-MX or ru-RU. Tool titles, descriptions, parameter descriptions, every error message and every note are translated; the JSON keys are not, because a client parses them. An unknown or missing value falls back to English rather than failing.

Tests

pytest              # 113 offline tests: unit, tools, end-to-end — no network
pytest -m live      # 10 live tests against DexScreener, Bybit, OKX and Binance

The offline suite replays a recorded fixture of three spot books, one search per ticker and eight pools per pinned contract. The live suite is optional and is excluded by default through addopts = "-m 'not live'".

Licence

MIT. See LICENSE.


Not affiliated with DexScreener, Bybit, OKX, Binance or any DEX. Quotes are public data, may be stale by the time you read them, and are not financial advice.

Available Tools

5 tools
compare_priceCompare DEX and CEX priceA
Read-only

One token, one size: the best pool price against every centralised book, both directions round (buy on the DEX and sell at the CEX bid, or the reverse), with the two taker fees and the constant-product price impact for that size charged before anything is called an opportunity. Also reports the size at which impact eats the whole edge, and the naive mid-to-mid spread side by side so the difference between the two numbers is visible.

Inputs: chain, query, venue, size_usd, +3 more. Returns: object

list_venuesList venuesB
Read-only

Which DEX index and which centralised books this server can reach, the chains the index covers, and with probe a live latency and symbol count per venue.

Inputs: probe. Returns: object

pool_liquidityPool liquidity and price impactA
Read-only

Every pool this server can see for a token, with real depth (the smaller side, which cannot be inflated by a token pricing itself), 24 hour volume, the turnover ratio, and the price impact a constant-product pool would charge at 1k, 10k, 100k and 1M dollars.

Inputs: chain, limit, query. Returns: object

resolve_tokenResolve a token to its contractA
Read-only

Given a ticker such as PEPE or a contract address, find the pools that hold it and decide whether that contract is the same asset the exchanges list. Pinned addresses are proof; without a pin the only evidence is that the pool trades within 25% of the centralised price, which is reported as weaker evidence. When no candidate agrees, the answer is a refusal listing what the copycats quote, so the reason is auditable instead of silently wrong.

Inputs: chain, query, candidates. Returns: object

scan_spreadsScan DEX/CEX spreadsB
Read-only

The same comparison over a list of tickers, ranked by net edge, with the rows that cannot be trusted kept in the answer as refusals rather than dropped. A scan that returns twelve symbols and eleven refusals is the honest result of asking about tickers that most aggregators would have turned into a 99.99 % 'opportunity'.

Inputs: chain, limit, venue, symbols, +4 more. Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.8/5.0

    Scored across 5 tools

    Disambiguation5/5

    Each tool occupies a distinct stage of the workflow: venue discovery, token identity resolution, single-pair comparison, batch scanning, and pool-liquidity inspection. compare_price and scan_spreads are explicitly separated by single-token versus list behavior, while resolve_token and pool_liquidity separate asset identity from depth analysis.

    Naming Consistency4/5

    All names use readable snake_case and follow a verb_noun pattern for list_venues, resolve_token, compare_price, and scan_spreads. pool_liquidity is the minor deviation, using a noun-led form instead of a verb, but it remains clear and consistent in casing style.

    Tool Count5/5

    Five tools map tightly to the DEX/CEX spread-analysis domain with no filler. The set is neither thin nor bloated: discovery, resolution, comparison, scanning, and liquidity each earn a dedicated tool.

    Completeness4/5

    The surface covers the core workflow well: venue discovery, token resolution, single and batch spread comparison, and liquidity/impact inspection. Minor gaps remain around historical spread tracking, alerting, and transfer or withdrawal-cost modelling, which could affect executable arbitrage decisions.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables checking liquidity depth for Solana DEX pools (Raydium, Orca, Meteora) via pay-per-call x402 micropayments. Returns TVL, slippage estimates, volume, and fee tier for a given token mint.
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Provides a tool to get real-time cross-DEX price and spread data for PancakeSwap v2 and v3 on BSC, with a pay-per-call model settled via x402.
      1
      33 npm
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Check a token address before acting on a pool alert. VetAgent reports liquidity across eight chains. On Ethereum, BSC and Base, it reports available sell-simulation and tax evidence and whether the simulation matches the displayed pool. On Solana it checks token authorities and liquidity. An unavailable sell check is disclosed. Try one address over MCP or HTTP without an API key.
      3
      MIT