ofaudio-mcp
ofaudio-mcp
An agent-first MCP server for any audio an AI agent needs — generate (music, sound effects, speech, multi-speaker dialogue) and transform (transcribe, caption, isolate/denoise, voice-convert/dub) — behind one intent-shaped tool surface. It wraps ElevenLabs (speech, dialogue, SFX, voice library/design/cloning, music, transcription, isolation, speech-to-speech) and Mureka (music, lyrics), does the work in-process, and writes files to the local filesystem. Games, audiobooks, podcasts, video, ads, accessibility, localization — all one MCP.
Built to be driven by an agent, never a human clicking a UI. Every generation call returns
a job_id instantly and runs in the background, so an agent can fan out many variants
without blocking, then collect them with check_jobs.
Install
# from a checkout
pip install -e .
ofaudio-mcp # or: python -m ofaudio_mcpOnly hard dependency is the mcp SDK. Python 3.10+.
Configure (environment)
Copy .env.example to .env and fill in your keys (.env is gitignored).
Set at least one provider's key. Keys accept a singular or plural form; the plural
is comma-separated and becomes a multi-account pool (see Parallelism).
Env var | Default | Purpose |
| — | ElevenLabs key(s) — voice + SFX. Works with a subscription tier or pure pay-as-you-go. |
| — | Mureka key(s) — music. Prepaid API credits. |
|
| Where audio files are written. |
|
| Job records (JSON) + |
| all | Comma-separated tool groups to mount ( |
|
| Concurrent requests per ElevenLabs key. |
|
| Concurrent requests per Mureka key (Mureka caps at 1/account). |
|
| Seconds between polls for async (Mureka) jobs. |
|
| Max seconds to wait for one generation. |
|
| Pin a Mureka model (e.g. the V9 flagship string) once confirmed on a live key. |
|
| TTS model; drop to |
| Rachel | Default voice id when a call doesn't specify one. |
| official | Override API base URLs. |
A key entry may be label:key to name the lane in logs and job results
(e.g. MUREKA_API_KEYS="acct-a:ak_...,acct-b:ak_...").
Tools
27 tools in six groups (generate, speakers, voices, account, transform,
pronunciation); mount a subset with OFAUDIO_TOOLS. Every parameter is documented in the
tool schema itself, so an agent needs nothing beyond tools/list.
Tool | What it does |
| Themes, BGM, songs, instrumentals. Soft-defaults to Mureka (prompt→song writes its own lyrics; pass |
| Write song lyrics from a theme (Mureka) — synchronous |
| Speech-to-text (ElevenLabs Scribe). |
| Align a known script to existing audio → exact per-word timings (+ optional SRT/VTT) — for captioning recordings you already have the transcript for |
| Remove background noise / isolate the voice → |
| Speech-to-speech: re-voice a recording onto another |
| One-shots, ambience, seamless loops → |
| Dialogue / character VO. Identity = a |
| Multi-speaker scene in one call (≤10 voices, ~2000 chars) with natural turn-taking → |
| Save a reusable persona/mood preset (a preset over the speech knobs) |
| Save a speaker (pinned voice + base delivery) under a workspace |
| Saved speakers (optionally by workspace), each with its workspace |
| Search ElevenLabs' shared library of thousands of voices; every result carries a |
| Add a library voice to the account and save it under |
| Synthesize a custom voice from a text description; returns previews to audition |
| Keep a designed preview as a permanent, reusable voice (uses a voice slot) |
| Instant Voice Cloning from your audio file(s) → saved, reusable voice (uses a slot) |
| Delete a custom voice and free its slot (fresh name→id, blocks premade, warns on profile/speaker refs) |
| Both providers, one call — ElevenLabs (tier, char quota, voice slots, cloning, + |
| ElevenLabs models available on the account + capability flags |
| Batch-poll — returns status + file path per id |
| Recent jobs, newest first |
| Lock how words/lore-names are said — |
| Extend a saved dictionary (mints a new version) |
| ElevenLabs voices on the account ( |
| One voice's details (category, labels, description, preview_url) |
| Everything saved, one call: voice aliases, music presets, profiles (built-in + custom), speakers, pronunciation dictionaries, workspaces |
Each generate_* has a soft-pinned provider (music→Mureka, SFX/speech→ElevenLabs) and an
optional engine= override. A result is {job_id, status, path, duration, format, seed, provider} once succeeded.
Voices, speakers & delivery
The voice is the speaker's identity — pick or make one, don't dial it out of parameters. Three ways to get a voice, all reusable by name afterwards:
Use one of ElevenLabs' many —
search_voice_library(query="warm narrator", age="middle_aged")→add_library_voice(public_owner_id, voice_id, "narrator"). Thousands of ready-made voices.Design a custom one —
design_voice("warm, measured audiobook narrator, clear articulation", save_as="narrator"). Describe it, audition the previews, keep the best.Reuse what's on the account —
list_voices()shows the premade voices already there.
Then just generate_speech("...", voice="narrator") — the voice stays consistent.
Make it a first-class Speaker, grouped by workspace. For a whole cast across several projects,
save_speaker("narrator", voice, workspace="projectA", ...) saves the identity (pinned voice + base
delivery), and generate_speech(text, speaker="narrator", mood="calm", workspace="projectA") speaks
it — the mood layers over the speaker (a speaker is who; a profile is what mood).
search_voice_library(query) returns candidates with a preview_url each (no slots), and
add_library_voice(..., speaker="narrator", workspace="projectA") adds + saves in one step.
variants=N on generate_speech fans out N takes so a human picks the best.
Delivery (mood/tone) is a separate layer on top. Shape it with a profile and/or the
precision knobs. Built-in profiles: neutral, narrator, calm, whisper, sad, angry, excited, shout (v3, emotion via audio tags) and steady, dynamic (v2, consistency axis). Save your
own persona/mood presets with save_profile.
Two facts worth knowing (both handled for you, but they explain the design):
Eleven v3 (default for speech) does emotion via inline audio tags (
[whispers],[angry],[snorts], …) and a 3-mode stability (creative/natural/robust) — it ignores the numericstyleslider. Tags only land on an expressive voice; a flat narration voice mutes them.Eleven v2 uses the numeric sliders, but those control consistency (dynamic ↔ steady), not a specific emotion. Use it via the
steady/dynamicprofiles.
Parallelism
Mureka caps concurrency at 1 request per prepaid account and it doesn't stack, so the way to run music generation in parallel is multiple accounts. This server treats keys as a pool: supply N keys and it runs N jobs in parallel, one per key, automatically routing around a key that hits its rate limit (back-off) or runs out of balance. Supplying one key is just the N=1 case. (ElevenLabs scales concurrency within a single key by tier, so a lane count > 1 per key is the norm there.)
Mount it
Claude Code
claude mcp add ofaudio \
--env ELEVENLABS_API_KEY=xi_... --env MUREKA_API_KEY=ak_... \
-- python -m ofaudio_mcpCursor — .cursor/mcp.json:
{
"mcpServers": {
"ofaudio": {
"command": "python",
"args": ["-m", "ofaudio_mcp"],
"env": { "ELEVENLABS_API_KEY": "xi_...", "MUREKA_API_KEY": "ak_..." }
}
}
}Self-hosted / server — add the server to your MCP client's config and put the keys in a
.env next to it (they stay on the box):
ELEVENLABS_API_KEYS=xi_...
MUREKA_API_KEYS=acct-a:ak_...,acct-b:ak_...
OFAUDIO_OUT_DIR=/var/audio/ofaudio-outThe intended usage pattern is fan-out: fire many generate_* calls, then check_jobs.
Context cost
Most MCP clients load every tool schema into the model's context on every turn, so the size
of tools/list is a real cost. Claude Code defers schemas until a tool is used, but truncates
any tool description longer than 2048 characters. The surface is shaped around both:
Each tool's docstring is ≤ 700 chars; every parameter is documented in its own schema
description(nothing gets cut, and schema-rendering clients see real docs, nottitles).Tools carry MCP annotations (
readOnlyHint,destructiveHint) so clients can skip approval prompts on reads and warn ondelete_voice.The advertised schemas are compacted at startup (pydantic's
title/anyOf null/default: nullnoise stripped; validation unchanged).OFAUDIO_TOOLS=generate,accountmounts only the groups a project needs.The usage guide is served in-band as the MCP resource
ofaudio://guide(text/markdown) for clients that support resources; the same text ships as theskills/ofaudioskill.
Surface | Tools |
| ≈ tokens |
before this shaping | 33 | 42.3 KB | 12.1k |
all six groups | 27 | 33.7 KB | 9.6k |
| 9 | 13.7 KB | 3.9k |
Measure it with python scripts/tool_surface.py (honours OFAUDIO_TOOLS; exits 1 if any
description exceeds 2048 chars).
Status
Both providers work end-to-end. ElevenLabs: speech (+ timestamps, mood profiles,
variants), multi-speaker dialogue, SFX, Eleven Music, voice library / design / instant
cloning, voice lifecycle, account introspection, the speaker/workspace layer, and the transform
tools (transcribe, forced alignment, isolate, voice-convert). Mureka: instrumental + song,
prompt→song (easy-generate), user-supplied lyrics, standalone generate_lyrics, reference-track
vibe-match, and lossless flac-default output.
Design
See CLAUDE.md for the architecture, module map, tool surface, and the verified
provider facts that shape the design.
License
Source-available under PolyForm Noncommercial 1.0.0, with a licensor carve-out that draws the line at the tool, not the audio:
✅ Run it freely for any purpose — including to generate audio you use commercially. This MCP is only a client; it claims no rights in what you generate. Your rights to the generated audio are governed by ElevenLabs' and Mureka's terms and your own accounts with them.
❌ Don't commercialize the tool itself — you may not sell this software, host it as a paid service, or turn it (or a derivative) into a commercial product.
In short: make whatever audio you want, sell it if your provider terms allow — just don't sell
the MCP. See LICENSE for the full terms.