---
title: "Deploy Meta ADS MCP"
description: "Connect AI assistants to Meta Ads with secure MCP tools."
category: "Analytics"
url: https://railway.com/deploy/meta-ads-mcp
---

# Deploy Meta ADS MCP

Connect AI assistants to Meta Ads with secure MCP tools.

**[Deploy Meta ADS MCP on Railway](https://railway.com/template/meta-ads-mcp)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/meta-ads-mcp/manifest.json

- **Creator:** Yvfl
- **Category:** Analytics
- **Total deploys:** 3

## Template content

### Postgres https://devicons.railway.app/i/postgresql.svg

- **Image:** ghcr.io/railwayapp-templates/postgres-ssl:18

### faceads-mcp-v2

- **Source:** https://github.com/yvfl/faceads-mcp-v2
- **Health check:** /health
- **Public domain:** Yes

## Documentation

# Deploy and Host Meta ADS MCP on Railway

Meta ADS MCP connects compatible AI assistants to the Meta Marketing API. It provides tools for exploring ad accounts, retrieving campaigns and performance metrics, and managing advertising resources. Each connection uses its own Meta credentials, selected accounts, and permissions, with read-only access selected by default.

## About Hosting Meta ADS MCP

Deploying Meta ADS MCP requires the application service, a persistent PostgreSQL database, a public HTTPS URL, and an encryption key for stored Meta credentials. The included Docker image builds the application and applies database migrations automatically at startup.

Users connect their MCP-compatible assistant to the `/mcp` endpoint, authenticate, provide a valid Meta access token, and select the accounts and permissions to authorize. OAuth credentials and account selections persist in PostgreSQL. The server supports automatic OAuth renewal, paginated queries, and account-level authorization. Keep the database and encryption key backed up, and run one application replica.

## Common Use Cases

- Analyze campaign performance using spend, impressions, clicks, conversions, and breakdowns.
- Audit campaigns, ad sets, and ads through paginated read-only tools.
- Create paused advertising resources and manage them through explicitly authorized assistant workflows.

## Dependencies for Meta ADS MCP Hosting

- A persistent PostgreSQL database connected through `DATABASE_URL`.
- A valid Meta user or system user access token with the required permissions and access to the selected advertising accounts.

### Implementation Details

Configure these application variables:

```env
MCP_BASE_URL=https://your-service.up.railway.app
MCP_ENCRYPTION_KEY=&lt;64-character hexadecimal secret&gt;
META_API_VERSION=v26.0
```

Generate the encryption key with:

```sh
openssl rand -hex 32
```

Preserve this key across deployments. Connect your assistant using:

```text
https://your-service.up.railway.app/mcp
```

The Docker image includes the Node.js runtime. Database migrations run automatically, and `/health` checks application and database availability.

Run **one application replica**. MCP transport sessions reside in memory; multiple replicas require additional session coordination. OAuth authorizations persist in PostgreSQL.

## Why Deploy Meta ADS MCP on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying Meta ADS MCP on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.


## Similar templates

- [Typesense vs Meilisearch](https://railway.com/deploy/typesense-vs-meilisearch) — self-hosted Typesense vs Meilisearch
- [Betterlytics](https://railway.com/deploy/betterlytics) — Betterlytics is a cookieless analytics platform GDPR-compliant.
- [Finance Tracker](https://railway.com/deploy/finance-tracker-1) — Private multi-user household finance ledger with budgets and CSV import.

Open this page in a browser: https://railway.com/deploy/meta-ads-mcp
