Skip to main content
Glama
KarimTarekDev

Facebook Insights Metrics v23

Facebook Insights Metrics v23 MCP Server

npm version License: MIT Node.js Version

A comprehensive Model Context Protocol (MCP) server that exposes Facebook Graph API v23.0 Insights metrics to any LLM via MCP tools and resources. This server provides access to 120+ Facebook metrics with intelligent search capabilities and real-time data updates.

Table of Contents

Features

  • Complete Metrics Coverage: 121+ Facebook Graph API v23.0 Insights metrics

  • Fast Fuzzy Search: Powered by Fuse.js for intelligent metric discovery

  • Dynamic Updates: Parse and refresh metrics from Markdown reference

  • Type Safety: Full TypeScript support with Zod validation

  • MCP Compatible: Works with any MCP-compatible LLM client

Quick Start

Prerequisites

  • Node.js v22.0.0 or higher

  • npm or yarn

  • An MCP-compatible client (Claude Desktop, Cline, etc.)

Installation

# Install globally
npm install -g facebook-insights-metrics-v23

# Or install locally
npm install facebook-insights-metrics-v23

Option 2: From Source

# Clone the repository
git clone https://github.com/KarimTarekDev/facebook-insights-metrics-v23.git
cd facebook-insights-metrics-v23

# Install dependencies
npm install

# Build the project
npm run build

# Generate initial metrics data
npm run refresh

Configuration

MCP Client Configuration

Add the server to your MCP client configuration:

Claude Desktop (claude_desktop_config.json)

{
  "mcpServers": {
    "facebook-insights-metrics-v23": {
      "command": "node",
      "args": ["/path/to/facebook-insights-metrics-v23/dist/server.js"]
    }
  }
}

Cline

{
  "mcpServers": {
    "facebook-insights-metrics-v23": {
      "command": "node",
      "args": ["/path/to/facebook-insights-metrics-v23/dist/server.js"]
    }
  }
}

Environment Variables

  • METRICS_DATA_PATH: Custom path to metrics.json file (optional)

  • DEBUG: Enable debug logging (optional)

Quick Fix for "No parameters" Error

If you're getting "No parameters" error, run this:

# Complete setup and test
npm install && npm run build && npm run refresh && npm run test

Running the Server

# Development mode (with auto-reload)
npm run dev

# Production mode
npm run build
npm start

# Force rebuild from Markdown
npm run dev -- --rebuild

MCP Tools

The server provides the following MCP tools:

metrics.list

Returns a list of all metrics with basic information.

Response:

[
  {
    "name": "page_impressions_unique",
    "level": "page",
    "periods": ["day", "week", "days_28"],
    "dataType": "Integer",
    "deprecated": false
  }
]

metrics.get

Returns full details of a specific metric by exact name.

Parameters:

  • name (string): The exact name of the metric

Response:

{
  "name": "page_impressions_unique",
  "level": "page",
  "description": "Number of people who had Page content enter their screen",
  "periods": ["day", "week", "days_28"],
  "dataType": "Integer",
  "notes": "Estimated metric",
  "tags": ["impressions", "unique"],
  "deprecated": false
}

metrics.search

Performs fuzzy search over metrics by name, description, or tags.

Parameters:

  • q (string): Search query

  • limit (number, optional): Maximum number of results (default: 20)

Response:

[
  {
    "item": {
      "name": "page_impressions_unique",
      "level": "page",
      "description": "Number of people who had Page content enter their screen",
      "periods": ["day", "week", "days_28"],
      "dataType": "Integer",
      "notes": "Estimated metric",
      "tags": ["impressions", "unique"],
      "deprecated": false
    },
    "score": 0.1,
    "matches": [...]
  }
]

metrics.refreshNow

Re-parses the Markdown reference file and reloads the in-memory cache.

Response:

{
  "content": [
    {
      "type": "text",
      "text": "Metrics refreshed successfully"
    }
  ]
}

MCP Resources

mcp://facebook-insights-metrics-v23/metrics.json

Complete JSON data of all Facebook Graph API v23.0 Insights metrics.

Content Type: application/json

Response:

