thrid3v

๐ŸŽ™๏ธ MCP Audio Server

Community thrid3v
Updated

๐ŸŽ™๏ธ MCP Audio Server

A Model Context Protocol (MCP) server that gives AI agents the ability to process audio files โ€” transcribe speech to text, detect spoken languages, and extract audio metadata. Built with OpenAI Whisper and served over SSE (Server-Sent Events) transport for seamless integration with any MCP-compatible client.

โœจ Features

Tool Description
speech_to_text Transcribes spoken dialogue from an audio file into structured text using Whisper
detect_audio_language Analyzes the first 30 seconds of audio to predict the primary spoken language with a confidence score
get_audio_metadata Extracts technical specs โ€” duration, bitrate, sample rate, channels, format, and file size via ffprobe

Highlights

  • ๐Ÿง  Thread-safe model caching โ€” Whisper models are loaded once and reused across requests
  • ๐Ÿ”’ Strict input validation โ€” All inputs are validated with Pydantic (file existence, extension support, model size)
  • ๐Ÿ“ก SSE transport โ€” HTTP-based transport accessible by any MCP client over the network
  • ๐ŸŽ›๏ธ Multiple Whisper models โ€” Choose from tiny, base, small, medium, or large depending on accuracy/speed tradeoff
  • ๐ŸŽต Wide format support โ€” .mp3, .wav, .flac, .m4a, .ogg, .mp4, .aac

๐Ÿ“ Project Structure

mcp-audio-server/
โ”œโ”€โ”€ server.py              # MCP server entry point โ€” registers tools, runs SSE transport
โ”œโ”€โ”€ audio_processor.py     # Core processing logic โ€” transcription, language detection, metadata
โ”œโ”€โ”€ models.py              # Pydantic models โ€” request validation & standardized response format
โ”œโ”€โ”€ requirements.txt       # Python dependencies
โ”œโ”€โ”€ speech-text-MCP.json   # Pre-built n8n workflow for AI agent integration
โ””โ”€โ”€ tests/
    โ””โ”€โ”€ test_models.py     # Unit tests for input validation and response serialization

๐Ÿ› ๏ธ Prerequisites

  • Python 3.10+
  • ffmpeg (required for audio metadata extraction and Whisper audio loading)
    • Windows: winget install ffmpeg or download from ffmpeg.org
    • macOS: brew install ffmpeg
    • Linux: sudo apt install ffmpeg
  • GPU (optional) โ€” Whisper will use CUDA if available, otherwise falls back to CPU

๐Ÿš€ Getting Started

1. Clone the repository

git clone https://github.com/<your-username>/mcp-audio-server.git
cd mcp-audio-server

2. Create a virtual environment and install dependencies

Using uv (recommended):

uv venv
uv pip install -r requirements.txt

Or with standard pip:

python -m venv .venv

# Windows
.venv\Scripts\activate

# macOS / Linux
source .venv/bin/activate

pip install -r requirements.txt

3. Start the server

python server.py

The server starts on http://127.0.0.1:8000 with the following endpoints:

Endpoint Purpose
http://127.0.0.1:8000/sse SSE connection endpoint for MCP clients
http://127.0.0.1:8000/messages/ JSON-RPC message endpoint

๐Ÿงช Testing

MCP Inspector

The MCP Inspector is the easiest way to test the server interactively:

npx @modelcontextprotocol/inspector
  1. Open the Inspector UI in your browser
  2. Set Transport Type โ†’ SSE
  3. Set URL โ†’ http://127.0.0.1:8000/sse
  4. Click Connect
  5. Select any tool and provide an absolute path to an audio file

Unit Tests

pytest tests/ -v

๐Ÿ”Œ Integration

n8n Workflow

A pre-built n8n workflow is included in speech-text-MCP.json. It sets up a complete AI agent pipeline:

Chat Trigger โ†’ AI Agent โ†’ Google Gemini LLM
                  โ†•              โ†•
            MCP Client     Buffer Memory
        (this server)

To import:

  1. Start n8n (npx n8n)
  2. Go to Workflows โ†’ Import from File
  3. Select speech-text-MCP.json
  4. Configure your Google Gemini API credentials in the Google Gemini Chat Model node
  5. Ensure this MCP server is running on http://127.0.0.1:8000
  6. Activate the workflow and start chatting โ€” the AI agent can now transcribe audio, detect languages, and extract metadata on demand

Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "audio-server": {
      "url": "http://127.0.0.1:8000/sse"
    }
  }
}

Any MCP Client

Connect to the SSE endpoint at http://127.0.0.1:8000/sse using any MCP-compatible client. The server exposes three tools that are automatically discoverable through the MCP protocol.

