MCP server for streaming market data via WebSocket
Project description
Ark Market Data MCP
An MCP (Model Context Protocol) server that streams real-time market data to Claude via WebSocket connection.
Features
- Real-time Market Data Streaming - Connects to a WebSocket server and buffers incoming market data
- MCP Integration - Works seamlessly with Claude via the Model Context Protocol
- Configurable WebSocket URL - Supports environment variable configuration for flexible deployment
- In-memory Buffering - Efficiently buffers up to 500 messages with configurable size
- Auto-reconnect - Automatically reconnects on connection failures with exponential backoff
Installation
Via PyPI
pip install ark-market-data-mcp
From Source
git clone https://github.com/arkhamides/mcp-market-data.git
cd ark-market-data-mcp
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -e .
Quick Start
1. Set up your WebSocket endpoint
The MCP server connects to a WebSocket at ws://localhost:9002 by default, you should override this:
export WS_URI=ws://your-websocket-url.com
2. Add to Claude
export WS_URI=ws://your-websocket-url.com
claude mcp add ark-market-data ark-market-data-mcp
3. Use with Claude
claude chat
Ask Claude to use the market data tools, e.g., "What's the latest market data?"
Configuration
Environment Variables
WS_URI- WebSocket server URL (default:ws://localhost:9002)
export WS_URI=wss://abc123.ngrok.io
Available Tools
The MCP server exposes the following tools for Claude:
get_latest_message- Get the most recent market message from the streamget_recent_messages- Get the last N messages (default: 10, max: 500)get_stream_status- Check WebSocket connection status and buffer statisticsclear_buffer- Clear the message buffer
Development
Run the server locally
source venv/bin/activate
WS_URI=ws://your-url python3 -m ark_market_data_mcp
Test with MCP Inspector
# Terminal 1: Start the server
source venv/bin/activate
WS_URI=ws://your-url python3 -m ark_market_data_mcp
# Terminal 2: Open the MCP Inspector
npx @modelcontextprotocol/inspector
Open http://localhost:5173 in your browser to test tools and messages.
Run tests
pytest
Architecture
┌─────────────────────────┐
│ Claude (User) │
└────────────┬────────────┘
│
│ (via stdio)
│
┌────────────▼────────────┐
│ MCP Server (Python) │
│ - Listens on stdio │
│ - Exposes tools │
└────────────┬────────────┘
│
│ (WebSocket)
│
┌────────────▼───────────────┐
│ Ark Market Data Server │
│ (Remote WebSocket) │
└────────────────────────────┘
Deployment Options
Connecting to the websocket
To connect to the WebSocket server, use the WS_URI env variable:
# Add to Claude
export WS_URI=wss://7.tcp.eu.ngrok.io:10542
claude mcp add ark-market-data ark-market-data-mcp
Troubleshooting
Connection Refused
If you see "Connection refused" errors:
- Ensure your WebSocket server is running
- Verify the
WS_URIenvironment variable is set correctly - Check firewall settings if using a remote server
No Messages Received
- Verify the WebSocket server is sending data in the expected format
- Check the logs: they show all incoming messages
- Use the
get_stream_statustool to verify connection status
MCP Tools Not Showing Up
- Restart Claude after adding the MCP
- Check that the server starts without errors
- Verify the MCP was added correctly:
claude mcp list
License
MIT
Author
arkhamides
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ark_market_data_mcp-0.1.1.tar.gz.
File metadata
- Download URL: ark_market_data_mcp-0.1.1.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
71f1490efa0ecfca283425d4b1eb903be4b51d150fd54be13126ed35c594753b
|
|
| MD5 |
d2d681b6485b987e935be014c29be004
|
|
| BLAKE2b-256 |
409096f92e91b109155804e8b2122a36fe1f4a015caa826c1dfff6b864b813de
|
File details
Details for the file ark_market_data_mcp-0.1.1-py3-none-any.whl.
File metadata
- Download URL: ark_market_data_mcp-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0669d7778a0b69ad3572b6c0bc0e5c2fa0fdd6d62ab12798f1bf3302a94a8f6f
|
|
| MD5 |
bd4089462b7381312a8eb9b155c44a64
|
|
| BLAKE2b-256 |
db24edb7a7a32c6bf437907faee437d78480d4f1eae4cfd9f69ada4ad8d283cb
|