@mhdd_24/linkedin-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., "@@mhdd_24/linkedin-mcp Post to LinkedIn: Just finished a great book on AI."
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.
@mhdd_24/linkedin-mcp
MCP server that posts to LinkedIn through the LinkedIn API. Use it from Cursor, Claude Desktop, VS Code Copilot, or any MCP-compatible client.
You type natural language — the assistant calls create_post for you. No manual member ID setup; your LinkedIn OAuth access token resolves identity automatically.
Full documentation: docs/WIKI.md
How it works (30 seconds)
You (chat) → MCP client → linkedin-mcp → LinkedIn userinfo (access token)
→ LinkedIn ugcPosts API
→ Text post on your profile
Access token calls
userinfo→ returnsmemberId,name,emailAuthor URN is built from
memberId— not hardcodedVisibilities come from config — validated before posting
create_postvalidates visibility, POSTs the share, returns the post URN
Related MCP server: LinkedIn MCP Server
Prerequisites
Requirement | Notes |
Node.js 18+ | Uses native fetch |
LinkedIn OAuth access token | Member token with required scopes (see below) |
Default visibility (optional) |
|
Required OAuth scopes
Scope | Purpose |
| OpenID Connect identity |
| Display name |
| Email address |
| Create posts on your profile |
Obtain a token via the LinkedIn OAuth 2.0 Authorization Code flow.
Install
Option A — npm (recommended after publish)
npm install -g @mhdd_24/linkedin-mcpThis installs the linkedin-mcp CLI and compiles dist/ via the package prepack script.
Option B — npx (no global install)
npx @mhdd_24/linkedin-mcpDownloads and runs the latest published version on each invocation.
Option C — clone and build (contributors)
git clone https://github.com/Mhdd-24/Linkedin-MCP.git
cd Linkedin-MCP
npm install
npm run build
node dist/index.jsConfigure your MCP client
Cursor
Edit Cursor Settings → MCP or ~/.cursor/mcp.json:
{
"mcpServers": {
"linkedin": {
"command": "npx",
"args": ["-y", "@mhdd_24/linkedin-mcp"],
"env": {
"LINKEDIN_ACCESS_TOKEN": "<your-oauth-access-token>",
"DEFAULT_VISIBILITY": "PUBLIC"
}
}
}
}After global install, you can use:
"command": "linkedin-mcp"Local development:
"command": "node",
"args": ["/path/to/linkedin-mcp/dist/index.js"]Restart Cursor (or toggle the MCP server off/on) after saving.
Claude Desktop
%APPDATA%\Claude\claude_desktop_config.json (Windows) or ~/Library/Application Support/Claude/claude_desktop_config.json (macOS):
{
"mcpServers": {
"linkedin": {
"command": "npx",
"args": ["-y", "@mhdd_24/linkedin-mcp"],
"env": {
"LINKEDIN_ACCESS_TOKEN": "<your-oauth-access-token>",
"DEFAULT_VISIBILITY": "PUBLIC"
}
}
}
}Environment variables
Variable | Required | Default | Purpose |
| Yes* | — | OAuth access token for userinfo + posting |
| No |
| Default audience for |
| No |
| LinkedIn API host |
* Or pass accessToken on each tool call.
Aliases: LI_ACCESS_TOKEN, accessToken, defaultVisibility, etc. (see WIKI).
Never commit access tokens. Put them only in MCP env or a local .env (for npm run dev).
Tools
Tool | Purpose |
| Test token — shows memberId, name, email, author URN |
| Lists valid post visibility values |
| Create a text post on your LinkedIn profile |
Usage
Step 1 — Verify setup (optional)
In chat:
Run whoami on the linkedin MCP.
Expected: your LinkedIn identity and author URN.
Step 2 — See valid visibilities (optional)
list_visibilities
Examples: PUBLIC, CONNECTIONS
Step 3 — Create a post
Post to LinkedIn: Just shipped a new feature! Excited to share what we've been building.
Create a LinkedIn post with visibility PUBLIC: Happy to announce our open-source MCP server for LinkedIn integration.
create_post parameters
Parameter | Required | Example |
| Yes | "Just shipped a new feature!" |
| No* | "PUBLIC" |
| No | Only if not in env |
* Optional when DEFAULT_VISIBILITY is set in MCP config.
What happens after npm install?
Package files land in
node_modules/@mhdd_24/linkedin-mcp/(or global prefix if-g).prepack/ publish includes compileddist/— no local build needed for end users.The
linkedin-mcpbin points todist/index.js.Your MCP client runs that entry over stdio (stdin/stdout = MCP protocol; logs go to stderr).
On startup:
validateEnv()warns if access token is missing.Tools are registered; the server waits for
CallToolrequests from the AI.
After publishing to npm (maintainers)
Bump version in
package.jsonandsrc/config/linkedin.config.ts(LI.SERVER.VERSION).Build and test:
npm run buildthen test with localmcp.json.Publish:
npm publish --access public(logged in as package owner).Users update by restarting MCP —
npxpicks up the new version automatically.Global install users:
npm update -g @mhdd_24/linkedin-mcp.
Current package version: 1.0.0.
See WIKI — Publishing for the full checklist.
Troubleshooting
Problem | Fix |
MCP server won't start | Check Node.js 18+ is installed |
No access token provided | Set |
Invalid visibility | Run |
visibility is required | Set |
userinfo failed: 401 | Token expired or invalid — refresh your OAuth token |
Post failed: 403 | Token missing |
More detail: docs/WIKI.md § Troubleshooting.
License
ISC
Available Tools
3 toolscreate_postA
Create a text share on LinkedIn. The author is resolved from userinfo (not from arguments). visibility is validated against the supported values. Returns the created post URN.
Inputs: text (required), visibility, accessToken.
list_visibilitiesA
List valid post visibility values (e.g. PUBLIC, CONNECTIONS). Use these exact values for visibility in create_post.
Inputs: accessToken.
whoamiA
Resolve the current LinkedIn member from the OpenID Connect userinfo endpoint using an access token. Returns the member id (used as the author URN), display name, and email.
Inputs: accessToken.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 3 tools
Each tool serves a distinct purpose: whoami resolves user identity, list_visibilities provides valid visibility options, and create_post handles posting. No overlap in functionality.
All tool names follow a consistent verb_noun snake_case pattern: create_post, list_visibilities, whoami (verb-only). The pattern is uniform and predictable.
3 tools is minimal but appropriate for a focused LinkedIn posting server. It covers the core workflow: identify user, check options, create post. Could be expanded slightly, but not under-scoped.
The tool surface covers the essential steps for creating a text post: user info, visibility choices, and posting. Missing update/delete or media posting, but for a basic text share it is complete.
Maintenance
Related MCP Connectors
Managed LinkedIn MCP server for AI agents: search, connect, message and enrich on accounts you own.
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.
Hosted MCP server for AI agents to post to LinkedIn profiles and X and upload to YouTube.
LinkedIn Ads MCP server: run LinkedIn campaigns, ad groups, ads and reports from AI.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceMCP server for managing LinkedIn Company Pages via the official Community Management API. Post content, manage comments, track analytics, and more through the Model Context Protocol.2MIT
- FlicenseNot gradedqualityCmaintenanceMCP server for posting to LinkedIn, managing drafts, scheduling, commenting, and reacting, all from the terminal.-
- FlicenseAqualityDmaintenanceA local MCP server that lets Claude log in to LinkedIn and publish image posts to your personal profile feed, backed by LinkedIn's REST Images API and Posts API.2-
- AlicenseNot gradedqualityDmaintenanceAn MCP server that lets you publish posts to your LinkedIn profile using the official LinkedIn API, with support for markdown formatting and OAuth authentication.MIT