linkedin-safe-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@linkedin-safe-mcp Find remote Python jobs posted this week and save the top 3 to my tracker"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
linkedin-safe-mcp
An MCP server that gives AI agents (Claude Code, Codex, Claude Desktop, Cursor, …) LinkedIn superpowers — without putting your LinkedIn account at risk:
Post to LinkedIn — text, links, and images via LinkedIn's official API (OAuth, ToS-compliant), plus comments and likes.
Search jobs — keyword/location/remote/experience/date filters via LinkedIn's public guest endpoints. No login, no cookies: your account is never involved.
Run a job hunt — a local SQLite application tracker (interested → applied → interviewing → offer) with notes and per-job posting snapshots, so an agent can manage your pipeline and write tailored cover letters even after a posting is taken down.
Why this design?
LinkedIn offers no official job-search API, and the unofficial routes (Voyager
internal API with your li_at session cookie, headless browsers on your logged-in
session) violate LinkedIn's User Agreement §8.2 and routinely get accounts
restricted. This server deliberately splits the difference:
Concern | How it's handled | Account risk |
Posting, comments, likes | Official REST API, your own OAuth app, | None — sanctioned |
Job search & details | Guest endpoints (the logged-out jobs pages), IP-rate-limited | None — no credentials involved |
Pipeline tracking | Local SQLite on your machine | None — never touches LinkedIn |
Easy Apply, DMs, feed reading | Intentionally not included — impossible without ToS-violating access | — |
Related MCP server: LinkedIn Buddy
Requirements
Python 3.11+ and uv
For posting only: a free self-serve LinkedIn developer app (5-minute setup below). Job search and the tracker work with zero setup.
Install & connect to your agent
Clone/copy this directory, then register it with your MCP client. <REPO> below is
the absolute path to this project.
Claude Code
claude mcp add linkedin \
--env LINKEDIN_CLIENT_ID=your_client_id \
--env LINKEDIN_CLIENT_SECRET=your_client_secret \
-- uv run --directory <REPO> linkedin-safe-mcpOr in a project's .mcp.json:
{
"mcpServers": {
"linkedin": {
"command": "uv",
"args": ["run", "--directory", "<REPO>", "linkedin-safe-mcp"],
"env": {
"LINKEDIN_CLIENT_ID": "your_client_id",
"LINKEDIN_CLIENT_SECRET": "your_client_secret"
}
}
}
}Codex (~/.codex/config.toml)
[mcp_servers.linkedin]
command = "uv"
args = ["run", "--directory", "<REPO>", "linkedin-safe-mcp"]
env = { LINKEDIN_CLIENT_ID = "your_client_id", LINKEDIN_CLIENT_SECRET = "your_client_secret" }Claude Desktop (claude_desktop_config.json) — same JSON shape as .mcp.json
above.
The LINKEDIN_CLIENT_* variables are only needed for posting; omit them if you
only want job search + tracking.
Enabling posting (one-time LinkedIn app setup)
Go to https://www.linkedin.com/developers/apps → Create app (requires associating any LinkedIn Page; you can create a trivial one).
On the app's Products tab, add Share on LinkedIn and Sign In with LinkedIn using OpenID Connect.
On the Auth tab, add the redirect URL
http://127.0.0.1:8765/callback(it must be the IP literal, notlocalhost— see Security below).Copy the Client ID and Client Secret into the env vars shown above.
Authenticate once — either way works:
In a terminal:
uv run --directory <REPO> linkedin-safe-mcp authOr just ask your agent to post something; it will call the
logintool and hand you the authorization URL.
Tokens are stored in ~/.linkedin-mcp/tokens.json, created mode 0600 inside a 0700
directory, and last ~60 days; LinkedIn doesn't issue refresh tokens to self-serve
apps, so you re-run the login when it expires (auth_status tells the agent exactly
when that is).
LinkedIn doesn't issue refresh tokens to self-serve apps, so you re-run the login
when it expires (auth_status tells the agent exactly when that is).
Tools
Tool | Needs auth | What it does |
| – | Reports config/auth state with exact next steps |
| – | Browser OAuth flow / delete stored tokens |
| ✓ | Name, email, person URN of the connected account |
| ✓ | Publish a post: text (+hashtags), optional link or local image (real PNG/JPEG/GIF, ≤10 MB); |
| ✓ | Delete one of your posts (URN or post URL) |
| ✓ | Comment on a post (URN or post URL) |
| ✓ | Like a post (URN or post URL) |
| – | Filters: location, remote/hybrid/onsite, time posted, experience levels, job types, Easy-Apply-only, sort; up to 50 results |
| – | Full posting: description, seniority, type, salary if listed, applicant count, external apply URL |
| – | Snapshot a job into the local tracker |
| – | One job with history / pipeline overview with status counts |
| – | interested → applied → interviewing → offer / rejected / withdrawn / archived, with notes |
| – | Append a note / drop a job |
Things agents can do with this: "find remote staff-engineer roles posted this week, save the promising ones, draft tailored cover letters from the saved descriptions, mark the ones I applied to, and post a summary of my open-source work."
Configuration
Env var | Default | Purpose |
| – | LinkedIn app credentials (posting only) |
|
| Where tokens + tracker DB live |
|
| OAuth callback port (must match the app's redirect URL) |
|
|
|
|
|
|
| a Chrome UA | UA for guest job requests |
| unset | If set, |
Behavior notes & limits
Posting: LinkedIn caps member posting at 150 requests/day and rejects exact duplicates of recent posts (422). Reserved characters in post text are escaped automatically for the versioned API so parentheses don't cause errors; hashtags are preserved.
Job search: guest endpoints are rate-limited per IP (HTTP 429). The server caches results (10 min searches / 6 h job details), retries with backoff, and paces multi-page fetches; on a persistent 429 it returns a clear "wait a minute" error to the agent. Keep
limitmodest.Scraping posture: guest job search reads the same public pages a logged-out visitor sees, at human-ish rates, with caching to minimize load. Still, LinkedIn could change or gate these endpoints at any time — the parsers are pinned by fixture tests so breakage is detected loudly, and the tool errors stay agent-actionable.
Security
The threat model assumes the agent driving this server is not trusted: it reads job descriptions scraped from LinkedIn, so a hostile posting is a prompt-injection channel straight into every tool argument. The boundaries that follow from that:
Image attachments are not a file-read primitive.
create_post(image_path=…)accepts only real PNG/JPEG/GIF files — verified by magic bytes and the format's mandatory trailer, so neither renaming a secret nor appending one after a valid header gets through — at most 10 MB, never via a symlink, hardlink, pipe or device. Without this, "attach~/.ssh/id_rsa" was a valid call that published the key. Residual limit: an attacker who can already both read a secret and write files could encode it inside a structurally valid image; no format check can prevent that. SetLINKEDIN_MCP_IMAGE_DIRto confine uploads to one folder if that matters to you.The OAuth callback validates
statebefore anything else. The listener on127.0.0.1is reachable by any local process and by any web page the user has open, so an unauthenticated request must not be able to abort a pending login (which would also free the port for an authorization-code interceptor). Error text is HTML-escaped at the sink.The redirect URL is
127.0.0.1, neverlocalhost. Browsers may resolve the name to::1, which a different local account can bind. RFC 8252 §8.3.Secrets are 0600 from creation. Tokens,
state.jsonand the tracker DB are created private rather than chmod-ed afterwards, closing the window where a local watcher could read a fresh access token;~/.linkedin-mcpis 0700.Upload targets are pinned. The Bearer token is only ever PUT to an HTTPS
linkedin.com/licdn.comhost, whatever URL the API response asks for.
These are covered by regression tests (tests/test_client_security.py, the
security sections of tests/test_oauth.py and tests/test_tracker.py) — each one
is a working exfiltration or hijack attempt that must fail closed.
Found something? Open an issue, or email the address on the GitHub profile for anything sensitive.
Development
uv sync # install deps (Python ≥3.11)
uv run pytest # 102 tests: parsers vs live fixtures, payloads, OAuth, tracker,
# security regressions, plus an end-to-end stdio smoke test
# that spawns the real server
uv run ruff check src tests && uv run ruff format --check src testsLayout: src/linkedin_mcp/ — server.py (tool surface) · api/ (official REST:
posts, social actions, uploads, dual rest/ugc backend) · auth/ (OAuth + token
store) · jobs/ (guest client, HTML parsers, filter mappings) · tracker/
(SQLite store) · cli.py (serve | auth | status | logout).
Roadmap
Publish to PyPI (
uvx linkedin-safe-mcpone-liner)Reaction types beyond like; multi-image posts; poll posts
Optional third-party job-data providers behind the same tool schema
streamable-httptransport for remote/hosted use(Considered, opt-in only, off by default) a cookie-based Voyager provider for personalized features — with loud warnings, since it violates LinkedIn's ToS
License
MIT
Available Tools
16 toolsadd_job_noteA
Append a timestamped note to a tracked job (e.g. recruiter name, interview date, salary discussed) without changing its status.
Inputs: note (required), job_id (required). Returns: url, title, events, job_id, +7 more
auth_statusA
Check LinkedIn authentication state. Call this before posting tools; if it reports not configured/authenticated it includes exactly what to do next. Job-search tools never need authentication.
Inputs: no named parameters. Returns: detail, scopes, configured, expires_at, +3 more
comment_on_postA
Comment on a LinkedIn post as the authenticated user. post is a post URN
(urn:li:share/ugcPost/activity:…) or a linkedin.com post URL. Confirm wording
with the user first — comments are public.
Inputs: post (required), text (required). Returns: message, target_urn, comment_urn
create_postA
Publish a LinkedIn post as the authenticated user. IMPORTANT: posts are
public professional content — confirm the final text with the user before
calling this. Hashtags (#likeThis) work in text. Attach at most one of:
link (shares a URL; link_title/link_description improve its preview
card) or image_path (local file to upload). LinkedIn rejects exact
duplicates of recent posts and caps posting at 150/day.
Inputs: text (required), link, image_path, link_title, +2 more. Returns: url, backend, post_urn, visibility
delete_postA
Delete one of the user's own posts. post is a post URN or a linkedin.com
post URL.
Inputs: post (required). Returns: result
get_jobA
Fetch full details for one job posting: description, seniority, employment
type, salary when listed, applicant count, and the external apply URL if the
posting is not Easy Apply. job is a job_id from search_jobs, a
linkedin.com/jobs/view/... URL, or a jobPosting URN.
Inputs: job (required). Returns: url, title, job_id, salary, +11 more
get_my_profileA
Get the authenticated user's LinkedIn identity (name, email, person URN). Requires login.
Inputs: no named parameters. Returns: name, email, locale, picture, +3 more
get_saved_jobA
Get one tracked job with its snapshot (description included) and full event history (status changes and notes).
Inputs: job_id (required). Returns: url, title, events, job_id, +7 more
like_postA
Like a LinkedIn post as the authenticated user. post is a post URN or a
linkedin.com post URL.
Inputs: post (required). Returns: result
list_saved_jobsA
List the user's tracked jobs with pipeline counts by status. Optionally filter by status and/or a title/company substring.
Inputs: search, status. Returns: jobs, total, by_status
loginA
Start the LinkedIn OAuth login. Returns an authorization URL — show it to the user and ask them to open it in a browser (it may also open automatically); the local callback completes the flow. Afterwards, call auth_status to confirm.
Inputs: no named parameters. Returns: message, authorization_url
logoutA
Delete the stored LinkedIn tokens for this machine.
Inputs: no named parameters. Returns: result
remove_saved_jobA
Remove a job (and its history) from the local tracker. Prefer update_job_status(..., "archived") to keep the record.
Inputs: job_id (required). Returns: result
save_jobA
Save a job to the user's local application tracker (stores a snapshot of the
posting, including its description, so it survives delisting). Idempotent: if
already saved, appends the note instead. job is a job_id, URL, or URN.
Inputs: job (required), note, status. Returns: url, title, events, job_id, +7 more
search_jobsA
Search LinkedIn job postings (no login required; the user's account is never
involved). location is free text like "Berlin", "India", or "United States";
combine it with workplace="remote" for remote roles. limit max is 50 — keep
it modest to avoid IP rate-limiting; on a rate-limit error, wait a minute
before retrying. Use get_job with a result's job_id for the full description.
Inputs: keywords (required), sort, limit, location, +5 more. Returns: jobs, note, count
update_job_statusA
Move a tracked job through the pipeline (interested → applied → interviewing → offer/rejected/withdrawn; archived hides it). The change is recorded in the job's event history with the optional note.
Inputs: job_id (required), status (required), note. Returns: url, title, events, job_id, +7 more
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 16 tools
Each tool targets a distinct action and resource: auth, profile, posts, comments/likes, job search, and local job tracking are cleanly separated. Even similar pairs like get_job vs get_saved_job are disambiguated by explicit descriptions.
The majority follow a clear verb_noun pattern (create_post, delete_post, search_jobs, get_saved_job, update_job_status). Minor deviations like auth_status and login/logout break the pattern slightly but remain intuitive.
At 16 tools the server is slightly above the ideal 3-15 range, but the count is justified by covering authentication, LinkedIn social actions, job search, and a local job tracker. Each tool serves a concrete purpose.
The surface covers the full workflow: auth lifecycle, profile retrieval, post creation/deletion, commenting/liking, job searching/details, and complete CRUD plus notes/status tracking for saved jobs. There are no significant dead ends or missing core operations.
Maintenance
Related MCP Connectors
Managed LinkedIn MCP server for AI agents: search, connect, message and enrich on accounts you own.
Hosted LinkedIn MCP server on your own account: 35 tools for search, profiles, inbox, posts, pages.
A hosted LinkedIn MCP server for your own account. Paste one address into Claude, ChatGPT, Cursor or n8n to read your inbox, send messages and invitations, and search people. Free to start. Not made by LinkedIn.
LinkedIn MCP with 47 tools: post, comment, DM and run comment-to-DM automations inside your limits.
Related MCP Servers
- AlicenseAqualityDmaintenanceFully featured MCP server that provides automation tools for LinkedIn, supporting browser-based scraping and API-based operations for content management, media uploads, and reactions.64MIT
- FlicenseNot gradedqualityDmaintenanceMCP server for LinkedIn automation that enables AI agents to perform LinkedIn actions (search, inbox, feed, jobs, etc.) safely with human-like evasion and two-phase commit preview.3-
- AlicenseBqualityDmaintenancePlaywright-powered MCP server for LinkedIn that automates jobs, profile edits, messaging, network actions, and feed posts using a real logged-in browser session.36Apache 2.0
- AlicenseNot gradedqualityCmaintenanceMCP server for AI-native LinkedIn prospecting. It enables lead research, audience building, conversation management, and controlled outreach actions such as messaging and publishing through an OAuth-protected remote endpoint.2MIT