> ## Documentation Index
> Fetch the complete documentation index at: https://docs.orq.ai/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Orq.ai is the control plane for model and MCP traffic: one key reaches the workspace's enabled models, MCP servers, and resources. The setup depends on where the agent runs.
> Hosted assistant (ChatGPT, claude.ai, a hosted sandbox): install nothing. Tell the human to add https://my.orq.ai/v2/mcp as a remote MCP connector and finish the Orq.ai sign-in. With OAuth, send no Authorization header; otherwise send an API key as a bearer token.
> Local coding agent (Claude Code, Codex, Cursor, OpenCode): run `curl -fsSL https://cli.orq.ai/install.sh | sh`. It installs the CLI and runs `orq setup`, which signs in, writes a project-scoped key to `~/.orq/env`, and wires the detected agents through the AI Gateway. It can also add the Orq MCP server and Orq Skills, the workflows for agents, evaluations, and traces: https://docs.orq.ai/ai-studio/integrations/code-assistants/orq-skills.md. Cursor receives the Orq MCP server and Orq Skills only; its model calls are not routed through the AI Gateway. Verify with `orq status`.
> Headless or CI: read `ORQ_API_KEY` from the environment; a human creates the key at https://docs.orq.ai/ai-studio/organization/api-keys.md.
> Send model traffic to https://my.orq.ai/v3/router with `Authorization: Bearer $ORQ_API_KEY`; the Anthropic SDK uses https://my.orq.ai/v3/anthropic. New integrations go on `/v3/router`: `/v2/router` stays published for backward compatibility, and `orq.prompt` works only on `/v2/router/chat/completions`.
> To enable a model for the workspace, ask a human to enable it in the Model Garden, or call `POST /v2/workspace-models` with a Management Key that has `workspace-model` write; API keys are rejected with `403`. Use the model's exact `provider/model` id. A call fails while the workspace has neither credits nor a provider key.
> On `/chat/completions`, a reasoning model rejects `tools` with a `reasoning_effort` other than `none`; `/responses` keeps reasoning.
> On a failure, branch on `error.code` and follow `error.doc_url`; a budget rejection answers 429.

# Quickstart

> Add an MCP server, sync it, build a gateway, and connect a client.

This path takes one upstream MCP server to one gateway and one client. The same steps apply to an OpenAPI server, which has no sync step.

## Before you start

* An upstream MCP endpoint over HTTP or SSE, an OpenAPI document, or an **MCP Provider**. MCP Providers are preconfigured connections such as Slack, Linear, Notion, or GitHub, so you do not need to host an HTTP server yourself. See the [full provider list](https://docs.orq.ai/ai-gateway/mcp-portal/mcp-servers.md#from-an-mcp-provider-or-an-mcp-url).
* The credentials that endpoint needs, if any.
* The client you will connect: Claude Code, Cursor, Codex, VS Code, Claude Desktop, or another MCP-compatible client.
* A workspace role that can create MCP Servers and MCP Gateways, such as **Admin**, or an API key with write access to both.

## Walkthrough

> [tab] AI Studio
>
> **1. Add an MCP Server**
>
> * **Open** **AI Gateway > MCP Portal > MCP Servers**.
> * **Select** <kbd>Add an MCP server</kbd>.
> * **Choose** an **MCP Provider**, an MCP URL, or OpenAPI.
> * **Set** the **Key**, **Connection**, and **Authentication**.
> * **Save** the server.
>
> ![Create server page with OpenAPI and MCP URL cards and a catalog of MCP Providers.](https://mintcdn.com/orqai/sfKTr29e0I7JbeYB/images/mcp-server-catalog-418.png?fit=max\&auto=format\&n=sfKTr29e0I7JbeYB\&q=85\&s=10fc9d83b7b6291101442c5538b8a12b)
>
> Create page with OpenAPI, MCP URL, and MCP Provider options.
>
> **2. Sync the server**
>
> * **MCP URL from the console**: syncs when you save.
> * **Per-user OAuth**: syncs after the account is connected.
> * **API-created**: run an explicit sync.
> * **OpenAPI**: no sync; the tools exist at create.
> * **Wait** for the server to show **Synced** and a tool count in the **MCP Servers** list. **Synced** means Orq.ai finished discovering its tools; **Failed** means the connection or credentials need fixing.
>
> See [Sync and tools](https://docs.orq.ai/ai-gateway/mcp-portal/mcp-servers.md#sync-and-tools).
>
> **3. Build an MCP Gateway**
>
> * **Open** **MCP Gateways**.
> * **Select** <kbd>MCP Gateway</kbd>.
> * **Set** the **Key**.
> * **Set runtime limits** (optional): request and tool timeouts, request and response size caps, max tools, and per-token or per-gateway rates. See [Runtime limits](https://docs.orq.ai/ai-gateway/mcp-portal/mcp-gateways/security.md#runtime-limits).
> * **Choose** how the gateway presents tools:
>   * **Code mode** (Exposes search, describe, and execute instead of every upstream tool.): a compact surface for a large tool catalogue.
>   * **Direct** (Exposes each upstream tool individually.): one client tool per upstream tool, with its annotations.
> * **Create** the gateway; the key becomes the public URL.
>
> See [MCP Gateways](https://docs.orq.ai/ai-gateway/mcp-portal/mcp-gateways.md).
>
> ![Create MCP Gateway form with Key, tool exposure mode, tool naming, runtime limits, and guardrails.](https://mintcdn.com/orqai/efuWqdURPf05zilL/images/create-mcp-gateway-form.png?fit=max\&auto=format\&n=efuWqdURPf05zilL\&q=85\&s=82708358b259c21a8bbc8ac26acfe824)
>
> Create MCP Gateway form
>
> **4. Link the server and expose tools**
>
> On the gateway's **Toolset** tab:
>
> * Select <kbd>+ Add server</kbd> and choose the synced server.
> * Use the  toggle on the server row to expose or hide every visible tool, or expand the server and toggle individual tools.
> * Resources and prompts have their own exposure toggles.
>
> See [Tool exposure](https://docs.orq.ai/ai-gateway/mcp-portal/mcp-gateways.md#scope-tools).
>
> ![MCP Gateway Toolset tab with a linked server and its exposed tools.](https://mintcdn.com/orqai/4rHc7pk98wwKW0RE/images/mcp-gateway-toolset-tab-418.png?fit=max\&auto=format\&n=4rHc7pk98wwKW0RE\&q=85\&s=be14db3150724335ceecfb023c063da8)
>
> Toolset tab after linking a server
>
> **5. Connect a client**
>
> * Copy the command from the gateway's **Connect** section, or register the gateway URL in the client.
> * Run the command; the client opens the browser for OAuth on first use.
> * For a headless client that cannot open a browser, use an API key instead.
>
> ```bash wrap theme={"theme":{"light":"github-light","dark":"github-dark"}}
> npx add-mcp https://my.orq.ai/v3/mcp/<gateway-key> --name <gateway-key>
> ```
>
> See [Connect clients](https://docs.orq.ai/ai-gateway/mcp-portal/mcp-gateways/connect-clients.md).

> [tab] API & SDK
>
> The examples use the **Orq.ai** MCP Provider with your `ORQ_API_KEY`.
>
> **1. Add an MCP Server**
>
> ```bash cURL wrap theme={"theme":{"light":"github-light","dark":"github-dark"}}
> curl -X POST https://my.orq.ai/v2/mcp-servers \
>   -H "Authorization: Bearer $ORQ_API_KEY" \
>   -H "Content-Type: application/json" \
>   -d '{
>     "key": "orq",
>     "display_name": "Orq MCP",
>     "connection": {
>       "type": "MCP_CONNECTION_TYPE_HTTP",
>       "url": "https://my.orq.ai/v2/mcp"
>     },
>     "auth": { "type": "MCP_AUTH_TYPE_STATIC_HEADERS", "static_headers": [{ "key": "Authorization", "value": "Bearer <ORQ_API_KEY>" }] },
>     "default_tool_exposure": { "mode": "MCP_TOOL_EXPOSURE_MODE_ALL" }
>   }'
> ```
>
> ```typescript TypeScript wrap theme={"theme":{"light":"github-light","dark":"github-dark"}}
> const server = await client.mcpServers.create({
>   key: "orq",
>   displayName: "Orq MCP",
>   connection: {
>     type: "MCP_CONNECTION_TYPE_HTTP",
>     url: "https://my.orq.ai/v2/mcp",
>   },
>   auth: { type: "MCP_AUTH_TYPE_STATIC_HEADERS", staticHeaders: [{ key: "Authorization", value: "Bearer <ORQ_API_KEY>" }] },
>   defaultToolExposure: { mode: "MCP_TOOL_EXPOSURE_MODE_ALL" },
> });
>
> console.log(server.mcpServer?.id);
> ```
>
> ```python Python wrap theme={"theme":{"light":"github-light","dark":"github-dark"}}
> server = client.mcp_servers.create(
>     key="orq",
>     display_name="Orq MCP",
>     connection={
>         "type": "MCP_CONNECTION_TYPE_HTTP",
>         "url": "https://my.orq.ai/v2/mcp",
>     },
>     auth={"type": "MCP_AUTH_TYPE_STATIC_HEADERS", "static_headers": [{"key": "Authorization", "value": "Bearer <ORQ_API_KEY>"}]},
>     default_tool_exposure={"mode": "MCP_TOOL_EXPOSURE_MODE_ALL"},
> )
>
> print(server.mcp_server.id)
> ```
>
> Use the same `ORQ_API_KEY` in the server `Authorization` header. The response carries the server `id`.
>
> **2. Sync the server**
>
> ```bash cURL wrap theme={"theme":{"light":"github-light","dark":"github-dark"}}
> curl -X POST "https://my.orq.ai/v2/mcp-servers/<server-id>:sync" \
>   -H "Authorization: Bearer $ORQ_API_KEY" \
>   -H "Content-Type: application/json" \
>   -d '{}'
> ```
>
> ```typescript TypeScript wrap theme={"theme":{"light":"github-light","dark":"github-dark"}}
> await client.mcpServers.sync({ id: "<server-id>" });
> ```
>
> ```python Python wrap theme={"theme":{"light":"github-light","dark":"github-dark"}}
> client.mcp_servers.sync(id="<server-id>")
> ```
>
> Wait for `sync_state.status` to read `SYNC_STATUS_SYNCED`.
>
> **3. Build an MCP Gateway**
>
> ```bash cURL wrap theme={"theme":{"light":"github-light","dark":"github-dark"}}
> curl -X POST https://my.orq.ai/v2/mcp-gateways \
>   -H "Authorization: Bearer $ORQ_API_KEY" \
>   -H "Content-Type: application/json" \
>   -d '{
>     "key": "workspace-tools",
>     "display_name": "Orq MCP tools",
>     "mode": "MCP_GATEWAY_MODE_CODE",
>     "tool_naming": "MCP_TOOL_NAMING_PREFIX_WITH_SERVER_KEY"
>   }'
> ```
>
> ```typescript TypeScript wrap theme={"theme":{"light":"github-light","dark":"github-dark"}}
> const gateway = await client.mcpGateways.create({
>   key: "workspace-tools",
>   displayName: "Orq MCP tools",
>   mode: "MCP_GATEWAY_MODE_CODE",
>   toolNaming: "MCP_TOOL_NAMING_PREFIX_WITH_SERVER_KEY",
> });
>
> console.log(gateway.mcpGateway?.publicUrl);
> ```
>
> ```python Python wrap theme={"theme":{"light":"github-light","dark":"github-dark"}}
> gateway = client.mcp_gateways.create(
>     key="workspace-tools",
>     display_name="Orq MCP tools",
>     mode="MCP_GATEWAY_MODE_CODE",
>     tool_naming="MCP_TOOL_NAMING_PREFIX_WITH_SERVER_KEY",
> )
>
> print(gateway.mcp_gateway.public_url)
> ```
>
> The response carries the gateway `id` and `public_url`.
>
> **4. Link the server and expose tools**
>
> ```bash cURL wrap theme={"theme":{"light":"github-light","dark":"github-dark"}}
> curl -X PATCH https://my.orq.ai/v2/mcp-gateways/<gateway-id> \
>   -H "Authorization: Bearer $ORQ_API_KEY" \
>   -H "Content-Type: application/json" \
>   -d '{
>     "server_links": [
>       {
>         "mcp_server_id": "<server-id>",
>         "alias": "orq",
>         "enabled": true,
>         "tool_exposure": { "mode": "MCP_TOOL_EXPOSURE_MODE_ALL" }
>       }
>     ]
>   }'
> ```
>
> ```typescript TypeScript wrap theme={"theme":{"light":"github-light","dark":"github-dark"}}
> await client.mcpGateways.update({
>   id: "<gateway-id>",
>   updateMcpGatewayRequest: {
>     serverLinks: [
>       {
>         mcpServerId: "<server-id>",
>         alias: "orq",
>         enabled: true,
>         toolExposure: { mode: "MCP_TOOL_EXPOSURE_MODE_ALL" },
>       },
>     ],
>   },
> });
> ```
>
> ```python Python wrap theme={"theme":{"light":"github-light","dark":"github-dark"}}
> client.mcp_gateways.update(
>     id="<gateway-id>",
>     server_links=[
>         {
>             "mcp_server_id": "<server-id>",
>             "alias": "orq",
>             "enabled": True,
>             "tool_exposure": {"mode": "MCP_TOOL_EXPOSURE_MODE_ALL"},
>         }
>     ],
> )
> ```
>
> `server_links` replaces every link, so send the full set. `enabled: true` makes the link serve tools.
>
> **5. Connect a client**
>
> Use the gateway `public_url` as the client URL. See [Connect clients](https://docs.orq.ai/ai-gateway/mcp-portal/mcp-gateways/connect-clients.md) for the client configuration.

> [tab] CLI
>
> The same flow with the `orq` CLI, using the **Orq.ai** MCP Provider with your `ORQ_API_KEY`. [Install the CLI](https://docs.orq.ai/reference/cli.md#installation), then replace the placeholder IDs with the values the commands print.
>
> **1. Add an MCP Server**
>
> Create the **Orq.ai** MCP Provider with your API key:
>
> ```bash wrap theme={"theme":{"light":"github-light","dark":"github-dark"}}
> orq mcp-servers create \
>   --key orq \
>   --display-name "Orq MCP" \
>   --connection '{"type":"MCP_CONNECTION_TYPE_HTTP","url":"https://my.orq.ai/v2/mcp"}' \
>   --auth '{"type":"MCP_AUTH_TYPE_STATIC_HEADERS","static_headers":[{"key":"Authorization","value":"Bearer <ORQ_API_KEY>"}]}' \
>   --default-tool-exposure '{"mode":"MCP_TOOL_EXPOSURE_MODE_ALL"}'
> ```
>
> Use the same `ORQ_API_KEY` in the server `Authorization` header. The command prints the server ID.
>
> **2. Sync the server**
>
> Run the first sync and wait for `SYNC_STATUS_SYNCED`:
>
> ```bash wrap theme={"theme":{"light":"github-light","dark":"github-dark"}}
> orq mcp-servers sync <server-id>
> ```
>
> **3. Build an MCP Gateway**
>
> Create a Code mode gateway. The command prints the gateway ID and public URL:
>
> ```bash wrap theme={"theme":{"light":"github-light","dark":"github-dark"}}
> orq mcp-gateways create \
>   --key workspace-tools \
>   --display-name "Orq MCP tools" \
>   --mode MCP_GATEWAY_MODE_CODE \
>   --tool-naming MCP_TOOL_NAMING_PREFIX_WITH_SERVER_KEY
> ```
>
> **4. Link the server and expose tools**
>
> Link the synced server. `--server-links` replaces every link, so send the full set:
>
> ```bash wrap theme={"theme":{"light":"github-light","dark":"github-dark"}}
> orq mcp-gateways update <gateway-id> \
>   --server-links '[{"mcp_server_id":"<server-id>","alias":"orq","enabled":true,"tool_exposure":{"mode":"MCP_TOOL_EXPOSURE_MODE_ALL"}}]'
> ```
>
> **5. Connect a client**
>
> Register the gateway URL in the client:
>
> ```bash wrap theme={"theme":{"light":"github-light","dark":"github-dark"}}
> npx add-mcp https://my.orq.ai/v3/mcp/workspace-tools --name workspace-tools
> ```

## Verify

List the gateway's tools from the client. In Code mode, `search` returns the exposed tools and `execute` runs them. In Direct, the client lists each upstream tool.

Open the gateway's **Traces** tab and confirm the call appears. If the client lists no tools, check that the server is linked, the tools are exposed, and the token carries `mcp:tools`. See [Troubleshooting](https://docs.orq.ai/ai-gateway/mcp-portal/troubleshooting.md).

> [card] [MCP Servers](https://docs.orq.ai/ai-gateway/mcp-portal/mcp-servers.md)
>
> Authentication, OpenAPI, sync, health, and server lifecycle.

> [card] [MCP Gateways](https://docs.orq.ai/ai-gateway/mcp-portal/mcp-gateways.md)
>
> Tool exposure, Code mode, access, and limits.

> [card] [Connect clients](https://docs.orq.ai/ai-gateway/mcp-portal/mcp-gateways/connect-clients.md)
>
> Client setup, OAuth, client credentials, and API keys.

> [card] [Troubleshooting](https://docs.orq.ai/ai-gateway/mcp-portal/troubleshooting.md)
>
> Fix a client that connects but lists no tools.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.