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

# MCP Server

> Expose the Sarj.ai API as MCP tools for AI agents.

The Sarj.ai [MCP](https://modelcontextprotocol.io) server lets AI agents (Claude Code, Cursor, any MCP-compatible client) call the API as native tools.

**Server URL:** `https://platform-api.sarj.ai/api/v1/mcp`

<Tip>
  **Authentication:** On first connect, your browser opens a Sarj.ai sign-in page; the API key is created and cached automatically.
</Tip>

## Prerequisites

* A Sarj.ai account — [sign in at platform.sarj.ai](https://platform.sarj.ai)
* An MCP-compatible client (Claude Code, Cursor, or any MCP SDK)

<Steps>
  <Step title="Connect your MCP client">
    Add the Sarj.ai MCP server to your client.

    <CodeGroup>
      ```bash Claude Code theme={null}
      # Add the server (run once)
      claude mcp add sarj-voice \
        --transport http \
        https://platform-api.sarj.ai/api/v1/mcp

      # Verify it was added
      claude mcp list
      ```

      ```json Cursor theme={null}
      // In Cursor: Settings → MCP → Add Server
      // Or add to ~/.cursor/mcp.json:
      {
        "mcpServers": {
          "sarj-voice": {
            "type": "http",
            "url": "https://platform-api.sarj.ai/api/v1/mcp"
          }
        }
      }
      ```

      ```json JSON config theme={null}
      // ~/.claude.json or project .claude/mcp.json
      {
        "mcpServers": {
          "sarj-voice": {
            "type": "http",
            "url": "https://platform-api.sarj.ai/api/v1/mcp"
          }
        }
      }
      ```
    </CodeGroup>
  </Step>

  <Step title="Authenticate">
    No manual API key needed — the MCP server issues one for you. When your client first connects, it will:

    1. Open your browser to the Sarj.ai sign-in page
    2. Sign in with your Sarj.ai account (skipped if already signed in)
    3. An API key is created server-side and returned to your client

    <Warning>
      The API key is scoped to your account and organization, and cached locally by your MCP client for future sessions. If you also need direct API or SDK access, generate a separate key from the [dashboard](https://platform.sarj.ai/api-keys).
    </Warning>
  </Step>

  <Step title="Prompt your agent">
    Example prompts:

    <CodeGroup>
      ```text Trigger a call theme={null}
      Call +966512345678 using scenario scn_appointment_reminder
      with language set to Arabic.
      ```

      ```text Track status theme={null}
      Check the status of call_8f9b2c1e-4a5d-4f6e-8b1a-2c3d4e5f6a7b.
      Tell me if it completed and how long it lasted.
      ```

      ```text Batch calls theme={null}
      Trigger calls to all numbers in this list using scenario scn_survey:
      +966512345678, +966598765432, +966501234567

      Wait for each to complete and report the results.
      ```
    </CodeGroup>
  </Step>
</Steps>

## Available tools

| Tool         | Description                                                                                                                   |
| ------------ | ----------------------------------------------------------------------------------------------------------------------------- |
| `createCall` | Place an outbound voice call (see [POST /calls](/api-reference/calls/place-an-outbound-sarjai-voice-call))                    |
| `getCall`    | Fetch call details by `call_id` (see [GET /calls/{call_id}](/api-reference/calls/fetch-sarjai-voice-call-details-by-call_id)) |
