# Core API over MCP

The Core API as a Model Context Protocol server: the endpoint, how a token's scopes decide the tools, every tool with its arguments, and how tool errors and limits behave.

Source: https://docs.omazy.ai/reference/core-api/mcp/

The Core API is also a Model Context Protocol server. An agent or a backend
that speaks MCP reaches the same verbs a REST caller does, with the same token.

```
POST https://mw.omazy.ai/api/v1/core/mcp
```

Use it when the caller is a model: give an agent this server and it can search
your knowledge, ask your agent, read a customer or place a call, choosing the
tool itself. Use the REST routes when your own code decides what to call.

This is not the [workspace MCP server](/reference/platform/mcp-server/). That
one sets a workspace up and acts as a signed-in person. This one uses what is
already set up and takes a Core API token.

## Connecting

It speaks Streamable HTTP with JSON-RPC 2.0 bodies. `POST` is the only method.
`GET` and `DELETE` return `405`: there is no session and no server-initiated
stream, so every request stands alone.

Authentication is the Core API's own header:

```http
Authorization: Bearer cai_<prefix>.<rest>
```

Most MCP clients take a URL and headers:

```json
{
  "mcpServers": {
    "omazy": {
      "type": "http",
      "url": "https://mw.omazy.ai/api/v1/core/mcp",
      "headers": { "Authorization": "Bearer cai_<prefix>.<rest>" }
    }
  }
}
```

A request without a working token answers `401` with `WWW-Authenticate:
Bearer`, for every method including `initialize`.

| Field | Value |
|---|---|
| `serverInfo.name` | `omazy-core` |
| `capabilities` | `tools` |
| Protocol revisions | `2024-11-05`, `2025-03-26`, `2025-06-18`, `2025-11-25`, `2026-07-28`. Another revision is answered with `2025-06-18` |

It implements `initialize`, `ping`, `tools/list` and `tools/call`. It has no
resources and no prompts. A notification gets `202` with no body. A batch of up
to 20 messages is accepted.

## The tools follow the token

`tools/list` returns only the tools the token's [scopes](/reference/core-api/authentication/#scopes)
allow. A token with `kb:search` alone sees two tools, `whoami` and
`knowledge_search`.

Calling a tool outside the token's scopes answers the same as calling one that
does not exist: a JSON-RPC error `-32602`, `Unknown tool`. A token learns
nothing about tools beyond its own.

| Tool | Scope | Runs | Changes something |
|---|---|---|---|
| `whoami` | None | `GET /whoami` | No |
| `knowledge_search` | `kb:search` | `POST /knowledge/search` | No |
| `knowledge_documents_list` | `kb:read` | `GET /knowledge/documents` | No |
| `knowledge_document_get` | `kb:read` | `GET /knowledge/documents/{id}` | No |
| `knowledge_document_create` | `kb:write` | `POST /knowledge/documents` | Yes |
| `knowledge_document_update` | `kb:write` | `PATCH /knowledge/documents/{id}` | Yes |
| `knowledge_document_delete` | `kb:write` | `DELETE /knowledge/documents/{id}` | Yes: it cannot be undone |
| `knowledge_sources_list` | `kb:read` | `GET /knowledge/sources` | No |
| `knowledge_source_create` | `kb:write` | `POST /knowledge/sources` | Yes: starts a crawl |
| `knowledge_source_crawl` | `kb:write` | `POST /knowledge/sources/{id}/crawl` | Yes: starts a crawl |
| `agent_turn` | `agent:run` | `POST /agent/turn` | It can: your agent may use its own tools |
| `ai_complete` | `ai:complete` | `POST /ai/complete` | No, but it spends budget |
| `customer_get` | `core:read` | `GET /customers/{id}` | No |
| `customer_update` | `memory:write` | `PATCH /customers/{id}` | Yes |
| `conversation_post_message` | `core:write` | `POST /conversations/{id}/messages` | Yes |
| `call_place` | `voice:calls` | `POST /voice/calls` | Yes: a phone rings |
| `call_status` | `voice:calls` | `GET /voice/calls/{ref}` | No |
| `voice_job_create` | `voice:tasks` | `POST /voice/jobs` | Yes: starts a background task |
| `voice_job_get` | `voice:tasks` | `GET /voice/jobs/{id}` | No |

Each tool carries annotations a client can act on. `readOnlyHint` is true for
the tools marked "No" above except `ai_complete`, and `openWorldHint` is true
for the ones that reach a model vendor or the phone network. A client that asks
a person before a write has what it needs to decide.

`knowledge_document_delete` is the one tool with `destructiveHint` true.

Speech, file upload, the knowledge export, LinkedIn publishing and session
credentials are REST only.

## Arguments

A tool takes the same fields as the route it runs, as one object. The fields
that sit in the route's path (`id`, `ref`) are arguments too. Each tool's
`inputSchema` in `tools/list` is the full list. The route's page says what each
field means:

- `knowledge_search`, `agent_turn`: [Knowledge and agent](/reference/core-api/knowledge-and-agent/)
- The `knowledge_document` and `knowledge_source` tools: [Knowledge documents](/reference/core-api/knowledge-documents/)
- `ai_complete`: [Completions](/reference/core-api/completions/). It never streams: a tool call is one request and one answer.
- `call_place`, `call_status`, `voice_job_create`, `voice_job_get`: [Speech and calls](/reference/core-api/speech-and-calls/)
- `customer_get`, `customer_update`, `conversation_post_message`: [Data and messages](/reference/core-api/data-and-messages/)

```json
{
  "jsonrpc": "2.0",
  "id": 7,
  "method": "tools/call",
  "params": {
    "name": "knowledge_search",
    "arguments": { "query": "What are your opening hours?", "top_k": 3 }
  }
}
```

The tools that change something take one more argument, `idempotency_key`:
`call_place`, `conversation_post_message`, `agent_turn`, `voice_job_create`,
`knowledge_document_create`, `knowledge_source_create` and
`knowledge_source_crawl`. It is the route's `Idempotency-Key` header. A tool
call repeated with the same key returns the first result and does the work
once. See [Sending a request again](/reference/core-api/errors-and-limits/#sending-a-request-again).

## Results

A tool's answer is what its route puts in `data`, twice: as text for a model
to read, and as `structuredContent` for code.

```json
{
  "jsonrpc": "2.0",
  "id": 7,
  "result": {
    "content": [{ "type": "text", "text": "{\"passages\":[...]}" }],
    "structuredContent": { "passages": [] },
    "isError": false
  }
}
```

## When a tool call is refused

A tool runs through its route, so the route's own checks answer: the scope, the
[rate limit](/reference/core-api/errors-and-limits/#rate-limits), the request
limits and the budget. A refusal is a tool result with `isError: true`, and
its text is the route's error code and message:

```json
{
  "content": [{ "type": "text", "text": "BAD_REQUEST: query is required" }],
  "isError": true
}
```

That is the protocol's way to let a model read the failure and try again with
better arguments. The codes are the ones in
[Errors and limits](/reference/core-api/errors-and-limits/#error-codes).

A JSON-RPC `error` is kept for the protocol itself:

| Code | Means |
|---|---|
| `-32700` | The body is not JSON |
| `-32600` | Not a JSON-RPC 2.0 message, or a batch over 20 |
| `-32601` | A method this server does not implement |
| `-32602` | A tool that does not exist for this token, or `params.name` is missing |

A tool call spends the rate bucket of the route it runs. Thirty `call_place`
calls and the thirty-first is refused, on MCP and on REST alike.
