> Documentation index: https://metorial.com/llms.txt. Every page is available as Markdown by adding .md to its URL.

# Self-host Metorial with Docker Compose
URL: https://metorial.com/docs/platform/guides/self-host-with-docker-compose

Run the open-source Metorial Platform on your own machine or server with the Docker Compose file and run.sh script in the metorial-platform repository.

---

{/* VERIFY: this page follows self-hosting/docker-compose.yml and self-hosting/run.sh in github.com/metorial/metorial-platform (identical to enterprise/oss as of Oct 30, 2026). Gaps between those files and self-hosting.md are marked below. */}

To self-host Metorial, clone the open-source [Metorial Platform](https://github.com/metorial/metorial-platform) repository and run `./self-hosting/run.sh --host localhost --secret "$(openssl rand -hex 32)"` from the repository root. The script builds the dashboard, starts the API and its backing services (PostgreSQL, Redis, MongoDB, Meilisearch, MinIO, OpenSearch, and etcd) with Docker Compose, and serves the dashboard on port 3300. You need Docker with Compose, at least 8 GB of RAM, about 20 GB of disk, and Node.js, npm, and Bun for the frontend build.

<PageIntro>
  <Learn>
    * What the self-hosted stack contains
    * How to start, check, and stop it
    * What to change before you expose it to anyone
  </Learn>

  <Reading title="Before you start">
    * Docker and Docker Compose
    * At least 8 GB of RAM and 20 GB or more of free disk
    * Node.js, npm, and Bun on the machine that builds the frontend
  </Reading>
</PageIntro>

<Callout type="warning">
  The repository's self-hosting setup is aimed at running and evaluating the open-source platform. For production deployments with strict compliance needs, Metorial offers [on-prem hosting](https://metorial.com/features/on-prem) with dedicated support and SLAs.
</Callout>

{/* VERIFY: which product areas work in a self-hosted build (Workforce, portals, Magic MCP, Enterprise Admin SSO and SCIM). Do not promise them here until confirmed. */}

## What runs [#what-runs]

| Service                                                                 | Image or source                       | Host ports           |
| ----------------------------------------------------------------------- | ------------------------------------- | -------------------- |
| API (core, MCP, marketplace, OAuth, private, portals, integrations, ID) | `ghcr.io/metorial/metorial-api:dev`   | 4310 to 4316, 4321   |
| PostgreSQL                                                              | `postgres:latest`                     | 35432                |
| Redis                                                                   | `redis:latest`                        | 36379                |
| MongoDB                                                                 | `mongo:latest`                        | 32707                |
| Meilisearch                                                             | `getmeili/meilisearch:v1.14`          | 37700                |
| MinIO                                                                   | `minio/minio:latest`                  | 9000, 9001 (console) |
| OpenSearch and OpenSearch Dashboards                                    | `opensearchproject/opensearch:2.18.0` | 9200, 9600, 5601     |
| etcd                                                                    | `bitnamilegacy/etcd:latest`           | 32379, 32380         |
| Dashboard and MCP Inspector                                             | Built from source by `run.sh`         | 3300, 6050           |

{/* VERIFY: the API is configured with ENGINE_MANAGER_ADDRESSES=engine:50050 and run.sh prints an MCP Engine on port 50050, but self-hosting/docker-compose.yml defines no `engine` service. Confirm how the engine is started. */}

## Start Metorial [#start-metorial]

<Steps>
  <Step title="Clone the repository">
    ```bash
    git clone https://github.com/metorial/metorial-platform.git
    cd metorial-platform
    ```
  </Step>

  <Step title="Run the setup script">
    ```bash
    ./self-hosting/run.sh --host localhost --secret "$(openssl rand -hex 32)"
    ```

    The script installs frontend dependencies, generates the Prisma client, builds the dashboard and the MCP Inspector, writes `self-hosting/.env`, pulls the images, runs `docker compose up -d`, and starts two small web servers for the frontends.

    {/* VERIFY: run.sh builds the inspector from vendor/mcp-inspector, which is not present in the public repository. Confirm the script completes on a fresh clone. */}
  </Step>

  <Step title="Open the dashboard">
    Open `http://localhost:3300` and create an account. The MCP Inspector runs on `http://localhost:6050`, and the core API on `http://localhost:4310`.

    {/* VERIFY: self-hosting.md says the dashboard is on port 4300 and the compose file sets APP_URL to port 4300, while run.sh serves it on 3300. */}
  </Step>

  <Step title="Connect a first integration">
    Configure an MCP server or integration in the dashboard, then try its tools in the Explorer. See [Integrations](/docs/platform/integrations) and the [SDK quickstart](/docs/build/quickstart).
  </Step>
</Steps>

## Script options [#script-options]

| Option                                                                         | What it does                                                                      |
| ------------------------------------------------------------------------------ | --------------------------------------------------------------------------------- |
| `--host`, `-h`                                                                 | Hostname for the deployment, for example `localhost` or `mydomain.com` (required) |
| `--secret`, `-s`                                                               | Secret for encryption and auth tokens (required)                                  |
| `--env`, `-e`                                                                  | `production` (default) or `development`                                           |
| `--email-host`, `--email-port`, `--email-user`, `--email-pass`, `--email-from` | SMTP settings for outgoing email                                                  |
| `--skip-build`, `--skip-backend`, `--skip-serve`                               | Skip the frontend build, the Docker services, or the web servers                  |
| `--status`, `--logs`, `--stop`                                                 | Show status, follow logs, or stop everything                                      |

You can also set `METORIAL_HOST` and `METORIAL_SECRET` as environment variables instead of passing flags.

{/* VERIFY: self-hosting.md documents AWS SES variables (EMAIL_SES_*), but the compose file and run.sh use SMTP variables (EMAIL_HOST, EMAIL_PORT, EMAIL_USER, EMAIL_PASS). */}

## Manage the stack [#manage-the-stack]

```bash
./self-hosting/run.sh --status
./self-hosting/run.sh --logs
./self-hosting/run.sh --stop
```

To work with the containers directly, use the compose file:

```bash
docker compose -f ./self-hosting/docker-compose.yml ps
docker compose -f ./self-hosting/docker-compose.yml logs api
docker compose -f ./self-hosting/docker-compose.yml restart api
```

Data lives in named Docker volumes: `postgres_data`, `mongodb_data`, `redis_data`, `meilisearch_data`, `minio_data`, and `opensearch_data`. Back them up regularly. `docker compose down -v` deletes them.

## Before you expose it [#before-you-expose-it]

The compose file is set up for a local machine. Before anyone else uses it:

1. Replace the default credentials in `docker-compose.yml`: PostgreSQL `postgres`/`postgres`, MongoDB `mongo`/`mongo`, MinIO `minio`/`minio123`, and OpenSearch `admin`/`admin`.
2. Turn on OpenSearch security. The compose file sets `DISABLE_SECURITY_PLUGIN=true`.
3. Use a strong, unique `--secret`. It is used for encryption and auth tokens.
4. Put a reverse proxy with TLS in front of the dashboard and API ports, and stop publishing database ports to the host.
5. Set resource limits, schedule backups, and consider managed databases.
6. Pin image tags instead of `latest` and `dev`, and update them for security patches.

## Troubleshooting [#troubleshooting]

### Services do not start [#services-do-not-start]

Check the logs of the API with `docker compose -f ./self-hosting/docker-compose.yml logs api`.

### The API cannot reach the database [#the-api-cannot-reach-the-database]

PostgreSQL may not have finished starting. Restart the API service once PostgreSQL is up.

### A port is already in use [#a-port-is-already-in-use]

Change the host port in `self-hosting/docker-compose.yml`, and update the matching URL environment variables of the API service.

### Containers crash or run slowly [#containers-crash-or-run-slowly]

Give Docker more memory. The stack needs at least 8 GB of RAM.

## FAQ [#faq]

### Is Metorial really open source? [#is-metorial-really-open-source]

Yes. The platform code is on GitHub at `metorial/metorial-platform` under the Functional Source License (FSL-1.1-ALv2), which converts to Apache 2.0 two years after each release. The integration catalog in `metorial/metorial` is Apache 2.0, and so is the Outpost proxy.

### Is the self-hosted version the same as the hosted platform? [#is-the-self-hosted-version-the-same-as-the-hosted-platform]

It is built from the same platform repository, but the hosted platform includes managed infrastructure and operations. Ask Metorial which features your deployment needs before choosing between self-hosting, on-prem hosting, and the hosted platform.

### Do we have to self-host to keep data in our network? [#do-we-have-to-self-host-to-keep-data-in-our-network]

No. An [Outpost](/docs/platform/guides/keep-data-in-your-network) keeps MCP traffic inspection and redaction in your network while you use the hosted platform, and the **None** retention level stops Metorial from storing message data.

### What does self-hosting cost? [#what-does-self-hosting-cost]

The code is free to run. You pay for your own infrastructure. For hosted and on-prem plans, see [pricing](https://metorial.com/pricing).

To see which other MCP gateways can be self-hosted and under what license, see [Self-hosted and open-source MCP gateways](/docs/compare/self-hosting) in the [MCP gateway comparison](/docs/compare).

## Related pages [#related-pages]

<Cards columns="2">
  <Card title="Keep data in your network" icon="server" href="/docs/platform/guides/keep-data-in-your-network">
    Outposts, retention levels, and encryption keys.
  </Card>

  <Card title="Custom providers" icon="code-s-slash" href="/docs/build/custom-providers">
    Bring your own MCP servers.
  </Card>

  <Card title="Metorial Platform on GitHub" icon="github" href="https://github.com/metorial/metorial-platform">
    Source code and self-hosting files.
  </Card>

  <Card title="On-prem on metorial.com" icon="external-link" href="https://metorial.com/features/on-prem">
    Production hosting in your own cloud or data center.
  </Card>
</Cards>