MCP surface starter

Create an MCP surface in the Agent Surface canvas, connect an MCP transit point through the gateway, and test routing with the correct URL pattern.

Use this guide when you want AI agents to call MCP tools through a governed access point, so every request is subject to identity, scope, and observability rather than reaching the MCP server directly.

An MCP surface is that access point: it defines the inbound route from external callers to your managed agent and, optionally, routes outbound calls from your agent to an external MCP server through a transit point.

This guide walks through creating the surface, configuring both routes, requiring caller authentication, and confirming the setup works end to end.

Prerequisites

  • You are logged in to the Agent Gateway dashboard.
  • You have permission to create surfaces.
  • A publicly accessible MCP server for your managed agent. The gateway must be able to reach this endpoint. If your server runs locally, use a tunnelling tool to expose it over a public URL. For production use, deploy your MCP server to a stable, publicly reachable endpoint.
  • A secret of type ApiKey that holds the API key your MCP clients will send. Create it under Secrets as described in Secrets.
  • (Optional, for outbound routing) A separate publicly accessible MCP server to receive outbound calls through the transit point.

Steps

Add a new surface and select a template

  1. Open Surfaces in the dashboard.
  2. Select Add Surface.
  3. In Start a new surface, select the MCP Surface Starter template.
  4. Update the generated Name, such as mcp_surface_1, in the Surface tab if needed.
MCP surface starter - select template

The canvas opens with three elements: a Surface container (blue box), a Managed Agent node, and an Access Point node. Elements with red outlines still require configuration. Additional templates are available in the Templates view after the canvas opens.

Tip: Select the auto-layout icon in the toolbar (tooltip: Auto-layout (⌘L / Ctrl+L)) to realign the canvas at any time. Select the undo icon (tooltip: Undo (⌘Z / Ctrl+Z)) to revert a change.

Configure the Managed Agent

  1. Select the Managed Agent node.
  2. Set Target Endpoint URL to the MCP server URL that should receive forwarded traffic.
MCP surface starter - managed agent

If required fields are incomplete, the red outline remains and the Elements tab lists what is still missing.

Configure the Access Point

The MCP Surface Starter template pre-configures the Access Point node with defaults for your deployment. Select the Access Point node to review or update the Entry point URL: the URL where external callers reach your surface.

MCP surface starter - access point

The URL is composed from the gateway’s address and two fields in the Routing section: Surface Prefix and Custom Path. The full URL is shown in the Entry point URL banner at the top of the panel and on the canvas.

The route part of the Entry point URL, the surface prefix and custom path, is also the base path for any transit point you add in Step 5.

Until the surface has caller authentication, the canvas shows “Not ready for external access” under the Entry point URL. You add it in the next step.

Require caller authentication

The MCP Surface Starter template adds no caller authentication. Add a Caller Context element so the surface accepts callers that send your API key.

  1. In the left palette, find Caller Context under Security & Policy.
  2. Drag it onto the Access Point → Managed Agent edge.
  3. Select the Caller Context node. On the method row, select Configure ↗.
  4. In Authentication Method, select API Key (secret store). Keep API Key Location at HTTP Header and HTTP Header Name at X-API-Key, and select your secret in Secret ID.
  5. Close the editor.

The “Not ready for external access” notice clears. Configure each MCP client to send the key in the X-API-Key header.

When callers use off-the-shelf MCP clients that sign users in at your own identity provider, use JWT Bearer instead and enable authorization server discovery.

Add a transit point for outbound MCP calls (optional)

Skip this section if you only need inbound routing from external callers to your managed agent.

  1. From the canvas palette, drag Transit Point (MCP) from the Transit Points section onto the canvas. The new node connects to the Managed Agent automatically.
  2. Fill in the following fields in the transit point panel:
