mcp-linkedin is a Model Context Protocol (MCP) server that wraps the Unipile API, enabling AI assistants (such as Claude Code, Claude Desktop, or any MCP-compatible client) to create posts, comments, and reactions on LinkedIn on the user's behalf. The AI writes the content, and the tool handles publishing. All publishing actions are in preview mode by default, and nothing goes live without explicit confirmation.
Main capabilities:
- 3 tools: publish, comment, react.
- Dry-run by default (preview before publishing).
- Automatically like the post immediately after publishing.
- Support for media attachments (local files or URLs, images and videos).
- Support for company @mentions (automatically resolved via Unipile).
- Compatible with Claude Code, Claude Desktop, and any MCP client.
- Requires Node.js 18+, uses ES modules, node:test, and top-level await.
How to use:
- You need a Unipile account. Unipile is a service that connects to the LinkedIn API. After signing up, connect your LinkedIn account in the dashboard and obtain the API key and DSN.
- Configure it in ~/.claude/mcp.json (Claude Code) or ~/Library/Application Support/Claude/claude_desktop_config.json (Claude Desktop on macOS). After editing the configuration, restart Claude Code or Claude Desktop.
- Environment variables are passed through the MCP configuration, not through a .env file. The server reads these variables from process.env at startup.
Tool descriptions:
- linkedin_publish: Create an original LinkedIn post. dry_run defaults to true. First call it with dry_run: true to get a preview, then call it with dry_run: false to actually publish. The preview response shows the final text, character count, media validation, resolved mentions, and warnings. The publish respshould return post_id, from which you can construct the post URL:https://www.linkedin.com/feed/update/{post_id}/ or https://www.linkedin.com/posts/{post_id}/。
- linkedin_comment: Post a comment on an existing LinkedIn post. dry_run defaults to true.
- react: React to a LinkedIn post. This action is immediate and has no dry_run.
Safe publishing process: The default dry_run exists to prevent accidental publishing. The intended process: the AI calls the tool with dry_run: true (the default) → you see the preview: final text, character count, media validation, resolved mentions, warnings → you confirm or request changes → the AI calls it again with dry_run: false. dry_run defaults to true. The AI cannot publish without explicitly setting it to false, and this must go through the preview step.
Media attachments: You can pass a local file path (/path/to/image.jpg) or a URL (https://example.com/img.png)。URL will be downloaded to /tmp/mcp-linkedin-media/ and cleaned up after publishing (whether successful or failed). Supported formats: jpg, jpeg, png, gif, webp (images), mp4 (video). Each file is validated before upload: it must exist, be non-empty, and be of a supported type. Failed files will appear in the preview's media array with "valid": false and an error message.
Company @mentions: Pass company names as strings: mentions: ["Microsoft", "OpenAI"]. The server slugifies each name and looks it up via Unipile's LinkedIn company search. Successfully resolved companies are injected into the post text as {{0}}, {{1}} placeholders—LinkedIn renders these as clickable @mentions. If the company name appears in the post text, it is replaced in place; if not, the placeholder is appended. Unresolved names will appear in the preview as warnings. The post can still be published without them.
Technical details: The AI assistant calls the tool via the MCP JSON-RPC protocol over stdio. It calls the Unipile API, and Unipile handles LinkedIn OAuth—no token management required.
Getting a Unipile account: Sign up for a Unipile account, connect a LinkedIn account in the dashboard, copy the API key and DSN from the dashboard settings, and paste them into the MCP configuration. Unipile has a free tier that covers basic usage.
License: MIT—see LICENSE. Built by Timur Kulbaev. Uses Anthropic's Model Context Protocol and the Unipile API.