Sarj AI

Official Sarj AI MCP server for outbound voice calls, call outcomes and scheduling. OAuth sign-in or scoped API-key authentication.

Hosted MCP Server

npx add-mcp 'https://platform-api.sarj.ai/api/v1/mcp'

Installs into Claude Code, Codex, Cursor and more

Documentation

Agent Instructions

Use OpenAPI for fields and errors; the Python guide and PyPI for SDK capabilities and availability. Scenario IDs are dashboard UUIDs. Bound polling; reports may stay null. Reconcile ambiguous call creation before retrying. Docs MCP reads docs and accepts feedback; API MCP performs authenticated call actions.

MCP Server

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

Connect an MCP client to place and inspect calls. Organizations in the MCP pilot can also let an agent read and draft scenario configuration, edit knowledge bases, review calls and run automated chat tests. MCP complements the dashboard: the agent works on the same scenarios and knowledge bases you see there, with the permissions of the key it uses. It never publishes a prompt; a person does that in the dashboard.

Server URL: https://platform-api.sarj.ai/api/v1/mcp (with or without a trailing slash)

Use the server that matches the task:

ServerPurposeAuthentication
https://platform-docs.sarj.ai/mcpSearch and read documentationPublic
https://platform-api.sarj.ai/api/v1/mcpCalls, and pilot scenario, knowledge base and test toolsYour Sarj account

The documentation server cannot place calls. Mintlify also exposes a documentation-feedback tool; it does not control calls. The published agent skill explains identifiers, result readiness, and retry constraints.

Prerequisites

  • A Sarj.ai account: sign in at platform.sarj.ai
  • An MCP-compatible client (Claude Code, Cursor, or any MCP SDK)
  • For pilot tools: an organization in the MCP pilot and a key with the permissions listed below

1. Connect your MCP client

Add the Sarj.ai MCP server to your client. Sign in, or send a dashboard API key in a header.

claude mcp add sarj-voice \
  --transport http \
  https://platform-api.sarj.ai/api/v1/mcp

claude mcp list
claude mcp add sarj-voice \
  --transport http \
  https://platform-api.sarj.ai/api/v1/mcp \
  --header "Authorization: Bearer $SARJ_API_KEY"

claude mcp list
{
  "mcpServers": {
    "sarj-voice": {
      "type": "http",
      "url": "https://platform-api.sarj.ai/api/v1/mcp",
      "headers": { "Authorization": "Bearer <your API key>" }
    }
  }
}

For browser sign-in, omit headers. Your MCP client must support the OAuth authorization code flow with S256 PKCE.

2. Authenticate

MethodPermissions of the keyExpires
Sign-in (OAuth)The scopes the client requests and you approve90 days after sign-in
Dashboard API keyThe permissions you choose on the API keys pageA date you choose, within 365 days

The server offers four sign-in scopes: calls:read, calls:write, scenarios:read and scenarios:write. Claude Code requests them when you sign in, and the sign-in page lists each one before you approve. A client that requests no scope gets calls:read and calls:write; any other scope fails with invalid_scope. Each authorization code works once: a second exchange fails with invalid_grant and revokes the key, so sign in again. Sign in again when the key expires. A sign-in key works only on the public API, MCP included: the dashboard's own routes refuse it with 401, whatever its scopes. Other clients send a dashboard key as Authorization: Bearer <key>.

ScopeLets the agent
calls:readView calls, transcripts and call analysis
calls:writeStart calls, and cancel or reschedule scheduled calls
scenarios:readView scenarios, prompts, personas, tools, integrations, knowledge bases and chat test results
scenarios:writeEdit scenarios, tools and personas, draft prompts, edit knowledge base files and run chat tests

Give the key only the permissions the agent needs. A key never receives a permission you do not have. Keys created before you could choose permissions cannot use pilot tools; create a new key. Revoked and expired keys cannot open MCP requests.

[!WARNING]

Keys are scoped to your account and organization. Generate a separate dashboard key for direct API or SDK access.

3. Prompt your agent

Example prompts:

Call +966512345678 using scenario 550e8400-e29b-41d4-a716-446655440000
with language set to Arabic.
Check the status of 8f9b2c1e-4a5d-4f6e-8b1a-2c3d4e5f6a7b.
Tell me if it completed and how long it lasted.
Trigger calls to all numbers in this list using scenario 550e8400-e29b-41d4-a716-446655440000:
+966512345678, +966598765432, +966501234567

