dchayes27/elevenlabs-mcp-server
If you are the rightful owner of elevenlabs-mcp-server 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 ElevenLabs MCP Server is a FastAPI-powered implementation of the Model-Context-Protocol (MCP) that integrates ElevenLabs Text-to-Speech capabilities into the MCP ecosystem.
ElevenLabs MCP Server
FastAPI-powered implementation of the Model-Context-Protocol (MCP) exposing ElevenLabs Text-to-Speech as easily consumable MCP tools.
This repo lets any MCP-compatible client list voices, generate speech, and plug high-quality audio into conversational AI flows. It runs locally or in Docker, is fully environment-configurable, and ships with tests & CI-ready linting.
1. Project Overview
• Bridges ElevenLabs’ REST API to the open-source MCP ecosystem.
• Implements initialize, tools/list, and tools/call methods.
• Secure Bearer-token access to the /mcp endpoint.
• Ships with production-ready Docker image & Compose stack.
2. Architecture Diagram
Mermaid Source (click)
flowchart TD
subgraph Client
A[MCP Client] -- HTTP/JSON --> B((FastAPI))
end
subgraph Server
B -- "/mcp" --> C[MCP Router]
C -- `text_to_speech` --> D[ElevenLabs SDK]
D -- HTTPS --> E[(ElevenLabs API)]
C -- returns --> A
end
3. Prerequisites
| Tool | Version |
|---|---|
| Python | 3.10+ |
| Docker Engine | 24+ |
| Docker Compose | v2 |
| ElevenLabs Account | API key |
4. Quick Start
Local one-liner
python -m venv .venv && source .venv/bin/activate \
&& pip install -r requirements.txt \
&& uvicorn src.main:app --reload --host 0.0.0.0 --port 8080
Visit http://localhost:8080/docs for the Swagger UI.
Docker Compose
docker compose up --build
5. Configuration
Copy & edit the template:
cp config/.env.example .env
| Variable | Default | Description |
|---|---|---|
MCP_PORT | 8080 | Listening port |
MCP_HOST | 0.0.0.0 | Bind address |
MCP_SECRET_TOKEN | – | Bearer token protecting /mcp |
ELEVENLABS_API_KEY | – | Your ElevenLabs API key |
ELEVENLABS_VOICE_ID | – | Default voice when none supplied |
MCP_SERVER_NAME | dans-mcp-server | Display name in /health |
MCP_VERSION | 1.0.0 | Advertised semantic version |
LOG_LEVEL | INFO | Logging level (DEBUG/INFO/…) |
DATABASE_URL | (commented) | Enable persistence later |
6. Running Locally (step-by-step)
python -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt
export $(grep -v "^#" .env | xargs) # load env vars
uvicorn src.main:app --reload --host "$MCP_HOST" --port "$MCP_PORT"
Docs available at http://localhost:$MCP_PORT/docs.
7. Docker Deployment
Build & tag:
docker build -t ghcr.io/<user>/elevenlabs-mcp:latest .
Push:
docker push ghcr.io/<user>/elevenlabs-mcp:latest
Compose scaling snippet:
services:
mcp:
image: ghcr.io/<user>/elevenlabs-mcp:latest
deploy:
replicas: 3
resources:
limits:
memory: 512m
env_file: .env
8. Testing & Linting
# unit + integration tests
pytest -q --cov=src tests/
# static analysis + formatting
ruff check src tests
black --check src tests
CI should fail on coverage or formatting regressions.
9. API Reference (mini)
| Path | Method | Summary |
|---|---|---|
/ | GET | Welcome & helpful links |
/health | GET | Liveness + ElevenLabs connectivity |
/mcp | POST | MCP protocol entrypoint |
Full OpenAPI spec + interactive UI live at /docs.
Additional protocol docs in .
10. Troubleshooting FAQ
| Symptom | Fix |
|---|---|
401 Unauthorized on /mcp | Pass Authorization: Bearer <MCP_SECRET_TOKEN> |
503 ElevenLabs client not available | Verify ELEVENLABS_API_KEY |
| Port already in use | Change MCP_PORT or free the port |
| Audio file not saved | Ensure ./data exists & is writable in container |
11. Contributing
See for branch strategy, code style, and issue workflow.
12. License & Acknowledgements
Licensed under the MIT License – see .
Thanks to ElevenLabs, FastAPI, Pydantic, Uvicorn, and the MCP community for their great tools & inspiration.