- MCP Audio Server
MCP Audio Server
Content
MCP Audio Server
A Model Context Protocol (MCP) server for audio processing and chord analysis.
Quick Start
Use Docker Compose for the quickest setup:
# Clone the repository
git clone https://github.com/yourusername/mcp-audio-server.git
cd mcp-audio-server
# Start the server
docker compose up -d
Sample Request
# Analyze a WAV file
curl -X POST http://localhost:8000/analyze_chords \
-H "Content-Type: application/json" \
-d '{
"audio_data": "'$(base64 -i tests/fixtures/tempo/120bpm_with_chord.wav)'",
"format": "wav",
"options": {"model": "basic"}
}'
Sample response:
{
"schema_version": "1.0.0",
"key": "C",
"tempo": 120.5,
"chords": [
{
"time": 0.0,
"label": "C",
"confidence": 0.92
},
{
"time": 1.0,
"label": "G",
"confidence": 0.87
}
],
"duration": 4.0,
"processing_info": {
"sample_rate": 44100,
"channels": 1,
"processing_time": 0.245,
"model_used": "basic"
},
"correlation_id": "550e8400-e29b-41d4-a716-446655440000"
}
Features
- Audio file decoding and normalization with FFmpeg
- Music analysis capabilities:
- Tempo detection (BPM)
- Key detection
- Chord analysis and tracking
- RESTful API with structured responses
- JSON schema validation for inputs and outputs
- Robust error handling with descriptive messages
- Resource management with concurrency controls
- Caching for performance optimization
- Observability with structured logging and metrics
- Comprehensive test suite
- Containerized deployment with Docker
Installation
Docker (Recommended)
docker compose up -d
Manual Installation
-
Prerequisites:
- Python 3.10 or higher
- FFmpeg
- Poetry
-
Install dependencies:
poetry install -
Run the server:
poetry run uvicorn mcp_audio_server.main:app --host 0.0.0.0 --port 8000
API Documentation
The full OpenAPI specification is available at /docs when the server is running:
http://localhost:8000/docs
Endpoints
| Endpoint | Description |
|---|---|
POST /analyze_chords | Analyze audio for chords, key, and tempo |
GET /health | Health check endpoint |
GET /ready | Readiness check for load balancers |
GET /metrics | Prometheus metrics (redirects to metrics server) |
Request Format
{
"audio_data": "base64-encoded-audio-data",
"format": "wav", // "wav", "mp3", "ogg", "m4a", "flac"
"options": {
"model": "basic" // "basic" or "advanced"
}
}
Response Format
{
"schema_version": "1.0.0",
"key": "C",
"tempo": 120.0,
"chords": [
{
"time": 0.0,
"label": "C",
"confidence": 0.9
}
],
"duration": 4.0,
"processing_info": {
"sample_rate": 44100,
"channels": 1,
"processing_time": 0.245,
"model_used": "basic"
},
"correlation_id": "550e8400-e29b-41d4-a716-446655440000"
}
Error Responses
{
"error_code": "DECODING_ERROR",
"message": "Failed to decode audio file: Invalid file format",
"details": {
"format": "wav",
"error": "Invalid WAV header"
},
"correlation_id": "550e8400-e29b-41d4-a716-446655440000"
}
Development
See CONTRIBUTING.md for development guidelines.
Testing
# Run all tests with coverage reporting
pytest
# Run specific tests
pytest tests/analysis/test_tempo.py
Documentation
API documentation is generated from the FastAPI app and available at /docs.
To rebuild the documentation site:
# Install documentation dependencies
poetry install --with docs
# Build documentation
poetry run mkdocs build
# Serve documentation locally
poetry run mkdocs serve
License and Compliance
This project is licensed under the MIT License - see the LICENSE file for details.
Dependencies
All dependencies are documented in DEPENDENCIES.md with their respective licenses.
Changelog
See CHANGELOG.md for the project's version history and changes.
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
WindsurfThe new purpose-built IDE to harness magic
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
DeepChatYour AI Partner on Desktop
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Serper MCP ServerA Serper MCP Server
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题;
Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
Tavily Mcp
Playwright McpPlaywright MCP server
ChatWiseThe second fastest AI chatbot™
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
Amap Maps高德地图官方 MCP Server
CursorThe AI Code Editor