---
title: "Internal Only Policy for API Gateway Routes"
description: "Restrict any route to calls made from inside your gateway with the Internal Only policy, and hide the REST routes behind your MCP server tools."
canonicalUrl: "https://zuplo.com/changelog/2026/10/06/internal-only-policy"
pageType: "changelog"
date: "2026-10-06"
tags: "runtime, policy"
---
The **Internal Only** policy is now available on every API Gateway route, not
just in the AI Gateway. It admits a request only when your own gateway made it
with `context.invokeRoute`, and rejects every request that arrives over the
network, whatever credentials, headers, or URL it carries.

Use it on routes that only other routes, handlers, and policies on the same
gateway should call. Those calls never leave the gateway, so the policy needs no
API key and makes no network calls.

## Hide REST routes behind your MCP server

The MCP Server handler calls each tool's route with `context.invokeRoute`, so
your tools keep working while direct calls to the underlying REST routes are
rejected. Set `status` to `404` and a direct call gets the same response as a
path that doesn't exist:

```json
{
  "name": "internal-only-inbound",
  "policyType": "internal-only-inbound",
  "handler": {
    "export": "InternalOnlyInboundPolicy",
    "module": "$import(@zuplo/runtime)",
    "options": {
      "status": 404
    }
  }
}
```

Put the policy first in the inbound policies of each route the MCP server
exposes, and mark those routes `x-internal` to keep them out of your Developer
Portal too. The MCP server route keeps its own authentication for AI clients.

## Choose the response

A rejected request gets `403 Forbidden` by default. Set `status` to any client
error status, and `detail` to add a message to the problem response. By default
the response has no `detail`, so callers outside the gateway learn nothing about
how the route is called.

Existing AI Gateway configurations that use the earlier Ensure Gateway Internal
Invocation Only names keep working unchanged. Use `internal-only-inbound` and
`InternalOnlyInboundPolicy` in new configurations.

## Getting started

Add Internal Only to a route's inbound policies in the
[Zuplo Portal](https://portal.zuplo.com) and deploy. See the
[Internal Only policy reference](https://zuplo.com/docs/policies/internal-only-inbound)
for every option and
[Keep REST routes private](https://zuplo.com/docs/handlers/mcp-server#keep-rest-routes-private)
for the full MCP Server setup.