Labsco
danielpopamd logo

LinkedIn Ads MCP

โ˜… 22

from danielpopamd

Analyze your LinkedIn Ads data

๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedAccount requiredAdvanced setup

LinkedIn Ads MCP Server

An MCP (Model Context Protocol) server that enables Claude AI to access and analyze your LinkedIn Ads data. Built for marketers, founders, and growth teams who want to leverage AI for campaign optimization, performance reporting, and data-driven advertising decisions.


Quick Install (No Coding Required!)

Don't want to deal with technical stuff? Just copy one of the prompts below and paste it into Claude. The AI will do everything for you!


Created By

Daniel Popa - Performance Marketing Consultant & AI Automation Specialist

I help ambitious startups scale profitably through paid ads, conversion rate optimization, and data-driven growth strategies. With 10+ years in performance marketing and $100M+ in managed ad budgets, I now focus on implementing AI workflows and automation to improve marketing efficiency and performance.

This tool was built to bridge the gap between LinkedIn's advertising data and AI-powered analysis, making it easier for marketers to get actionable insights through natural language conversations with Claude.

  • Website: danielpopa.me
  • Focus: Performance Marketing, AI Automation, Growth Strategy

Manual Installation (For Developers)

If you prefer to install manually or want more control, follow the instructions below.


What This Does

This MCP server connects Claude Desktop (or any MCP-compatible client) to the LinkedIn Marketing API, allowing you to:

  • Query campaign performance using natural language
  • Analyze audience demographics to understand who's engaging with your ads
  • Track conversions and leads across your LinkedIn campaigns
  • Compare performance between time periods, campaigns, or campaign groups
  • Get AI-powered insights on your advertising data

Example Conversations with Claude

"Show me campaign performance for the last 30 days"
"Which job functions are responding best to my ads?"
"Compare this week's performance vs last week"
"What's my cost per lead for the lead gen campaigns?"
"Which creatives have the best CTR?"
"Show me the daily trend for conversions"

Features

  • 25 Specialized Tools - Covering accounts, campaigns, creatives, audiences, conversions, analytics, and full campaign management (create, update, delete)
  • Comprehensive Metrics - Every report includes: Spend, Impressions, Clicks, CTR, Reach, Frequency, Engagements, Engagement Rate, CPM, CPC, Conversions, Conversion Rate, Cost per Conversion, Audience Penetration, and Average Dwell Time
  • Single OAuth Authentication - Authenticate once and access all your LinkedIn ad accounts
  • Automatic Token Refresh - Tokens refresh automatically before expiration
  • Rate Limit Handling - Built-in exponential backoff for API rate limits
  • Human-Readable Names - Demographic data shows actual names (not IDs) for seniorities, job functions, industries, and more

Authentication

Run the authentication flow to get your access tokens:

npm run auth

This will:

  1. Open your browser to LinkedIn's OAuth page
  2. Ask you to authorize the application
  3. Store your tokens locally in ~/.linkedin-ads-mcp/tokens.json
  4. Tokens are valid for 60 days and auto-refresh

Available Tools

Account Management

ToolDescription
list_ad_accountsList all accessible LinkedIn ad accounts
get_account_detailsGet detailed account configuration and settings

Campaign & Creative Performance

ToolDescription
get_campaign_performanceCampaign metrics with all standard KPIs including audience penetration and average dwell time
get_creative_performanceAd-level metrics with engagement, video stats, and average dwell time
get_campaign_groupsList campaign groups with aggregated performance
list_campaignsList all campaigns including drafts and paused with zero impressions

Audience & Demographics

ToolDescription
get_audience_demographicsPerformance by job function, industry, seniority, company size, country, region
get_audience_reachUnique member reach, frequency, and native audience penetration metrics
list_saved_audiencesView matched and lookalike audiences

Conversions & Lead Generation

ToolDescription
get_conversion_performanceConversion metrics by conversion action
list_conversionsView conversion tracking rules and configuration
get_lead_gen_performanceLead form submissions and cost per lead
list_lead_formsView lead gen form configurations

