Skip to main content
Glama

LinkedIn MCP

A local-first Model Context Protocol (MCP) server for working with your own LinkedIn profile and preparing LinkedIn text posts through the official LinkedIn APIs.

The project is built with Python, FastMCP, FastAPI and SQLite. Its initial development target is a single-user environment on WSL. It is not currently designed for public or multi-user deployment.

Important: This is an independent, community project and is not affiliated with, endorsed by, or supported by LinkedIn. API access depends on LinkedIn's approval of your application and permissions.

Project status

The core implementation is merged. The remaining work is live validation with a LinkedIn Developer application and production hardening. See the roadmap.

Area

Status

MCP server and local WSL setup

Implemented

LinkedIn OAuth 2.0 flow

Implemented; live credentials required

Encrypted local token storage

Implemented

OIDC profile lookup

Implemented

Local post drafts and approval workflow

Implemented

LinkedIn text-post API integration

Implemented; permission and live test pending

Multi-user / public deployment

Not supported

Related MCP server: LinkedIn MCP

Features

  • LinkedIn OAuth 2.0 authorization-code flow with state validation bound to an HTTP-only cookie.

  • OpenID Connect profile lookup using LinkedIn's userinfo endpoint.

  • Encrypted local OAuth token storage.

  • MCP tools for reading the authorized profile.

  • Persistent local post drafts using SQLite.

  • Explicit approval state before a post can be published.

  • Text-post publishing through LinkedIn's official Posts API.

  • Automated hygiene checks, Ruff linting, and pytest in GitHub Actions.

Requirements

  • Python 3.12 or newer.

  • Git.

  • Ubuntu or another Linux distribution, including WSL.

  • A LinkedIn Developer application with the products and permissions required for the operations you intend to use.

Quick start (WSL / Linux)

git clone https://github.com/MHChlagou/free-linkedin-mcp.git
cd free-linkedin-mcp

python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
pip install -e ".[dev]"

cp .env.example .env
mkdir -p data

Generate a local encryption key:

python -c "import secrets; print(secrets.token_urlsafe(48))"

Set the generated value as APP_SECRET_KEY in your local .env file. Configure the LinkedIn application values:

  • LINKEDIN_CLIENT_ID

  • LINKEDIN_CLIENT_SECRET

  • LINKEDIN_REDIRECT_URI

  • LINKEDIN_SCOPES

  • LINKEDIN_API_VERSION

Register this exact local redirect URI in the LinkedIn Developer Portal:

http://localhost:8000/oauth/linkedin/callback

Start the server:

python -m app.main

Check the health endpoint:

curl http://127.0.0.1:8000/health

Open the following URL to start LinkedIn authorization:

http://127.0.0.1:8000/oauth/linkedin/start

After successful authorization, the callback stores the token response encrypted in data/linkedin_tokens.enc.

The MCP endpoint is:

http://127.0.0.1:8000/mcp

Available MCP tools

Tool

Purpose

get_my_profile

Read profile fields exposed by the granted OpenID Connect permissions.

create_post_draft

Save a local post draft.

get_post_draft

Retrieve a saved draft and its status.

get_pending_posts

List drafts waiting for review.

submit_post_for_approval

Move a draft to pending review.

approve_post

Approve the exact text after explicit user confirmation.

publish_approved_post

Publish an approved draft through the official LinkedIn Posts API.

Publication safety: never approve or publish a post unless the user has reviewed and explicitly approved the exact content and requested publication.

LinkedIn API permissions and limitations

LinkedIn API access depends on the products and permissions approved for your application.

The initial profile integration uses OpenID Connect scopes: openid, profile, and optionally email. These scopes do not provide unrestricted access to edit profile sections such as the headline, About, experience, or skills. Profile editing is therefore not implemented.

The w_member_social permission is required for member post creation. LinkedIn must grant this permission to your application. The Posts API also requires a currently supported API version configured through LINKEDIN_API_VERSION.

This project does not scrape LinkedIn pages, automate browser sessions, or bypass LinkedIn API restrictions.

Development and quality checks

Install development dependencies with pip install -e ".[dev]", then run:

python scripts/check_hygiene.py --all --messages
ruff check .
pytest

All three checks are expected to pass before opening a pull request. See CONTRIBUTING.md and the pull request template.

Security

  • Never commit .env, OAuth client secrets, access tokens, refresh tokens, private keys, or local database files.

  • OAuth tokens are encrypted at rest using a key derived from APP_SECRET_KEY. Keep that key private and back it up securely. Losing it makes the locally stored token file unreadable.

  • OAuth state is bound to an HTTP-only cookie and expires after ten minutes.

  • The local token store is intended for single-user development on loopback.

  • Do not expose this server to a network or the public internet until MCP client authentication, TLS, durable OAuth state storage, rate limiting, backups, monitoring, and a security review are complete.

Please read SECURITY.md before reporting a vulnerability.

Current limitations

  • OAuth refresh is not implemented. Reconnect when the access token expires.

  • LinkedIn profile editing is not implemented because the available API permissions do not grant those capabilities.

  • Post publishing requires LinkedIn approval for w_member_social and a valid LINKEDIN_API_VERSION.

  • Draft storage uses local SQLite and is intended for one local development instance.

  • Live OAuth and real publication have not been validated without the user's LinkedIn application credentials.

Documentation

License

This project is licensed under the MIT License. You may use, copy, modify, distribute, sublicense, and sell copies of the software, subject to the license conditions.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Enables local-only use of LinkedIn's official API to authenticate via OAuth, publish text posts, and read or reply to comments with explicit confirmation. Keeps access tokens in the OS keychain and avoids scraping or browser automation.
      4
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Enables secure LinkedIn OAuth connection and publishing of text and single-image posts with explicit human approval before anything goes live.
      5
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables local browser-based management of personal and company LinkedIn accounts, including posting, messaging, approvals, scheduling, and analytics, without requiring an official LinkedIn API token.
      MIT
    • A
      license
      B
      quality
      C
      maintenance
      Enables publishing text or image posts to LinkedIn through the official API and preparing or submitting simplified job applications using a secure local browser session, with user confirmation and privacy safeguards.
      2
      Apache 2.0