npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

mcp-facebook-ads

v0.1.1

Published

MCP server para consultar dados do Facebook Ads API

Readme

MCP Facebook Ads

MCP Server para consultar dados do Facebook Ads API (Marketing API) - Somente leitura.

🚀 Features

  • ✅ Consultar campanhas
  • ✅ Obter métricas e performance de campanhas
  • ✅ Extrair insights e relatórios da conta
  • ✅ Consultar criativos de anúncios

📋 Pré-requisitos

  • Node.js 18+
  • Facebook App criado no Facebook Developers
  • Access Token com permissões de leitura (ads_read)
  • Account ID da conta de anúncios

🔧 Instalação

  1. Clone o repositório:
cd mcp-facebook-ads
  1. Instale as dependências:
npm install
  1. Configure as variáveis de ambiente:
cp .env.example .env
  1. Edite o arquivo .env com suas credenciais:
FB_ACCESS_TOKEN=seu_token_aqui
FB_ACCOUNT_ID=seu_account_id_aqui
FB_API_VERSION=v21.0
  1. Build o projeto:
npm run build

🎯 Como usar

Opção 1: Via npx (recomendado)

Adicione ao seu arquivo de configuração MCP (ex: .cursor/mcp.json):

"facebook-ads": {
  "command": "npx",
  "args": [
    "--yes",
    "mcp-facebook-ads",
    "--transport",
    "stdio"
  ],
  "env": {
    "FB_ACCESS_TOKEN": "seu_token_aqui",
    "FB_ACCOUNT_ID": "seu_account_id_aqui",
    "FB_API_VERSION": "v21.0"
  }
}

Opção 2: Executar localmente

npm start

🛠️ Tools disponíveis

1. get_campaigns

Retorna lista de campanhas da conta de anúncios.

Parâmetros:

  • fields (opcional): Campos a serem retornados (ex: id,name,status,objective)
  • limit (opcional): Limite de resultados (padrão: 25)

2. get_campaign_insights

Retorna métricas e performance de uma campanha específica.

Parâmetros:

  • campaign_id (obrigatório): ID da campanha
  • date_preset (opcional): Período pré-definido (ex: last_7d, last_30d, lifetime)
  • fields (opcional): Métricas a serem retornadas (ex: impressions,clicks,spend,ctr)

3. get_account_insights

Retorna insights e relatórios da conta de anúncios.

Parâmetros:

  • date_preset (opcional): Período pré-definido (ex: last_7d, last_30d, today)
  • fields (opcional): Métricas a serem retornadas (ex: impressions,clicks,spend,cpc,cpm,ctr)
  • level (opcional): Nível de agregação (account, campaign, adset, ad)

4. get_ad_creatives

Retorna informações sobre os criativos de um anúncio.

Parâmetros:

  • ad_id (obrigatório): ID do anúncio
  • fields (opcional): Campos a serem retornados (ex: name,thumbnail_url,object_story_spec)

📚 Campos úteis da API

Campanhas:

  • id, name, status, objective, daily_budget, lifetime_budget, created_time

Métricas/Insights:

  • impressions, clicks, spend, ctr, cpc, cpm, reach, frequency, conversions

Criativos:

  • id, name, thumbnail_url, image_url, video_id, object_story_spec

🔐 Obter Access Token

  1. Acesse o Facebook Graph API Explorer
  2. Selecione seu App
  3. Adicione as permissões: ads_read
  4. Clique em "Generate Access Token"
  5. Copie o token gerado

⚠️ Importante: Tokens de curta duração expiram em 1-2 horas. Para uso prolongado, gere um Long-Lived Token.

📖 Documentação da API

📝 License

MIT