Advanced Analytics

ToolDescription
compare_performanceCompare metrics between time periods or entities
get_daily_trendsDaily time-series data for trend analysis

Campaign Management (Write Operations)

ToolDescription
create_campaign_groupCreate a new campaign group for organizing campaigns
update_campaign_groupUpdate campaign group status, budget, name, or end date
delete_campaign_groupDelete a campaign group
create_campaignCreate a new campaign with targeting, budget, and objective
update_campaignUpdate campaign status, budget, targeting, or bid amount
delete_campaignDelete a campaign
create_creativeCreate a creative from an existing post/share
create_inline_adCreate an ad with inline content (text, image, CTA) in one call
update_creative_statusActivate, pause, or archive a creative
upload_imageUpload an image for use in ads (PNG, JPG, GIF)

Standard Metrics

Every performance report includes these metrics:

MetricDescription
SpendTotal cost in USD
ImpressionsNumber of times ads were shown
ClicksTotal clicks on ads
CTRClick-through rate (%)
ReachApproximate unique members reached
FrequencyAverage impressions per unique member
EngagementsTotal engagements (likes, comments, shares, etc.)
Engagement RateEngagements / Impressions (%)
CPMCost per 1,000 impressions
CPCCost per click
ConversionsTotal conversion events
Conversion RateConversions / Clicks (%)
Cost per ConversionSpend / Conversions
Audience PenetrationNative LinkedIn metric: unique members reached / total target audience size (%). Uses API-native value when available (โ‰ค92 day range), with client-side fallback
Average Dwell TimeAverage seconds users spent with >50% of ad pixels visible in viewport

API Limits & Best Practices

LinkedIn API Limits

  • Rate Limit: 45 million metric values per 5-minute window
  • Response Limit: Max 15,000 elements per response
  • Metrics per Request: Max 20 metrics
  • Demographic Data Delay: 12-24 hours
  • Reach Data: Max 92-day date range

Best Practices

  1. Start with account listing - Always list accounts first to get valid account IDs
  2. Use reasonable date ranges - Shorter ranges return faster; use 30 days for regular reporting
  3. Be specific with campaigns - Filter by campaign IDs when you know which campaigns to analyze
  4. Leverage comparisons - Use the compare tool to quickly identify performance changes

Project Structure

linkedin-ads-mcp/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ index.ts              # MCP server entry point
โ”‚   โ”œโ”€โ”€ auth-cli.ts           # OAuth CLI tool
โ”‚   โ”œโ”€โ”€ auth/
โ”‚   โ”‚   โ”œโ”€โ”€ oauth.ts          # OAuth 2.0 flow
โ”‚   โ”‚   โ””โ”€โ”€ token-store.ts    # Secure token storage
โ”‚   โ”œโ”€โ”€ lib/
โ”‚   โ”‚   โ”œโ”€โ”€ linkedin-api.ts   # LinkedIn Marketing API client
โ”‚   โ”‚   โ””โ”€โ”€ types.ts          # TypeScript type definitions
โ”‚   โ””โ”€โ”€ tools/
โ”‚       โ”œโ”€โ”€ accounts.ts       # Account management tools
โ”‚       โ”œโ”€โ”€ performance.ts    # Campaign & creative performance
โ”‚       โ”œโ”€โ”€ demographics.ts   # Audience demographics tools
โ”‚       โ”œโ”€โ”€ conversions.ts    # Conversion & lead gen tools
โ”‚       โ”œโ”€โ”€ analytics.ts      # Advanced analytics tools
โ”‚       โ””โ”€โ”€ campaign-management.ts  # Campaign CRUD & image upload tools
โ”œโ”€โ”€ dist/                     # Compiled JavaScript output
โ”œโ”€โ”€ package.json
โ”œโ”€โ”€ tsconfig.json
โ””โ”€โ”€ .env.example

Development

# Build the project
npm run build

# Run the server (for testing)
npm run dev

# Run authentication flow
npm run auth

Tech Stack