> For the complete documentation index, see [llms.txt](https://docs.p0.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.p0.dev/integrations/resource-integrations/agentic-gateway/mcp-server/custom.md).

# Custom MCP server

A **custom** MCP server is one you define yourself, for any MCP server P0 does not ship a [predefined](/integrations/resource-integrations/agentic-gateway/mcp-server.md) definition for. The gateway either proxies to a server hosted outside it or runs a Docker container to host the server's tools. Once configured, it behaves like any other server behind the [P0 AI Gateway](/readme/agentic-control-plane.md): agents reach it through the gateway URL, and every tool call is authenticated and checked against policy.

## Prerequisites

* A registered [Gateway](/integrations/resource-integrations/agentic-gateway/gateway.md) component, with the gateway deployed in your environment.

## Configure the custom MCP server

Follow the shared steps in [Add an MCP server](/integrations/resource-integrations/agentic-gateway/mcp-server.md#add-an-mcp-server) to name the server and choose its gateway. On the configuration screen, set **Definition** to **Custom**, then choose a **Server type**.

<figure><img src="/files/rENk3fFyGiomqBhYCHZK" alt="Custom server definition form with Server type set to External, showing Server URL, Label, Logo URL, and Agent prompt fields"><figcaption></figcaption></figure>

### Server type

The **Server type** determines how the gateway reaches the server.

**External** proxies requests to an MCP server hosted outside the gateway, reachable at a fixed URL:

| Field          | Description                              | Required |
| -------------- | ---------------------------------------- | -------- |
| **Server URL** | URL of the externally hosted MCP server. | Yes      |
| **Label**      | Human-friendly label for this server.    | Yes      |

**Container** runs a Docker container behind the gateway to host the server's tools:

| Field                 | Description                                                                                          | Required |
| --------------------- | ---------------------------------------------------------------------------------------------------- | -------- |
| **Docker image**      | Image that hosts the MCP server.                                                                     | Yes      |
| **Docker entrypoint** | Container run entrypoint. Supports LiquidJS templating to inject request parameters and credentials. | Yes      |

### Server details

These fields apply to both server types:

| Field            | Description                                | Required |
| ---------------- | ------------------------------------------ | -------- |
| **Logo URL**     | Address of a logo image for the server.    | No       |
| **Agent prompt** | Text that describes this server to agents. | Yes      |

## Next steps

* Define the MCP roles and policies that determine which agents and users may call the custom MCP server, and what they may do.
