MCP HubMCP Hub
qeinfinity

binance-mcp-server

by: qeinfinity

binance mcp server

8created 18/12/2024
Visit
binance
exchange

📌Overview

Purpose: To provide a robust and efficient Model Context Protocol server for real-time Binance market data with seamless WebSocket integration.

Overview: The Binance MCP Server facilitates the streaming of market data for both spot and futures markets through WebSocket connections, ensuring fast and reliable updates. Its design focuses on enabling developers to implement data-driven applications with easy access to real-time financial information.

Key Features:

  • Real-time market data streaming via WebSocket: Enables developers to receive live updates on market activity.

  • Support for both spot and futures markets: Provides versatility by allowing the use of both types of trading markets.

  • Automatic reconnection with exponential backoff: Enhances reliability by automatically reconnecting after disconnections in a graceful manner.

  • Type-safe message handling: Ensures data integrity and reduces errors through strict typing.

  • Comprehensive error handling: Improves robustness by effectively managing errors that may arise during operation.


Binance MCP Server

A Model Context Protocol (MCP) server implementation for Binance market data with WebSocket support.

Features

  • Real-time market data streaming via WebSocket
  • Support for both spot and futures markets
  • Automatic reconnection with exponential backoff
  • Type-safe message handling
  • Comprehensive error handling

Installation

npm install

Usage

Starting the Server

npm start

WebSocket Stream Types

Supported stream types:

  • trade: Real-time trade data
  • ticker: 24-hour rolling window price change statistics
  • bookTicker: Best bid/ask price and quantity
  • kline: Candlestick data
  • markPrice: Mark price and funding rate (futures only)
  • fundingRate: Funding rate data (futures only)

Example Usage in Claude Desktop

// Subscribe to trade and ticker streams for BTC/USDT
await server.subscribe('BTCUSDT', 'spot', ['trade', 'ticker']);

// Handle incoming data
server.onStreamData('BTCUSDT', 'trade', (data) => {
  console.log('New trade:', data);
});

Development

Running Tests

npm test

Building

npm run build

License

Private