Skip to main content
Glama
linkedin-campaign-manager-mcp

linkedin-campaign-manager-mcp

LinkedIn Campaign Manager MCP

npm version npm downloads Node.js MCP License: MIT

LinkedIn Marketing API用MCPサーバー。Claudeから平易な英語でキャンペーン、パフォーマンス、リード獲得フォームをクエリできます。

広告アカウント、キャンペーン、クリエイティブ、パフォーマンス分析、デモグラフィック、動画分析、予算の進捗管理、期間比較、コンバージョン、リード獲得フォーム、オーディエンス、ターゲティングファセットを網羅した19種類の読み取り専用ツール。LinkedInでスポンサードコンテンツ、リード獲得フォーム、アカウントベースのキャンペーンを運用するB2B有料ソーシャルチーム向けに構築されています。


なぜこれが必要なのか

LinkedIn Marketing APIは、非常に扱いづらいことで知られています。毎月のRosettaバージョニング、文書化されていないフィールドマッピング、分析用のRest.li形式のネストされたクエリパラメータ、そして黙って期限切れになる60日間のアクセストークンなどです。このサーバーは、それらすべてを内部で処理するため、dateRange=(start:(year:...))のようなコードを手書きする代わりに、平易な英語で質問することができます。

LinkedIn広告用の他のオープンソースMCPサーバーで、これほど深い機能を持つものはありません。ほとんどは「キャンペーンの一覧表示」で止まっています。本サーバーには、デモグラフィック、動画視聴完了ファネル、予算の進捗管理、期間比較、そしてMarketoやSalesforceとリードを照合するための個人情報(PII)を含むリード獲得フォームの回答が含まれています。


プロンプトの例

インストール後、Claudeに以下のように尋ねることができます:

  • 「過去28日間のLinkedIn広告の支出傾向を、キャンペーングループ別に教えてください。」

  • 「今月と先月の競合他社攻略キャンペーンのCPLを比較して、どのクリエイティブが数字を動かしましたか?」

  • 「支出額トップのキャンペーンのデモグラフィックを取得して、どの役職や業界がコンバージョンしているか教えてください。」

  • 「先月、最も送信率が高かったリード獲得フォームはどれですか?また、リード単価はいくらでしたか?」

  • 「認知度向上キャンペーンの動画視聴完了ファネルを表示してください。どこで離脱が発生していますか?」

  • 「予算超過のリスクがあるキャンペーンはありますか?すべてのアクティブなキャンペーンの予算進捗を表示してください。」

  • 「昨日のリード獲得フォームの回答を取得して、Marketoと照合できるようにしてください。」


デモ

🎥 解説動画近日公開 — Claude Codeから60秒以内にLinkedInキャンペーンのパフォーマンスをクエリする方法。


ツール

ツール

機能

li_list_ad_accounts

ユーザーがアクセス可能なすべての広告アカウント(ステータスと通貨を含む)。

li_get_account

単一アカウントの詳細:通貨、ステータス、タイプ、請求情報。

li_list_campaigns

アカウント内のキャンペーン。ステータスやキャンペーングループでフィルタリング可能。

li_get_campaign

キャンペーンの詳細:ターゲティング基準、入札額、予算、目的。

li_list_campaign_groups

キャンペーングループ(予算や目的を共有するコンテナ)。

li_list_creatives

広告クリエイティブ。キャンペーンやステータスでフィルタリング可能。

li_get_creative

クリエイティブの詳細:見出し、コピー、URL、画像/動画URN。

li_get_campaign_performance

指定期間のインプレッション/クリック/支出/コンバージョン/リード。DAILY/MONTHLY/YEARLY/ALLの粒度。

li_get_demographics_report

企業/企業規模/業界/職種/役職/職位/地域/国別のパフォーマンス。

li_compare_periods

WoW/MoM/YoY比較。サーバー側で計算された_current/_prior/_delta/_pct_change列を含む。

li_get_video_analytics

