语音转文本服务

Groq语音转文本MCP服务器,基于whisper-large-v3-turbo模型,支持将音频文件或URL转换为文本或JSON格式的转录。

  • by miraclebakelaser
  • TypeScript
  • 本地部署
  • 更新于
在 GitHub 查看 miraclebakelaser/Groq-Speech-to-Text-MCP-Server

使用说明

Groq语音转文本MCP服务器

用于Groq语音转文本的MCP(模型上下文协议)服务器(默认为 whisper-large-v3-turbo).

每个转录都会将输出的副本写入 ./transcripts (要么 .txt 或 .json 取决于 response_format).

先决条件

  • Node.js 20+
  • Groq API密钥

快速开始

npm install
export GROQ_API_KEY="your_groq_api_key"
npm run build
npm start

对于带有env文件的本地dev:

cp .env.local.example .env.local
# edit .env.local
npm run dev

添加到MCP客户端(stdio)

{
  "mcpServers": {
    "groq-speech-to-text": {
      "command": "node",
      "args": ["<ABSOLUTE_PATH>/groq-speech-to-text-mcp-server/dist/index.js"],
      "env": {
        "GROQ_API_KEY": "your_groq_api_key"
      }
    }
  }
}

工具

groq_transcribe_audio

转录一个或多个音频文件或URL。每个转录都会将输出的副本写入 ./transcripts.

示例(单个URL):

{
  "items": [{ "url": "https://example.com/audio.wav" }],
  "response_format": "text"
}

常见输入:

  • items:输入数组。每个项目必须提供以下内容之一 file_path 或 url.
  • items[*].save_as:保存在 ./transcripts 具有明确的文件名(仅文件名;无路径分隔符)。
  • response_format: text | json | verbose_json (时间戳需要 verbose_json).
  • timestamp_granularities: ["word"], ["segment"],或两者兼而有之(仅适用于 verbose_json).
  • include_metadata:在结构化输出中包含时间戳/元数据(对于长音频来说可能很大)。
  • output_format:工具如何格式化其 文本 响应: text | markdown | json.
  • concurrency:并发转录的最大数量(1-10)。

示例(许多输入):

{
  "items": [
    { "id": "intro", "url": "https://example.com/intro.wav", "save_as": "intro.txt" },
    { "id": "outro", "file_path": "/absolute/path/to/outro.m4a" }
  ],
  "concurrency": 4
}

备注

  • Groq语音转文本文档:https://console.groq.com/docs/speech-to-text
  • 此服务器使用Groq的OpenAI兼容端点: https://api.groq.com/openai/v1/audio/transcriptions.
  • file_path 从运行MCP服务器的机器读取。对于远程/私人文件,首选 url (例如预签名的URL)。
  • 直接文件上传限制为25MB。对于较大的媒体(例如。, .mkv 视频)、提取/压缩音频或使用 url.

配置(环境)

  • GROQ_API_KEY (必填)
  • GROQ_OPENAI_BASE_URL (可选):覆盖基本URL(默认 https://api.groq.com/openai/v1)
  • GROQ_STT_REQUEST_TIMEOUT_MS (可选):请求超时(毫秒)(默认值 300000)
  • GROQ_STT_MAX_RETRIES (可选):429/5xx的重试次数(默认值 2)
  • GROQ_STT_RETRY_BASE_MS (可选):基本退避(毫秒)(默认值 250)

发展

npm test