Check each call for up to five minutes, then report its status and any available results.
Read the transcripts and analysis of yesterday's failed calls for scenario
550e8400-e29b-41d4-a716-446655440000 and summarize what went wrong.
Draft a shorter Arabic prompt for scenario 550e8400-e29b-41d4-a716-446655440000,
run a chat test on the draft, and show me any failed checks.

Replace the illustrative UUID with an active scenario ID copied from your dashboard. Confirm the recipient numbers before asking the agent to place real calls.

How changes reach calls

  • Prompts and languages are drafts. saveScenarioPrompt, addScenarioLanguage and removeScenarioLanguage save a draft. New calls keep the published prompt until a person publishes the draft in the dashboard. There is no publish tool.
  • Settings change only on scenarios that are not live. Scenario settings, tools, quality flags, CRM updates and recording destinations are refused with 409 on a live scenario; make those changes in the dashboard. On other scenarios they apply to new calls at once. A persona cannot change while a live scenario uses it.
  • Creating is always allowed. A new scenario starts active and not live. A new persona is not used until a scenario is set to use it.
  • Knowledge base edits apply at once. A replace or restore affects every scenario that uses the knowledge base, live or not. Calls that start after it returns use the new text; a call already in progress may keep the earlier text.
  • Configuration edits are checked against what you read. Tools that change an existing scenario, prompt, tool, persona or knowledge base file declare expected_updated_at: send the updated_at from your last read. If the item changed since, the write fails with 409: read it again and retry. cancelScheduledCall, rescheduleScheduledCall and cancelScenarioTestRun have no such check and take no expected_updated_at.

Secrets stay out of the model

  • Tools refer to connections your organization already has, by id. Values that could be secrets read back as null: fixed header values other than Content-Type, Accept and Accept-Language, every fixed query value, an endpoint with a query string or a user name or password, keys, tokens and encrypted values. A tool that holds one is not editable through MCP and can change only in the dashboard, but deleteScenarioTool can still remove it. Writes that include such values are refused.
  • A custom API tool sends credentials only by reference to a connection. saveScenarioTool keeps a credential only when the stored tool with the same name already sends that same credential to the same host, written out in the endpoint. A new credential, or a credential sent to another host, is refused with 422 and the dashboard link where a person adds it. createScenario refuses every credential.
  • getScenario never includes credentials, headers, endpoints or the values custom API tools send. A private variable's default reads as null. Setting one is refused with 422, and sending the variable back as read keeps the stored default; a person sets it in the dashboard. A variable is private when a custom API tool sends it anywhere (path, header, query or body), or when its name contains auth, key, token, secret, password, passwd, signature, session, cookie or bearer (any case).
  • A connector action leaves out inputs whose fixed values could carry secrets: encrypted values, inputs sent in a header, query, path or cookie, and inputs with names like those above. See Connector actions.
  • A person connects integrations and enters secrets in the dashboard, through the links listIntegrations returns.
  • MCP results never include recording links.

Pilot capabilities

Sarj enables pilot tools for each organization in groups called capabilities. There is no dashboard switch: ask your Sarj contact to enable the capabilities you need. During the pilot, Sarj can also limit the tools to named users. Your client lists only the pilot tools that your key and organization can use. Call tools and sendFeedbackToSarj need no capability.

CapabilityLets the agent
readsRead scenarios, prompts, personas, knowledge bases, integrations, calls and chat test runs; cancel test runs
kb_writesReplace knowledge base file content and restore earlier versions
prompt_writesSave prompt drafts and add or remove languages as drafts
scenario_writesCreate scenarios and personas; change settings, tools, quality flags and personas
test_startsStart automated chat tests

Available tools

Calls

ToolPermissionDescription
createCallcalls:writePlace an outbound voice call (see POST /calls)
getCallcalls:readFetch call details by call_id (see GET /calls/{call_id})
cancelScheduledCallcalls:writeCancel a pending scheduled call or retry attempt
rescheduleScheduledCallcalls:writeMove a pending scheduled call to another time

Schedule-config creation is currently a REST/SDK operation, not an action MCP tool. Reports are asynchronous and can remain null; do not poll indefinitely or infer webhook outcome types from call-status names.

Call history

Capability reads, permission calls:read.

