MCP
Connect an AI assistant to Sprag through MCP and call speech, transcription, voice, and decision models as tools.
The Sprag MCP server lets an AI assistant call the Sprag API as tools over the Model Context Protocol. The assistant can generate speech, transcribe a recording, design and create voices, and ask Decisions questions on your behalf.
Connect
Add a remote MCP server in your client with this URL:
https://api.sprag.ai/mcpThe first connection asks you to sign in with your Sprag account and approve access.
The connection acts under your default workspace. Tool calls draw on that workspace's credits and use its voices, the same as a request made with one of its API keys.
To connect another workspace, switch to it in the app and copy its URL from API keys.
To check the connection, ask the assistant to list the Sprag models.
Example
Asked to read a sentence aloud, the assistant calls list_voices to find a
voice, then calls generate_speech:
{
"model": "chorus",
"voice": "marin",
"input": "Hello from Sprag.",
"response_format": "wav"
}The result carries the audio inline, along with its MIME type and size in bytes.
Tools
Each tool sends one request to the endpoint in its row and returns the completed response. The client receives the full input schema of every tool when it connects.
| Tool | Endpoint | Returns |
|---|---|---|
list_models | GET /v1/models | The model catalog |
list_voices | GET /v1/audio/voices | Preset voices and your workspace's voices, one page at a time |
generate_speech | POST /v1/audio/speech | Audio |
transcribe_audio | POST /v1/audio/transcriptions | A transcript, with timestamps and speaker labels when requested |
translate_audio | POST /v1/audio/translations | Translated text |
create_chat_completion | POST /v1/chat/completions | A completion, including any tool calls the model made |
evaluate_decisions | POST /v1/decisions | One answer per question, with probabilities |
detect_turn | POST /v1/turns | An end-of-turn probability and decision |
fingerprint_voice | POST /v1/audio/voices/fingerprint | A voice fingerprint |
design_voice | POST /v1/audio/voices/design | Audio previews, each with a design_id and expires_at |
create_voice | POST /v1/audio/voices | A voice in your workspace |
delete_voice | DELETE /v1/audio/voices/{voice_id} | The deletion result |
A tool accepts the same fields as its endpoint. list_models, list_voices,
generate_speech, and transcribe_audio take those fields as top-level
arguments. The other tools take them in a request object, except
delete_voice, which takes voice_id.
create_chat_completion returns the model's tool calls to the assistant
without running them.
Send a recording
Tools that take a recording accept it as base64 in audio_base64, with a
filename that carries the file's extension:
{
"model": "rhythm",
"audio_base64": "UklGRiQAAABXQVZFZm10IBAAAAABAAEAgD4AAAB9AAACABAAZGF0YQAAAAA=",
"filename": "recording.wav"
}To produce the value from a file on disk, run
base64 < recording.wav | tr -d '\n'.
Create a voice
To create a voice from a description, call design_voice, listen to the
previews, then call create_voice with a name and the chosen preview's
design_id before its expires_at.
To clone a speaker, call create_voice with a name, a model, the
reference recording in audio_base64 and filename, and its transcript in
ref_text. A voice comes from either a recording or a design_id, not both.
delete_voice permanently deletes a voice from your workspace.
Constraints
generate_speech,transcribe_audio,translate_audio,create_chat_completion,evaluate_decisions,detect_turn,fingerprint_voice,design_voice, andcreate_voiceare billed like the endpoints they call.- If a tool call times out, the request may already be billed. Calling the tool again sends a new request.
- Every tool returns a completed response. Streaming output and realtime sessions are available through the API.
- Model and voice ids come from
list_modelsandlist_voices.
Errors
If the API refuses a tool call, the tool returns an error whose message names the HTTP status.
| Status | Meaning |
|---|---|
400 | A field was missing, malformed, or out of range. Check the tool's input schema and the model's supported parameters. |
401 | The client is not signed in, or its authorization expired. Reconnect the server in your client and sign in again. |
402 | Your workspace is out of credit. Add credit in Billing. |
404 | The model, voice, or design_id does not exist, or the preview passed its expires_at. |
429 | Your workspace is rate limited. Wait, then ask the assistant to try again. |
Next steps
For the fields each tool accepts, see the endpoint pages for text to speech, speech to text, voice design, voice cloning, and Decisions.