Skip to navigation

MCP Server

View as Markdown

Sarvam API MCP server

Official Sarvam Model Context Protocol (MCP) server. Exposes every public Sarvam API — STT (batch and realtime), TTS, text translation, transliteration, Language ID, LLM (105B and 105B Conversations), Document AI (parse, extract, classify, split), Document Translation, Dubbing, and Pronunciation Dictionaries — as first-class MCP tools so any MCP-aware client (Claude Desktop, Claude Code, Cursor, Windsurf, Zed) can call Sarvam with zero boilerplate.

For whole-file translation (PDF, Office, HTML), see the Document Translation API in the docs — the MCP server’s sarvam_tools_translate tool covers text translation only, while sarvam_tools_document_translate handles documents.

Cross-platform Python package: macOS, Windows, and Linux (Python 3.11+).

Quickstart

1. Get your API key

Sign up or log in at indus.sarvam.ai/key-management and copy your API key.

2. Add to your MCP client

Paste this JSON into your favorite agent (Cursor, Claude Desktop, Windsurf, etc.) and it’ll set up Sarvam for you:

{
"mcpServers": {
"sarvam": {
"command": "uvx",
"args": ["sarvam-mcp"],
"env": {
"SARVAM_API_KEY": "<YOUR_SARVAM_API_KEY>"
}
}
}
}

Replace <YOUR_SARVAM_API_KEY> with your actual API key.

If you installed with pip install sarvam-mcp instead, drop the args array and use the console script directly:

{
"mcpServers": {
"sarvam": {
"command": "sarvam-mcp",
"env": {
"SARVAM_API_KEY": "<YOUR_SARVAM_API_KEY>"
}
}
}
}

3. Alternative: credentials file

Instead of setting SARVAM_API_KEY in the JSON config, you can store it in ~/.sarvam/credentials:

api_key = <YOUR_SARVAM_API_KEY>

The server checks the SARVAM_API_KEY env var first, then falls back to ~/.sarvam/credentials.

Verify your install

Ask your assistant something that exercises a Sarvam tool, for example:

“Translate ‘good morning’ to Hindi using sarvam.”

Tools

All defaults below reflect the latest non-deprecated models. Tools are registered under their namespace prefix, so the name your client sees is exactly what’s in the tables below.

Speech-to-text

ToolWhat it doesDefault model
sarvam_tools_stt_transcribeAudio file → transcript. Five modes: transcribe, translate (any Indic language → English), verbatim, translit, codemixsaaras:v4
sarvam_tools_stt_realtimeMono 16-bit WAV (8000 or 16000 Hz) → realtime transcript over the WebSocketsaaras:v3-realtime
sarvam_tools_stt_batch_submitLong audio (> 30 s) → batch job; creates the job and uploads the audio for you—
sarvam_tools_stt_batch_statusPoll a batch job, returns the transcript when completed—
sarvam_tools_stt_batch_downloadFresh presigned download URLs for a finished batch job—

See Batch Speech-to-Text for the underlying job pipeline.

Text-to-speech

ToolWhat it doesDefault model
sarvam_tools_tts_speakText → audio file, written under SARVAM_MCP_BASE_PATHbulbul:v3 (default) or bulbul:v4-flash
sarvam_tools_tts_streamText → streamed audio over the TTS WebSocketbulbul:v3 (default) or bulbul:v4-flash

Speakers are model-specific: bulbul:v3 uses short names (shubh is the default), while bulbul:v4-flash uses persona IDs of the form <voice>_<lang>_<style> (default shubh_enhi_ads). See Voices for both catalogs.

Text and language

ToolWhat it doesDefault model
sarvam_tools_translateCross-language text translationmayura:v1 (11 languages, formal/colloquial/code-mixed) or sarvam-translate:v1 (22 scheduled languages + English, formal only)
sarvam_tools_transliterateScript conversion without translating meaning—
sarvam_tools_identify_languageDetect language (BCP-47) and script—
sarvam_tools_llm_completeChat completions, OpenAI-compatible message format incl. function calling and structured outputsarvam-105b (128K context) or sarvam-105b-conversations (32K, post-trained for dialogue)

Document AI

