# Manage custom operator MCP publishing

Publish the enabled custom operator as a workspace MCP tool for discovery and invocation by clients that support MCP. Publishing, unpublishing and querying status use custom operator API. The client uses the MCP entry of the workspace when calling published tools.

<span id="调用前准备"></span>

## Before you call


Configure the [CloudSigma regional endpoint and authentication](https://omnifabric.cloudsigma.com/docs/developer/endpoints-and-authentication.html.md) before calling. The endpoint, credentials, workspace, and resource IDs must belong to the same region.
First [query the custom operator details](https://omnifabric.cloudsigma.com/docs/reference/api/ai-studio/data-processing/custom-operators/get-custom-operator.html.md#成功响应), obtain the operator ID and confirm that the operator is enabled. Prepare [personal access token](https://omnifabric.cloudsigma.com/docs/guides/billing/credentials.html.md#personal-access-token) and [target workspace ID](https://omnifabric.cloudsigma.com/docs/guides/ai-studio/resource-center/workspace.html.md#复制工作区-id) with access rights to the target workspace.

- **Publish or Unpublish**: Requires the operator's update permission.
- **Query status**: Requires read permission of operator.
- **Call from MCP client**: Directories are filtered by read permissions, calls also require run permissions.

The product API bridging tool uses different directory visibility rules and still needs to pass the permission verification of the product interface when calling.
Tools visible in the directory do not necessarily allow invocation by the current identity.

<span id="发布取消发布和查询状态"></span>

## Publish, unpublish and query status

Only one active version of the same `identifier` can be released. When another version is released, it replaces the current version. Unpublishing only removes the publication corresponding to the current operator.

After deactivating the operator, the tool will be hidden, but publishing records may be retained. `published` and `live_published` combined with the enabled status indicate whether the tool is visible and cannot be used to determine whether the release record exists.

Publishing, unpublishing and status queries all return `code`, `msg`, `data`. The data contains `operator_id`, `identifier`, `version`, `published`, and `live_published`. `live_operator_id` and `live_version` are also returned when there is a currently active version. Business errors only return `code` and `msg`. The current execution release for the deactivated operator returns `500` / `ErrServer`.

Replace `$OPERATOR_ID` with your custom operator ID.

:::::::{div} mo-api-tabs
::::::{tab-set}
:::::{tab-item} publish

```bash
curl -X POST "$CLOUDSIGMA_API_BASE/workflow/v2/custom-operators/$OPERATOR_ID/mcp-publish" \
  -H "X-API-Key: $CLOUDSIGMA_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID"
```

:::::
:::::{tab-item} Unpublish

```bash
curl -X POST "$CLOUDSIGMA_API_BASE/workflow/v2/custom-operators/$OPERATOR_ID/mcp-unpublish" \
  -H "X-API-Key: $CLOUDSIGMA_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID"
```

:::::
:::::{tab-item} Query status

```bash
curl "$CLOUDSIGMA_API_BASE/workflow/v2/custom-operators/$OPERATOR_ID/mcp-status" \
  -H "X-API-Key: $CLOUDSIGMA_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID"
```

:::::
:::::{tab-item} Parameter reference

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `operator_id` | integer | Yes | Custom operator ID, located in the request path. |

:::::
::::::
:::::::

Publish or cancel the publication and return after synchronously completing the writing and querying the status. The error may occur after writing. Check the publishing status first and then decide whether to resubmit.

<span id="从-mcp-客户端调用已发布算子"></span>

## Calling a published operator from an MCP client

When calling `tools/list` and `tools/call`, `X-Workspace-ID` must be submitted at the same time, and it must be completely consistent with the path workspace. Initialization, notification and `ping` do not use the same tool call check.

The workspace entrance of the published tools is as follows. This portal uses sessionless Streamable HTTP and JSON-RPC. Use `X-API-Key` to pass the personal access token, and do not pass the `Authorization` request header at the same time.

```text
POST $CLOUDSIGMA_API_BASE/workspaces/{workspace_id}/published-mcp
```

Initialize first, then call `tools/list` to obtain the tools available to the current caller. After initialization is completed, `notifications/initialized` notification is sent. The notification returns HTTP `202` with no response body.

```bash
curl -X POST "$CLOUDSIGMA_API_BASE/workspaces/$WORKSPACE_ID/published-mcp" \
  -H "X-API-Key: $CLOUDSIGMA_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "jsonrpc": "2.0",
    "id": "init-01",
    "method": "initialize",
    "params": {
      "protocolVersion": "2025-03-26",
      "capabilities": {},
      "clientInfo": {
        "name": "example-client",
        "version": "1.0.0"
      }
    }
  }'
```

`GET` and `DELETE` do not support this entry and return HTTP `405`.
