# Self-host MetaMCP

> An MCP aggregator and gateway that groups many MCP servers behind one endpoint with auth, namespaces and middleware.

- Page: https://levelrail.com/templates/metamcp/
- JSON: https://levelrail.com/templates/metamcp.json
- Category: AI
- Licence: MIT (Permissive license)
- Source: https://github.com/metatool-ai/metamcp
- Upstream docs: https://docs.metamcp.com

## Requirements
- Memory: about 1 GiB
- amd64: published, arm64: published
- Needs configuration before start: no
- Pinned image tag: 16-alpine

## Services

| Service | Image | Tag | Ports | Volumes |
| --- | --- | --- | --- | --- |
| db | postgres | 16-alpine | none | pgdata -> /var/lib/postgresql/data |
| metamcp | ghcr.io/metatool-ai/metamcp | 2.4 | 12008 | none |

## Environment

| Service | Variable | Kind |
| --- | --- | --- |
| db | POSTGRES_DB | preset |
| db | POSTGRES_PASSWORD | generated |
| db | POSTGRES_USER | preset |
| metamcp | APP_URL | preset |
| metamcp | BETTER_AUTH_SECRET | generated |
| metamcp | DATABASE_URL | generated |
| metamcp | NEXT_PUBLIC_APP_URL | preset |
| metamcp | POSTGRES_DB | preset |
| metamcp | POSTGRES_HOST | preset |
| metamcp | POSTGRES_PASSWORD | generated |
| metamcp | POSTGRES_PORT | preset |
| metamcp | POSTGRES_USER | preset |
| metamcp | TRANSFORM_LOCALHOST_TO_DOCKER_INTERNAL | preset |

## Deploy

### CLI

```bash
levelrail-cli templates install metamcp --name my-metamcp
```

Add --domain SERVICE=HOST to serve a service on your own domain, for example --domain db=app.example.com.

### API

```bash
curl -X POST -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  https://levelrail.example.com/api/v1/service-templates/metamcp/install \
  -d '{
    "name": "my-metamcp"
  }'
```

Create a token in the dashboard first. Name, env and domains are the request fields.

## Questions

### Can I deploy MetaMCP on Dokploy or Dokku?

The services and pinned images on this page can be run on any Docker host. The public Dokploy templates list we compared does not have an entry with the same id for MetaMCP, so on Dokploy you would use a Docker Compose application with the file from this page. Dokku deploys container images with its own commands, so the pinned image postgres:16-alpine, ghcr.io/metatool-ai/metamcp:2.4 is what you deploy there.

Self-host MetaMCP, MetaMCP docker compose file, deploy MetaMCP on a VPS: this page lists the pinned image, ports, volumes and the commands for each.