ToolWhat it doesDefault model
sarvam_tools_vision_parseFull-document OCR that keeps layout, reading order and tables → markdown (md), HTML, or JSON. Pass md, not markdownSarvam Vision
sarvam_tools_vision_extractSchema extraction — pass a JSON schema, get structured values backSarvam Vision
sarvam_tools_vision_classifyLabel the whole document, or each page with scope='page', against your categoriesSarvam Vision
sarvam_tools_vision_splitSplit a bundle of pages into separate child documents (semantic, fixed_pages, page_ranges, or triggers)Sarvam Vision
sarvam_tools_vision_job_statusPoll any Document AI job — parse, extract, classify or split—

parse replaces the old digitise job, which was renamed upstream. See Document Intelligence for job shapes.

Page limits: 30 pages per PDF for parse, 20 for extract, and 500 for split and classify. Split and Classify also accept up to 10 documents per request, 20 categories and 1,000 segments. Full table in Languages, Formats & Limits.

Document translation and dubbing

ToolWhat it doesDefault model
sarvam_tools_document_translateWhole document (PDF, Word, Excel, PowerPoint, HTML) with layout preserved, up to 12 target languages—
sarvam_tools_document_translate_statusPoll a document translation job; set export=true once a language is completed to get download links—
sarvam_tools_dubbing_submitStart an official dubbing job for a video or audio file — creates the job, uploads the media, starts processing—
sarvam_tools_dubbing_statusPoll a dubbing job, or fetch signed export URLs (video, audio, mp3, srt) that last about 24 hours—

See Dubbing API for pipeline and export formats.

Pronunciation dictionaries

ToolWhat it doesDefault model
sarvam_tools_pronunciation_listList pronunciation dictionary IDs you own—
sarvam_tools_pronunciation_getGet a dictionary’s word → pronunciation entries—
sarvam_tools_pronunciation_createCreate a dictionary to control how specific words are spoken in TTS—
sarvam_tools_pronunciation_deleteDelete a dictionary by ID—

Multi-step workflows

ToolWhat it doesDefault model
sarvam_tools_voiceVoice agent loop: transcribe an Indic audio file → LLM reply → synthesize the reply—
sarvam_tools_dubDub a short Indic audio clip into another Indic language (STT → translate → TTS)—
sarvam_tools_localizeTranslate a JSON or key=value string-table file, walking every string value (nested JSON supported)—
sarvam_tools_recallAnswer a natural-language question grounded in a set of files — audio is transcribed, text and markdown read directly—

sarvam_tools_text_analytics is still registered for compatibility but raises immediately: Sarvam retired the /text-analytics endpoint, so there is no network call to make. For document and text extraction, use the Document AI tools above.

Builder tools

Builder tools help your assistant write code that uses Sarvam. They don’t call the API.

ToolWhat it does
sarvam_code_api_referenceAuthoritative request/response shape for an endpoint — parameters, defaults, errors
sarvam_code_languagesSupported BCP-47 language codes for a given API (coverage varies by endpoint)
sarvam_code_speakersTTS speakers compatible with a model tag, e.g. bulbul:v4-flash
sarvam_code_pricingCurrent pricing and billing unit for a model
sarvam_code_snippetTested, copy-paste-ready code snippet for calling a Sarvam API
sarvam_code_recommend_modelRecommend the right model and mode from a plain-English description of what you’re building
sarvam_code_validate_requestValidate a draft request body against the canonical schema before you send it

Configuration

Env varDefaultDescription
SARVAM_API_KEY—Required. API key from indus.sarvam.ai. Falls back to ~/.sarvam/credentials.
SARVAM_API_BASE_URLhttps://api.sarvam.aiOverride for testing/staging.
SARVAM_MCP_BASE_PATH~/DesktopWhere audio/document files land.
SARVAM_AUDIO_OUTPUT_MODEfilesfiles, resources, or both — whether audio comes back as a file path, an MCP resource, or both.

Two namespaces

The server exposes tools across two namespaces:

  • sarvam_tools_*, runtime tools. Call Sarvam APIs to do things (transcribe, speak, translate, parse a document, etc.).
  • sarvam_code_*, builder tools. Help you write code that uses Sarvam: docs, endpoint shapes, language lists, code snippets, starter projects.