meta-insights-mcp

meta-insights-mcp

Provides Meta (Facebook/Instagram) business insights through the Graph and Marketing APIs, enabling access to ad accounts, pages, campaigns, and business assets using a System User access token.

Category
访问服务器

README

meta-insights-mcp

An MCP server exposing Meta (Facebook / Instagram) business insights through the Graph and Marketing APIs, using a System User access token.

Install

pip install meta-insights-mcp
# or
uv add meta-insights-mcp
# or run ad-hoc without installing
uvx meta-insights-mcp

Configuration

The server reads its configuration from environment variables:

Var Required Default Purpose
META_ACCESS_TOKEN yes — System User access token
META_API_VERSION no v23.0 Graph API version
META_BUSINESS_ID no — When set, enables business-scoped tools (list_business_assets, etc.)

Connect to Claude

Add one of the following to your MCP client config (Claude Desktop: ~/Library/Application Support/Claude/claude_desktop_config.json; Claude Code: ~/.claude.json or project .mcp.json).

Recommended — zero-install via uvx

{
  "mcpServers": {
    "meta-insights": {
      "command": "uvx",
      "args": ["meta-insights-mcp"],
      "env": {
        "META_ACCESS_TOKEN": "EAAG..."
      }
    }
  }
}

After pip install

{
  "mcpServers": {
    "meta-insights": {
      "command": "meta-insights-mcp",
      "env": {
        "META_ACCESS_TOKEN": "EAAG..."
      }
    }
  }
}

Module form (fallback)

{
  "mcpServers": {
    "meta-insights": {
      "command": "python",
      "args": ["-m", "meta_insights_mcp"],
      "env": {
        "META_ACCESS_TOKEN": "EAAG..."
      }
    }
  }
}

Tools

User-scoped (always available)

Tool Purpose
list_meta_assets Ad accounts + Pages the token can see
check_token_status Token scopes, app, expiry
get_ad_account_insights Ads performance for an ad account
get_campaign_insights Insights for a single campaign
list_campaigns List campaigns under an ad account
get_page_insights Organic Page insights
get_post_insights Insights for a single Page post
list_page_posts Recent posts from a Page

Business-scoped (enabled when META_BUSINESS_ID is set)

Tool Purpose
list_business_assets Everything the business owns (ad accounts, Pages, IG, System Users)
list_owned_ad_accounts Ad accounts owned by the business
list_owned_pages Pages owned by the business
list_client_ad_accounts Ad accounts shared WITH this business by clients/partners
list_business_system_users System Users under the business

Meta setup required

Before the server returns data, you need (in Meta Business Manager):

  1. A Business App in Meta for Developers tied to your Business Manager
  2. A System User with scopes: ads_read or ads_management, pages_read_engagement, business_management
  3. Asset assignment: assign the Ad Account(s) and Page(s) you want to read to the System User (this is the step people most often miss — a valid token with unassigned assets returns empty data)
  4. A System User access token — pass it as META_ACCESS_TOKEN

Use check_token_status to verify scopes and expiry.

Testing locally with the MCP Inspector

The MCP Inspector is a browser-based UI (provided by Anthropic) that lets you call your tools directly — no AI needed. Great for verifying the server works before connecting it to Claude.

# From the project root, with your venv active
mcp dev meta_insights_mcp/server.py

This launches:

  • Your Python MCP server
  • A local web UI (opens automatically in your browser)

In the Inspector:

  1. Click Connect at the top
  2. Open the Tools tab
  3. Try these in order:
    • check_token_status — no args; confirms your token is valid and shows scopes/expiry
    • list_meta_assets — no args; lists ad accounts and Pages assigned to the System User
    • get_ad_account_insights — paste an ad_account_id from the previous step
  4. Enable business-scoped tools by setting META_BUSINESS_ID in your shell / .env before launching the Inspector, then call list_business_assets

If list_meta_assets returns empty arrays, the token is fine but the System User has no assets assigned yet — fix that in Meta Business Settings (see "Meta setup required" above).

Development

git clone <repo>
cd meta-mcp-server
python3 -m venv .venv && source .venv/bin/activate
pip install -e .        # editable install

# Run the MCP Inspector
mcp dev meta_insights_mcp/server.py

# Or run the server directly (stdio)
meta-insights-mcp

Publishing

Build wheel + sdist:

pip install build
python -m build        # produces dist/*.whl and dist/*.tar.gz

Upload to TestPyPI first (sandbox):

pip install twine
python -m twine upload --repository testpypi dist/*
pip install -i https://test.pypi.org/simple/ meta-insights-mcp   # verify

Then to real PyPI:

python -m twine upload dist/*

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选