クリエイティブごとの動画視聴完了ファネル:開始 → 25% → 50% → 75% → 完了 + 完了率。

li_get_budget_pacing

設定期間におけるアクティブなキャンペーンの支出対予算消化率。

li_get_conversion_events

Insight Tagコンバージョンイベントの定義:タイプ、アトリビューションウィンドウ、有効ステータス。

li_get_conversion_performance

コンバージョンイベント別のパフォーマンス(CONVERSIONピボット):クリック後対ビュー後の内訳。

li_get_audience_insights

DMPセグメント:マッチングオーディエンス、企業リスト、結合/類似セグメントとそのサイズ。

li_search_targeting_facets

ターゲティング値(役職、スキル、企業、業界、場所、職位)のタイプアヘッド検索。

li_get_leadgen_forms

リード獲得フォーム + 質問設定 + ステータス。

li_get_leadgen_responses

個人情報(名前、メール、企業、役職)を含む実際のフォーム送信データ。

li_get_leadgen_form_performance

クリエイティブごとのLGF指標:フォーム開封率、送信率、リード単価。


セットアップ

1. インストール

npm install -g linkedin-campaign-manager-mcp

または、クローンしてローカルでビルド:

git clone https://github.com/ZLeventer/linkedin-campaign-manager-mcp
cd linkedin-campaign-manager-mcp
npm install
npm run build

2. LinkedIn Developerアプリの作成

Marketing APIは制限されています。特定の製品承認を受けたLinkedIn Developerアプリが必要です:

  1. developer.linkedin.com にアクセスし、アプリを作成(会社ページに関連付けます)。

  2. Productsタブ — 以下へのアクセスをリクエストします:

    • Marketing Developer Platform (r_ads, r_ads_reporting を含む)

    • Lead Gen Forms または Community Management API (r_ads_leadgen_automation を含む)

  3. LinkedInがアプリのアクセス権を手動で審査します(通常2〜6週間)。

  4. Authタブ — Authorized Redirect URLs に http://127.0.0.1:53123 を追加します。 (LINKEDIN_OAUTH_PORT を変更した場合は、そのポート番号を使用してください)。

  5. Authタブから Client ID と Client Secret をコピーします。

製品承認がない場合、すべてのAPI呼び出しは403を返します。サーバーは正常にコンパイルおよび起動しますが、403はアプリレベルの権限の問題であり、コードの問題ではありません。

3. 環境設定

cp .env.example .env
# edit .env with your LINKEDIN_CLIENT_ID, LINKEDIN_CLIENT_SECRET,
# LINKEDIN_DEFAULT_AD_ACCOUNT (numeric ID from Campaign Manager URL)

4. 認証(初回のみのOAuthフロー)

npm run auth

これにより、ポート53123(または LINKEDIN_OAUTH_PORT)でローカルHTTPサーバーが開き、ターミナルに認証URLが表示され、OAuthコールバックを待機します。ブラウザで承認すると、コードがアクセストークンと365日間のリフレッシュトークンと交換され、token.json(モード0600)に保存されます。

リフレッシュトークンが期限切れになった場合(365日後)のみ、npm run auth を再実行する必要があります。

5. Claude Code(または任意のMCPクライアント)への接続

~/.claude.json の mcpServers に以下を追加します:

{
  "mcpServers": {
    "linkedin": {
      "command": "linkedin-campaign-manager-mcp",
      "env": {
        "LINKEDIN_CLIENT_ID": "your_client_id",
        "LINKEDIN_CLIENT_SECRET": "your_client_secret",
        "LINKEDIN_TOKEN_PATH": "/absolute/path/to/token.json",
        "LINKEDIN_DEFAULT_AD_ACCOUNT": "123456789",
        "LINKEDIN_API_VERSION": "202504"
      }
    }
  }
}

ソースから実行する場合:

