spark-trader
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@spark-traderWhat is my unrealized P&L?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Ran-Vain — Spark × Claude Desktop Bridge
Ask Claude "What is my unrealized P&L?" and get a live, data-driven answer sourced directly from Spark — in under two seconds.
What Is This?
Ran-Vain bridges Spark (a professional ASX trading platform) with Claude Desktop using Anthropic's Model Context Protocol (MCP). Spark delivers live market data via Dynamic Data Exchange (DDE) — a Windows-native protocol that Excel understands but AI systems don't. This project builds a four-layer translation stack so Claude can answer natural language trading questions using live ASX data.
Related MCP server: IOL MCP Tool
Architecture
Spark (live ASX feed via DDE)
│
▼
dde_client.py ← polls 6 stocks every 2 seconds
│
┌────┴────┐
▼ ▼
Redis SQLite ← real-time snapshots + historical data
└────┬────┘
▼
api/main.py ← 15 authenticated REST endpoints (FastAPI)
│
▼
spark_mcp.py ← 18 Claude tools (MCP server over stdio)
│
▼
Claude Desktop ← natural language query interfaceLayer | Component | Responsibility |
1 — DDE Listener |
| Subscribes to Spark DDE feeds; writes to Redis & SQLite |
2 — Data Store | Redis + SQLite | Redis for real-time snapshots; SQLite for historical data |
3 — API Layer |
| 15 authenticated REST endpoints |
4 — MCP Server |
| 18 Claude tools registered with Claude Desktop |
Prerequisites
Windows 10 or 11 (DDE is Windows-only)
Spark — installed and logged in
Python 3.11 — python.org/downloads
Claude Desktop — claude.ai/download
Docker Desktop — for Redis
Installation
Step 1 — Virtual environment
cd D:\spark-dde-bot
python -m venv venv
venv\Scripts\Activate.ps1Step 2 — Dependencies
pip install pywin32 redis loguru python-dotenv fastapi uvicorn httpx mcpStep 3 — Configure .env
REDIS_URL=redis://localhost:6379/0
SQLITE_PATH=dde_listener/spark_data.db
API_BASE=http://localhost:8000
API_KEY=your-strong-api-key-here
DDE_POLL_MS=2000Step 4 — Start Redis
docker-compose up -dStep 5 — Seed dummy data (first run only)
python seed_dummy_data.pyStep 6 — Start the DDE listener (open Spark first)
python dde_listener\dde_client.pyStep 7 — Start the API
uvicorn api.main:app --port 8000 --reloadStep 8 — Register MCP with Claude Desktop
Edit claude_desktop_config.json:
{
"mcpServers": {
"spark-trader": {
"command": "D:\\spark-dde-bot\\venv\\Scripts\\python.exe",
"args": ["D:\\spark-dde-bot\\mcp_server\\spark_mcp.py"],
"env": {
"API_BASE": "http://localhost:8000",
"API_KEY": "your-strong-api-key-here"
}
}
}
}Step 9 — Restart Claude Desktop
Fully close and reopen Claude Desktop. The hammer icon in the toolbar confirms the MCP server is connected.
Startup Checklist
# | Action | Verification |
1 | Start Spark and log in | Live market data visible in watchlist |
2 | Start Redis via Docker |
|
3 | Activate venv | Terminal prompt shows |
4 | Run | Logs show: |
5 | Run uvicorn |
|
6 | Open Claude Desktop | Hammer icon visible in toolbar |
7 | Test: "Show my positions" | Claude returns 6 stocks with live P&L |
Project Structure
D:\spark-dde-bot\
├── .env # Secrets and config (never commit this)
├── claude_desktop_config.json # Claude Desktop MCP registration
├── docker-compose.yml # Redis container
├── seed_dummy_data.py # One-time dummy data seeder
│
├── dde_listener/
│ ├── dde_client.py # DDE → Redis/SQLite listener
│ ├── spark_data.db # SQLite database
│ └── logs/ # Rotating logs (7-day retention)
│
├── api/
│ └── main.py # FastAPI — all 15 endpoints
│
├── mcp_server/
│ └── spark_mcp.py # MCP server — 18 Claude tools
│
└── venv/ # Python 3.11 virtual environmentAPI Endpoints
All endpoints require the X-API-Key header. Full docs at http://localhost:8000/docs.
Endpoint | Source | Description |
| Redis | All stocks — live prices, bid, ask, change, volume |
| Redis | Single stock live quote |
| Redis | Top N gainers by % change |
| Redis | Top N losers by % change |
| Redis | Stocks ranked by volume |
| Redis | Count of stocks up / down / flat |
| SQLite | Price history over last N hours |
| SQLite | High / low / avg / peak volume |
| SQLite + Redis | All positions with live P&L |
| SQLite + Redis | Single position with live P&L |
| SQLite | Today's P&L snapshot |
| SQLite | Daily P&L history with win rate |
| SQLite | Order history — filterable |
| SQLite | All orders for a specific stock |
| SQLite + Redis | Portfolio exposure % breakdown |
| SQLite | Highest unrealized P&L position |
| SQLite | Lowest unrealized P&L position |
| SQLite | Max drawdown from peak P&L |
Claude Tools (18)
Category | Tools |
Live Quotes |
|
Historical |
|
Positions |
|
P&L |
|
Orders |
|
Analytics |
|
Example Queries
"Show my open positions"
"What is my P&L today?"
"Which stocks are up today?"
"Show my BHP orders this month"
"What is my portfolio exposure?"
"What was my best trading day?"
"What is my drawdown this week?"
"Which stock has the most volume?"
"Summarise my month and tell me my biggest risk"Security
API key authentication on every endpoint via
X-API-KeyheaderFastAPI binds to
localhost:8000only — not network-exposed by defaultAll secrets stored in
.env— nothing hardcodedAll endpoints are read-only
GET— no write operations
Before production: change the API key to a strong random value (32+ characters), add
.envto.gitignore, enable Redis password auth, and add HTTPS via nginx if exposing beyond localhost.
Known Limitations
Limitation | Detail |
Windows only | DDE is Windows-exclusive — the listener cannot run on macOS or Linux |
Dummy data | Positions, orders, and P&L use seeded synthetic data pending broker API integration |
Fixed watchlist | Hardcoded to 6 symbols (BHP, FMG, CBA, NAB, PLS, WOW) |
Pull-only | Claude queries are on-demand — no price alerts or real-time push |
Read-only | Cannot place, modify, or cancel orders |
Troubleshooting
Symptom | Resolution |
| Open Spark and log in before running |
| Run |
| DDE listener isn't running or hasn't completed first poll — wait 2 seconds |
| Check paths in |
|
|
| Expected — replace seeded data with real broker data when ready |
Tech Stack
Technology | Version | Purpose |
Python | 3.11.9 | Primary runtime |
pywin32 | 306 | Windows DDE client |
Redis | 7.x | Real-time price snapshots |
SQLite | Built-in | Historical data store |
FastAPI | 0.110+ | REST API framework |
uvicorn | 0.29+ | ASGI server |
httpx | 0.27+ | Async HTTP client |
MCP SDK | Latest | Anthropic Model Context Protocol |
loguru | 0.7+ | Structured logging |
Docker | Latest | Containerised Redis |
Roadmap
Replace dummy positions/P&L with live broker API or CSV export
Register
dde_client.pyas a Windows Service for auto-start and crash recoveryRead watchlist symbols from a config file or database table
Use Spark's Watchlist DDE topic to query all symbols in a single DDE call
Add price alert monitoring that Claude can query
Expand beyond 6 ASX symbols
Ran-Vain is a read-only analytics and query tool. It does not place, modify, or cancel orders.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/shivamrawat2002/spark-mcp-bridge'
If you have feedback or need assistance with the MCP directory API, please join our Discord server