{
  "version": "v23.0.2025-09-19",
  "updatedAt": "2025-09-19T12:00:00.000Z",
  "metrics": [
    {
      "name": "page_impressions_unique",
      "level": "page",
      "description": "Number of people who had Page content enter their screen",
      "periods": ["day", "week", "days_28"],
      "dataType": "Integer",
      "notes": "Estimated metric",
      "tags": ["impressions", "unique"],
      "deprecated": false
    }
    // ... 120+ more metrics
  ]
}

Metrics Categories

Page-Level Metrics (59 metrics)

  • Page Content & Tab: Tab views and content metrics

  • Page CTA & Actions: Call-to-action interactions

  • Page Engagement: Follows, unfollows, and engagement metrics

  • Page Impressions: Reach and impression tracking

  • Page Posts Impressions: Post-specific reach metrics

  • Page Video Performance: Video views and completion rates

  • Page Fan/Demographics: Follower demographics and growth

  • Page Content & Views: Profile page visits

  • Page Stories & Activity: Story creation and activity metrics

Post-Level Metrics (33 metrics)

  • Post Impressions: Post reach and visibility

  • Post Engagement & Activity: Post interactions and clicks

  • Post Reactions: Individual reaction counts

  • Post Video Performance: Post-specific video metrics

Video Metrics (26 metrics)

  • Video views, completion rates, and retention

  • Demographic breakdowns by age, gender, and location

  • Attribution tracking (paid vs organic)

Monetization Metrics (3 metrics)

  • Content monetization earnings

  • Revenue tracking and estimates

Data Types

  • Integer: Counts, totals, and whole numbers

  • Float: Earnings, rates, and decimal values

  • JSON: Complex objects with breakdowns (demographics, attribution)

  • String: Text-based data

Supported Periods

  • day: Daily data points

  • week: Weekly aggregated data

  • days_28: 28-day rolling periods

  • month: Monthly data

  • lifetime: All-time totals since Page creation

CLI Options

# Force rebuild from Markdown
facebook-insights-metrics-v23 --rebuild

# Override metrics.json location
facebook-insights-metrics-v23 --data /path/to/metrics.json

Development

Project Structure

facebook-insights-metrics-v23/
├── package.json              # Project configuration
├── mcp.json                  # MCP server configuration
├── tsconfig.json             # TypeScript configuration
├── src/
│   ├── server.ts             # MCP server implementation
│   ├── schema.ts             # Zod schemas and types
│   ├── loader.ts             # Metrics data loader
│   ├── search.ts             # Fuzzy search implementation
│   ├── parser.ts             # Markdown parser
│   └── data/
│       └── metrics.json      # Generated metrics data
├── scripts/
│   └── refresh.ts            # Refresh script
└── FACEBOOK_API_V23_METRICS_REFERENCE.md  # Source markdown

Available Scripts

# Development
npm run dev          # Start server in development mode
npm run build        # Build TypeScript to JavaScript
npm run refresh      # Parse Markdown and update metrics.json

# Production
npm start            # Start built server

Adding New Metrics

  1. Update the FACEBOOK_API_V23_METRICS_REFERENCE.md file

  2. Run npm run refresh to parse and update metrics

  3. The server will automatically reload with new metrics

Customization

  • Search Threshold: Modify threshold in src/search.ts (default: 0.35)

  • Data Path: Set METRICS_DATA_PATH environment variable

  • Tags: Customize tag extraction in src/schema.ts

API Reference

Facebook Graph API v23.0

This MCP server is based on the official Facebook Graph API v23.0 Insights documentation. All metrics are sourced from the comprehensive reference document and include:

  • Complete metric definitions

  • Supported time periods

  • Data types and formats

  • Deprecation status

  • Usage notes and limitations

Rate Limits

  • MCP Server: No built-in rate limiting

  • Facebook API: 200 calls per hour per app (when used with actual API)

  • Search: Optimized with Fuse.js for fast local searches

Troubleshooting

Common Issues

  1. "No parameters" error: This is the most common issue. Follow these steps:

    # 1. Ensure proper installation
    npm install
    npm run build
    npm run refresh
    
    # 2. Test the server
    npm run test
    
    # 3. Use correct mcp.json configuration

    Correct mcp.json:

    {
      "mcpServers": {
        "facebook-insights-metrics-v23": {
          "command": "node",
          "args": ["/full/path/to/facebook-insights-metrics-v23/dist/server.js"]
        }
      }
    }
  2. No metrics found: Run npm run refresh to generate metrics.json

  3. Build errors: Ensure Node.js v22+ and run npm install

  4. Search not working: Check that metrics.json exists and is valid