ToolDescription
listCallsList calls newest first. Filter by scenario, status and creation time (created_from inclusive, created_to exclusive). 20 per page by default, up to 100. Automated chat test calls are left out.
getCallTranscriptRead the caller and agent turns of a call, each with a UTC timestamp and offset_ms, its offset in milliseconds from the call start, when they are known. Returns the transcript corrected by post-call analysis when there is one, and the live transcript otherwise. Empty until the call ends.
getCallAnalysisRead the data a call collected, its outcome, caller experience and quality flags. Fields stay null until post-call analysis finishes.
  • A turn's timestamp is null when no time was recorded for it, and in the corrected transcript also when the call has neither a recording start nor a started_at. Its offset_ms is null when timestamp is, or when the call has no started_at.
  • Polling again does not fill in a null time. Times change only when the corrected transcript replaces the live one after post-call analysis.

Scenarios

ToolCapabilityPermissionDescription
listScenariosreadsscenarios:readList scenarios newest first, up to 100 per page.
getScenarioreadsscenarios:readRead a scenario's languages, prompts, greetings, personas, tools, knowledge bases, variables, success criteria, data extraction, retry schedule, time zone, quality flags, whether it is live, and updated_at.
getScenarioToolsreadsscenarios:readRead every tool of a scenario with its settings, and whether each one can change here.
createScenarioscenario_writesscenarios:writeCreate a scenario with its languages, prompts, greetings, personas, variables, knowledge bases, success criteria, data extraction, retry schedule, time zone and tools. Personas default to the organization's default for each language. Tools follow the saveScenarioTool rules, and custom API tools carry no credentials and no fixed query values. Fails with 409 if the name is taken.
updateScenarioscenario_writesscenarios:writeChange greetings, personas, the default language, variables, knowledge base attachments, success criteria, data extraction, retry schedule, time zone, CRM updates or recording destinations. Omitted settings stay as they are. CRM updates (post_call_sync) replace every entry, connector actions included: send back the entries you read to keep them. Zoho entries and recording destinations need Zoho connected in the dashboard.
updateScenarioQualityFlagsscenario_writesscenarios:writeTurn quality flag checks on or off and replace the flags calls are checked for. Flags left out are removed. Send expected_quality_flags, the quality_flags that getScenario returned; if the stored flags or the switch changed since, it fails with 409 scenario_changed.
saveScenarioToolscenario_writesscenarios:writeAdd a tool, or replace the tool with that name. A custom API tool keeps only the credentials the stored tool already sends to the same host; see Secrets stay out of the model. Transfers use only your organization's own numbers, picked with transfer_from_provisioned_number_id.
deleteScenarioToolscenario_writesscenarios:writeRemove a tool.

updateScenario, updateScenarioQualityFlags, saveScenarioTool and deleteScenarioTool work only on scenarios that are not live.

Prompts and languages

ToolCapabilityPermissionDescription
getScenarioPromptreadsscenarios:readRead the prompt new calls use for each language, the latest unpublished draft, languages the draft adds or removes, and updated_at.
saveScenarioPromptprompt_writesscenarios:writeSave new prompt text for one language as a draft. The outcome is draft_saved, or unchanged when the text matched.
addScenarioLanguageprompt_writesscenarios:writeAdd a language with its prompt, greeting and persona as a draft.
removeScenarioLanguageprompt_writesscenarios:writeRemove a language as a draft. The default language and the only language cannot be removed.

Saving fails with 409 while language changes already wait for publishing. Publish or discard them in the dashboard first.

Personas

ToolCapabilityPermissionDescription
listPersonasreadsscenarios:readList personas with their voice, persona text and pronunciations.
listVoicesreadsscenarios:readList the active voices a persona can use.
createPersonascenario_writesscenarios:writeCreate a persona with a voice, persona text and pronunciations. Other settings come from the organization's default persona in that language.
updatePersonascenario_writesscenarios:writeChange a persona's text, pronunciations or voice. Refused while a live scenario uses the persona.

Knowledge bases

