LinkedIn MCP Server
Click on "Install 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 MCP Servershow my LinkedIn profile"
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 MCP Server
A production-ready Model Context Protocol (MCP) server for interacting with the LinkedIn API through a secure, tool-based interface. This project is designed for developers who want to use LinkedIn from MCP-compatible clients such as Claude Desktop, Cursor, VS Code, or custom agents.
The server supports profile lookup, publishing posts, uploading image posts, deleting posts, and managing organization page feeds when the appropriate LinkedIn partner permissions are enabled.
Why this project exists
LinkedIn exposes powerful APIs, but integrating them into MCP workflows usually requires writing a fair amount of boilerplate for authentication, token storage, callback handling, and request retry logic. This project packages those concerns into a small, maintainable server so you can focus on using the tools rather than building the plumbing yourself.
Key features
OAuth 2.0 authentication flow with local callback handling
Automatic token caching and refresh support
Profile retrieval via LinkedIn OpenID Connect
Text post creation and deletion
Image post creation with upload and status polling
Organization page support for partner-tier applications
Clear error handling and structured logging
Ready-to-use MCP tool definitions for client integration
Supported capabilities
Personal profile tools
get_profile: retrieve your profile details and Person URNcreate_post: publish a text post to your personal feedupload_image_post: upload an image and publish it as a postdelete_post: remove a published post by URN
Organization tools
get_organization_pages: list organization pages you can managecreate_company_post: publish a post to a company page feedlist_recent_posts: inspect recent posts on an organization page
Organization features require the correct LinkedIn partner-tier permissions and app scopes. If those permissions are missing, the server raises explicit errors that guide you toward the correct setup steps.
Architecture overview
The project is organized into a few simple layers:
server.py: starts the FastMCP server and registers toolstools.py: exposes MCP tool implementationsauth.py: manages OAuth flows, redirect handling, and token exchangelinkedin_client.py: wraps LinkedIn HTTP requests and error handlingconfig.py: loads configuration from environment variables and.envtests/: contains automated tests for the core behavior
Prerequisites
Before you begin, make sure you have:
Python 3.11 or newer
pipinstalledA LinkedIn developer app created in the LinkedIn Developer Portal
A valid redirect URI configured for local development
LinkedIn developer app setup
To use this server, you need to create a LinkedIn app and configure it correctly.
Go to the LinkedIn Developer Portal.
Create a new app.
Under the Products tab, enable:
Share on LinkedIn
Sign In with LinkedIn using OpenID Connect
Under the Auth tab, copy your Client ID and Client Secret.
Add a redirect URI such as
http://localhost:8000/callback.Save the app and keep the credentials safe.
Installation
From the project root, install the dependencies:
pip install -r requirements.txtIf you use a virtual environment, activate it first:
python -m venv .venv
source .venv/bin/activate # macOS/Linux
.venv\Scripts\activate # Windows PowerShell
pip install -r requirements.txtConfiguration
Create a local environment file from the sample:
copy .env.example .envOn Linux or macOS, use:
cp .env.example .envThen edit .env and set the values:
LINKEDIN_CLIENT_ID=your_linkedin_client_id_here
LINKEDIN_CLIENT_SECRET=your_linkedin_client_secret_here
LINKEDIN_REDIRECT_URI=http://localhost:8000/callback
LINKEDIN_SCOPES=w_member_social,openid,profile,email
LINKEDIN_TOKEN_CACHE_PATH=~/.linkedin_mcp_token.json
LINKEDIN_API_VERSION=202406Environment variable reference
LINKEDIN_CLIENT_ID: your LinkedIn app client IDLINKEDIN_CLIENT_SECRET: your LinkedIn app client secretLINKEDIN_REDIRECT_URI: the locally served callback URLLINKEDIN_SCOPES: the scopes required by the appLINKEDIN_TOKEN_CACHE_PATH: where access tokens are cachedLINKEDIN_API_VERSION: LinkedIn API version header value
Running the server
Start the MCP server with:
python server.pyWhen the server starts, it will expose the available tools to whichever MCP client is connected to it.
OAuth flow walkthrough
The server handles OAuth automatically:
It checks whether a cached access token already exists.
If no valid token is available, it starts a temporary local callback listener.
It opens the LinkedIn authorization page in your browser.
After you authorize the app, LinkedIn redirects back to the callback URL.
The server exchanges the authorization code for tokens and stores them locally.
This makes the authentication experience much smoother than manually wiring the callback flow for each integration.
Integrating with MCP clients
Claude Desktop
Add a server entry similar to the following in your Claude Desktop config:
{
"mcpServers": {
"linkedin-mcp": {
"command": "python",
"args": [
"C:/path/to/linkedin_mcp/server.py"
],
"env": {
"LINKEDIN_CLIENT_ID": "your_linkedin_client_id_here",
"LINKEDIN_CLIENT_SECRET": "your_linkedin_client_secret_here",
"LINKEDIN_REDIRECT_URI": "http://localhost:8000/callback",
"LINKEDIN_SCOPES": "w_member_social,openid,profile,email",
"LINKEDIN_TOKEN_CACHE_PATH": "C:/Users/YourName/.linkedin_mcp_token.json",
"LINKEDIN_API_VERSION": "202406"
}
}
}
}Cursor or other MCP clients
Most MCP-compatible clients support a command-based server definition. Point them to the server.py file and provide the same environment variables shown above.
Docker deployment
You can also run the server in Docker.
docker compose up --build -dThe compose configuration mounts a local data directory so the token cache can persist between container restarts.
Testing
Run the test suite with:
pytestSecurity notes
Never commit your real
.envfile or any real credentials.Keep your LinkedIn client secret private.
Use placeholders in sample configuration files.
If you publish this repository publicly, make sure the real secrets are removed from your local environment before pushing.
Project structure
linkedin_mcp/
├── auth.py
├── config.py
├── linkedin_client.py
├── server.py
├── tools.py
├── tests/
├── .env.example
├── .gitignore
├── README.md
└── requirements.txtTroubleshooting
If the OAuth flow fails, confirm that the redirect URI in LinkedIn matches the value in
.envexactly.If the server cannot publish posts, verify that your LinkedIn app has the correct products enabled.
If organization tools fail, confirm that your app has the necessary partner-tier permissions.
If you see 401 or 403 errors, refresh the token cache or re-run the authorization flow.
Contributing
Pull requests are welcome. If you make changes, please keep the documentation up to date and avoid committing secrets or local environment files.
License
This project is provided as-is for educational and development purposes. Review LinkedIn's developer terms and API usage policies before deploying it publicly or in production.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/abdulrehmanzahid160/linkedin_mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server