mcp-market-server
Enables agents to access live crypto market data and execute risk-controlled paper trades through standardized MCP tool calls.
README
mcp-market-server
MCP (Model Context Protocol) server exposing live crypto market data and a paper-trading engine as standardized tool calls — so any agent (Claude Code, custom multi-agent systems) can query Bybit and execute simulated trades.
Built for the Tower Research Capital AI/ML intern application: demonstrates MCP integration, agent tool-calling, risk controls, and production-style Python.
Architecture
┌─────────────┐ MCP stdio ┌──────────────────┐ REST ┌─────────┐
│ Claude Code │ ◄───────────────► │ FastMCP Server │ ─────────► │ Bybit │
│ / Agent │ │ (tools.py) │ public API │ v5 │
└─────────────┘ └────────┬─────────┘ └─────────┘
│
┌────────▼─────────┐
│ Paper Engine │
│ SQLite + Risk │
└──────────────────┘
Tools Exposed
| Tool | Description |
|---|---|
get_klines |
OHLCV candles for any symbol/timeframe |
get_orderbook |
L2 order book snapshot |
get_ticker |
Latest price / 24h stats |
place_paper_order |
Market/limit order into paper engine (risk-guarded) |
cancel_order |
Cancel an open paper order |
get_positions |
Open positions + unrealized P&L |
get_orders |
Open/filled order history |
close_position |
Flatten a position at market |
get_account |
Cash balance, equity, realized/unrealized P&L |
Risk Guards (paper engine)
- Max notional per order (
risk.max_order_notional_usd) - Max open positions (
risk.max_open_positions) - Daily loss halt — trading disabled once daily drawdown exceeds cap
- Every order + decision is written to an audit log table
Setup
cd mcp-market-server
python -m venv .venv && .venv\Scripts\activate # Windows
pip install -e ".[dev]"
cp .env.example .env # optional overrides
pytest # run tests
Register with Claude Code
{
"mcpServers": {
"market": {
"command": "python",
"args": ["-m", "mcp_market_server.server"],
"cwd": "/absolute/path/to/mcp-market-server"
}
}
}
Or with the CLI:
claude mcp add market -- python -m mcp_market_server.server
Demo Prompts (after registering)
Fetch the last 100 hourly candles for BTCUSDT and summarize the trend.
Place a paper long of 0.01 BTCUSDT with a 2% stop loss and take profit at 3%.
Show my account, then flatten everything if unrealized PnL is worse than -$50.
Design Notes
- Public endpoints only — no API keys, no real money. Paper engine fills market orders against live ticker price, limit orders when price touches.
- SQLite for orders/positions/trades/audit — zero-dependency persistence, mirrors how quant desks log every decision.
- Risk layer sits between tools and engine — same pattern as a real desk: strategy proposes, risk disposes.
Recommended Servers
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.
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.
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.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
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.
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.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
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.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.