Debug Mode

# Enable debug logging
DEBUG=* npm run dev

Development

Project Structure

facebook-insights-metrics-v23/
├── src/                          # TypeScript source code
│   ├── server.ts                 # MCP server implementation
│   ├── schema.ts                 # Zod schemas and types
│   ├── loader.ts                 # Metrics data loader
│   ├── search.ts                 # Fuzzy search implementation
│   ├── parser.ts                 # Markdown parser
│   └── data/
│       └── metrics.json          # Generated metrics data
├── scripts/
│   └── refresh.ts                # Refresh script
├── .github/                      # GitHub templates
├── dist/                         # Compiled JavaScript
├── FACEBOOK_API_V23_METRICS_REFERENCE.md  # Source markdown
└── test-mcp.js                   # Test script

Available Scripts

npm run dev          # Start development server
npm run build        # Build TypeScript to JavaScript
npm run refresh      # Parse Markdown and update metrics.json
npm start            # Start production server
npm test             # Run MCP server tests
npm run test:quick   # Quick MCP test

Adding New Metrics

  1. Update FACEBOOK_API_V23_METRICS_REFERENCE.md with new metrics

  2. Run npm run refresh to parse and update metrics

  3. Test the new metrics with npm test

Contributing

We welcome contributions! Please see our Contributing Guide for details.

Quick Start for Contributors

  1. Fork the repository

  2. Create a feature branch: git checkout -b feature/amazing-feature

  3. Make your changes

  4. Run tests: npm test

  5. Commit your changes: git commit -m 'Add amazing feature'

  6. Push to the branch: git push origin feature/amazing-feature

  7. Open a Pull Request

Support

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Facebook Graph API team for the comprehensive metrics documentation

  • Model Context Protocol team for the MCP specification

  • All contributors who help improve this project


Version: 1.0.0
Node.js: v22.0.0+
Facebook API: v23.0
Last Updated: September 19, 2025

Available Tools

4 tools
metrics.getB

Returns full details of a metric by exact name

ParametersJSON Schema
NameRequiredDescriptionDefault
nameYesThe exact name of the metric to retrieve

TDQS

B3.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but only states it returns details without disclosing behavioral traits like error handling, permissions needed, rate limits, or response format. It's a read operation but lacks context on what 'full details' includes or any constraints.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste, front-loaded with the core action. It's appropriately sized for a simple tool with one parameter and clear purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations, no output schema, and a simple tool, the description is incomplete. It doesn't explain what 'full details' returns, error cases, or behavioral context, leaving gaps for the agent to understand the tool fully beyond basic usage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents the 'name' parameter fully. The description adds no additional meaning beyond implying exact name matching, which is already covered. Baseline 3 is appropriate as the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Returns full details') and resource ('of a metric'), specifying it's by exact name. It distinguishes from siblings like metrics.list (which lists multiple) and metrics.search (which searches), though not explicitly named. It's specific but lacks explicit sibling differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage when you need details for a specific metric by exact name, suggesting an alternative to list/search for bulk operations. However, it doesn't explicitly state when to use this vs. siblings or any exclusions, leaving some ambiguity for the agent.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

metrics.listB

Returns a list of all metrics with basic information

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states it returns a list but doesn't mention any behavioral traits such as pagination, rate limits, permissions required, or what 'basic information' entails. This leaves significant gaps for a tool that likely interacts with data.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's function without any wasted words. It is front-loaded and appropriately sized for a simple list operation.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is incomplete. It doesn't explain what 'basic information' includes, the format of the returned list, or any behavioral aspects like error handling. For a tool with no structured support, this leaves too much unspecified.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters, and the schema description coverage is 100%, so there's no need for parameter details in the description. The baseline for this scenario is 4, as the description appropriately avoids redundant information about parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Returns a list') and resource ('all metrics with basic information'), making the purpose understandable. However, it doesn't differentiate from sibling tools like 'metrics.search' which might also list metrics, so it doesn't reach the highest score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'metrics.search' or 'metrics.get'. It lacks context about use cases, prerequisites, or exclusions, leaving the agent with minimal direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

