elevenlabs-mcp-server

dchayes27/elevenlabs-mcp-server

3.1

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

ToolVersion
Python3.10+
Docker Engine24+
Docker Composev2
ElevenLabs AccountAPI 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
VariableDefaultDescription
MCP_PORT8080Listening port
MCP_HOST0.0.0.0Bind address
MCP_SECRET_TOKENBearer token protecting /mcp
ELEVENLABS_API_KEYYour ElevenLabs API key
ELEVENLABS_VOICE_IDDefault voice when none supplied
MCP_SERVER_NAMEdans-mcp-serverDisplay name in /health
MCP_VERSION1.0.0Advertised semantic version
LOG_LEVELINFOLogging 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)

PathMethodSummary
/GETWelcome & helpful links
/healthGETLiveness + ElevenLabs connectivity
/mcpPOSTMCP protocol entrypoint

Full OpenAPI spec + interactive UI live at /docs.
Additional protocol docs in .

10. Troubleshooting FAQ

SymptomFix
401 Unauthorized on /mcpPass Authorization: Bearer <MCP_SECRET_TOKEN>
503 ElevenLabs client not availableVerify ELEVENLABS_API_KEY
Port already in useChange MCP_PORT or free the port
Audio file not savedEnsure ./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.