๐Ÿ“– API Reference

speech_to_text

Transcribes audio to text using OpenAI Whisper.

Parameters:

Parameter Type Default Description
audio_path string required Absolute path to the audio file
model_size string "base" Whisper model variant: tiny, base, small, medium, large

Response:

{
  "status": "success",
  "data": {
    "text": "The transcribed text content...",
    "language": "en"
  }
}

detect_audio_language

Identifies the spoken language from the first 30 seconds of audio.

Parameters:

Parameter Type Default Description
audio_path string required Absolute path to the audio file

Response:

{
  "status": "success",
  "data": {
    "detected_language": "en",
    "confidence_score": 0.9847
  }
}

get_audio_metadata

Extracts technical metadata using ffprobe.

Parameters:

Parameter Type Default Description
audio_path string required Absolute path to the audio file

Response:

{
  "status": "success",
  "data": {
    "format_name": "mp3",
    "duration_seconds": 245.67,
    "size_bytes": 3932160,
    "bit_rate": "128000",
    "sample_rate": "44100",
    "channels": 2
  }
}

Error Response

All tools return a standardized error format on failure:

{
  "status": "error",
  "message": "Validation failed: The path '/bad/path.mp3' does not exist on this machine."
}

โš™๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                     MCP Client                          โ”‚
โ”‚         (Claude, n8n, Inspector, etc.)                  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                       โ”‚ SSE (HTTP)
                       โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  server.py โ€” FastMCP Server                              โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚
โ”‚  โ”‚ speech_to_text โ”‚ detect_language   โ”‚ get_metadata   โ”‚  โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚
โ”‚          โ”‚                 โ”‚                 โ”‚            โ”‚
โ”‚          โ–ผ                 โ–ผ                 โ–ผ            โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚
โ”‚  โ”‚  models.py โ€” Pydantic Validation Layer            โ”‚   โ”‚
โ”‚  โ”‚  (AudioPathMixin, TranscriptionRequest, etc.)     โ”‚   โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚
โ”‚                          โ–ผ                               โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚
โ”‚  โ”‚  audio_processor.py โ€” Processing Engine           โ”‚   โ”‚
โ”‚  โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚   โ”‚
โ”‚  โ”‚  โ”‚   Whisper    โ”‚  โ”‚  Whisper   โ”‚  โ”‚  ffprobe   โ”‚  โ”‚   โ”‚
โ”‚  โ”‚  โ”‚ transcribe() โ”‚  โ”‚ detect()  โ”‚  โ”‚  metadata  โ”‚  โ”‚   โ”‚
โ”‚  โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚   โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ“ License

This project is open source. See LICENSE for details.

MCP Server ยท Populars

MCP Server ยท New

    WJZ-P

    Douyin Upload MCP Skill

    MCP Server

    Community WJZ-P
    pwno-io

    pwno-mcp

    MCP for Pwn

    Community pwno-io
    antoinebou12

    UML-MCP: Diagram Generation via MCP

    UML-MCP Server is a UML diagram generation tool based on MCP (Model Context Protocol), which can help users generate various types of UML diagrams through natural language description or directly writing PlantUML and Mermaid and Kroki https://uml-mcp.vercel.app/docs

    Community antoinebou12
    JeremyVyska

    BC Code Intelligence MCP Server

    BC Code Intelligence MCP Server - Persona-driven workflow orchestration for Business Central development. Provides 16+ MCP tools, layered knowledge system, and intelligent BC pattern analysis through Model Context Protocol.

    Community JeremyVyska
    noimank

    FNewsCrawler ๏ผˆ่ฏฅ้กน็›ฎๅทฒๆ”พๅผƒ็ปดๆŠค๏ผ‰

    ไธ€ไธชไธ“้—จไธบๅคงๆจกๅž‹่ฎพ่ฎก็š„่ดข็ปไฟกๆฏMCP๏ผˆModel Context Protocol๏ผ‰ๆœๅŠก๏ผŒ้€š่ฟ‡้ซ˜ๆ•ˆ็š„็ˆฌ่™ซๆŠ€ๆœฏไปŽๅ„ๅคง่ดข็ป็ฝ‘็ซ™๏ผˆๅŒ่Šฑ้กบใ€ไธœๆ–น่ดขๅฏŒ็ญ‰๏ผ‰่Žทๅ–ๅฎžๆ—ถ่ต„่ฎฏ๏ผŒไธบAIๆจกๅž‹ๆไพ›ๅ‡†็กฎใ€ๅŠๆ—ถ็š„่ดข็ปๆ•ฐๆฎๆ”ฏๆŒใ€‚

    Community noimank