---
title: mcp
description: The MCP server for AI assistants. Port 4500. Optional.
---

Serves the [Model Context Protocol](https://modelcontextprotocol.io) over streamable HTTP at `/mcp`, without sessions. To connect an assistant, see [MCP](/mcp).

- The bearer token is an API token (`opt_…`) or an OAuth access token issued by [api](/self-hosting/services/api#oauth-for-mcp) for `MCP_ORIGIN/mcp`. Anything else answers 401.
- Each organization turns the server on in **Settings → API**. Until then it answers 403.
- Past `MCP_RATE_LIMIT_PER_MINUTE` calls per token or user, it answers 429.

Reads [PostgreSQL](/self-hosting/configuration#postgresql), [ClickHouse](/self-hosting/configuration#clickhouse), [Redis](/self-hosting/configuration#redis), [proxies](/self-hosting/configuration#proxies) and [logging](/self-hosting/configuration#logging). All variables below are optional.

| Variable                    | Default                 | Description                                                                   |
| --------------------------- | ----------------------- | ----------------------------------------------------------------------------- |
| `PORT`                      | `4500`                  | HTTP port.                                                                    |
| `API_ORIGIN`                | `http://localhost:4000` | Public origin of `api`, which issues the OAuth tokens and their keys.         |
| `MCP_ORIGIN`                | `http://localhost:4500` | Public origin of `mcp`. Must match `MCP_ORIGIN` in `api`.                     |
| `MCP_RATE_LIMIT_PER_MINUTE` | `600`                   | Requests per API token or OAuth user per minute before 429. `0` turns it off. |
