返回市场
MCP音频服务器

MCP音频服务器

作者:AIO-20307 星标更新:2025-05-27

项目介绍

MCP-Audio 插件

mcp-audio 是一个符合 AIO-2030 标准的 MCP 插件,它使用音频语音识别 API 进行语音转文字的转换。

它通过 multipart/form-database64 格式暴露了 identify_voice 方法,支持 AIO 的 tools.call 协议,并返回 JSON-RPC 结构化的输出。


功能

  • 完全符合 AIO 标准的 MCP 插件 (/tools.call, /help)
  • 使用 SiliconFlow 将 .wav/.mp3 音频文件转换成文本
  • 通过 .env 文件安全地管理 API 密钥
  • 兼容 Docker 并具有最小依赖项
  • 已准备好注册到 AIO 终端节点注册表

设置(本地)

1. 克隆并安装

git clone git@github.com:AIO-2030/mcp-audio.git
cd mcp-audio
python -m venv venv && source venv/bin/activate
pip install -r requirements.txt

2. 添加 .env 文件

cp .env.example .env

设置您的音频 URL 和 API 密钥:

AUDIO_URL=https--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

3. 运行 MCP 服务器

python src/mcp_server.py

4. Docker

4.1 构建并运行

docker build -t mcp-audio .
docker run --env-file .env -p 8080:8080 mcp-audio

API 概览

POST /api/v1/mcp/voice_model

直接上传音频文件。响应:

{
  "transcript": "hello world",
  "confidence": 0.91,
  "audio_hash": "a1b2c3..."
}

POST /api/v1/mcp/tools.call (AIO 协议)

使用 base64 编码音频的 JSON-RPC 格式。响应:

{
  "method": "tools.call",
  "params": {
    "method": "identify_voice",
    "inputs": [
      {
        "type": "audio",
        "value": "<base64-audio>"
      }
    ]
  }
}

GET /api/v1/mcp/help

自动提供 mcp_audio_registration.json 的内容。用于 Queen AI 的 MCP 发现和服务索引。

测试工具

Base64 声音测试

python test/test_audio_base64.py

健康检查

python health_check.py

MCP 注册(到 AIO 终端节点容器)

./register_mcp.sh

需要 jq, dfx 和正在运行的 endpoint_registry 容器。