metrics.refreshNowB

Re-parses the Markdown file and reloads the in-memory cache

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

B3.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions 're-parses' and 'reloads cache' which imply mutation/refresh operations, but doesn't specify side effects (e.g., whether this blocks other operations), permission requirements, error conditions, or what 'reloads' entails. Significant behavioral gaps remain.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states what the tool does without any unnecessary words. It's appropriately sized for a zero-parameter tool and front-loads the core functionality.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has zero parameters and no output schema, the description adequately covers the basic action. However, as a mutation/refresh tool with no annotations, it should ideally mention more about behavioral aspects like side effects, timing implications, or error handling to be fully complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters with 100% schema description coverage, so the schema already fully documents the parameter situation. The description appropriately doesn't waste space discussing parameters, maintaining focus on the tool's action. Baseline for zero parameters is 4.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Re-parses', 'reloads') and target resource ('Markdown file', 'in-memory cache'), making the purpose understandable. However, it doesn't explicitly differentiate this tool from its siblings (metrics.get, metrics.list, metrics.search), which appear to be read operations while this seems to be a refresh/cache operation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. The description doesn't mention prerequisites (e.g., after file changes), exclusions, or comparisons with sibling tools, leaving the agent with no contextual usage information.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

metrics.searchC

Performs fuzzy search over metrics by name, description, or tags

ParametersJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum number of results (default: 20)
qYesSearch query

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions 'fuzzy search' but doesn't explain what that entails (e.g., partial matches, case sensitivity), nor does it cover aspects like permissions, rate limits, or response format. This leaves significant gaps in understanding how the tool behaves beyond basic functionality.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's function without unnecessary words. It's front-loaded with the core action and resources, making it easy to parse quickly, with no wasted information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is incomplete. It doesn't address behavioral traits like search behavior, error handling, or result format, which are crucial for a search tool. The high schema coverage helps with parameters, but overall context for effective use is insufficient.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with clear documentation for 'q' (search query) and 'limit' (maximum results with default). The description adds minimal value by implying search over 'name, description, or tags', but this doesn't provide syntax or format details beyond what the schema already covers, aligning with the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Performs fuzzy search') and target resources ('over metrics by name, description, or tags'), making the purpose understandable. However, it doesn't explicitly differentiate from sibling tools like metrics.list (which might list all metrics without search) or metrics.get (which might retrieve a specific metric by ID), so it doesn't reach the highest clarity level.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like metrics.list or metrics.get. It implies usage for searching metrics but doesn't specify scenarios, exclusions, or comparisons to siblings, leaving the agent to infer context without explicit direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 4 tool updatesv1.0.0
    • First observedmetrics.get
    • First observedmetrics.list
    • First observedmetrics.refreshNow
    • First observedmetrics.search

TDQS

A3.5/5.0
Disambiguation5/5

Each tool has a clearly distinct purpose: 'metrics.get' retrieves a specific metric by name, 'metrics.list' returns all metrics, 'metrics.refreshNow' reloads the cache, and 'metrics.search' performs fuzzy searches. There is no overlap in functionality, making tool selection unambiguous for an agent.

Naming Consistency5/5

All tool names follow a consistent 'metrics.verb' pattern with clear, descriptive verbs (get, list, refreshNow, search). The naming is uniform and predictable, using a consistent prefix and verb style throughout the set.

Tool Count5/5

With 4 tools, the server is well-scoped for managing metrics, covering essential operations: listing, retrieving, searching, and refreshing. This count is appropriate, providing necessary functionality without being overwhelming or insufficient for the domain.

Completeness4/5

The toolset covers core operations for metric management, including retrieval, listing, searching, and cache refresh. A minor gap exists in lacking explicit create, update, or delete tools, but given the domain (likely read-only metrics from a Markdown file), this is reasonable and agents can work around it.

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/KarimTarekDev/facebook-insights-metrics-v23'

If you have feedback or need assistance with the MCP directory API, please join our Discord server