{
  "mcpServers": {
    "linkedin": {
      "command": "node",
      "args": ["/path/to/linkedin-campaign-manager-mcp/dist/index.js"],
      "env": {
        "LINKEDIN_CLIENT_ID": "...",
        "LINKEDIN_CLIENT_SECRET": "...",
        "LINKEDIN_TOKEN_PATH": "/path/to/token.json",
        "LINKEDIN_DEFAULT_AD_ACCOUNT": "123456789"
      }
    }
  }
}

Claude Codeを再起動します。19個のツールが linkedin サーバーの下に表示されます。


環境変数

変数

必須

デフォルト

説明

LINKEDIN_CLIENT_ID

はい

—

OAuthアプリのクライアントID

LINKEDIN_CLIENT_SECRET

はい

—

OAuthアプリのクライアントシークレット

LINKEDIN_TOKEN_PATH

いいえ

./token.json

トークンファイルの読み書きパス

LINKEDIN_DEFAULT_AD_ACCOUNT

推奨

—

数値のアカウントID。ad_account_id が渡されない場合にツールが使用

LINKEDIN_OAUTH_PORT

いいえ

53123

OAuthリダイレクト用のループバックポート

LINKEDIN_API_VERSION

いいえ

202504

LinkedIn Rosetta APIバージョン (YYYYMM)


URNの取り扱い

LinkedInのリソースはURNで識別されます:urn:li:sponsoredAccount:123、urn:li:sponsoredCampaign:456 など。

すべてのツール入力は、数値IDのみ、または完全なURNのいずれかを受け入れます。クライアントが数値IDを自動的にラップします。数値IDはキャンペーンマネージャーのURL(/accounts/<id>/、/campaigns/<id>/)に表示されます。


日付入力

すべての日付パラメータは以下を受け入れます:

入力

意味

2024-10-01

リテラルISO日付

today / yesterday

そのままの意味

7daysAgo, 28daysAgo, 90daysAgo

今日のN日前

デフォルト範囲:28daysAgo → yesterday。


LinkedIn特有の注意点

APIバージョンの変更

LinkedIn Rosettaは月次バージョン(202504 = 2025年4月)を使用します。バージョンはリリースから約12ヶ月後に廃止され、その時点で 410 Gone エラーが発生します。四半期ごとに LINKEDIN_API_VERSION を更新してください。バージョニングのドキュメントを参照してください。

分析クエリの形式

/adAnalytics は、単純なISO文字列ではなく、Rest.li形式のネストされたパラメータを使用します:

dateRange=(start:(year:2024,month:10,day:1),end:(year:2024,month:10,day:31))
campaigns=List(urn:li:sponsoredCampaign:123,urn:li:sponsoredCampaign:456)

これは内部的に dateRangeParam() と liGetRaw() によって処理されます。サーバーを拡張する場合は、手動で構築したURLを使用して liGetRaw() 経由で分析呼び出しをルーティングしてください。URLSearchParams がネストされた括弧を壊すため、分析エンドポイントには liGet() を使用しないでください。

分析データの遅延

LinkedInの分析データは、ほとんどの指標で2〜6時間、コンバージョンデータでは最大24時間の遅延が発生します。昨日の数値は通常完了していますが、今日の数値は部分的です。

60日間のアクセストークン、365日間のリフレッシュトークン

アクセストークンは60日で期限切れになり、リフレッシュトークンは365日で期限切れになります。クライアントは必要に応じて、リクエストごとに自動的にアクセストークンを更新します。リフレッシュトークンが期限切れになった場合は、npm run auth を再度実行してください。

リード獲得フォームの回答に含まれる個人情報(PII)

li_get_leadgen_responses は、名前、メール、企業、役職といった実際のリードの個人情報を返します。出力は機密情報として扱ってください。共有ログ、暗号化されていないストレージ、または公開チャンネルには書き込まないでください。LinkedInのデータ利用ポリシーでは、リードが積極的に同意していない限り、受信から90日以内にリードの回答を削除することが義務付けられています。このツールは、承認されたCRM照合(Marketo/SFDC)を目的としています。

