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:
| Server | Purpose | Authentication |
|---|---|---|
https://platform-docs.sarj.ai/mcp | Search and read documentation | Public |
https://platform-api.sarj.ai/api/v1/mcp | Calls, and pilot scenario, knowledge base and test tools | Your 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
| Method | Permissions of the key | Expires |
|---|---|---|
| Sign-in (OAuth) | The scopes the client requests and you approve | 90 days after sign-in |
| Dashboard API key | The permissions you choose on the API keys page | A 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>.
| Scope | Lets the agent |
|---|---|
calls:read | View calls, transcripts and call analysis |
calls:write | Start calls, and cancel or reschedule scheduled calls |
scenarios:read | View scenarios, prompts, personas, tools, integrations, knowledge bases and chat test results |
scenarios:write | Edit 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,addScenarioLanguageandremoveScenarioLanguagesave 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
409on 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 theupdated_atfrom your last read. If the item changed since, the write fails with409: read it again and retry.cancelScheduledCall,rescheduleScheduledCallandcancelScenarioTestRunhave no such check and take noexpected_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,AcceptandAccept-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, butdeleteScenarioToolcan still remove it. Writes that include such values are refused. - A custom API tool sends credentials only by reference to a connection.
saveScenarioToolkeeps 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 with422and the dashboard link where a person adds it.createScenariorefuses every credential. getScenarionever includes credentials, headers, endpoints or the values custom API tools send. A private variable's default reads as null. Setting one is refused with422, 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 containsauth,key,token,secret,password,passwd,signature,session,cookieorbearer(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
listIntegrationsreturns. - 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.
| Capability | Lets the agent |
|---|---|
reads | Read scenarios, prompts, personas, knowledge bases, integrations, calls and chat test runs; cancel test runs |
kb_writes | Replace knowledge base file content and restore earlier versions |
prompt_writes | Save prompt drafts and add or remove languages as drafts |
scenario_writes | Create scenarios and personas; change settings, tools, quality flags and personas |
test_starts | Start automated chat tests |
Available tools
Calls
| Tool | Permission | Description |
|---|---|---|
createCall | calls:write | Place an outbound voice call (see POST /calls) |
getCall | calls:read | Fetch call details by call_id (see GET /calls/{call_id}) |
cancelScheduledCall | calls:write | Cancel a pending scheduled call or retry attempt |
rescheduleScheduledCall | calls:write | Move 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.
| Tool | Description |
|---|---|
listCalls | List 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. |
getCallTranscript | Read 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. |
getCallAnalysis | Read the data a call collected, its outcome, caller experience and quality flags. Fields stay null until post-call analysis finishes. |
- A turn's
timestampis null when no time was recorded for it, and in the corrected transcript also when the call has neither a recording start nor astarted_at. Itsoffset_msis null whentimestampis, or when the call has nostarted_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
| Tool | Capability | Permission | Description |
|---|---|---|---|
listScenarios | reads | scenarios:read | List scenarios newest first, up to 100 per page. |
getScenario | reads | scenarios:read | Read 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. |
getScenarioTools | reads | scenarios:read | Read every tool of a scenario with its settings, and whether each one can change here. |
createScenario | scenario_writes | scenarios:write | Create 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. |
updateScenario | scenario_writes | scenarios:write | Change 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. |
updateScenarioQualityFlags | scenario_writes | scenarios:write | Turn 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. |
saveScenarioTool | scenario_writes | scenarios:write | Add 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. |
deleteScenarioTool | scenario_writes | scenarios:write | Remove a tool. |
updateScenario, updateScenarioQualityFlags, saveScenarioTool and deleteScenarioTool work only on scenarios that are not live.
Prompts and languages
| Tool | Capability | Permission | Description |
|---|---|---|---|
getScenarioPrompt | reads | scenarios:read | Read the prompt new calls use for each language, the latest unpublished draft, languages the draft adds or removes, and updated_at. |
saveScenarioPrompt | prompt_writes | scenarios:write | Save new prompt text for one language as a draft. The outcome is draft_saved, or unchanged when the text matched. |
addScenarioLanguage | prompt_writes | scenarios:write | Add a language with its prompt, greeting and persona as a draft. |
removeScenarioLanguage | prompt_writes | scenarios:write | Remove 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
| Tool | Capability | Permission | Description |
|---|---|---|---|
listPersonas | reads | scenarios:read | List personas with their voice, persona text and pronunciations. |
listVoices | reads | scenarios:read | List the active voices a persona can use. |
createPersona | scenario_writes | scenarios:write | Create a persona with a voice, persona text and pronunciations. Other settings come from the organization's default persona in that language. |
updatePersona | scenario_writes | scenarios:write | Change a persona's text, pronunciations or voice. Refused while a live scenario uses the persona. |
Knowledge bases
| Tool | Capability | Permission | Description |
|---|---|---|---|
listKnowledgeBases | reads | scenarios:read | List knowledge bases. |
getKnowledgeBase | reads | scenarios:read | Read a knowledge base and its files, without their content. |
getKnowledgeBaseFileContent | reads | scenarios:read | Read a file's current text and its updated_at. |
searchKnowledgeBase | reads | scenarios:read | Find 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. |
listKnowledgeBaseFileRevisions | reads | scenarios:read | List a file's earlier versions, newest first, up to the latest 50. |
replaceKnowledgeBaseFileContent | kb_writes | scenarios:write | Replace a file's text. The original upload is kept. |
restoreKnowledgeBaseFileRevision | kb_writes | scenarios:write | Publish 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
| Tool | Capability | Permission | Description |
|---|---|---|---|
listIntegrations | reads | scenarios:read | List 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:
updateScenarioreplaces every CRM update entry, connector actions included. Send back the entriesgetScenarioreturned to keep them; an entry left out is removed.- A new or changed connector action must use a connector, action and inputs that
listIntegrationslists, 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 answer422; most messages include the dashboard link to use. getScenarionames each action with hidden inputs inlocked_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 with409 connector_action_not_editable; make it in the dashboard.
Automated chat tests
| Tool | Capability | Permission | Description |
|---|---|---|---|
startScenarioTestRun | test_starts | scenarios:write | Start a chat test with typed turns, checks, tool results to return and score. |
rerunScenarioTestRun | test_starts | scenarios:write | Run an earlier test again with exactly its inputs, including the prompt version. |
getScenarioTestRun | reads | scenarios:read | Read 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. |
listScenarioTestRuns | reads | scenarios:read | List a scenario's runs, newest first. |
cancelScenarioTestRun | reads | scenarios:write | Stop 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: livetests 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.
scoreis 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 withgetCallAnalysisonce the analysis finishes. Withscore: falsethe call gets no analysis. A rerun keeps the setting.- Checks:
tool_called,reply_contains,reply_not_contains,knowledge_base_returned,conversation_endedandjudge. Ajudgecheck 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,getCallTranscriptandgetCallAnalysis.listCallsleaves test calls out.
Feedback to Sarj
| Tool | Capability | Permission | Description |
|---|---|---|---|
sendFeedbackToSarj | None | None | Tell 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 with409 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.
| Status | Code | What to do |
|---|---|---|
| None | Tool 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. |
401 | error.type is unauthorized | Sign in again, or use a key that is not expired or revoked. |
403 | scoped_api_key_required | The key was created before you could choose permissions. Create a new key. |
403 | api_key_scope_forbidden | The key lacks the tool's permission. Create a key, or sign in again, with it. |
403 | organization_membership_required | The key's owner needs the permission through their role in the organization. Ask an admin. |
403 | mcp_capability_disabled | The tool's capability is off for your organization. Ask your Sarj contact. |
403 | mcp_pilot_user_required | During the pilot, only users Sarj enabled can use pilot tools. Ask your Sarj contact. |
404 | error.type is not_found, call_not_found or scenario_not_found | The resource does not exist in your organization. Check the ID. |
409 | scenario_live, persona_used_by_live_scenario | The scenario is live, or a live scenario uses the persona. Make the change in the dashboard. |
409 | scenario_changed, scenario_prompt_changed, persona_changed, knowledge_base_file_changed | It changed after you read it. Read it again and retry with the new updated_at, and for quality flags the new quality_flags. |
409 | scenario_language_changes_pending | Publish or discard the pending language changes in the dashboard. |
409 | tool_not_editable, private_variable_default, default_persona_missing, connector_action_not_editable | This change needs the dashboard. The hint after the code, when there is one, says what to do. |
409 | scenario_name_taken | Choose another name. |
409 | scenario_test_concurrency_limit | Wait for a run to finish, or cancel one. |
409 | feedback_limit_reached | The key already sent 20 feedback messages in the last 24 hours. Tell the user the feedback was not sent. |
422 | A field violation on body.tool, or body.tools.<n> for createScenario, that starts Add a credential, or send it to another host | The 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. |
422 | error.type is validation_error | Fix 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. |
500 | An 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.