Skip to main content
Glama
Nayshins

Cryptocurrency Market Data MCP Server

by Nayshins

get-price

Retrieve the current price of any cryptocurrency trading pair from leading exchanges including Binance, Coinbase, and Kraken using market data integration.

Instructions

Get current price of a cryptocurrency pair from a specific exchange

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
exchangeNoExchange to use (supported: binance, coinbase, kraken, kucoin, hyperliquid, huobi, bitfinex, bybit, okx, mexc)binance
symbolYesTrading pair symbol (e.g., BTC/USDT, ETH/USDT)

Implementation Reference

  • The handler logic for the 'get-price' tool. Fetches the ticker data for the specified symbol using ccxt and returns the current price in a formatted text content block.
    if name == "get-price": symbol = arguments.get("symbol", "").upper() ticker = await exchange.fetch_ticker(symbol) return [ types.TextContent( type="text", text=f"Current price of {symbol} on {exchange_id.upper()}: {ticker['last']} {symbol.split('/')[1]}" ) ]
  • src/server.py:105-119 (registration)
    Registration of the 'get-price' tool in the list_tools handler, defining its name, description, and input schema.
    types.Tool( name="get-price", description="Get current price of a cryptocurrency pair from a specific exchange", inputSchema={ "type": "object", "properties": { "symbol": { "type": "string", "description": "Trading pair symbol (e.g., BTC/USDT, ETH/USDT)", }, "exchange": get_exchange_schema() }, "required": ["symbol"], }, ),
  • Schema definition helper function used in the inputSchema for 'get-price' tool to validate the exchange parameter.
    def get_exchange_schema() -> Dict[str, Any]: """Get the JSON schema for exchange selection.""" return { "type": "string", "description": f"Exchange to use (supported: {', '.join(SUPPORTED_EXCHANGES.keys())})", "enum": list(SUPPORTED_EXCHANGES.keys()), "default": "binance" }
  • Helper function to retrieve or initialize the ccxt exchange instance, used by the 'get-price' handler.
    async def get_exchange(exchange_id: str) -> ccxt.Exchange: """Get or create an exchange instance.""" exchange_id = exchange_id.lower() if exchange_id not in SUPPORTED_EXCHANGES: raise ValueError(f"Unsupported exchange: {exchange_id}") if exchange_id not in exchange_instances: exchange_class = SUPPORTED_EXCHANGES[exchange_id] exchange_instances[exchange_id] = exchange_class() return exchange_instances[exchange_id]

Other Tools

Related Tools

Latest Blog Posts

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/Nayshins/mcp-server-ccxt'

If you have feedback or need assistance with the MCP directory API, please join our Discord server