レート制限

LinkedInは厳密なレート制限数を公開していません。実際には、アプリごとに1分あたり約100回の分析呼び出しでスロットリングが発生すると予想してください。429エラー時の再試行機能は組み込まれていません。制限に達した場合は、呼び出し頻度を減らすか、クライアント側で結果をキャッシュしてください。


このサーバーを使用すべきでない場合

  • キャンペーン、予算、クリエイティブの作成または編集 — 設計上、読み取り専用です。キャンペーン作成には自動化するには失敗モードが多すぎるため、キャンペーンマネージャーのUIを使用してください。

  • リアルタイムのインプレッションデータ — ほぼリアルタイムのデータには、LinkedIn Insight Tag + GA4を使用してください。

  • 任意のターゲティング基準に対するオーディエンスサイズの推定 — アドホックなサイズ測定には、キャンペーンマネージャーのオーディエンスビルダーUIを使用してください。li_get_audience_insights は、保存済み/アップロード済みのセグメントのサイズのみを返します。


ライセンス

MIT © 2026 Zach Leventer

Available Tools

19 tools
li_compare_periodsA

Compare LinkedIn campaign performance across two time periods. wow (week-over-week): last 7d vs prior 7d. mom (month-over-month): last 30d vs prior 30d. yoy (year-over-year): last 30d vs same 30d last year. Returns per-entity rows (keyed by campaign/creative URN) with _current, _prior, _delta, and _pct_change columns for every requested metric. Deltas are computed server-side so you do not need to post-process. Useful for weekly/monthly performance reports and anomaly detection.

Inputs: pivot, fields, comparison, campaign_ids, +1 more.

li_get_accountA

Get full details for a single LinkedIn ad account, including currency code, status, account type (BUSINESS/ENTERPRISE), total budget, billing info, and the associated organization URN. Useful for confirming account currency before interpreting spend data, or checking billing status before troubleshooting ad delivery issues.

Inputs: ad_account_id.

li_get_audience_insightsA

List DMP (Data Management Platform) segments attached to a LinkedIn ad account. Segments represent matched audiences (USER type: contact list uploads, website retargeting, lookalike audiences) and company lists (COMPANY type: for account-based marketing). Returns segment name, type, source, estimated size (where LinkedIn reports it), and status. Use to audit available audiences before building campaigns, or to confirm a matched audience uploaded successfully and has enough members to serve ads.

Inputs: ad_account_id, type, page_size.

li_get_budget_pacingA

Calculate budget utilization for active LinkedIn campaigns. Compares spend over the specified period_days window against total or estimated period budget, and returns a utilization_pct for each campaign. Useful for mid-flight pacing checks: if utilization is below 80% near the end of a month, the campaign may be under-delivering; above 100% means it is over-pacing. Accepts optional campaign_ids to limit scope; defaults to all ACTIVE campaigns in the account.

Inputs: ad_account_id, campaign_ids, period_days.

li_get_campaignA

Get complete detail for a single LinkedIn campaign, including the full targetingCriteria object (all included/excluded facets), bid strategy, unit cost, daily/total budget, run schedule, objective, optimization target, format, and locale. Use this when you need to audit targeting setup, diagnose budget configuration, or confirm campaign structure before pulling performance data.

Inputs: campaign_id (required), ad_account_id.

li_get_campaign_performanceA

Fetch performance metrics for LinkedIn campaigns over a date range. Returns impressions, clicks, spend (USD and local currency), website conversions, one-click lead form submissions, landing-page clicks, video views, follows, reactions, comments, and shares. Pass campaign_ids for specific campaigns or use ad_account_id for account-level totals. Supports DAILY/MONTHLY/YEARLY/ALL time granularity and CAMPAIGN/CAMPAIGN_GROUP/CREATIVE/ACCOUNT pivots. Default range: last 28 days.

Inputs: campaign_ids, ad_account_id, start_date, end_date, +3 more.