FieldValue
Namemcp-weather
Endpoint TypeDirect URL
Target EndpointThe public URL of your MCP server.
Surface PrefixAccept the default outbound prefix, for example outbound → routes.
Custom Pathmcp-weather. The Listener URL banner at the top of the panel shows the full URL your managed agent calls, for example https://<GATEWAY_HOST>/outbound/routes/mcp-weather.
Transit Point (MCP) panel for mcp-weather showing the Listener URL banner, Surface Prefix, and Custom Path fields

Configuration notes:

  • The alias shown is derived automatically from the name you enter.

Confirm

Open the Elements tab and confirm that all required fields are complete. No red outlines should remain on any surface element. You can also open the Config tab to inspect the configuration of your surface.

Once the Elements tab shows all fields as complete, save the surface. In create mode, select the green checkmark button in the toolbar (tooltip: Create surface). In edit mode, select the disk icon button in the toolbar (tooltip: Save changes).

The surface is now live and the gateway begins routing traffic. Connect an MCP-compatible client to the URL shown in the Entry point URL banner, sending your API key in the X-API-Key header, to confirm end-to-end routing.

Default outbound route (no custom path set):

https://<GATEWAY_HOST>/outbound/<SURFACE_ROUTE>/<TRANSIT_ALIAS>/<OPTIONAL_PATH>

Example:

https://<GATEWAY_HOST>/outbound/<your-surface-route>/mcp-weather

Custom outbound route (custom path set): the surface prefix followed by the custom path, as shown in the transit point’s Listener URL banner.

https://<GATEWAY_HOST>/<SURFACE_PREFIX>/<CUSTOM_PATH>/<OPTIONAL_PATH>

Save as a reusable template (optional)

  1. Select the Surface tab in the left sidebar.
  2. Select Save Surface as Template….
  3. Fill in the template metadata: name, details, description, and priority in the template list.
  4. Save the template.

Your template is then available in future surface creation flows alongside the prebuilt templates.

Troubleshooting

SymptomLikely causeFix
Red outlines remain after filling all fields.A required field is still empty or invalid.Check the Elements section: it lists every incomplete field.
MCP client receives HTTP 503 with JSON-RPC error -32603 and “This Access Point is not available.”The surface has no caller authentication, so it is not ready for external access. The canvas shows “Not ready for external access” under the Entry point URL.Add the Caller Context element from Step 4, or select Configure Authentication in the notice, then save the surface.
MCP client receives HTTP 401 with “Caller credential missing or invalid”.The client sent no X-API-Key header, or a value that doesn’t match the secret.Configure the client to send the key stored in the secret, in the header named by HTTP Header Name.
MCP client receives 404.URL pattern does not match the transit point configuration.Confirm the URL you are using matches the route shown in the transit point’s own Listener URL banner and the transit alias shown below the transit point Name field.
MCP client receives 502 or connection refused.The MCP server is not reachable from the gateway.Confirm the server is running and Target Endpoint in the transit point panel matches the correct URL.
MCP client receives HTTP 400 with JSON-RPC error -32022 (Unsupported protocol version).The client sent an MCP-Protocol-Version header naming a revision the gateway does not serve. The error’s data.requested shows that revision, and data.supported lists the revisions the endpoint accepts: the session revisions 2024-11-05, 2025-03-26, 2025-06-18, and 2025-11-25, and 2026-07-28.Connect with a client that supports one of the revisions in data.supported. See Which MCP protocol revisions the gateway accepts.
MCP client using 2026-07-28 receives -32022, and data.supported lists only session revisions.The MCP server behind the Managed Agent supports only session-based MCP and refused the sessionless 2026-07-28 request.Use a client that falls back to opening a session with initialize when it receives this error. To serve 2026-07-28 itself, set Target Endpoint URL to an MCP server that supports it. For tools generated from an OpenAPI specification, set Endpoint Type to via MCP Proxy: an MCP Proxy serves both kinds of revision itself.
MCP client receives HTTP 400 after it sends an Mcp-Method or Mcp-Name header.The header does not match the request body: Mcp-Method must name the request’s method, and Mcp-Name must name the tool, prompt, or resource the request names.Correct the client so these headers repeat the values in the request body.

Next steps