> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gnani.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# MCP Server

> Use Gnani Speech-to-Text and Text-to-Speech from Cursor, Claude, Codex and other AI coding agents through the gnani-mcp server.

## Overview

`gnani-mcp` is the official Gnani [MCP](https://modelcontextprotocol.io) (Model Context Protocol) server. It gives an AI coding agent such as Cursor, Claude Code, Claude Desktop or Codex a set of tools for Gnani Speech-to-Text (Prisma) and Text-to-Speech (Timbre). You ask for what you want in plain English, for example *"Transcribe `/Users/me/call.wav` in Hindi"*, and the agent picks the tool, fills in its inputs and shows you the result.

```text theme={null}
You   "Transcribe call.wav in Hindi"
 │
 ▼
Coding agent (Cursor / Claude / Codex)     picks a tool and fills in its inputs
 │
 ▼
gnani-mcp                                  runs on your computer
 │
 ▼
Gnani API                                  uses your API key
```

The server runs **on your own computer**. It reads audio files from your disk, sends them to the Gnani API, and saves any generated audio back to your disk.

| Capability | What you can ask for |
| - | - |
| **Speech-to-Text** | Transcribe recordings in 10 Indian languages, from short clips to 4-hour files. Prisma v2.5 and Prisma v3.0. |
| **Text-to-Speech** | Generate speech from text with Timbre v2.5 (42 voices) or Timbre v3.0 (34 voices, expressive audio tags). |

***

## Installation

You need a Gnani API key from [app.gnani.ai](https://app.gnani.ai) and **one** of these ways to start the server. Your agent starts the server for you, so there is nothing to keep running.

> [tab] uv (recommended)
>
> Install [`uv`](https://docs.astral.sh/uv/) once. Your agent then runs `uvx gnani-mcp`, which downloads and starts the server on demand.
>
> ```bash theme={null}
> # macOS (Homebrew)
> brew install uv
>
> # macOS or Linux
> curl -LsSf https://astral.sh/uv/install.sh | sh
> ```
>
> On Windows (PowerShell):
>
> ```powershell theme={null}
> powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
> ```
>
> Open a new terminal and check it with `uv --version`.

> [tab] pip
>
> The server needs **Python 3.10 or newer**. Install it into a virtual environment:
>
> ```bash theme={null}
> python3 -m venv ~/.gnani-mcp-venv
> ~/.gnani-mcp-venv/bin/pip install gnani-mcp
> ```
>
> On Windows (PowerShell):
>
> ```powershell theme={null}
> python -m venv $HOME\.gnani-mcp-venv
> $HOME\.gnani-mcp-venv\Scripts\pip install gnani-mcp
> ```
>
> The program is then at `~/.gnani-mcp-venv/bin/gnani-mcp` (Windows: `%USERPROFILE%\.gnani-mcp-venv\Scripts\gnani-mcp.exe`). Wherever a config below says `"command": "uvx"`, use this full path instead and drop the `args` line.

> [!NOTE]
>
> The 34 Timbre v3.0 voices and the Timbre v3.0 speed range (0.8 to 1.2) need `gnani-mcp` **0.2.2 or newer**. Upgrade with `pip install -U gnani-mcp`, or run `uvx gnani-mcp@latest` so `uvx` picks up the newest release.

***

## Set your API key

Your agent starts the server as a separate background program, so the key has to be handed to it **when it starts**. A key you typed into a terminal earlier is not visible to it. The server looks in two places, in this order:

| Order | Place | Typical use |
| - | - | - |
| 1 | The `GNANI_API_KEY` environment variable of the server | The `env` block in your agent's config (used in every example below) |
| 2 | The file `~/.gnani/credentials` | A one-time setup that works with every agent and keeps the key out of config files |

The first one found wins, so an old key in your config overrides a correct key in the file. If neither exists, the server still starts, but every call that needs the API fails with a message that says the key is missing.

**The credentials file** (macOS or Linux):

```bash theme={null}
mkdir -p ~/.gnani
printf 'api_key = YOUR_GNANI_API_KEY\n' > ~/.gnani/credentials
chmod 600 ~/.gnani/credentials
```

On Windows (PowerShell):

```powershell theme={null}
New-Item -ItemType Directory -Force "$HOME\.gnani" | Out-Null
Set-Content "$HOME\.gnani\credentials" 'api_key = YOUR_GNANI_API_KEY'
```

> [!WARNING]
>
> The line must read `api_key = your-key`, with `api_key` in lowercase. A line such as `GNANI_API_KEY=...` in this file is silently ignored. Treat the key like a password: do not commit it to Git or paste it into chats.

***

## Connect your agent

Every agent needs the same three values:

| Setting | Value |
| - | - |
| **Command** | `uvx` (or the full path to `gnani-mcp` if you installed with pip) |
| **Arguments** | `gnani-mcp` |
| **Environment** | `GNANI_API_KEY` set to your key (optional if you use the credentials file) |

Replace `YOUR_GNANI_API_KEY` in the examples with your real key.

> [tab] Cursor
>
> Edit `~/.cursor/mcp.json` (Windows: `%USERPROFILE%\.cursor\mcp.json`), or `.cursor/mcp.json` inside a project. Create the file if it does not exist.
>
> ```json theme={null}
> {
>   "mcpServers": {
>     "gnani": {
>       "command": "uvx",
>       "args": ["gnani-mcp"],
>       "env": {
>         "GNANI_API_KEY": "YOUR_GNANI_API_KEY"
>       }
>     }
>   }
> }
> ```
>
> To keep the key out of the file, use `"env": { "GNANI_API_KEY": "${env:GNANI_API_KEY}" }`, or leave `env` out and use the credentials file.
>
> Open Cursor's Customize panel (or Settings → MCP). `gnani` should be listed and switched on, showing 8 tools. If it is not, open the Output panel and choose **MCP Logs**. Cursor asks for approval the first time the agent uses each tool.

> [tab] Claude Code
>
> Run one command. `--env` goes after the server name and before the `--`:
>
> ```bash theme={null}
> claude mcp add gnani --env GNANI_API_KEY=YOUR_GNANI_API_KEY -- uvx gnani-mcp
> ```
>
> Check it with `claude mcp list`, which should show `gnani` as `✔ Connected`, or type `/mcp` inside a session.
>
> To share the server with a team, put it in a `.mcp.json` file in the project root and leave the key out so it is not committed:
>
> ```json theme={null}
> {
>   "mcpServers": {
>     "gnani": {
>       "command": "uvx",
>       "args": ["gnani-mcp"]
>     }
>   }
> }
> ```
>
> The server then reads the key from `~/.gnani/credentials`. The first time you start `claude` in a project with a `.mcp.json`, it asks you to approve the server.

> [tab] Claude Desktop
>
> Open the config file (Settings → Developer → Edit Config):
>
> * macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
> * Windows: `%APPDATA%\Claude\claude_desktop_config.json`
>
> ```json theme={null}
> {
>   "mcpServers": {
>     "gnani": {
>       "command": "uvx",
>       "args": ["gnani-mcp"],
>       "env": {
>         "GNANI_API_KEY": "YOUR_GNANI_API_KEY"
>       }
>     }
>   }
> }
> ```
>
> **Quit and reopen** Claude Desktop (closing the window is not enough), then start a new chat. The tools icon in the message box lists the `gnani` tools.
>
> Desktop apps do not always inherit your terminal's `PATH`. If you see `spawn uvx ENOENT`, replace `"uvx"` with its full path, which `which uvx` (macOS or Linux) or `where uvx` (Windows) prints.

> [tab] Codex
>
> Run one command:
>
> ```bash theme={null}
> codex mcp add gnani --env GNANI_API_KEY=YOUR_GNANI_API_KEY -- uvx gnani-mcp
> ```
>
> Or edit `~/.codex/config.toml`:
>
> ```toml theme={null}
> [mcp_servers.gnani]
> command = "uvx"
> args = ["gnani-mcp"]
> startup_timeout_sec = 60     # the first run downloads the package
> tool_timeout_sec = 1800      # long transcriptions can take many minutes
>
> [mcp_servers.gnani.env]
> GNANI_API_KEY = "YOUR_GNANI_API_KEY"
> ```
>
> Keep the two timeout lines. By default Codex gives a server 10 seconds to start and a tool call 60 seconds to finish, which is too short for the first download and for long transcriptions. Type `/mcp` to see active servers.

> [tab] Windsurf and Zed
>
> **Windsurf:** in the Cascade panel, open the MCPs menu and choose *Open MCP config file*. Add the same `mcpServers` entry as Cursor, then press the refresh button in the MCP panel. The file is `~/.config/devin/mcp_config.json` on macOS and Linux and `%APPDATA%\devin\mcp_config.json` on Windows. Older installs use `~/.codeium/windsurf/mcp_config.json`.
>
> **Zed:** open the settings file (`zed: open settings file`) and add the entry under `context_servers`, not `mcpServers`:
>
> ```json theme={null}
> {
>   "context_servers": {
>     "gnani": {
>       "command": "uvx",
>       "args": ["gnani-mcp"],
>       "env": { "GNANI_API_KEY": "YOUR_GNANI_API_KEY" }
>     }
>   }
> }
> ```
>
> Any other client that supports MCP **stdio** servers works with the same command, arguments and environment. Run `uvx gnani-mcp --print` to print a ready-made config snippet for your machine.

### Check that it works

Ask your agent: *"List my recent Gnani batch transcription jobs."* This asks the API for your jobs and does not process any audio, so it proves the server found your key and the API accepted it.

| What you get | What it means |
| - | - |
| A list of jobs (it may be empty) | The key is found and accepted. You are set. |
| `GNANI_API_KEY is not set. ...` | The server did not find a key. See [Set your API key](#set-your-api-key), then restart the agent. |
| `[HTTP 401 INVALID_API_KEY] Unauthorized` | A key was found but the API rejected it. Re-copy it from [app.gnani.ai](https://app.gnani.ai). |

Do not use *"list the voices"* as the test. That tool reads a catalog built into the server and works even with no key.

***

## Example prompts

Give **full file paths** (such as `/Users/me/audio/call.wav`) so the server can find your files. Generated audio is saved as a file, and the tool's response gives its location (your Desktop by default).

**Transcribe a recording**

* *"Transcribe `/Users/me/audio/customer-call.wav`. It is in Hindi."*
* *"Transcribe this clip and detect the language automatically: `/Users/me/audio/clip.mp3`. Use the newest model."*
* *"Transcribe `/Users/me/audio/sales-call.wav` in Hindi and make sure these words are spelled right: Gnani, Vachana, Prisma."*

**Transcribe long audio**

* *"This is a 2-hour recording: `/Users/me/audio/long-call.mp3`. Transcribe it in Tamil and tell me who said what."*
* *"Show me my recent batch transcription jobs, then give me the transcript of the last completed one."*

**Generate speech**

* *"Read this out in a Hindi female voice and save it as an MP3: 'नमस्ते, गनानी में आपका स्वागत है।'"*
* *"What voices are available for Telugu? Describe the options."*
* *"Say this with a laugh in the middle, using a female voice on the newest voice model: 'Let me check… `<laugh>` found it!'"*
* *"Make an 8 kHz telephone-quality version of this announcement for a call-centre IVR."*

**Combine tasks**

* *"Transcribe `/Users/me/call.wav` in Hindi, summarize it in three bullets, then read the summary back as audio in a female English voice."*

***

## Tools

The server provides 8 tools. You normally ask in plain English and the agent chooses one.

| Tool | What it does |
| - | - |
| `gnani_stt_transcribe` | Transcribe a short clip (up to 30 seconds) right away |
| `gnani_stt_batch_transcribe` | Transcribe long audio (up to 4 hours) or a URL, start to finish |
| `gnani_stt_batch_list_jobs` | List your batch jobs (filter by status, newest first) |
| `gnani_stt_batch_status` | Check the progress of a batch job |
| `gnani_stt_batch_get_transcripts` | Download the transcripts of a finished batch job |
| `gnani_stt_batch_cancel` | Cancel a batch job that has not finished |
| `gnani_tts_synthesize` | Turn text into speech and save an audio file |
| `gnani_tts_list_voices` | Browse the voices of a Timbre model |

### Speech-to-Text

Both transcription tools take a `model`: `prisma-v2.5` (the default) or `prisma-v3.0`.

| | **Prisma v2.5** (default) | **Prisma v3.0** |
| - | - | - |
| Language | You choose exactly one language | One model for all 10 languages. It can detect the language (`indic-auto`) or take 1 to 4 language hints. |
| Output styles | `verbatim`, `transcribe` | `verbatim`, `transcribe`, `codemix` (English words stay in Latin letters), and `transliterate` (short clips only) |
| Extras | `itn_native_numerals`, and word boosting with `bias_list` and `bias_score` | Context hints: `keyterms`, `topic`, `previous_text`, `speaker_names`. The reply reports `detected_language_code`. |

If you leave the style out, Prisma v2.5 uses `verbatim`. Prisma v3.0 uses `transcribe` for a single `hi-IN` or `en-IN` language and `verbatim` otherwise. Ask for a style explicitly to keep output the same across models.

**`gnani_stt_transcribe`** transcribes audio up to 30 seconds and returns the text at once. Give the audio as one of `audio_path`, `audio_base64` or `audio_url` (the last two also need `filename`). Audio sent as base64 or fetched from a link can be at most 25 MB. It accepts WAV, MP3, OGG, FLAC, AAC and M4A, and returns `transcript`, `model`, `request_id` and, on v3.0, `detected_language_code`.

**`gnani_stt_batch_transcribe`** handles recordings up to 4 hours. One call creates the job, starts it, checks progress every 10 seconds (up to 30 minutes) and fetches the transcripts, so the agent waits while it runs.

| Parameter | What it means |
| - | - |
| `language_code` | Required. v2.5: one code, or up to 3 for per-file detection. v3.0: `indic-auto` or 1 to 4 codes. |
| `audio_path` or `audio_url` | A local file or a public link (4 hours maximum). Local files over 10 MB are sent through the API's large-file route, which is not available on the production API yet. Until it is, host big files and pass `audio_url`, or split them under 10 MB. One file per call: ZIPs, multi-file jobs and cloud-storage sources are not supported through the MCP server. |
| `with_diarization`, `num_speakers` | Separate the speakers. `num_speakers` (1 to 8) is an upper limit, not a target. |
| `with_denoise` | Clean up noisy audio first. Leave it off for clean recordings. |
| `bias_list`, `bias_score` | Prisma v2.5 only, word boosting: up to 100 single words (letters only) to favour, with a strength of 0.0, 0.5, 1.0, 1.5 or 2.0 (default 1.0). |
| `format`, `keyterms`, `topic`, `speaker_names` | Prisma v3.0 only. Use one of `keyterms`, `topic`, `topic` plus `keyterms`, or `speaker_names`. `topic` must be 30 to 1,600 characters. |
| `callback_url` | An HTTPS address that Gnani calls when the job finishes. |

Batch accepts WAV, MP3, MP4, FLAC, OGG, Opus, M4A, AAC, WebM and AMR. If the call is cut short, for example when your agent times out, the job keeps running on Gnani's servers. Use `gnani_stt_batch_list_jobs`, `gnani_stt_batch_status` and `gnani_stt_batch_get_transcripts` to pick it up.

### Text-to-Speech

| | **Timbre v2.5** (default) | **Timbre v3.0** |
| - | - | - |
| Voices | 42, each with one preferred language | 34, each speaks **all 10 languages** |
| Speed | `0.85` to `1.15` | `0.8` to `1.2` (the service snaps it to `0.8`, `1.0` or `1.2`) |
| Expressive tags | Not supported. Tags are removed and you get a warning. | Supported, such as `<laugh>` and `<whispers>`. |

**Voices belong to one model.** A Timbre v2.5 voice name does not work with Timbre v3.0, and the other way round. If you ask for a voice that belongs to the other model, the tool stops before calling the API and tells you which model it belongs to. See [Available voices](https://docs.gnani.ai/api/TTS/available-voices.md) for the full catalogs.

**`gnani_tts_synthesize`**

| Parameter | What it means |
| - | - |
| `text` | Required. What to say. |
| `voice` | Required. A voice name from the chosen model's catalog (not case-sensitive). |
| `model` | `timbre-v2.5` (default) or `timbre-v3.0`. |
| `language` | `auto` (default, detected from the script), or a code such as `hi-IN`, or `hi-en` for Hinglish. With v2.5, match the voice's language. |
| `speed` | Optional. Leave it out and the voice's recommended speed is used. Otherwise the range depends on the model, as in the table above. A value outside the range is rejected before the API is called. |
| `container` | `wav` (default), `mp3`, `ogg` (Opus), `raw`, `mulaw`, `alaw`. `mulaw` and `alaw` are phone formats and always 8,000 Hz. |
| `sample_rate` | 8000, 16000, 22050, 24000, 44100 or 48000 Hz (default 48000). |
| `bitrate` | MP3 only: `32k`, `64k`, `96k`, `128k` or `192k`. |

It returns `audio_file` (the saved file's full path), `size_bytes`, `model`, `voice`, `language`, `container`, `encoding`, `sample_rate`, and `warnings` if something was adjusted.

**Expressive tags (Timbre v3.0 only).** Put them inline in `text`: `<laugh>`, `<giggle>`, `<sigh>`, `<exhales>`, `<sniffles>`, `<yawns>`, `<coughs>`, `<clears throat>`, `<whispers>`, `<shouting>`, `<excited>`, `<slow>` and `<pauses>`. A tag applies from where it appears until the next tag. `<pauses>` adds silence and is never spoken. Tags are billed as characters. A tag the service does not know is removed, and you get a warning listing the supported tags. See [Audio tags](https://docs.gnani.ai/api/TTS/tts-audio-tags.md).

**`gnani_tts_list_voices`** lists a model's voices with gender, persona and description. It takes `model`, an optional `gender` (`Male` or `Female`) and, for Timbre v2.5 only, an optional `language`. It reads a catalog built into the server and makes no API call.

## Languages

Speech-to-Text works in the same 10 languages as the API: Bengali (`bn-IN`), English (`en-IN`), Gujarati (`gu-IN`), Hindi (`hi-IN`), Kannada (`kn-IN`), Malayalam (`ml-IN`), Marathi (`mr-IN`), Punjabi (`pa-IN`), Tamil (`ta-IN`) and Telugu (`te-IN`). Prisma v3.0 also accepts `indic-auto` and comma-separated hints such as `hi-IN,en-IN`. See [Languages](https://docs.gnani.ai/api/STT/languages.md).

Text-to-Speech uses the same 10 languages plus `auto`. Timbre v2.5 also has one Hinglish voice (`hi-en`).

***

## Settings

You normally only need the API key.

| Setting | Default | What it does |
| - | - | - |
| `GNANI_API_KEY` | none | **Required.** Your Gnani API key (or use `~/.gnani/credentials`). |
| `GNANI_MCP_BASE_PATH` | `~/Desktop` | The folder where generated audio is saved. Set it to a project folder to keep your Desktop tidy. |

Set them in the `env` block of your agent's config:

```json theme={null}
"env": {
  "GNANI_API_KEY": "YOUR_GNANI_API_KEY",
  "GNANI_MCP_BASE_PATH": "/Users/me/projects/audio-output"
}
```

The folder is created if it does not exist. Files are named with the tool and the date and time, such as `gnani_tts_20261103_175002_945517.wav`.

***

## Run it as a local web service

By default your agent talks to the server through its standard input and output (the *stdio* transport), and the server starts and stops with the agent. Some clients want a web address instead. You can run the same server yourself, on your own machine, over HTTP:

```bash theme={null}
GNANI_API_KEY="YOUR_GNANI_API_KEY" gnani-mcp --transport http --host 127.0.0.1 --port 8000 --path /mcp
```

Then point your client at `http://127.0.0.1:8000/mcp`. In Cursor, for example:

```json theme={null}
{ "mcpServers": { "gnani": { "url": "http://127.0.0.1:8000/mcp" } } }
```

`--transport` accepts `stdio` (the default), `http`, `sse` or `streamable-http`.

* **The key goes to the server, not the client.** You start the server, so the key must be in the environment of the terminal that starts it, or in `~/.gnani/credentials`. Putting it in the client's config does nothing.
* **There is no login on the web address.** Anyone who can reach the port can use your Gnani account through the server. Keep `--host 127.0.0.1` so only your own computer can connect, and do not expose the port to a network.

***

## Troubleshooting

| Symptom | Likely cause and fix |
| - | - |
| The server does not appear in my agent | The config file is in the wrong place or is not valid JSON. Check for missing commas or quotes, then restart the agent (for Claude Desktop, quit it fully). |
| `command not found` or `spawn uvx ENOENT` | The agent cannot find `uvx`. Install `uv`, open a new terminal, and use the full path from `which uvx` (Windows: `where uvx`) as the `command`. |
| The server fails or times out on first start (Codex) | The first launch downloads the package. Set `startup_timeout_sec = 60`. |
| A long transcription fails with a timeout | Your agent's tool timeout is too short, and the batch tool can wait up to 30 minutes. In Codex set `tool_timeout_sec = 1800`. In Claude Code set the `MCP_TOOL_TIMEOUT` environment variable (in milliseconds) before starting it. The job keeps running either way, so ask for its status or transcripts afterwards. |
| `401` or `INVALID_API_KEY` | The API rejected the key. It has a typo, extra spaces or quotes, a leftover placeholder, or an older key in the config overrides the credentials file. Re-copy it from [app.gnani.ai](https://app.gnani.ai). |
| `403` or `SCOPE_NOT_ALLOWED` | The key was accepted but is not allowed to use that product or model. Contact [support@gnani.ai](mailto:support@gnani.ai). |
| An error mentions `GNANI_API_KEY` or `~/.gnani/credentials` | No key was found. Add it to the config's `env` or to the credentials file, then restart the agent. |
| `Audio file not found` | The path is wrong or relative. Use the full absolute path. |
| `Voice 'X' is not available for timbre-...` | Voices belong to one model. The message names the model the voice belongs to and lists the valid voices. |
| My audio tags were removed | Tags only work with `timbre-v3.0`. Ask for that model. |
| `speed ... is outside the range` | The range depends on the model: `0.8` to `1.2` for Timbre v3.0, `0.85` to `1.15` for Timbre v2.5. |
| I cannot find the generated audio | Check the `audio_file` path in the response. The default folder is your Desktop. |
| `429` (too many requests) | The server already retries up to 5 times. Wait a moment and try again, and avoid sending many requests at once. |
| `504`, or `did not respond within 120s` | The API took too long to answer. Try again. For long audio, use batch transcription. |

Where to find logs: in Cursor, open the Output panel and choose **MCP Logs**. In Claude Code, run `claude mcp list` or `/mcp`. In Codex, type `/mcp`. The server writes its log lines to stderr, which most clients capture. Still stuck? Contact [support@gnani.ai](mailto:support@gnani.ai) with the error text (never your API key) and the `request_id` that transcription calls return.

***

## Security and costs

* **Your API key is a secret.** Do not paste it into chats, commit it to Git, or share config files that contain it. Prefer the credentials file or an environment variable referenced from your config. If a key leaks, stop using it and ask Gnani to replace it.
* **Project-level configs are often committed.** `.cursor/mcp.json` and `.mcp.json` are usually shared, so keep keys out of them.
* **Your audio leaves your computer.** Files you transcribe are uploaded to the Gnani API. Do not use sensitive recordings unless that is acceptable under your organization's policies.
* **The server runs with your permissions.** It reads any file path the agent gives it and writes audio to the output folder. Review the agent's tool calls when you are unsure.
* **Requests count against your Gnani account.** Every transcription and synthesis request uses your API key, and expressive tags are billed as characters. A request to "try all the voices" makes many calls.

***

## Next steps

> [card] [Available voices](https://docs.gnani.ai/api/TTS/available-voices.md)
>
> The full Timbre v2.5 and Timbre v3.0 voice catalogs.

> [card] [Audio tags](https://docs.gnani.ai/api/TTS/tts-audio-tags.md)
>
> Expressive tags for Timbre v3.0.

> [card] [Speech-to-Text](https://docs.gnani.ai/api/STT/overview.md)
>
> The models and options behind the transcription tools.

> [card] [Python SDK](https://docs.gnani.ai/python-sdk/introduction.md)
>
> Call the same APIs from your own Python code.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.