Project
meta-mcp
24-tool Model Context Protocol server for the Meta Marketing API, running serverless on AWS Lambda with stateless JWE tokens.
- 24 MCP tools
- ECS Fargate → Lambda
- Zero-idle infrastructure
meta-mcp is an enterprise TypeScript Model Context Protocol (MCP) server that connects Claude and internal AI agents directly to the Meta Marketing API. It enables growth and marketing teams to inspect campaigns, retrieve ad insights, evaluate creative performance, and draft ad sets through conversational agent workflows.
The Architecture Evolution
The initial prototype ran on AWS ECS Fargate with stateful session-based OAuth authentication. While functional, it incurred constant container compute costs and added operational overhead for session persistence.
I re-architected the system into a high-scale, serverless architecture:
- Stateless JWE Token Authorization: Converted the OAuth token exchange to emit encrypted JSON Web Encryption (JWE) tokens. This eliminated database session lookups on every tool call while ensuring secure user delegation.
- Scale-to-Zero Compute: Migrated the server to AWS Lambda behind an HTTP API Gateway, allowing the system to scale to zero when idle and instantly handle bursts during campaign launches.
- Infrastructure as Code: Defined 100% of the AWS infrastructure using AWS Cloud Development Kit (CDK) in TypeScript.
- Keyless CI/CD Deployment: Deployed via GitHub Actions using AWS OIDC federation, eliminating long-lived AWS IAM credentials from CI secrets.
Capabilities
The server exposes 24 discrete tools spanning:
- Campaign budget and status management.
- Ad set targeting and bidding configuration.
- Creative asset analysis and metadata retrieval.
- Granular performance telemetry and conversion metric aggregation.
By providing authenticated, rate-limited tool boundaries, growth engineers and marketing analysts interact with complex Meta API data through Claude without writing custom scripts or requesting ad-hoc data extracts.