Skip to main content
Glama
hear-audio-mcp

hear-audio-mcp

by sinogrand
README.md
# hear-audio-mcp

MCP server exposing [hear-audio](https://github.com/sinogrand/hear-audio) to
text-only AI models over the open MCP standard (Streamable HTTP at `/mcp`).

- `analyze_audio(audio_url)` — loudness, true peak, LRA, tempo, sections,
  spectral balance, clipping + waveform/spectrogram images
- `compare_audio(url_a, url_b)` — A/B objective deltas
- `transcribe_lyrics(audio_url, lyrics?)` — faster-whisper transcript + LRC +
  alignment diff (optional dependency)

## Run locally (Windows)

Double-click `run-server.bat` (or run it from a terminal). Keep the window open.

- Listens on `http://127.0.0.1:7860/mcp` (stateless, JSON responses)
- Prints a timestamped startup log; a watchdog reports if the port is not
  reachable within 20 s (with a stack dump for diagnosis)

Env vars: `HEAR_PUBLIC_HOST` (extra allowed Host for DNS-rebinding protection),
`HEAR_PORT`, `FFMPEG_PATH`, `HEAR_MAX_BYTES` (download cap, default 80 MB),
`HEAR_ALLOW_PRIVATE=1` (allow private-address URLs for local testing only).

## Expose to the internet (Cloudflare named tunnel)

Prerequisites: the domain is on Cloudflare; cloudflared at
`D:\Ai人工智能\cloudflared\cloudflared.exe`.

1. dash.cloudflare.com → Zero Trust → Networks → Tunnels → Create a tunnel
   (Cloudflared) → name it e.g. `hear-audio` → save.
2. On the tunnel page, run the shown install command in an admin PowerShell
   (it contains a token — keep it private), e.g.:

   ```
   D:\Ai人工智能\cloudflared\cloudflared.exe service install <TOKEN>
   ```

   This registers cloudflared as a Windows service that starts at boot.
3. Public Hostname tab: subdomain `audio`, domain `sinogrand.net`,
   service type `HTTP`, URL `127.0.0.1:7860` → save.
4. Verify: `curl https://audio.sinogrand.net/mcp` reaches the server
   (an HTTP 400/406 from the MCP layer is fine — the transport is up).

## Connect from ChatGPT

chatgpt.com/plugins → + → Add custom MCP server → URL
`https://audio.sinogrand.net/mcp`, authentication: none.
Requires a plan that allows custom connectors (Plus/Pro/Business/Edu/Enterprise).

## Autostart on this machine

- cloudflared: installed as a Windows service (step 2 above) — starts at boot.
- MCP server: put a shortcut to `run-server.bat` (Start in: this folder,
  Run: Minimized) into `shell:startup`.

## Security notes

- The downloader refuses private/loopback/link-local addresses (SSRF guard),
  caps file size (80 MB default) and redirects.
- DNS-rebinding protection only accepts the configured public Host header.
- No credentials are stored in this repo.