mcp播客生成器
从脚本生成播客音频的MCP(模型上下文协议)服务器。它在Docker中运行,公开一个HTTP端点,并提供 generate_podcast 该工具:
- 使用将脚本转换为语音 谷歌双子座TTS (
gemini-2.5-flash-preview-tts) - 支持 单一主机 独白和 双主机 对话格式
- 可选择添加 介绍/旁白音乐 从任何HTTPS URL(Cloudflare R2、S3等)获取
- 适用于 EBU R128响度归一化 通过FFmpeg
- 输出最终结果 MP3文件 到映射的卷
/output文件夹
入门指南
先决条件
- 码头工人 和 Docker Compose 已安装()
- A. Google AI Studio API密钥 可以访问Gemini模型(在这里买一个)
- (可选)托管在任何HTTPS URL(Cloudflare R2、S3等)上的介绍/扩展MP3
1.克隆和配置
git clone https://github.com/ivo-toby/mcp-podcast-generator.git
cd mcp-podcast-generator
cp .env.example .env打开 .env 并设置您的API密钥:
GOOGLE_API_KEY=your_api_key_here2.创建输出目录
MP3文件被写入 ./output 在主机上(映射到 /output 容器内):
mkdir -p output3.启动服务器
docker compose up第一次运行构建Docker镜像(几分钟)。成功后,你会看到:
mcp-podcast-generator | MCP Podcast Generator listening on port 3000要在后台运行(分离):
docker compose up -d4.验证它是否正在运行
curl http://localhost:3000/health
# → {"status":"ok"}常见Docker操作
# View logs (follow mode)
docker compose logs -f
# Stop the server
docker compose down
# Rebuild the image after code changes
docker compose up --build
# Remove containers and volumes (full reset)
docker compose down -v5.生成你的第一个播客
curl -s -X POST http://localhost:3000/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "generate_podcast",
"arguments": {
"type": "single",
"hosts": [{ "name": "Host", "voice": "Kore" }],
"segments": [
{ "text": "Welcome to my first AI-generated podcast episode." },
{ "text": "Today we explore how easy it is to turn a script into audio." },
{ "text": "Thanks for listening. See you next time!" }
],
"outputFilename": "first-episode.mp3"
}
}
}' | jq .成功后,您将返回输出路径和持续时间:
{
"success": true,
"outputPath": "/output/first-episode.mp3",
"durationSeconds": 18.4,
"downloadUrl": "http://localhost:3000/output/first-episode.mp3"
}您的MP3可在 http://localhost:3000/output/first-episode.mp3 在磁盘上 ./output/first-episode.mp3.
6.安装在克劳德桌面(可选)
在容器运行的情况下,将服务器添加到Claude Desktop的MCP配置中。
查找您的配置文件:
| 操作系统 | 路径 |
|---|---|
| macOS | ~/Library/Application Support/Claude/claude_desktop_config.json |
| 窗户 | %APPDATA%\Claude\claude_desktop_config.json |
| Linux | ~/.config/Claude/claude_desktop_config.json |
添加服务器:
{
"mcpServers": {
"podcast-generator": {
"command": "npx",
"args": ["mcp-remote", "http://localhost:3000/mcp"]
}
}
}Claude Desktop不直接支持流式HTTP-- mcp-remote 桥接连接。 npx 将在首次运行时自动下载。
如果您已经配置了其他MCP服务器,请添加 podcast-generator 在现有的 mcpServers 对象。
重新启动克劳德桌面。 这 generate_podcast 工具将出现在工具面板中。现在,您可以要求Claude直接生成播客:
*“使用Alex(Charon)和Sam(Aoede)制作一个关于开源未来的5分钟双主持人播客,并配有来自https://podcast.briefcast.online/assets/music/intro.mp3,并将其另存为开源ep1.mp3“*
Claude将调用该工具,并在完成后返回输出路径。
环境变量
| 变量 | 必填 | 默认 | 描述 |
|---|---|---|---|
GOOGLE_API_KEY | ✅ | — | Google AI Studio API密钥(在这里买一个) |
OUTPUT_DIR | /output | 写入MP3文件的目录 | |
TEMP_DIR | /tmp/podcast-gen | 临时处理目录 | |
PORT | 3000 | HTTP服务器端口 | |
PUBLIC_URL | http://localhost:3000 | 用于构建工具返回的下载链接的基本URL。在反向代理或远程服务器上运行时,将其设置为公共主机名。 |
MCP端点
发布 /mcp --可流式HTTP传输(JSON-RPC 2.0)
获取 /health --健康检查,退货 { "status": "ok" }
工具: generate_podcast
输入模式
{
// "single" = one host monologue, "dual" = two-host dialogue
type: "single" | "dual";
// Host configurations (1 for single, exactly 2 for dual)
hosts: Array;
// Script segments
segments: Array;
// Output filename (written to OUTPUT_DIR)
outputFilename: string; // e.g. "episode-2026-04-02.mp3"
// Optional music (any HTTPS URL: R2, S3, etc.)
introMusicUrl?: string;
outroMusicUrl?: string;
// Audio processing options
fadeInDuration?: number; // seconds, default 2
fadeOutDuration?: number; // seconds, default 3
targetLufs?: number; // LUFS target, default -16
}输出
{
"success": true,
"outputPath": "/output/episode-2026-04-02.mp3",
"durationSeconds": 245.3,
"downloadUrl": "http://localhost:3000/output/episode-2026-04-02.mp3"
}可用的双子座声音
| 声音 | 角色 |
|---|---|
Aoede | 温暖,讲故事 |
Charon | 深度、权威 |
Fenrir | 大胆、充满活力 |
Kore | 清晰、专业 |
Puck | 明亮、健谈 |
Orbit | 光滑,测量 |
Perseus | 自信、直接 |
Tethys | 冷静、体贴 |
Vega | 动感、富有表现力 |
Zubenelgenubi | 与众不同,令人难忘 |
MCP呼叫示例
单主机
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "generate_podcast",
"arguments": {
"type": "single",
"hosts": [{ "name": "Alex", "voice": "Charon" }],
"segments": [
{ "text": "Welcome to Tech Weekly, your daily dose of AI news." },
{ "text": "Today we're covering the latest developments in language models." },
{ "text": "That's all for today. Thanks for listening!" }
],
"outputFilename": "episode-2026-04-02.mp3",
"introMusicUrl": "https://your-bucket.r2.dev/intro.mp3",
"outroMusicUrl": "https://your-bucket.r2.dev/outro.mp3"
}
}
}双主机
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "generate_podcast",
"arguments": {
"type": "dual",
"hosts": [
{ "name": "Alex", "voice": "Charon" },
{ "name": "Sam", "voice": "Puck" }
],
"segments": [
{ "speaker": "Alex", "text": "Welcome back to the show! I'm Alex." },
{ "speaker": "Sam", "text": "And I'm Sam. Today we're talking about MCP servers." },
{ "speaker": "Alex", "text": "It's a fascinating topic. Let's dive in." },
{ "speaker": "Sam", "text": "Absolutely. Thanks everyone for listening!" }
],
"outputFilename": "episode-dual-2026-04-02.mp3",
"introMusicUrl": "https://your-bucket.r2.dev/intro.mp3",
"outroMusicUrl": "https://your-bucket.r2.dev/outro.mp3",
"fadeInDuration": 3,
"fadeOutDuration": 4,
"targetLufs": -16
}
}
}curl示例
curl -X POST http://localhost:3000/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "generate_podcast",
"arguments": {
"type": "single",
"hosts": [{ "name": "Host", "voice": "Kore" }],
"segments": [{ "text": "Hello world, this is a test podcast episode." }],
"outputFilename": "test.mp3"
}
}
}'音频管道
Input Script
│
▼
Gemini TTS (gemini-2.5-flash-preview-tts)
│ PCM 24kHz 16-bit mono (base64)
▼
FFmpeg: PCM → MP3 (192kbps libmp3lame)
│
▼
EBU R128 Normalization (two-pass, target: -16 LUFS)
│
├── [intro music URL] → download → fade-in
│
├── TTS audio (normalized)
│
└── [outro music URL] → download → fade-out
│
▼
FFmpeg concat (re-encoded, avoids frame boundary issues)
│
▼
Final EBU R128 normalization pass
│
▼
/output/episode.mp3与MCP客户端一起使用
添加到MCP客户端配置中:
{
"mcpServers": {
"podcast-generator": {
"command": "npx",
"args": ["mcp-remote", "http://localhost:3000/mcp"]
}
}
}发展
npm install
npm run dev # runs tsx src/index.ts directly需要 ffmpeg 和 ffprobe 本地安装用于开发。
相关
- 简报 --使用此服务器进行音频生成的完整播客管道
