Skip to main content
Glama
mcp-fadr-server
by ebuart

mcp-fadr-server

CI

An MCP (Model Context Protocol) server that integrates the Fadr API, enabling LLMs to separate audio stems, extract MIDI, and analyze chord progressions, key, and tempo from audio files via structured MCP tool calls.


Features

  • Stem separation — split any audio track into vocals, bass, drums, melodies, and instrumental

  • MIDI extraction — get MIDI files for each stem and the full chord progression

  • Music analysis — detect key, tempo (BPM), time signature, and chord progression

  • Structured outputs — every tool response is a strictly-typed JSON envelope; no free-text

  • Secure by default — SSRF-safe URL validation, secrets never logged, HTTPS-only

  • Async polling — handles Fadr's async task lifecycle transparently

  • Fully typed — Python 3.11+, Pydantic v2, mypy strict mode

  • Testable — mockable Fadr client, ≥ 80% test coverage enforced in CI


Related MCP server: mcp-daw

Architecture Overview

MCP Client (LLM host)
       │ JSON-RPC / stdio
       ▼
  Transport Layer     ← MCP protocol handling, tool registration
       │
       ▼
   Tools Layer        ← Input validation, response envelope wrapping
       │
       ▼
  Service Layer       ← Fadr pipeline orchestration, output normalization
       │
       ▼
   Client Layer       ← All HTTP calls to api.fadr.com (mockable)
       │
       ▼
  Schema Layer        ← Pydantic v2 models, JSON Schema export

See docs/architecture.md for the full layer diagram and design decisions.


Quickstart

1. Install

git clone https://github.com/ebuart/mcp-fadr-server.git
cd mcp-fadr-server

python -m venv .venv && source .venv/bin/activate
pip install -e .

2. Configure

cp .env.example .env
# Set your Fadr API key:
echo "FADR_API_KEY=your_key_here" >> .env

3. Run

mcp-fadr

The server listens on stdio and is designed to be launched by an MCP host.

4. Claude Desktop Integration

Claude Desktop does not inherit your shell PATH, so you must use the absolute path to the binary.

Find it with:

which mcp-fadr

Then add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "fadr": {
      "command": "/absolute/path/to/mcp-fadr",
      "env": {
        "FADR_API_KEY": "your_key_here"
      }
    }
  }
}

Restart Claude Desktop. You can now ask Claude to separate stems, extract MIDI, or analyze music.


Example Tool Calls

Separate stems

{
  "tool": "separate_stems",
  "params": {
    "audio_url": "https://example.com/my-song.mp3",
    "quality": "hqPreview"
  }
}

Response:

{
  "success": true,
  "data": {
    "job_id": "64f1a2b3c4d5e6f7a8b9c0d1",
    "processing_time_ms": 187340,
    "stems": [
      { "name": "vocals",       "url": "https://..." },
      { "name": "bass",         "url": "https://..." },
      { "name": "drums",        "url": "https://..." },
      { "name": "melodies",     "url": "https://..." },
      { "name": "instrumental", "url": "https://..." }
    ]
  },
  "error": null
}

Extract MIDI

{
  "tool": "extract_midi",
  "params": {
    "audio_url": "https://example.com/my-song.mp3"
  }
}

Analyze music

{
  "tool": "analyze_music",
  "params": {
    "audio_url": "https://example.com/my-song.mp3"
  }
}

Response:

{
  "success": true,
  "data": {
    "job_id": "64f1a2b3c4d5e6f7a8b9c0d3",
    "processing_time_ms": 19850,
    "key": "A minor",
    "tempo_bpm": 128.0,
    "time_signature": "4/4",
    "chord_progression": [
      { "chord": "Am", "start_beat": 1, "duration_beats": 4 },
      { "chord": "F",  "start_beat": 5, "duration_beats": 4 }
    ]
  },
  "error": null
}

Full schema documentation: docs/api_contract.md


Configuration

ENV Variable

Required

Default

Description

FADR_API_KEY

Yes

—

Fadr API bearer token

FADR_BASE_URL

No

https://api.fadr.com

Fadr API base URL

FADR_TIMEOUT_S

No

30

HTTP request timeout (seconds)

FADR_POLL_INTERVAL_S

No

5

Task polling interval (seconds)

FADR_POLL_TIMEOUT_S

No

300

Max task wait time (seconds)

FADR_MAX_RETRIES

No

3

Retry count on transient HTTP errors

LOG_LEVEL

No

INFO

Log level (DEBUG, INFO, WARNING, ERROR)

ALLOWED_AUDIO_SCHEMES

No

https

Comma-separated allowed URL schemes

MAX_AUDIO_SIZE_MB

No

100

Max audio download size in MB

See docs/security.md for security guidance on each variable.


Requirements

  • Python 3.11+

  • Fadr Plus subscription ($10/month) — required for API access

  • Fadr charges $0.05 per minute of audio processed


Development

pip install -e ".[dev]"
pytest --cov=server --cov-fail-under=80
ruff check .
mypy server/

Full guide: docs/development.md


Troubleshooting

Server not appearing in Claude Desktop

  1. Verify mcp-fadr is on your PATH: which mcp-fadr

  2. Check the FADR_API_KEY is set in the Claude Desktop config env block

  3. Restart Claude Desktop after config changes

  4. Check MCP server logs: Claude Desktop writes them to ~/Library/Logs/Claude/

INVALID_URL error

  • Ensure the audio URL uses https:// (not http://)

  • Ensure the URL is publicly accessible (no authentication required)

  • Check the file extension is a supported audio format: mp3, wav, aac, flac, ogg, m4a

TASK_TIMEOUT error

  • Stem separation typically takes 2–4 minutes; this is normal

  • Increase FADR_POLL_TIMEOUT_S (default: 300) if processing very long files

  • Check Fadr's status page for service disruptions

DOWNSTREAM_ERROR with HTTP 401

  • Your FADR_API_KEY is invalid or expired

  • Ensure your Fadr Plus subscription is active

DOWNSTREAM_ERROR with HTTP 402

  • You have exceeded your Fadr billing threshold

  • Check your usage at fadr.com

High latency

  • Stem separation typically takes 2–4 minutes; this is expected

  • The server polls every FADR_POLL_INTERVAL_S (default: 5s); reduce to 3s for faster responses

  • Network latency between the server and Fadr adds overhead


License

MIT — see LICENSE


Docs Index

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to build songs by editing a JSON song model: searching a licence-tagged sample library, adding step-pattern and time-stretched loop tracks, setting gain/pan, describing songs, and rendering them to 44.1 kHz WAV/MP3 with release-safety warnings. Songs and renders are read from and written to a project root, so an agent can go from empty project to finished track through MCP tool calls.
      1
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to perform deterministic, sample-accurate music production, DJ mixing, audio editing, stem separation, and loudness mastering through non-destructive timeline operations and structured MCP tools.
      Mozilla Public 2.0
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents and scripts to edit, convert, repair, separate, tune, transcribe, notate, mix, and master audio through stable versioned JSON commands, with provenance sidecars and replayable, reproducible results. Every capability is exposed as tooling an agent can chain without a GUI, including dry runs, schema introspection, and pass/fail quality gates.
      5
      Apache 2.0