Gemini 3.8 TTS OAuth 2.1 MCP Server
Generates single-speaker, multi-speaker, and scene-by-scene speech/voiceover audio using Google's Gemini 3.8 TTS models through the Gemini API/AI Studio, with voice listing and usage tracking.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Gemini 3.8 TTS OAuth 2.1 MCP Server
English | 日本語
A self-hosted OAuth 2.1 Remote MCP Server for Gemini 3.8 TTS (gemini-3.8-flash-lite-tts & gemini-3.8-flash-tts), built for Google Cloud Run and compatible with ChatGPT Web, Claude.ai, and Gemini (Web / Dev Mode / Enterprise).
You can apply monthly Google AI Pro / Ultra Cloud credits toward this deployment.
Architecture
flowchart LR
C[ChatGPT / Claude / Gemini] -->|OAuth 2.1 + Streamable HTTP /mcp| CR[Cloud Run: FastMCP Server]
CR -->|OAuth tokens & monthly usage| FS[(Firestore Free Tier)]
CR -->|Gemini 3.8 TTS v1beta| API[Gemini API via AI Studio]
C -.->|Click short URL| CR
CR -.->|/play, /audio, /dl/*.zip| U[Browser / NLE / Manim]Related MCP server: audio.ditto/tts
Key Features
Works across all 3 major Web MCP clients: Extends FastMCP v4.2.5+
GoogleProviderto bridge the refresh-token spec conflict between Gemini Connected Apps (non-rotating refresh tokens required) and Claude.ai / ChatGPT (rotating refresh tokens + single-flight grace cache for FastMCP #4901). Includes optionalMultiAuthfor Gemini Enterprise.Spend caps can pause Gemini API and Cloud Run usage. Billing and enforcement can lag, so charges can exceed a cap. Source deployments also use Cloud Build and Artifact Registry, which can incur separate build and image storage charges.
Beats the 60-second client timeout: Parallelizes multi-scene synthesis with a 25s sync window; longer batches return a
job_idfor long-polling viaget_job(claude-ai-mcp #115).Video-editing ready (
output_mode="split"): Generates an on-demand ZIP containingscenes/001_*.wav(optional 48 kHz video standard),combined.wav(with configurable silence gaps), UTF-8subtitles.srt(auto-wrapped to 2 lines), andmanifest.json(exact frame-measuredduration_secand timecodes for Premiere Pro, DaVinci Resolve, Final Cut Pro, CapCut, and Manim).Hardened for production: Fail-closed
ALLOWED_EMAILSallowlist +email_verifiedcheck, uniformK_<sha256>Firestore key sanitization (avoids google-ads-mcp #136),FernetEncryptionWrapper, 256 MB LRU + 15 min TTL memory cap, non-root Docker container, and two-stage per-user sliding-window rate limits (soft warn → hard block).
MCP Tools (5)
Tool | Description |
| Single-speaker speech, multi-speaker dialogue ( |
| Long-polls an in-progress batch job (up to 25s per call) until completion. |
| Lists your custom AI Studio voices (Voice Design / Remix / Replication) and prebuilt studio voices. |
| Real-time monthly request count, audio minutes, and estimated USD spend from Firestore. |
| Progressive-disclosure AI reference ( |
Quick Deploy (Google Cloud Run)
1. Claim Credits & Create Gemini API Key
In Google AI Studio, claim your monthly Google Cloud credits (guide). (Note: Gemini API credit drawdown requires a $5 initial prepayment.)
Disable Auto-reload in AI Studio Billing.
Create an API key (
GEMINI_API_KEY).
2. Enable Firestore & Set Spend Caps
In Google Cloud Console, create a Firestore database in Native mode (1 free database per project, Free Tier).
Under Billing → Budgets & alerts → Create budget, select Spend cap enforcement (docs) and create two monthly caps (example for a $100/month credit):
cap-gemini-api→ Service:Gemini API, Target: $80cap-cloud-run→ Service:Cloud Run, Target: $5
The monthly estimate uses $0.50 per million studio input tokens in 2026 and $1.00 from January 2027 (UTC).
3. Create Google OAuth 2.0 Web Client
Configure APIs & Services → OAuth consent screen (add your Google account as a test user).
Create an OAuth Client ID (type: Web application) and save the Client ID & Secret.
4. Create Service Account, Secrets & Deploy
export PROJECT_ID="your-gcp-project-id"
gcloud config set project "${PROJECT_ID}"
# Least-privilege service account (Firestore + Secret Manager only)
gcloud iam service-accounts create gemini-tts-mcp-sa --display-name="Gemini TTS MCP"
SA_EMAIL="gemini-tts-mcp-sa@${PROJECT_ID}.iam.gserviceaccount.com"
gcloud projects add-iam-policy-binding "${PROJECT_ID}" --member="serviceAccount:${SA_EMAIL}" --role="roles/datastore.user"
# Store secrets in Secret Manager
printf '%s' "YOUR_GEMINI_API_KEY" | gcloud secrets create gemini-api-key --data-file=-
printf '%s' "YOUR_OAUTH_CLIENT_SECRET" | gcloud secrets create oauth-client-secret --data-file=-
openssl rand -hex 32 | tr -d '\n' | gcloud secrets create jwt-signing-key --data-file=-
python3 -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode(), end='')" \
| gcloud secrets create storage-encryption-key --data-file=-
for secret in gemini-api-key oauth-client-secret jwt-signing-key storage-encryption-key; do
gcloud secrets add-iam-policy-binding "${secret}" --project="${PROJECT_ID}" \
--member="serviceAccount:${SA_EMAIL}" --role="roles/secretmanager.secretAccessor"
done
# Deploy to Cloud Run (--no-cpu-throttling keeps background TTS jobs running during polling)
gcloud run deploy gemini-tts-mcp \
--source . \
--region asia-northeast1 \
--service-account "${SA_EMAIL}" \
--allow-unauthenticated \
--no-cpu-throttling \
--min-instances 0 \
--max-instances 1 \
--memory 1Gi \
--set-env-vars "BASE_URL=https://placeholder.run.app,GOOGLE_OAUTH_CLIENT_ID=YOUR_CLIENT_ID,ALLOWED_EMAILS=you@gmail.com,GOOGLE_CLOUD_PROJECT=${PROJECT_ID}" \
--set-secrets "GEMINI_API_KEY=gemini-api-key:latest,GOOGLE_OAUTH_CLIENT_SECRET=oauth-client-secret:latest,JWT_SIGNING_KEY=jwt-signing-key:latest,STORAGE_ENCRYPTION_KEY=storage-encryption-key:latest"After deployment outputs your service URL (e.g. https://gemini-tts-mcp-xxxxx-an.a.run.app):
Update
BASE_URL:gcloud run services update gemini-tts-mcp \ --region asia-northeast1 \ --update-env-vars "BASE_URL=https://gemini-tts-mcp-xxxxx-an.a.run.app"Add the following to your Google OAuth Web Client:
Authorized JavaScript origins:
https://gemini-tts-mcp-xxxxx-an.a.run.appAuthorized redirect URIs:
https://gemini-tts-mcp-xxxxx-an.a.run.app/auth/callback
Register
https://gemini-tts-mcp-xxxxx-an.a.run.app/mcpin ChatGPT Web, Claude.ai, or Gemini and sign in.
Security Notes
By default, tools require a verified Google email in
ALLOWED_EMAILS. SettingALLOW_ANY_USER=trueadmits every verified Google account, even when an allowlist is set. All admitted users share one project’s API key, custom voices, and monthly usage totals.Synthesis requests set
store=Falsein the Interactions API. The ZIP’smanifest.jsoncontains the full script for every scene.Short-lived capability URLs: Generated playback/download endpoints (
/play/{job_id},/audio/{job_id}/...,/dl/{job_id}.zip) are unauthenticated capability URLs backed by 128-bit random IDs so browsers can play and download audio directly. Treat them as temporary secret links (do not paste them into public shared chats; they expire automatically after ~15 minutes from completion, or earlier on cache eviction, Cloud Run redeployment, restart, or scale-to-zero).
Local Development & Tests
PYTHONPATH=src python3 -m unittest discover -s tests -vDisclaimer & License
This is an unofficial community open-source project and is not affiliated with or endorsed by Google, OpenAI, or Anthropic.
Licensed under the Apache License 2.0.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Speech, transcription, voice agents, Trace, Recap, dubbing and narration with browser OAuth.
Turn text into speech, browse voices, and get MP3 audio with optional SRT or WebVTT captions.
1Generate AI images and videos, quote credit costs, manage media and track batch jobs with OAuth.
Generate English and Chinese speech, split long text, track batch jobs, and download audio.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables natural language generation of speech in any language, voice creation and management, music composition, dubbing, pronunciation dictionaries, and account history/usage through any MCP client using your own API key.MIT

audio.ditto/ttsofficial
FlicenseNot gradedqualityCmaintenanceEnables AI clients to browse voices and languages and synthesize text into downloadable audio links, including batch jobs of up to 1,000 texts.1-- AlicenseNot gradedqualityBmaintenanceEnables clients to synthesize text into audio in German, English, French, and Italian, choose voices and output formats, list available voices and formats, and delete cached audio files.Apache 2.0
- AlicenseNot gradedqualityCmaintenanceEnables text-to-speech generation with emoji vocal cues like whispers, sighs and kisses, plus multi-voice scenes where each segment uses its own voice and language across 29 voices and 22 languages, secured by OAuth 2.1.MIT