li_get_conversion_eventsA

List LinkedIn conversion event definitions on an ad account. Returns each event's name, type (URL/FILE_DOWNLOAD/SIGN_UP/etc.), enabled status, attributionType, post-click and view-through attribution window sizes, and associated Insight Tag. These are the events tracked by the LinkedIn Insight Tag on your website. Use to audit conversion event setup, confirm event names before pulling conversion performance, or verify attribution window configuration.

Inputs: ad_account_id, enabled_only, page_size.

li_get_conversion_performanceA

Fetch conversion performance broken down by conversion event (CONVERSION pivot). Returns externalWebsiteConversions, externalWebsitePostClickConversions, externalWebsitePostViewConversions, impressions, clicks, and spend per conversion event. Use to compare cost-per-conversion across event types, diagnose which Insight Tag events are driving value, or build a funnel from impression → click → conversion. Scope to specific campaigns or report at account level.

Inputs: campaign_ids, ad_account_id, start_date, end_date, +1 more.

li_get_creativeA

Get full detail for a single LinkedIn ad creative, including the creative content (headline, body copy, destination URL, image/video URNs, call-to-action label), intendedStatus, associated campaign URNs, and creative type. Use when auditing ad copy and creative assets, debugging a rejected creative, or pulling the landing page URL to cross-reference with GA4 UTM data.

Inputs: creative_id (required), ad_account_id.

li_get_demographics_reportA

Break down LinkedIn campaign performance by a demographic dimension of the people who saw or clicked your ads. Pivot options: MEMBER_JOB_TITLE (which titles engage most), MEMBER_JOB_FUNCTION, MEMBER_SENIORITY (director vs. manager vs. C-suite), MEMBER_COMPANY (which accounts clicked), MEMBER_COMPANY_SIZE, MEMBER_INDUSTRY, MEMBER_COUNTRY_V2, MEMBER_REGION_V2. Returns impressions, clicks, spend, leads, and conversions per dimension value. Useful for buyer-persona fit analysis and ABM account-list validation.

Inputs: pivot (required), campaign_ids, ad_account_id, start_date, +2 more.

li_get_leadgen_form_performanceA

Fetch LinkedIn Lead Gen Form performance analytics broken down by creative. Returns impressions, clicks, Lead Gen Form opens (oneClickLeadFormOpens), lead submissions (oneClickLeads), spend, and computed metrics: formOpenRate (opens / clicks), leadSubmitRate (submissions / opens), costPerLead (spend / submissions), and CTR. Use to identify high-performing LGF creatives, diagnose drop-off between form open and submission, or compare cost-per-lead across campaigns.

Inputs: end_date, start_date, campaign_ids, ad_account_id.

li_get_leadgen_formsA

List LinkedIn Lead Gen Forms on an ad account. Returns form name, state (ACTIVE/DRAFT/ARCHIVED), the list of questions asked (field type, label, pre-fill source), the thank-you page URL and message, and the associated landing page (if any). Use to audit form question setup, confirm form state before troubleshooting lead delivery, or verify which forms are attached to active campaigns.

Inputs: ad_account_id, state, page_size.

li_get_leadgen_responsesA

Retrieve actual Lead Gen Form submission data from LinkedIn. Each response includes questionResponses with field-by-field values (first name, last name, email, company, job title, phone, etc.) and submission timestamp. Filter by lead_form_id and/or submitted_after/before date range. Use for lead-to-CRM reconciliation against SFDC or Marketo, for auditing lead quality, or for confirming that a form integration is capturing the right fields. NOTE: This endpoint returns PII — handle output as sensitive data.

Inputs: ad_account_id, lead_form_id, submitted_after, submitted_before, +1 more.

li_get_video_analyticsA

