microstructure-mcp

microstructure-mcp

Computes structured market-structure features (liquidity zones, fair value gaps, order blocks, break of structure) from live Bybit data and exposes them as typed MCP tools for AI agents.

Category
Visit Server

README

microstructure-mcp

Market-microstructure primitives for AI agents, over MCP.

LLM trading agents are usually fed raw candles and asked to "figure out the chart". This server does the deterministic part for them: it computes structured market-structure features — liquidity zones, fair value gaps, order blocks, break of structure — from live exchange data and exposes them as typed MCP tools. The agent reasons; the server measures.

Works out of the box with Claude Desktop, Claude Code, and any MCP-compatible client. Data source: Bybit v5 public API (no API key required).

Tools

Tool What it returns
get_liquidity_zones Clusters of equal highs/lows (buy-side / sell-side resting liquidity), touch count, swept status, distance from price
get_fair_value_gaps 3-candle FVGs with zone boundaries, size %, filled / mitigated status
get_order_blocks Last opposite candle before an impulsive move, with mitigation status
get_market_structure Current trend read + recent BOS / CHoCH events
get_snapshot Everything above in a single call — the cheapest way to give an agent full context

All tools take symbol (e.g. BTCUSDT), timeframe (1m–1w) and limit, plus per-tool sensitivity parameters. Output is compact JSON designed to be token-efficient in agent context windows.

Quick start

git clone https://github.com/rustamovppl/microstructure-mcp
cd microstructure-mcp
pip install -e .

Add to Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "microstructure": {
      "command": "microstructure-mcp"
    }
  }
}

Then ask the agent something like: "Pull a 4h snapshot of BTCUSDT and describe where liquidity is resting relative to the current structure."

Example output

get_liquidity_zones("BTCUSDT", "4h") →

{
  "symbol": "BTCUSDT",
  "timeframe": "4h",
  "last_close": 96420.5,
  "zones": [
    {
      "side": "buy_side",
      "level": 97180.0,
      "touches": 3,
      "swept": false,
      "distance_pct": 0.7877
    }
  ]
}

Detection logic (brief)

  • Swings — symmetric fractal window (lookback candles each side).
  • Liquidity zones — swing highs/lows clustered within tolerance_pct; ≥ min_touches equal highs = buy-side liquidity, equal lows = sell-side. Marked swept once traded through.
  • FVG — classic 3-candle gap; tracked to mitigated (price entered the zone) or filled (traded through it).
  • Order blocks — last opposite-direction candle preceding a move ≥ impulse_pct within impulse_window candles.
  • Structure — close beyond the last confirmed swing = BOS; against prevailing direction = CHoCH.

The logic is pure-Python, dependency-light, and unit-tested (pytest tests/).

Roadmap

  • [ ] Multi-timeframe confluence in get_snapshot
  • [ ] Volume-weighted liquidity scoring
  • [ ] Additional data sources (Binance, Hyperliquid)
  • [ ] SSE transport for hosted deployment
  • [ ] Backtest harness for detection-parameter tuning

Disclaimer

This server produces descriptive market-structure features, not trade signals. Nothing here is financial advice; markets can and will invalidate any structural read.

License

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured