Cursor, VS Code, Codex and others

Any MCP client that supports Streamable HTTP, with OAuth or a static token.

Connection details

Transport Streamable HTTP
Endpoint a computer: https://mcp.opsgates.com/c/<id>/mcp — a server: https://YOUR-SERVER/mcp
Authentication OAuth 2.1 with PKCE and dynamic client registration (discovery at /.well-known/oauth-authorization-server). Servers also accept a static token in Authorization: Bearer <token>

Computers sign in only with OAuth (your OpsGates account). The examples below use a server URL; for a computer use its connector URL and the browser sign-in.

Create a static token on a server for clients that cannot open a browser:

sudo opsgate token create cursor
sudo opsgate token list
sudo opsgate token revoke cursor

Tokens are stored only as SHA-256 hashes; the token itself is shown once.

Cursor

~/.cursor/mcp.json (all projects) or .cursor/mcp.json (one project):

{
  "mcpServers": {
    "opsgate": { "url": "https://YOUR-SERVER/mcp" }
  }
}

Cursor opens the OpsGates sign-in page the first time. With a token instead:

{
  "mcpServers": {
    "opsgate": {
      "url": "https://YOUR-SERVER/mcp",
      "headers": { "Authorization": "Bearer ogt_..." }
    }
  }
}

VS Code

.vscode/mcp.json in your project, or MCP: Open User Configuration:

{
  "servers": {
    "opsgate": { "type": "http", "url": "https://YOUR-SERVER/mcp" }
  }
}

Codex CLI

~/.codex/config.toml:

[mcp_servers.opsgate]
url = "https://YOUR-SERVER/mcp"
bearer_token_env_var = "OPSGATE_TOKEN"
export OPSGATE_TOKEN=ogt_...
codex

Your own agents

Any MCP SDK works. With the official Python SDK:

from mcp import ClientSession
from mcp.client.streamable_http import streamablehttp_client

async with streamablehttp_client("https://YOUR-SERVER/mcp",
                                 headers={"Authorization": "Bearer ogt_..."}) as (r, w, _):
    async with ClientSession(r, w) as s:
        await s.initialize()
        print(await s.call_tool("service_status", {"name": "nginx"}))

Allowed sign-in redirects

The built-in sign-in only sends codes back to known apps: claude.ai, claude.com, chatgpt.com, vscode.dev, local desktop clients (localhost, 127.0.0.1) and editor schemes (cursor://, vscode://). To allow another web app, add its host:

sudo opsgate config set MCP_OAUTH_REDIRECT_HOSTS=claude.ai,claude.com,chatgpt.com,localhost,127.0.0.1,app.example.com