---
title: Gating The Endpoint
editUrl: https://github.com/Cratis/Arc/edit/main/Documentation/backend/csharp/mcp/gating-the-endpoint.md
description: 'The MCP endpoint must never answer an anonymous request. Arc enforces that with the capability gate: endpoints selected for gating are served only on the…'
lastUpdated: 2026-11-10T00:00:00.000Z
---


The MCP endpoint must never answer an anonymous request. Arc enforces that with the [capability gate](/arc/backend/csharp/capability-hosting/): endpoints selected for gating are served only on the capabilities port and only after a verified caller is admitted.

## What is required

`WithMcp` needs all of these, in any registration order. The check runs when the host starts:

- `WithCapabilities(...)` for capability hosting.
- A port for the capabilities endpoint group: `options.EndpointGroups.Assign("capabilities", port)`.
- A verified caller installation: `WithPersonalAccessTokens(...)` or `WithVerifiedCallers(...)`.

```csharp
.WithCapabilities()
```

## Gated by default

You do not set `CapabilitiesOptions.GatedEndpoints` for MCP. When it is unset, Arc gates every endpoint on the capabilities port after routing, so `/mcp` is never served without a verified caller. The OAuth protected resource metadata endpoint stays reachable without a caller so clients can discover how to authenticate; it is the only exempt route. Other routes on that port, such as health probes, then need a verified caller too; see the [upgrade notes](/arc/upgrading/mcp-gated-by-default/).

An explicit `GatedEndpoints` selection is respected unchanged. `WithMcp` adds the MCP endpoint to it, so you do not list `/mcp` yourself, and the rest of the port stays outside the gate.

## What the gate does to a request

| Situation | Result |
| --- | --- |
| Request on the default port | Not served. |
| Request on the capabilities port with no accepted credential | 401 `unauthorized` with a `WWW-Authenticate` challenge. |
| Credential of a kind the profile does not accept | 401 `unauthorized`. |
| Verified caller | Admitted. Scope and authorizer checks follow; see [Authorization](/arc/backend/csharp/mcp/authorization/). |

Assigning the port does not bind a listener. Bind both the default listener and one on the capabilities port, and make that port reachable only through your trusted ingress; see [Turn it on](/arc/backend/csharp/mcp/advanced/#turn-it-on).

## Map the endpoint

```csharp
var app = builder.Build();
app.UseCratisArc();
app.MapArcMcp();
```

`MapCratisArcMcp` still works as an obsolete forwarder to `MapArcMcp` and is removed in Arc 24.

## Related

- [Capability hosting](/arc/backend/csharp/capability-hosting/)
- [Endpoint groups](/arc/backend/csharp/endpoint-groups/)
- [Troubleshooting](/arc/backend/csharp/mcp/troubleshooting/#startup-errors)
