Skip to main content

MCP servers guide

How to register upstream MCP servers and discover their tools.

Overview​

MCP Servers are upstream Model Context Protocol servers that Cortega exposes through the gateway. Registering a server tells Cortega where the server is, how to authenticate to it, and whether it should be rendered into gateway config.

MCP Servers do not assign caller teams. Teams come from Identities and MCP Authorization.

Add an MCP server​

Navigate to AI Border Gateway → MCP.

  1. Click Add Server.
  2. Enter a server name.
  3. Select the transport.
  4. Enter the endpoint or command details.
  5. Select upstream auth, if the upstream server requires it.
  6. Save.

Transport choices​

TransportUse when
Streamable HTTPThe MCP server exposes the streamable HTTP transport
HTTP SSEThe MCP server uses Server-Sent Events
StdioYou want to store a local command-based MCP server definition

Enabled HTTP servers are rendered into gateway config. Stdio server records are stored, but the current gateway target render path only includes HTTP transports.

Enable or disable a server​

Use the Enabled toggle on the MCP Servers table.

StateResult
EnabledRendered into gateway config if it uses an HTTP transport
DisabledRemoved from gateway config

The legacy approval field is informational. Rendering is controlled by Enabled.

Upstream auth​

Choose upstream auth based on how Cortega should authenticate when it forwards calls to the server.

Common options:

Auth typeUse when
NoneThe upstream server needs no auth
API keyCortega should attach a stored key to upstream calls
Client-supplied upstream credentialThe client sends its own credential for this server in a request header; Cortega never stores it
CopilotThe upstream is GitHub Copilot MCP
GCP / AWS / Azure implicitThe gateway environment supplies cloud identity

API keys are encrypted at rest and rendered as secret references.

Choose Client-supplied upstream credential when the client brings its own credential for the upstream server. The client still authenticates to Cortega with an MCP identity; it sends the server credential in the upstream-credential header, and Cortega forwards that value as the upstream Authorization and strips the header before the call. See Pass-through routing for the safety rules and the stored-credential override.

Discover tools​

Tool discovery reads the upstream server's current tool list and stores it in Cortega.

Use discovery when:

  • you first register a server
  • an upstream server adds or removes tools
  • MCP Authorization needs current tool checkboxes

You can discover tools for one server, or use Get All Tools where available.

Discovery updates existing tools and removes tools that no longer exist on that server. Existing MCP Authorization selections are preserved when the same tool remains present.

Servers on a private network​

Discovery and JWKS checks are made by management-backend itself. It never follows redirects, reports only the upstream HTTP status on failure (never the response body), and always refuses link-local addresses, which include the cloud instance metadata endpoint 169.254.169.254.

CORTEGA_EGRESS_ALLOW_PRIVATE controls private networks. Left blank (the default in every env template), it follows CORTEGA_MULTI_TENANCY_ENABLED:

  • Single-organisation install (multi-tenancy off, the usual on-prem setup): private networks are allowed, so MCP servers and JWKS endpoints on the same Docker network or LAN (for example a compose service name such as http://my-mcp:8080/mcp) work out of the box.
  • Multi-tenant install: private, loopback and other internal addresses (checked after DNS resolution) are refused too, so a URL one tenant registers can't reach the install's own network.

Set it to true or false in the .env management-backend reads, and restart it, to override either way. Gateway traffic to MCP servers is not affected by this setting. Package upgrades (migrate-package-env.py) show the setting with this explanation and leave it blank unless you enter a value.

For HTTP SSE servers the message endpoint the server announces must be on the same scheme, host and port as the registered server URL.

SSE servers​

For HTTP SSE servers, Cortega initializes the SSE connection first and posts JSON-RPC messages to the server-provided message endpoint. Directly posting initialize to an SSE URL can return 404.

Troubleshooting​

SymptomLikely causeWhat to check
Server does not appear in gateway configDisabled, non-HTTP transport, or global MCP toggle offCheck server Enabled state and transport
Tool discovery returns 404SSE endpoint was treated as direct POST endpointConfirm server transport is HTTP SSE
Tool discovery fails with "private or internal network address"The server URL resolves to a link-local/metadata address (always refused), or to a private address on a multi-tenant install (or with CORTEGA_EGRESS_ALLOW_PRIVATE=false)Use a public address for the server, or set CORTEGA_EGRESS_ALLOW_PRIVATE=true if you accept that tenants' URLs can reach the install's network
No tools appear under MCP AuthorizationTools have not been discovered yetRun discovery for the server
Upstream call fails authWrong upstream auth type or missing credentialEdit server upstream auth settings