The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
Install
git clone https://github.com/brijr/meta-mcpInstall command taken from the project's README or registry entry. Always review code before running it.
README excerpt
Read full README on GitHub →Meta Ads MCP Server
A Cloudflare Workers MCP server for Meta Ads account setup, campaign management, ad sets, creatives, audiences, reporting, and batch workflows.
This repo is built on xmcp and exposes a Streamable HTTP MCP endpoint plus browser-facing Meta OAuth routes.
Open Source / Self-Hosted
This repository is intended to be deployed in your own Cloudflare account with your own Meta app credentials.
It does not ship with:
- a hosted control plane
- a shared Meta app
- a built-in end-user dashboard
- a JWT issuer for your users and workspaces
You bring:
- your Cloudflare Worker deployment
- your Meta developer app
- your JWT issuer or auth provider
- your own UI or backend that initiates the OAuth flow
What It Does
- Runs as a Cloudflare Worker
- Uses direct Meta Graph API
fetchcalls instead of the Meta SDK - Stores Meta user connections per workspace in D1
- Stores short-lived OAuth state in KV
- Encrypts stored Meta access tokens
- Protects MCP requests with your app-issued JWTs
Endpoints
GET /healthGET /appPOST /mcpGET /oauth/meta/startGET /oauth/meta/callback
Auth Model
This server is multi-tenant. Every MCP request must include a bearer JWT issued by your app.
If you are open-sourcing this project, the important implication is that consumers must wire it into their own auth system. The server does not know how to identify a user or workspace without that JWT.
Required JWT claims:
suboruserIdworkspaceId- optional
roles
Example payload:
{
"sub": "user_123",
"workspaceId": "workspace_abc",
"roles": ["admin"]
}
Why /oauth/meta/start is not a generic public link:
- the server must know which workspace the Meta account should be attached to
- that workspace context comes from the JWT
- without it, the server cannot safely bind the resulting Meta token
Tool Surface
Implemented tool families:
- Account and setup
- Campaign management
- Ad set management
- Creative and ads
- Audience and targeting
- Reporting and insights
- Batch helpers
The server currently registers 39 tools.
Project Layout
src/toolstool definitions grouped by domainsrc/libauth, storage, OAuth, runtime, and Meta client helperssrc/servicesdomain-specific Meta service logicsrc/middleware.tsOAuth routing and MCP JWT authcloudflare-entry.mjsWorker wrapper entry for Cloudflare-specific route interceptionschema.sqlD1 schematestunit and contract-style tests
Local Development
Install dependencies:
pnpm install
Run local dev:
pnpm dev
Useful scripts:
pnpm build
pnpm test
pnpm deploy
Cloudflare Bindings
Required bindings:
- D1 database bound as
META_DB - KV namespace bound as
META_OAUTH_STATE
Required secrets:
JWT_SECRETorJWT_JWKS_URLMETA_APP_IDMETA_APP_SECRETMETA_TOKEN_ENCRYPTION_KEYAPP_UI_PASSWORDfor the built-in admin page at/app
Optional configuration:
JWT_ISSUERJWT_AUDIENCEAPP_SESSION_SECRETAPP_UI_WORKSPACE_IDAPP_UI_USER_IDMETA_REDIRECT_URIMETA_GRAPH_VERSIONMETA_OAUTH_SCOPESMETA_OAUTH_ALLOWED_RETURN_ORIGINS
Defaults:
META_GRAPH_VERSION=v25.0META_OAUTH_SCOPES=ads_management,business_managementAPP_UI_WORKSPACE_ID=workspace_adminAPP_UI_USER_ID=app_admin
Built-In Admin UI
The Worker now includes a small browser UI at /app.
What it does:
Similar plugs
Reverse engineer anything with agents, from app behavior down to native binaries.
Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.
Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype…
User-friendly AI Interface (Supports Ollama, OpenAI API, ...)