feat: voice + TTS voice message MCP tools #89

Merged
jlxq0 merged 1 commit from feat/tts-voice-message into main 2026-05-22 13:45:28 +00:00
Owner

Summary

  • send_voice_message: posts m.audio with the MSC3245 voice flag + MSC1767 audio block from a caller-supplied HTTPS URL, so Element renders it as a voice-memo bubble.
  • send_tts_voice_message: POSTs caller text to a configured OpenAI-compatible TTS endpoint (e.g. Chatterbox at https://tts.oddie.media/v1), parses the returned WAV for duration, uploads to the homeserver media repo, and posts the same voice-message envelope.
  • Enables ruma's unstable-msc3245-v1-compat feature for the typed voice / audio fields on AudioMessageEventContent.
  • New env vars MATRIX_MCP_TTS_BASE_URL and MATRIX_MCP_TTS_BEARER_TOKEN — both required together, or both unset (in which case send_tts_voice_message returns invalid_params). No existing tool changes behaviour.

Test plan

  • cargo fmt
  • cargo clippy --all-targets -- -D warnings
  • cargo test (164 passed including 2 new WAV-parser tests)
  • After deploy: smoke-test send_tts_voice_message against the live server in a small test room.

🤖 Generated with Claude Code

## Summary - `send_voice_message`: posts m.audio with the MSC3245 voice flag + MSC1767 audio block from a caller-supplied HTTPS URL, so Element renders it as a voice-memo bubble. - `send_tts_voice_message`: POSTs caller text to a configured OpenAI-compatible TTS endpoint (e.g. Chatterbox at https://tts.oddie.media/v1), parses the returned WAV for duration, uploads to the homeserver media repo, and posts the same voice-message envelope. - Enables `ruma`'s `unstable-msc3245-v1-compat` feature for the typed `voice` / `audio` fields on `AudioMessageEventContent`. - New env vars `MATRIX_MCP_TTS_BASE_URL` and `MATRIX_MCP_TTS_BEARER_TOKEN` — both required together, or both unset (in which case `send_tts_voice_message` returns `invalid_params`). No existing tool changes behaviour. ## Test plan - [x] `cargo fmt` - [x] `cargo clippy --all-targets -- -D warnings` - [x] `cargo test` (164 passed including 2 new WAV-parser tests) - [ ] After deploy: smoke-test `send_tts_voice_message` against the live server in a small test room. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
feat: voice + TTS voice message MCP tools
All checks were successful
CI / cargo (pull_request) Successful in 56s
CI / docker (pull_request) Successful in 2m13s
0c393016e7
Two new MCP tools for posting Matrix voice messages:

- send_voice_message: posts m.audio decorated with the MSC3245
  voice flag and MSC1767 audio block from a caller-supplied URL,
  so Element renders the event as a voice-memo bubble.
- send_tts_voice_message: POSTs text to a configured OpenAI-
  compatible TTS endpoint (e.g. Chatterbox), parses the returned
  WAV for duration, uploads to the homeserver media repo, and
  posts the same voice-message envelope as above.

Enables ruma's unstable-msc3245-v1-compat feature so the typed
voice/audio fields on AudioMessageEventContent are available.

New env vars MATRIX_MCP_TTS_BASE_URL and MATRIX_MCP_TTS_BEARER_TOKEN
(both required together, or both unset). When unset, send_tts_-
voice_message returns invalid_params; no existing tool's behaviour
changes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
jlxq0 merged commit 40a755f83e into main 2026-05-22 13:45:28 +00:00
jlxq0 deleted branch feat/tts-voice-message 2026-05-22 13:45:29 +00:00
Sign in to join this conversation.
No description provided.