Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Add a remote MCP server that signs in with OAuth

For anyone adding a hosted MCP server whose setup page gives only an address, such as https://mcp.example.com/mcp, and says "your client will ask you to sign in". At the end, the server is in Surjection's store and in each client you pick, and each client has signed in to it with its own account.

Surjection does not sign in for your clients. With MCP's OAuth, each client is its own OAuth app: it registers with the server, opens the sign-in page and keeps the tokens in its own storage. So Surjection writes the entry (an HTTP server with no headers), shows how each client signs in, and you sign in once in each client.

Before you start

Steps

  1. Paste the address. Open MCP in the sidebar and choose Add server (or press Ctrl+N; on the MCP page, Ctrl+V outside a text field opens the dialog with the clipboard already pasted). Paste the address into Paste a server URL, a config snippet, or a command. The dialog says what it found, for example "Detected: Remote server (Streamable HTTP)". Choose Continue (or press Enter).

    The Add MCP server dialog with https://mcp.linear.app/mcp pasted and the message Detected: Remote server (Streamable HTTP).

  2. Review what was filled in. Name and ID come from the address (the ID follows the name until you edit it; it uses a-z, digits, ., _ and -, and clients show it as the server's name). Under Connection, the transport is Streamable HTTP (SSE for an address ending in /sse) and URL holds the address. Under Sign-in, choose Signs in with OAuth: no header is needed, the client adds its own token.

  3. Check this address (optional). Choose Check this address to find out what the server asks for before you add it. The first time for a host, Surjection asks before it contacts it ("Contact mcp.example.com?"); choose Check mcp.example.com or Don't contact it. The answer is remembered for that host on this computer, and you can change it in Settings > Address checks.

    The question Contact mcp.example.com? with what the check sends, that the answer is remembered, and the buttons Check mcp.example.com and Don't contact it.

    The check sends one MCP request without credentials and, if the server uses OAuth, reads public metadata from its sign-in server, which may be another host. It reports one of:

    • "Signs in with OAuth (sign-in server: ...)", and whether clients can register themselves with it, or that this is not known (when the sign-in server's metadata could not be read). When they cannot, or it is not known, a client may need a client ID from the server's owner.
    • "Asks for a token (HTTP 401) without OAuth": add the token as a header instead (paste-token.md).
    • "Answered without credentials".
    • "Could not reach ..." or "Unexpected answer ...", with the reason.

    The outcome also sets the Sign-in choice. See Security, Address check and client sign-in for exactly what is sent.

  4. Pick the clients. Under Enable in clients, the installed clients that can run a remote server are already on. Turn clients on or off; clients that are not installed, or that have no MCP config here, are behind Show N more. A client marked "(no MCP config here)" cannot get this entry from a file (Claude Desktop reads only local servers from its config file; see below).

    The review state of Add MCP server: Name and ID filled in from the address, Streamable HTTP with the URL, Signs in with OAuth selected, and the check's result Signs in with OAuth with its sign-in server.

  5. Choose Add server (or press Ctrl+Enter). In the default instant mode the client files are backed up and written at once. The notification says, for example, "Added Linear. Enabled in omp, Claude Code, Codex." Choose View to go to the server's card.

    The notification Added, with the clients the server is enabled in and a View button.

  6. Sign in from each client. Expand the server's card (View does this for you). Its Sign-in section lists each client the server is enabled in, with the client's own steps and the page they come from. For a client with a sign-in command, Sign in with client runs it: Surjection first shows the exact command and asks; choose Run it, then finish the sign-in in the browser. Surjection passes no token or password to the command. Steps marked Not verified were not confirmed against the client's documentation.

    The Sign-in section of a remote server's card: Claude Code and Codex with their sign-in commands and Sign in buttons (Sign in with Codex highlighted), and omp marked Signs in inside the client and Not verified.

    Restart a client that was open first. What each client does:

    ClientHow it signs in
    CodexSign in with Codex runs codex mcp login <id>; it opens the browser. In the ChatGPT desktop app, Settings > MCP servers shows Authenticate for a server that needs it (Codex docs).
    Claude CodeSign in with Claude Code runs claude mcp login <id>. Or, in a session, run /mcp, select the server and choose Authenticate. claude mcp list shows "Needs authentication" until then (Claude Code docs).
    OpenCodeSign in with OpenCode runs opencode mcp auth <id>; or open /mcps in OpenCode and authenticate the server (OpenCode docs).
    Gemini CLIIn a session, run /mcp auth <id>; it opens the browser (Gemini CLI docs).
    ompRun /mcp reauth <id> in omp; it opens the sign-in page and keeps the credential with your other sign-ins, not in mcp.json (omp docs). The app shows this client as Not verified.
    GitHub Copilot in VS CodeVS Code's Copilot sessions read ~/.copilot/mcp-config.json, the file Surjection writes for GitHub Copilot. Complete the authorization when VS Code prompts, or use Authenticate in the session's server actions (VS Code docs). Surjection only reads VS Code's own mcp.json.
    Grok BuildGrok Build supports OAuth for Streamable HTTP and SSE servers (Grok Build docs). Its docs do not describe the sign-in step for a server added through mcp.json; not verified here. Look for the server under Customize in Grok Build.
    Claude Desktop, claude.aiNot through a config file: remote servers are custom connectors. In Customize > Connectors, choose + Add, then Add custom connector, enter a name and the URL, pick how to sign in, and Add; then Connect. On Team and Enterprise plans an Owner first adds the connector under Organization settings > Connectors, and members then choose Connect. The connection comes from Anthropic's cloud, so the server must be reachable from the internet on port 443 (Claude Help Center). Surjection does not manage connectors.

    Clients without a listed step show "If client supports OAuth for remote servers, it asks you to sign in when it first connects". Each client signs in once; the token stays in that client. Signing out is the client's own command too (for example /mcp unauth <id> in omp, Clear authentication in Claude Code's /mcp).

On the command line

surject server check https://mcp.example.com/mcp   # optional: what the server asks for
surject server add https://mcp.example.com/mcp

server check asks before it contacts a host for the first time (in a script, --allow-host answers yes); the answer is shared with the app's Settings > Address checks. It exits 0 when the server answered (OAuth, token or open), 1 when it could not be checked, and 4 (host_waiting) when the host is not allowed.

server add <url> makes the ID from the address and an HTTP server (SSE when the path ends in /sse), and enables it for the detected clients that can run it. To choose the ID, use surject server add acme-docs --url https://mcp.example.com/mcp; to choose the clients, --client omp --client codex (repeatable), --all-detected, or --no-clients to only define it. Without --header there are no headers. Then sign in from each client as in step 6.

Check that it worked

  • The server has a card on the MCP page with a pill for each client, and surject status shows the entries as in sync.
  • Each client lists the server as connected after the sign-in, for example claude mcp list shows "Connected" instead of "Needs authentication".
  • If a client keeps asking to sign in, check the URL (the path matters) and that no Authorization header is set on the server: a header you set yourself takes precedence over the client's sign-in in some clients.

Undo

History, select the apply, Undo this apply (surject rollback last). To remove the server later: the trash button on its card, or surject server rm <id>. Removing it from Surjection does not revoke the sign-in at the service: each client keeps its own token. Sign out in each client first if you want the token gone (/mcp unauth <id> in omp, claude mcp logout <id> for Claude Code, which also revokes it where the service supports that), or revoke the app in the service's own account settings.

More detail