LinkedIn Ads MCP Server
Create and manage LinkedIn ad campaigns as drafts via natural language, supporting campaign groups, targeting, creatives, and audience uploads through MCP tools.
README
Liam
Liam is an ad manager for LinkedIn (LinkedIn Ad Manager). Create campaigns by talking to Claude (MCP) or from a CLI. Built for go-to-market teams who want to spin up many campaigns from a contact list and a brief, then add creative images themselves. Everything is created as a draft, so nothing spends until you explicitly activate it in Campaign Manager.
Unofficial and not affiliated with or endorsed by LinkedIn.
Covers creation, matched audiences (including building one straight from Salesforce), conversion selection, and performance reporting/insights. See ROADMAP.md for what's shipped and what's planned next.
Hierarchy mapping (LinkedIn differs from Google/Meta)
| Common term | LinkedIn entity | Holds |
|---|---|---|
| Campaign | Campaign Group | status, total/shared budget |
| Ad group | Campaign | targeting, budget, bid, schedule, format |
| Ad | Creative | the rendered ad (status: DRAFT) |
| Audience | DMP Segment | attached to a Campaign's targeting |
Packages
@liads/core— LinkedIn REST client, OAuth, resource modules, CSV + SHA256 hashing, Salesforce reader.@liads/mcp— MCP server (stdio for local; reused by the hosted app). Primary interface.@liads/cli— theliamCLI over the same core, for scripted batch runs.@liads/web— Next.js app that hosts the MCP over HTTP on Vercel.
Prerequisites (everyone needs their own LinkedIn app)
- Create a developer app at https://www.linkedin.com/developers/apps and request the Advertising API product. (The Audiences product, needed for CSV audience upload, is requested separately.)
- Add an OAuth redirect URL of
http://localhost:53682/callbackfor local login.
Option A — Run locally (self-host, free)
pnpm install
pnpm -r build
# App credentials (alternatively set LIADS_CLIENT_ID / LIADS_CLIENT_SECRET env vars)
mkdir -p ~/.liads
echo '{ "clientId": "...", "clientSecret": "...", "linkedinVersion": "202605" }' > ~/.liads/config.json
node packages/cli/dist/index.js auth login # opens browser, stores tokens in ~/.liads
node packages/cli/dist/index.js accounts list # verify
node packages/cli/dist/index.js launch --brief examples/brief.json
Register the local MCP server with Claude (Desktop / Code):
{
"mcpServers": {
"liam": { "command": "node", "args": ["/abs/path/linkedin-ads/packages/mcp/dist/index.js"] }
}
}
Option B — Host the MCP on Vercel (single-tenant, for you)
- Get your env values locally:
node packages/cli/dist/index.js auth export. - Deploy
apps/webto Vercel (set the project Root Directory toapps/web). - In Vercel project settings, add the env vars from
.env.example(LIADS_CLIENT_ID,LIADS_CLIENT_SECRET,LIADS_REFRESH_TOKEN,LIADS_LINKEDIN_VERSION, and a strongMCP_AUTH_TOKEN). - Your MCP endpoint is
https://<your-app>.vercel.app/api/mcp.
Connect Claude to the remote server (header carries the secret):
npx mcp-remote https://<your-app>.vercel.app/api/mcp --header "Authorization: Bearer <MCP_AUTH_TOKEN>"
Tools (MCP)
- Accounts:
list_ad_accounts - Targeting:
list_targeting_facets,search_targeting(typeahead a facet for entity URNs),list_facet_entities,estimate_audience(structured spec). Talk in plain language ("VPs of demand gen at SaaS companies in the US") and Liam resolves the facets, estimates reach, then builds the campaign. - Audiences:
upload_audience_csv(auto-cleans the CSV: normalizes column names, drops non-matcher columns, hashes emails, converts company domains to website URLs; supports both contact and company lists),audience_from_salesforce(SOQL → matched audience),get_audience_status - Conversions:
list_conversions(select an existing insight-tag conversion to track).create_campaignandlaunch_from_briefacceptconversionIdsorconversionName, and fall back todefaultConversionNamefrom config. - Campaigns:
create_campaign_group,create_campaign,create_text_ad,create_image_ad - Orchestrator:
launch_from_brief(audience + group + campaign + draft creatives in one call) - Reporting:
performance_summary(account rollup + top/bottom + flags),get_performance(per-entity KPIs at any level),performance_trend(weekly/monthly with deltas). KPIs: CTR, CPC, CPM, CPL, conversion rate, cost per conversion. Levels: campaign_group → campaign → creative.
Targeting spec
Structured targeting uses short facet names mapped to entity URNs (resolve URNs with
search_targeting). URNs within a facet are ORed; facets are ANDed; excluded facets are ORed.
{ "include": { "locations": ["urn:li:geo:103644278"], "seniorities": ["urn:li:seniority:7"], "titles": ["urn:li:title:26587"] },
"exclude": { "industries": ["urn:li:industry:47"] } }
CLI reference
All commands also work via node packages/cli/dist/index.js <cmd>.
liam auth login # OAuth, stores tokens in ~/.liads
liam auth export # print env vars for the hosted (Vercel) server
liam accounts list # list accessible ad accounts
liam targeting search <facet> <query> # typeahead a facet for entity URNs
liam targeting estimate <facet> <urns…> # audience size for one facet's URNs
liam audience upload -n <name> -f <csv> # clean + upload a CSV as a matched audience
liam audience upload -n <name> -f <csv> --dry-run # preview the cleaned CSV, no upload
liam audience from-salesforce -n <name> -q "<SOQL>" # Salesforce query -> matched audience
liam audience status <segmentId> # matching status + resolved size
liam conversions list # account conversions (pick one to track)
liam report summary [-p <period>] # account rollup: totals, top performers, flags
liam report perf <level> [--parent <id>] # per-entity KPI rows
liam report trend <level> <id> [-b weekly|monthly] # trend with deltas
liam launch --brief <brief.json> # audience + group + campaign + draft creatives
Periods: last_7_days, last_30_days, last_90_days, month_to_date, last_month.
--account defaults to defaultAccountId from config where applicable.
Configuration
Local config lives in ~/.liads/config.json (mode 0600, never in the repo):
| Field | Purpose |
|---|---|
clientId, clientSecret |
LinkedIn app credentials (or LIADS_CLIENT_ID/LIADS_CLIENT_SECRET) |
linkedinVersion |
Pinned API version, e.g. 202605 |
defaultAccountId |
Ad account used when a command/brief omits one |
defaultConversionName |
Conversion auto-selected for new campaigns when none is given |
mcpAuthToken |
Bearer secret for the hosted MCP endpoint |
Hosted equivalents are the LIADS_* env vars plus MCP_AUTH_TOKEN (see .env.example).
OAuth tokens are stored separately in ~/.liads/credentials.json.
Salesforce integration
Liam reads Salesforce by shelling out to the authenticated sf CLI (sf data query), so it
reuses your existing login and needs no new credentials. audience_from_salesforce (and
liam audience from-salesforce) take a SOQL query that selects an email column and turn the
result into a matched audience, closing the loop from "accounts flagged in Salesforce" to
"LinkedIn targeting." Example:
liam audience from-salesforce -n "Q3 target accounts" \
-q "SELECT Email FROM Contact WHERE Account.Target_List__c = true AND Email != null"
Safety
- Every campaign/creative is created DRAFT/PAUSED. Activation is a separate, explicit step.
- Matched-audience matching takes up to 48h, and a campaign needs ~300 matched members to serve.
- LinkedIn does not expose person-level ad-view data; cross-referencing is account/segment-level.
- Secrets never enter the repo. Local:
~/.liads. Hosted: Vercel env vars.
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。