ToolCapabilityPermissionDescription
listKnowledgeBasesreadsscenarios:readList knowledge bases.
getKnowledgeBasereadsscenarios:readRead a knowledge base and its files, without their content.
getKnowledgeBaseFileContentreadsscenarios:readRead a file's current text and its updated_at.
searchKnowledgeBasereadsscenarios:readFind the records that contain a query, ignoring case and Arabic diacritics. A record is a block of text between blank lines, such as one spreadsheet row. Searches up to 20 files; complete is false when results were cut.
listKnowledgeBaseFileRevisionsreadsscenarios:readList a file's earlier versions, newest first, up to the latest 50.
replaceKnowledgeBaseFileContentkb_writesscenarios:writeReplace a file's text. The original upload is kept.
restoreKnowledgeBaseFileRevisionkb_writesscenarios:writePublish an earlier version again.
  • The content a write replaces is kept as a new revision, so a restore can undo it.
  • Until the file is reindexed in the background, calls that search knowledge bases in that file's language use keyword matching.
  • Text over the knowledge base size limit is refused with knowledge_base_file_content_too_large.

Integrations

ToolCapabilityPermissionDescription
listIntegrationsreadsscenarios:readList the connections and integrations your organization can use, without secrets, its connectors with their actions and inputs, and the dashboard links where a person sets up new ones.

Connector actions

A connector is a custom integration registered on the dashboard's integrations page. listIntegrations lists each connector with its actions; each action lists its inputs with where the request sends them, their type and whether they are required. Connectors can be off in an environment: the list is then empty, and new connector actions are refused.

A scenario's CRM updates (post_call_sync) can run connector actions after each call:

  • updateScenario replaces every CRM update entry, connector actions included. Send back the entries getScenario returned to keep them; an entry left out is removed.
  • A new or changed connector action must use a connector, action and inputs that listIntegrations lists, and take credentials only from your organization's connections and integrations. A fixed value for an input that could carry a secret is refused. These refusals answer 422; most messages include the dashboard link to use.
  • getScenario names each action with hidden inputs in locked_connector_actions, with its connector, action and the inputs left out. Send it back unchanged to keep it as stored, hidden values included. Any other change fails with 409 connector_action_not_editable; make it in the dashboard.

Automated chat tests

ToolCapabilityPermissionDescription
startScenarioTestRuntest_startsscenarios:writeStart a chat test with typed turns, checks, tool results to return and score.
rerunScenarioTestRuntest_startsscenarios:writeRun an earlier test again with exactly its inputs, including the prompt version.
getScenarioTestRunreadsscenarios:readRead a run's status and, when it finishes, each check with pass or fail and its evidence, the conversation, the mocked tool calls and the knowledge base searches.
listScenarioTestRunsreadsscenarios:readList a scenario's runs, newest first.
cancelScenarioTestRunreadsscenarios:writeStop a queued or running run. A finished run is returned unchanged.
  • The real agent answers each typed turn with the scenario's current configuration. By default (version: draft) it tests the latest saved draft, so a change can be checked before anyone publishes it. version: live tests the published prompt. Without an unpublished draft, a draft test uses the published prompt. Real calls keep using the published prompt.
  • Tests are typed chats only. They do not test speech recognition, voice or telephony quality.
  • Tools, integrations and webhooks are replaced by mocks, so nothing external runs. A test call never sends webhooks, CRM updates or connector actions, never books a callback, gets no insight tagging, and stays out of customer metrics.
  • score is on by default: the run's call gets post-call analysis, with the data it collected, its outcome against the success criteria, caller experience and quality flags. Read it with getCallAnalysis once the analysis finishes. With score: false the call gets no analysis. A rerun keeps the setting.
  • Checks: tool_called, reply_contains, reply_not_contains, knowledge_base_returned, conversation_ended and judge. A judge check is a model's judgment of a rubric and names the judge model.
  • A run has up to 20 turns, 20 checks and 300 seconds (120 by default). An organization can have 2 runs queued or running at once; another start fails with 409 scenario_test_concurrency_limit.
  • A run's call id is a plain UUID, like every call id, and works with getCall, getCallTranscript and getCallAnalysis. listCalls leaves test calls out.

Feedback to Sarj

