mcp-calculator

quyen-nguyen-270898/mcp-calculator

3.2

If you are the rightful owner of mcp-calculator and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

The MCP Calculator is a server designed to perform calculations using the Model Context Protocol (MCP) technology, enabling seamless integration and communication with various endpoints.

MCP Multi-Tool Server

MCP servers providing calculator and music streaming capabilities.

Available Servers

1. Calculator (calculator.py)

Evaluate Python mathematical expressions

2. Music Streamer (music_streamer.py)

Search music from YouTube

3. Stream Proxy (stream_proxy.py)

Provides audio streaming endpoints for ESP32

🎵 ESP32 Music Player Setup

Complete cloud solution - no local server needed!

  1. Deploy on Render (done!)
  2. ESP32 connects to https://your-app.onrender.com/url/{video_id}
  3. First request downloads MP3 to the server cache; subsequent plays stream directly from Render.

📖 - Complete ESP32 code & setup

Quick Start:

// ESP32 code
String videoId = "FN7ALfpGxiI";  // From MCP search
String url = "https://your-app.onrender.com/url/" + videoId;
// Fetch URL → Parse JSON → Play stream

Services on Render (single public port):

  • Port 10000: Health check + MCP wrapper + /audio/{video_id}, /url/{video_id}, /stream/{video_id} (download→serve)
  • MCP: Calculator + Music search

Local Development

  1. Install dependencies:
pip install -r requirements.txt
  1. Set environment variable:
export MCP_ENDPOINT='wss://your-endpoint-url'
  1. Run locally:
python3 mcp_pipe.py

Deploy to Render

  1. Push code to GitHub

  2. Create new Web Service on Render:

    • Connect your GitHub repository
    • Select branch: main
    • Build Command: pip install -r requirements.txt
    • Start Command: python server.py
  3. Add Environment Variable:

    • Key: MCP_ENDPOINT
    • Value: Your WebSocket endpoint URL
    • (Optional) YOUTUBE_API_KEY: Official YouTube Data API key for reliable search
    • (Optional) PUBLIC_BASE_URL: Override Render external URL if auto-detection fails
  4. Deploy!

The service will:

  • Start an HTTP server on port 10000 for Render health checks
  • Run MCP pipe in background to connect calculator to your endpoint
  • Auto-restart if MCP connection fails

Health check endpoint: https://your-app.onrender.com/health

Streaming reliability tips

  • Set YOUTUBE_API_KEY so searches use the official Data API instead of scraping.
  • You can override proxy frontends without redeploying:
    • PIPED_API_INSTANCES – comma-separated list of Piped API hosts.
    • INVIDIOUS_API_INSTANCES – comma-separated list of Invidious API hosts.
  • The ESP32 stream proxy now downloads MP3 then streams from cache (default cache TTL: 6 hours, dir: /tmp/audio_cache).