LinkedIn Ads
概览
作者提供的说明(英文原文)
MCP server for LinkedIn Campaign Manager — campaigns, creatives, and analytics
PopNx MCP 的三大支柱
这三项永远不会合并成一个分数:意见、测量和人气是不同的东西。
- 用户评价i暂无评价评价功能将在后续阶段与账户功能一起开放
- 我们的基础检查i1 项中通过 1 项依据公开信息检查;尚未扫描代码
- 使用情况i非常新↓ 297/周 · ★ –
它能帮你做什么
我们还没有为它写通俗的介绍。下面是我们从注册中心读取到的事实。
- 连接方式: 在你的电脑上运行
- 传输方式: stdio
- 分类: 营销与社交媒体
- 你需要填写:LINKEDIN_CLIENT_ID, LINKEDIN_CLIENT_SECRET, LINKEDIN_ACCESS_TOKEN
安装
选择你使用的 AI 应用,然后复制设置。
安装之前
- 基础检查:1 项中通过 1 项
- 在你的电脑上运行,拥有你的用户账户的权限(文件、网络、应用)。
- 需要你自己填写:
LINKEDIN_CLIENT_ID,LINKEDIN_CLIENT_SECRET,LINKEDIN_ACCESS_TOKEN
标为机密的值是你账户的钥匙。千万不要分享给别人,也不要粘贴到聊天里。
你需要
- npm已安装 Node.js(用于 npx 命令)
你用的是哪个应用?
在上方选择你的应用。我们会记住它,下次按钮会显示“安装到 …”。
打开 Claude Desktop → Settings → Developer → Edit Config,把下面的内容粘贴到 claude_desktop_config.json
{
"mcpServers": {
"linkedin-ads": {
"command": "npx",
"args": [
"-y",
"mcp-linkedin-ads"
],
"env": {
"LINKEDIN_CLIENT_ID": "your-value",
"LINKEDIN_CLIENT_SECRET": "your-value",
"LINKEDIN_ACCESS_TOKEN": "your-value"
}
}
}
}在终端中运行这条命令
claude mcp add linkedin-ads --env LINKEDIN_CLIENT_ID=your-value --env LINKEDIN_CLIENT_SECRET=your-value --env LINKEDIN_ACCESS_TOKEN=your-value -- npx -y mcp-linkedin-ads运行前请先填写空着的值。
或者自己复制设置
粘贴到项目中的 .cursor/mcp.json,或 ~/.cursor/mcp.json
{
"mcpServers": {
"linkedin-ads": {
"command": "npx",
"args": [
"-y",
"mcp-linkedin-ads"
],
"env": {
"LINKEDIN_CLIENT_ID": "your-value",
"LINKEDIN_CLIENT_SECRET": "your-value",
"LINKEDIN_ACCESS_TOKEN": "your-value"
}
}
}
}浏览器会先询问是否打开应用,然后应用会显示设置并请你确认。密钥的值会留空,由你自己填写。
或者自己复制设置
粘贴到项目中的 .vscode/mcp.json
{
"servers": {
"linkedin-ads": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"mcp-linkedin-ads"
],
"env": {
"LINKEDIN_CLIENT_ID": "your-value",
"LINKEDIN_CLIENT_SECRET": "your-value",
"LINKEDIN_ACCESS_TOKEN": "your-value"
}
}
}
}浏览器会先询问是否打开应用,然后应用会显示设置并请你确认。密钥的值会留空,由你自己填写。
这个服务器在你的电脑上运行,而 ChatGPT 只能连接互联网上的服务器。请选择其他应用。
你的选择通过 Cookie 保存在这台设备上,无需账户。
需要你填写的值
- LinkedIn OAuth app client ID
- LinkedIn OAuth app client secret
- LinkedIn OAuth access token
这些设置是根据作者在注册中心的条目生成的。如果 README 的写法不同,请以 README 为准。
它能做什么
它在你的电脑上运行;安装后,工具列表会显示在你的 AI 应用中。
基础检查i
我们检查的是任何人都能看到的信息;我们没有阅读代码。不适用的检查项不计入总数。 · 检查于 2026年11月8日
- ✓ 通过
作者与仓库一致
注册名称已通过 GitHub 账户 mharnett 验证,该账户拥有此仓库
- … 尚未检查
仍在维护
我们还没有从 GitHub 读取这个仓库
- … 尚未检查
有许可证
我们还没有从 GitHub 读取这个仓库
- – 不适用
端点有响应
它在你的电脑上运行,没有互联网端点
- – 不适用
使用 OAuth 登录
在你的电脑上运行,改用本地设置
- … 尚未检查
工具描述中没有隐藏指令
它在你的电脑上运行;我们只能读取互联网端点的工具列表
与“营销与社交媒体”中的其他服务器比较i
- 星标数多于此分类中其他 3603 个服务器的 0%
- 发布到注册中心的时间比此分类中其他 3603 个服务器的 3% 更新
- 基础检查结果等于或优于此分类中其他 3603 个服务器的 100%
与注册中心里这个分类中所有活跃的服务器比较。只有当发布者拥有该仓库时,星标数才计入。
常见问题
LinkedIn Ads 安全吗?
它在 1 项适用的基础检查中通过了 1 项。我们没有阅读代码。在添加密钥或令牌之前,请先看看这个服务器要求哪些权限,并使用只具备所需权限的密钥。
它需要哪些密钥或代码?
你需要填写:LINKEDIN_CLIENT_ID, LINKEDIN_CLIENT_SECRET, LINKEDIN_ACCESS_TOKEN
它在我的电脑上运行还是在云端?
它在你的电脑上运行。你的 AI 应用会在需要时启动它,数据不会经过作者的服务器(除非它自己调用在线服务)。
它还在维护吗?
GitHub 仓库最后更新于–,最新版本(1.0.2)于8个月前进入注册中心。
哪些应用可以使用它?
支持 MCP 的应用,例如 Claude Desktop、Claude Code、Cursor 和 VS Code。你的电脑上还需要有 Node.js。
有什么可以替代它?
同一分类中有:MCP YouTube Transcript, Google Analytics MCP, BibiGPT YouTube Video Summarizer
替代选择
同一分类中其他作者的服务器,按星标数排序。
如何看卡片:↓ 每周下载量i★ GitHub 星标i三大支柱:评价 · 检查 · 使用情况i更新 = 最新版本发布到注册中心的时间i
Google Analytics MCP
GA4 MCP server for AI agents: schema discovery, server-side aggregation, analysis-ready defaults.
BibiGPT YouTube Video Summarizer
AI video summarizer: summarize and transcribe YouTube, Bilibili, TikTok and podcast videos.
作者的 README
打开 README
按原文从作者的仓库复制。PopNx MCP 没有审查或背书其内容。HTML、图片和脚本已被移除。链接会离开本站。
LinkedIn Ads MCP Server
Production-grade MCP server for LinkedIn Campaign Manager API. Enables Claude to manage LinkedIn ad accounts, campaigns, ad sets, and creatives with full read/write support.
Features:
- 7 tools -- production-tested
- Multi-account management (multiple LinkedIn ad accounts)
- Campaign and campaign group listing
- Account and campaign performance analytics
- Flexible pivot-based reporting (demographics, device, creative breakdowns)
- Landing page click-based CTR (not total clicks)
Stats:
- ⭐ Production-proven: active campaigns under management
- 📊 Multi-client: per-client config, no client data in repo
- 🔄 CTR accuracy: Uses
landingPageClicks(not total clicks with engagement) - ✅ Full test coverage: 40+ contract tests
Installation
npm install mcp-linkedin-ads
Configuration
Security: Never share your .mcp.json file or commit it to git -- it may contain API credentials. Add .mcp.json to your .gitignore.
- Get OAuth credentials:
- Go to LinkedIn Developer Portal
- Create a new app with "Sign In with LinkedIn" + "Marketing Developer Platform"
- Scopes:
r_ads,rw_ads,w_member_social,r_organization_social,w_organization_social
- Create `config.json`:
cp config.example.json config.json
- Fill in your credentials:
{
"oauth": { "client_id": "YOUR_CLIENT_ID", "client_secret": "YOUR_CLIENT_SECRET" }, "clients": { "default": { "account_id": "YOUR_AD_ACCOUNT_ID", "name": "My Account" } } }
- Set environment variables (recommended for production):
export LINKEDIN_ADS_CLIENT_ID="your_client_id"
export LINKEDIN_ADS_CLIENT_SECRET="your_client_secret" export LINKEDIN_ADS_ACCESS_TOKEN="your_access_token"
Environment variables
| Variable | Required | Default | Purpose |
|---|---|---|---|
LINKEDIN_ADS_CLIENT_ID | yes | -- | OAuth client ID |
LINKEDIN_ADS_CLIENT_SECRET | yes | -- | OAuth client secret |
LINKEDIN_ADS_ACCESS_TOKEN | yes | -- | OAuth access token |
LINKEDIN_ADS_REFRESH_TOKEN | optional | -- | OAuth refresh token (rotated automatically when set) |
LINKEDIN_ADS_MCP_WRITE | optional | false | Set to true to expose mutating tools. Read-only by default. |
Read-only by default
Write tools (currently linkedin_ads_create_predictive_audience and linkedin_ads_update_predictive_audience) are hidden from ListTools and refused at call time unless LINKEDIN_ADS_MCP_WRITE=true is set in the MCP server environment. This mirrors the Google Ads MCP gate. Motivation: prevent a casual LLM request from mutating production ad accounts without the operator explicitly opting in.
Each write also requires account_id and confirm_account_id set to the same id. The account is never resolved from the working directory or a default, and an update refuses a segment owned by a different account. Every write reads the object back and returns any field that did not stick as mismatches.
Predictive audiences (lookalikes)
| Tool | Kind |
|---|---|
linkedin_ads_list_predictive_audiences | read — every predictive audience in an account, with locations, seeds, size, build status |
linkedin_ads_get_predictive_audience | read — one audience by parent DMP segment id |
linkedin_ads_create_predictive_audience | write — parent DMP segment + audience, then read-back; dry_run supported |
linkedin_ads_update_predictive_audience | write — partial update of name, locations, seeds, desired size; dry_run supported |
Requirements and behaviour (verified live 2026-11-05):
- The token needs the
rw_dmp_segmentsscope (included inconfig.example.json). LinkedIn grants DMP write access per developer app. - These calls use
LinkedIn-Version: 202607regardless ofapi.version; the audience endpoints 404 at 202604. desired_audience_countand at least oneurn:li:geo:location are required on create.- Freshly created audiences 404 their POST/PATCH for a few seconds, and reads lag writes; the tools retry 404s and re-read before reporting a mismatch.
- If create fails after the parent segment exists, the error names it; retry with
existing_dmp_segment_idinstead of creating a second parent. - Segments created after early September 2026 cannot be attached to campaigns through the API in our testing; attach them in Campaign Manager.
Usage
Start the server
npm start
Use with Claude Code
Add to ~/.claude.json:
{
"mcpServers": { "linkedin-ads": { "type": "http", "url": "http://localhost:3001" } } }
Claude Desktop: Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows).
Example API Calls
// Get client context
linkedin_ads_get_client_context({ working_directory: "/path/to/project" })
// List campaigns linkedin_ads_list_campaigns({ account_id: "511664399" })
// Get campaign performance linkedin_ads_campaign_performance({ start_date: "2026-01-01", end_date: "2026-03-31", time_granularity: "MONTHLY" })
// Flexible analytics (e.g. by seniority) linkedin_ads_analytics({ start_date: "2026-03-01", end_date: "2026-03-31", pivot: "MEMBER_SENIORITY" })
Key Data Conventions
CTR Calculation
- Always use
landingPageClicks(LP clicks), NOTclicks(total clicks) - Total clicks include social engagement (likes, comments, shares) which inflates CTR
- This is critical for accurate campaign analysis
Campaign Status
DRAFT— Not yet activeACTIVE— Actively servingPAUSED— Paused manuallyARCHIVED— Historical record
Audience Targeting
- Flexible targeting:
flexible_specarray (OR logic between items) - Exclude targeting:
exclude_specarray - Job titles, seniority levels, functions, locations all supported
CLI Tools
npm run dev # Run in dev mode (tsx)
npm run build # Compile TypeScript npm test # Run contract tests
Architecture
Files:
src/index.ts— MCP server, OAuth flow, tool handlerssrc/tools.ts— Tool schema definitionssrc/errors.ts— Error handling & classificationconfig.json— Credentials & client mapping
Error Handling:
- OAuth errors: Clear messages for token refresh needed
- Rate limits: Automatic retry with backoff (recommended by LinkedIn)
- Invalid campaigns: Validation before creation (save API quota)
Development
Adding a New Tool
- Define schema in
src/tools.ts - Add handler in
src/index.tstool dispatch - Test with contract test in
.contract.test.ts - Document in here
Testing
npm test -- --run # Single run
npm test -- --watch # Watch mode
Troubleshooting
Config file not found
cp config.example.json config.json
Fill in your OAuth credentials and account IDs
Missing required credentials
Check that:
LINKEDIN_ADS_CLIENT_IDandLINKEDIN_ADS_CLIENT_SECRETare set (or in config.json)config.jsonexists and contains at least one client withaccount_id- OAuth tokens are valid (they expire)
Rate limit exceeded
LinkedIn enforces strict rate limits. The server includes automatic retry with exponential backoff. If you hit limits:
- Wait before retrying
- Batch operations when possible
- Reduce query frequency
CTR seems too low
Verify you're using landingPageClicks (LP clicks), not clicks (all interactions). The latter includes social engagement and will inflate CTR incorrectly.
License
MIT
Contributing
Contributions welcome! Please:
- Add tests for new tools
- Update README with new features
- Follow existing code style
- Tag release with version
Support
- Issues: GitHub issues for bugs/feature requests
- Docs: See
docs/folder for detailed API reference - Community: Discussions in GitHub
Built By
[Mark Harnett](https://www.linkedin.com/in/markharnett/) — Demand generation leader and paid media practitioner building AI-powered ad management tools. This server was born from managing LinkedIn campaigns across multiple clients and wanting Claude to handle campaign ops, performance analysis, and bulk creative updates autonomously.
Built with production workloads in mind: resilient API calls (circuit breakers, retry with backoff, response truncation), accurate CTR calculation (landing page clicks, not total clicks), and multi-account support.
Also by Mark: mcp-bing-ads -- Bing/Microsoft Ads MCP server with 10 tools.
Last Updated: 2026-03-13