aigwdocs

Connecting MCP servers

People and agents reach every MCP server through one address on the gateway, https://gateway.aigw.app/mcp/<server>, with their aigw key. aigw checks the call against your tool policy, records it, and then calls the server with the credential that server needs. Choosing that credential is what this page is about: it is set per server, under Tools > the server > Auth.

How aigw signs in to a server

AuthWhat the server receivesUse it for
NoneNothingOpen servers, and servers inside your network
Bearer tokenAuthorization: Bearer <token>A server with one API token
API key (named header)Your header, e.g. X-API-KeyA server that takes a key in its own header
BasicUser and passwordOlder internal services
OAuth2 (client credentials)A token aigw fetches and renewsA server that trusts a service identity from your IdP
On behalf of the callerA token exchanged for the person’s own (Entra on-behalf-of, or RFC 8693)Your own servers that trust your IdP, when callers arrive with an IdP token
Each person connects their own accountThat person’s own token at the serverSaaS servers where everyone has their own account: Miro, LeanIX, GitHub, Atlassian
mTLSA client certificateServers that require one

Secrets are sealed when you save them and only the gateway opens them. The console never shows them again; it shows that one is on file.

Every option except the last presents one credential for everybody, so the server sees aigw, not a person, and applies that one account’s permissions. aigw still records who made each call. When the server itself has to see the person, use per-person connections.

Per-person connections

With Each person connects their own account, everyone signs in to the server once with their own account, and aigw calls the server as them from then on. People keep using only their aigw key; they never handle the server’s tokens.

What an admin sets

Choose Each person connects their own account under Auth. That is usually all: aigw finds the server’s sign-in from the server itself (the MCP authorization standard) and registers itself there.

Each person needs their own aigw key. A connection belongs to the person a key belongs to, so a key shared between people would share one person’s account. People can create their own key under Access.

What a person sees

The first time someone uses the server, it is there but not yet connected. In Claude Code, Cursor or any MCP client, it offers one tool, connect_<server>. Ask for anything on that server and the assistant calls it and shows the link:

  1. Open the link. The page says what is being connected and for which key.
  2. Click Continue to sign in and sign in at the server’s own login page. If your company uses single sign-on at that vendor, this is usually one click.
  3. The page says Connected. Ask again: the server’s real tools are there now.

Behind step 3, aigw ends the stand-in session and the client opens a new one against the real server. That is part of the MCP transport, so no client needs reconnecting by hand.

A client that supports MCP’s URL elicitation (-32042) offers the same link as a sign-in prompt when a real tool is called without a connection.

After connecting

Signing in to aigw from an MCP client

Separately from how aigw signs in to servers, people can sign in to aigw from their MCP client with your company’s single sign-on, instead of using a key. aigw then knows each person and their groups on every tool call, and tool access can be granted by group.

  1. Set up Settings > Access & security > Single sign-on with your identity provider, and verify your email domain with the DNS record shown. For Microsoft Entra: register an app with the redirect URI https://api.aigw.app/v1/auth/sso/callback, add a client secret, and for group-based access add the groups claim. Grant admin consent for the app if your users cannot consent themselves: aigw asks for offline access so it can check back with Entra.
  2. Turn on Sign in from MCP clients in the same section.
  3. People add https://gateway.aigw.app/mcp/<workspace>/all (every server) or .../<workspace>/<server> (one) in their client, which opens the sign-in.

aigw checks each sign-in with your identity provider every few minutes: someone disabled there loses access at their next renewal, and group changes apply then. A person in more groups than Entra puts in a token keeps their groups: aigw reads them from Microsoft Graph with the sign-in’s own User.Read.

This sign-in and per-person connections work together: a person signed in with SSO has their own connections, as with their own key.

When something goes wrong

Every failure comes back as an MCP error that names the server and the reason, so the client can show it:

Self-hosted gateways

Everything here works on a self-hosted gateway. For per-person connections, the people’s tokens are held sealed by aigw’s control plane and handed to your gateway per call, sealed to it. Keeping them only on your gateway is on the roadmap.