ToolCapabilityPermissionDescription
sendFeedbackToSarjNoneNoneTell the Sarj team that the tools could not do what the user asked.
  • An AI agent should send feedback when no tool can do the task (missing), a tool failed or returned something wrong (broken), a tool or its result was unclear (confusing), or the user suggests an improvement or asks it to send feedback (idea).
  • It should send feedback at most once per task, never to log progress or to test the tool, and tell the user it sent it.
  • The description says what the user wanted and what was missing in general terms, in up to 2,000 characters, with the tool's name when there is one. It must leave out secrets, credentials, phone numbers, call transcripts and other customer data. Saudi phone numbers that slip through are masked to their last four digits before the feedback is stored.
  • Any active dashboard or sign-in key of an organization can send feedback, with no capability or permission. A call-service key, or an expired or revoked key, is refused with 401. Each key can send 20 in any 24 hours; the next one fails with 409 feedback_limit_reached.
  • Only Sarj's team reads feedback. It does not reach your organization.

Errors

A failed tool call returns the HTTP status and the API error body as text in the tool result, for example:

Error calling tool 'getCall': HTTP error 403: Forbidden - {'error': {'message': 'api_key_scope_forbidden', 'type': 'forbidden'}, 'meta': {'request_id': '019a7e2c-4b1d-7f3e-9a26-5c8d1e0b7f43'}}

Requests without a valid key are refused with 401 before any tool runs. A 403 answers error.type forbidden with its code in error.message. A 409 from a pilot tool or sendFeedbackToSarj answers error.type conflict with its code in error.code; error.message starts with the code, sometimes followed by ; and a hint. A 422 from a pilot tool answers error.type validation_error. Call tools keep their own error types, such as call_not_pending. Branch on error.type and error.code, not on the message text.

Error calling tool 'updateScenario': HTTP error 409: Conflict - {'error': {'message': 'scenario_live', 'type': 'conflict', 'code': 'scenario_live'}, 'meta': {'request_id': '019a7e2d-0c6f-7a18-b3e4-2d9f6a1c8e05'}}

A tool call with an argument the tool does not declare fails before anything is sent. The tool error names the arguments:

Unknown arguments: live, variable_definitions. Send only the arguments in this tool's input schema.
StatusCodeWhat to do
NoneTool error Unknown arguments: <names>The tool does not declare those arguments, and nothing was sent. Retry with only the arguments in the tool's input schema.
401error.type is unauthorizedSign in again, or use a key that is not expired or revoked.
403scoped_api_key_requiredThe key was created before you could choose permissions. Create a new key.
403api_key_scope_forbiddenThe key lacks the tool's permission. Create a key, or sign in again, with it.
403organization_membership_requiredThe key's owner needs the permission through their role in the organization. Ask an admin.
403mcp_capability_disabledThe tool's capability is off for your organization. Ask your Sarj contact.
403mcp_pilot_user_requiredDuring the pilot, only users Sarj enabled can use pilot tools. Ask your Sarj contact.
404error.type is not_found, call_not_found or scenario_not_foundThe resource does not exist in your organization. Check the ID.
409scenario_live, persona_used_by_live_scenarioThe scenario is live, or a live scenario uses the persona. Make the change in the dashboard.
409scenario_changed, scenario_prompt_changed, persona_changed, knowledge_base_file_changedIt changed after you read it. Read it again and retry with the new updated_at, and for quality flags the new quality_flags.
409scenario_language_changes_pendingPublish or discard the pending language changes in the dashboard.
409tool_not_editable, private_variable_default, default_persona_missing, connector_action_not_editableThis change needs the dashboard. The hint after the code, when there is one, says what to do.
409scenario_name_takenChoose another name.
409scenario_test_concurrency_limitWait for a run to finish, or cancel one.
409feedback_limit_reachedThe key already sent 20 feedback messages in the last 24 hours. Tell the user the feedback was not sent.
422A field violation on body.tool, or body.tools.<n> for createScenario, that starts Add a credential, or send it to another hostThe tool sends a credential the stored tool does not already send to that host. A person adds it in the dashboard, at the link in the message.
422error.type is validation_errorFix the request. error.field_violations names the field when there is one; a refusal such as knowledge_base_file_content_too_large has no field and its code is the message. Some messages include the dashboard link to use.
500An unexpected error occurred. Please try again or contact support.Internal details are never returned. Retry a read; before retrying a write, read the current state.

Data handling

  • Transcripts and call analysis are your customers' conversations. Treat what the agent reads, and where your client stores it, with the same care as the dashboard.
  • MCP results contain no audio and no recording links. Use the dashboard or the REST API for recordings.
  • Changes made through MCP are recorded as made by the user who owns the key.

This documentation is built and hosted on Mintlify, a developer documentation platform.