Skip to content

Latest commit

 

History

History
293 lines (200 loc) · 31 KB

File metadata and controls

293 lines (200 loc) · 31 KB

McpGateways

Overview

Available Operations

  • list - List MCP gateways
  • create - Create an MCP gateway
  • list_tools - List exposed tools for a gateway
  • retrieve - Retrieve an MCP gateway
  • delete - Delete an MCP gateway
  • update - Update an MCP gateway

list

Returns a paginated list of MCP gateways in the workspace.

Example Usage

from orq_ai_sdk import Orq
import os


with Orq(
    api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:

    res = orq.mcp_gateways.list()

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
limit Optional[int] ➖ Page size between 1 and 200. Defaults to 25.
starting_after Optional[str] ➖ Cursor for the page after the given item id. Mutually exclusive with ending_before.
ending_before Optional[str] ➖ Cursor for the page before the given item id. Mutually exclusive with starting_after.
search Optional[str] ➖ Case-insensitive match against the gateway key and display name.
status Optional[models.McpGatewayStatus] ➖ Returns only gateways in this status.
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.ListMcpGatewaysResponse

Errors

Error Type Status Code Content Type
models.APIDefaultError 4XX, 5XX */*

create

Creates a client-facing MCP gateway that links one or more synced upstream servers and exposes a unified MCP endpoint.

Example Usage

from orq_ai_sdk import Orq
import os


with Orq(
    api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:

    res = orq.mcp_gateways.create(key="<key>", display_name="Litzy_Ruecker98", server_links=[
        {
            "mcp_server_id": "<id>",
            "alias": "<value>",
            "tool_exposure": {
                "mode": "MCP_TOOL_EXPOSURE_MODE_ALL",
            },
        },
    ])

    # Handle response
    print(res)

Parameters

Parameter Type Required Description Example
key str ✔️ Lowercase slug of letters, digits, hyphens and underscores, max 64 characters, unique per workspace; backs the gateway's public MCP URL.
display_name str ✔️ Human readable name shown in the workspace. Production Gateway
description Optional[str] ➖ Free-form note about what this gateway is for.
server_links List[models.McpGatewayServerLink] ➖ Upstream servers this gateway aggregates.
tool_naming Optional[models.McpToolNaming] ➖ N/A
mode Optional[models.McpGatewayMode] ➖ N/A
sharing Optional[models.Sharing] ➖ Which projects in the workspace may use this gateway. Defaults to every project.
plugins List[models.McpGatewayPlugin] ➖ Plugins run on every tool call this gateway serves.
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.CreateMcpGatewayResponse

Errors

Error Type Status Code Content Type
models.APIDefaultError 4XX, 5XX */*

list_tools

Returns the namespaced tool view for a gateway.

Example Usage

from orq_ai_sdk import Orq
import os


with Orq(
    api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:

    res = orq.mcp_gateways.list_tools(gateway_id="<id>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
gateway_id str ✔️ Unique identifier of the MCP gateway.
limit Optional[int] ➖ Page size between 1 and 200. Defaults to 25.
starting_after Optional[str] ➖ Cursor for the page after the given exposed_name. Mutually exclusive with ending_before.
ending_before Optional[str] ➖ Cursor for the page before the given exposed_name. Mutually exclusive with starting_after.
mcp_server_id Optional[str] ➖ Returns only tools contributed by this upstream server.
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.ListMcpGatewayToolsResponse

Errors

Error Type Status Code Content Type
models.APIDefaultError 4XX, 5XX */*

retrieve

Retrieves the details of an existing MCP gateway by its unique ID.

Example Usage

from orq_ai_sdk import Orq
import os


with Orq(
    api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:

    res = orq.mcp_gateways.retrieve(id="<id>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
id str ✔️ Unique identifier of the MCP gateway.
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.GetMcpGatewayResponse

Errors

Error Type Status Code Content Type
models.APIDefaultError 4XX, 5XX */*

delete

Deletes an MCP gateway from the workspace. The response body is empty when the delete succeeds.

Example Usage

from orq_ai_sdk import Orq
import os


with Orq(
    api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:

    res = orq.mcp_gateways.delete(id="<id>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
id str ✔️ Unique identifier of the MCP gateway.
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.DeleteMcpGatewayResponse

Errors

Error Type Status Code Content Type
models.APIDefaultError 4XX, 5XX */*

update

Updates mutable fields of an existing MCP gateway. Omitted optional fields keep their current values.

Example Usage

from orq_ai_sdk import Orq
import os


with Orq(
    api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:

    res = orq.mcp_gateways.update(id="<id>", server_links=[
        {
            "mcp_server_id": "<id>",
            "alias": "<value>",
            "tool_exposure": {
                "mode": "MCP_TOOL_EXPOSURE_MODE_ALL",
            },
        },
    ])

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
id str ✔️ Unique identifier of the MCP gateway.
key Optional[str] ➖ Rejected with INVALID_ARGUMENT: the key backs the gateway's public MCP URL
and is immutable after creation. Retained so callers get an error rather
than a silently ignored field.
display_name Optional[str] ➖ Human readable name shown in the workspace.
description Optional[str] ➖ Free-form note about what this gateway is for.
server_links List[models.McpGatewayServerLink] ➖ Replaces the current links. An empty array is treated as no change; use clear_server_links to remove them all.
tool_naming Optional[models.McpToolNaming] ➖ N/A
status Optional[models.McpGatewayStatus] ➖ N/A
mode Optional[models.McpGatewayMode] ➖ N/A
sharing Optional[models.Sharing] ➖ Which projects in the workspace may use this gateway. Defaults to every project.
clear_server_links Optional[bool] ➖ Set true to remove every link; cannot be combined with server_links.
plugins List[models.McpGatewayPlugin] ➖ Plugins run on every tool call this gateway serves.
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.UpdateMcpGatewayResponse

Errors

Error Type Status Code Content Type
models.APIDefaultError 4XX, 5XX */*