Fetch video-specific performance metrics for LinkedIn campaigns, broken down by creative. Returns videoStarts, videoViews, videoFirstQuartileCompletions, videoMidpointCompletions, videoThirdQuartileCompletions, videoCompletions, plus a computed videoCompletionRate (completions / starts × 100). Use to evaluate video ad quality — high completion rates indicate compelling content; low rates signal drop-off. Scope to specific campaigns via campaign_ids or report at account level.

Inputs: campaign_ids, ad_account_id, start_date, end_date, +1 more.

li_list_ad_accountsA

List all LinkedIn ad accounts the authenticated user has access to. Returns account ID, name, status, currency, type (BUSINESS/ENTERPRISE), and reference organization URN. Use this first to discover the ad_account_id needed by other tools. Filter by status (ACTIVE/CANCELED/DRAFT/PENDING_DELETION/REMOVED) or omit to see all accounts.

Inputs: status, page_size.

li_list_campaign_groupsA

List campaign groups in a LinkedIn ad account. Campaign groups are containers that group related campaigns under a shared name and optional total budget cap. Returns group name, status, total budget, run schedule, and the campaigns count. Use to understand account structure before pulling campaign-level data.

Inputs: ad_account_id, status, page_size.

li_list_campaignsA

List campaigns in a LinkedIn ad account. Returns campaign name, status, objectiveType (WEBSITE_VISITS/LEAD_GENERATION/BRAND_AWARENESS/etc.), optimizationTargetType, bid amount, daily/total budget, run schedule, and targeting criteria summary. Filter by status or campaign_group_id. Use li_get_campaign for full targeting detail on a specific campaign.

Inputs: ad_account_id, status, campaign_group_id, page_size.

li_list_creativesA

List ad creatives in a LinkedIn ad account. Returns creative content type (SPONSORED_STATUS_UPDATE/MESSAGE/etc.), intendedStatus, associated campaigns, and content URNs. Filter by campaign_id to see all creatives on a specific campaign, or by status to find paused/archived ads. Use li_get_creative for full content detail on a specific creative.

Inputs: ad_account_id, campaign_id, status, page_size.

li_search_targeting_facetsA

Search LinkedIn targeting facet values to find the correct URNs for audience targeting. Facets include: jobTitles (e.g., 'Supply Chain Director'), skills (e.g., 'S&OP'), companies, industries, seniorities, locations, and more. Returns matching facet values with their LinkedIn URNs, which can then be used to configure campaign targeting via the Campaign Manager UI. Useful for researching targeting options, confirming exact category names, or building audience documentation.

Inputs: facet (required), query (required), locale, count.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4/5.0

    Scored across 19 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: listing vs. getting details vs. performance reports vs. conversion/leadgen analytics vs. targeting research. Even similar-looking tools like li_get_campaign_performance, li_get_leadgen_form_performance, and li_get_conversion_performance target different metric types and dimensions, so an agent can reliably pick the right one.

    Naming Consistency5/5

    All tools follow a consistent snake_case pattern with the li_ prefix and verb-noun structure (list_, get_, search_, compare_). The naming is highly predictable: li_list_* for enumeration, li_get_* for details or reports, and specific modifiers like _performance, _analytics, _insights. No mixed conventions or irregular verbs.

    Tool Count4/5

    At 19 tools, this is slightly above the typical 3-15 range but still well-justified for the complexity of LinkedIn advertising. Each tool covers a distinct aspect (accounts, campaigns, creatives, performance, demographics, video, conversions, audiences, leadgen, targeting, pacing, comparison) without redundancy. The count feels reasonable for the domain's depth.

    Completeness3/5

    The toolset is heavily read/analytics-focused: it covers listing, getting details, and detailed performance/reporting for all major entities, but lacks any create, update, or delete operations for campaigns, creatives, or account settings. For a 'campaign manager' one might expect lifecycle management, but as a monitoring/analytics surface it is fairly complete. The gaps are significant if the intended scope includes editing, but for reporting and optimization analysis it works well.

    Maintenance

    ActivityNo data
    ResponsivenessSyncing

    Related MCP Connectors