# Use Paxa with Strands Agents

Give a Strands agent Paxa's speech, transcription, OCR, and translation tools through the Paxa MCP server and the MCP client built into Strands.

Give a [Strands Agents](https://strandsagents.com) agent the Paxa API as tools. It can speak in English, Thai, and Mandarin, transcribe recordings, read documents with OCR and extract their fields, and translate into Thai.

Strands loads the tools from the Paxa MCP server, `@paxalabs/mcp`, through its built-in MCP client. No Strands-specific package is needed.

## Before you start

- Install Node.js 20 or later, or 22 for `listen`. The server runs with `npx`.
- Create an API key on the [dashboard](https://paxalabs.com/app/keys?new=mcp). A new account starts with 100 free credits.
- Choose a model provider for the agent. Strands uses Amazon Bedrock by default, and its [model providers guide](https://strandsagents.com/docs/user-guide/sdk/model-providers/) lists the others.

## Python

Terminal:

```bash
pip install "strands-agents>=1.62,<2"
export PAXA_API_KEY=pxa_your_key_here
```

Python:

```python
import os

from mcp import StdioServerParameters, stdio_client
from strands import Agent
from strands.tools.mcp import MCPClient

paxa = MCPClient(lambda: stdio_client(
    StdioServerParameters(
        command="npx",
        args=["-y", "@paxalabs/mcp"],
        env={"PAXA_API_KEY": os.environ["PAXA_API_KEY"]},
    )
))

agent = Agent(tools=[paxa])
agent("Save 'สวัสดีครับ, welcome to the show' as welcome.mp3 with the khanomkrok voice.")
```

The agent starts the server on first use and stops it when the agent is done.

## TypeScript

Terminal:

```bash
npm install @strands-agents/sdk @modelcontextprotocol/sdk
export PAXA_API_KEY=pxa_your_key_here
```

TypeScript:

```typescript
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
import { Agent, McpClient } from "@strands-agents/sdk";

const paxa = new McpClient({
  transport: new StdioClientTransport({
    command: "npx",
    args: ["-y", "@paxalabs/mcp"],
    env: { PAXA_API_KEY: process.env.PAXA_API_KEY ?? "" },
  }),
});

const agent = new Agent({ tools: [paxa] });
await agent.invoke(
  "Save 'สวัสดีครับ, welcome to the show' as welcome.mp3 with the khanomkrok voice.",
);
```

## Choose the tools

The playback tools, `design_voice`, `refine_voice`, and `listen` use the speakers and microphone of the machine that runs the server. A server-side agent usually needs only the file tools. In Python, pass `tool_filters` to `MCPClient` to keep those.

Python:

```python
paxa = MCPClient(
    lambda: stdio_client(
        StdioServerParameters(
            command="npx",
            args=["-y", "@paxalabs/mcp"],
            env={"PAXA_API_KEY": os.environ["PAXA_API_KEY"]},
        )
    ),
    tool_filters={
        "allowed": [
            "text_to_speech",
            "transcribe_audio",
            "ocr_document",
            "extract_fields",
            "translate_to_thai",
            "list_voices",
        ]
    },
)
```

The [MCP server page](https://paxalabs.com/docs/mcp#tools) lists every tool and its price. Its [environment variables](https://paxalabs.com/docs/mcp#environment), such as the output folder and the default voice, go in `env` next to `PAXA_API_KEY`.

Speech runs on Paxa TTS Flash v2, whose 50 voices each speak English, Thai, and Mandarin. [Direction tags](https://paxalabs.com/docs/directions) written into the text, such as `[whispering]` or `[laughs]`, set the delivery. Transcription is a Research preview.

Strands documents its MCP client in the [MCP tools guide](https://strandsagents.com/docs/user-guide/sdk/tools/mcp-tools/).
