LinkedIn MCP Server
LinkedIn MCP Server
A local Model Context Protocol server that exposes structured LinkedIn profile, company, and job data to MCP-compatible clients. It uses a persistent Patchright browser session, so you authenticate interactively instead of storing a LinkedIn password in an environment variable.
LinkedIn may restrict automated access, and use of this project may be subject to LinkedIn's terms and account limitations. Use it responsibly with your own account. This project is not affiliated with or endorsed by LinkedIn.
Features
Area | MCP tools |
People |
|
Companies |
|
Jobs |
|
Session |
|
Profile reads can include experience, education, interests, honors, languages, contact information, and posts. Company reads can include about information, posts, and jobs. Job search supports date, type, experience, workplace, Easy Apply, and sorting filters.
Connection requests are deliberately constrained: the tool accepts an exact profile slug, previews
the current state by default, requires confirm=true to write, and never includes a note.
Requirements
Python 3.12+
A LinkedIn account
The project uses pyproject.toml and uv.lock; a requirements.txt file is intentionally not
needed.
Setup
git clone https://github.com/aarnav-hariramani/linkedin-mcp.git
cd linkedin-mcp
uv sync --locked
uv run patchright install chromiumAuthenticate once in a visible browser:
uv run linkedin-mcp-server --loginThe default profile is stored at ~/.linkedin-mcp-server/browser-data. It contains sensitive
session cookies and must never be committed or shared.
Check or clear the saved session:
uv run linkedin-mcp-server --status
uv run linkedin-mcp-server --logoutMCP client configuration
Use the absolute path to your clone. For Codex:
codex mcp add linkedin -- uv --directory /absolute/path/to/linkedin-mcp-server run linkedin-mcp-serverEquivalent JSON configuration for clients such as Claude Desktop or Cursor:
{
"mcpServers": {
"linkedin": {
"command": "uv",
"args": [
"--directory",
"/absolute/path/to/linkedin-mcp-server",
"run",
"linkedin-mcp-server"
]
}
}
}Restart the MCP client after changing its configuration.
Running directly
The recommended local transport is stdio:
uv run linkedin-mcp-serverFor local development, loopback-only HTTP is also available:
uv run linkedin-mcp-server \
--transport streamable-http \
--host 127.0.0.1 \
--port 8000Connect to http://127.0.0.1:8000/mcp. The server rejects non-loopback HTTP bindings.
Configuration
Copy the documented template only when you need to override defaults:
cp .env.example .envConfiguration precedence is CLI arguments, existing environment variables, .env.local, .env,
then defaults.
Variable | Default | Purpose |
|
|
|
|
| Loopback HTTP bind address |
|
| HTTP port |
|
| HTTP endpoint path |
|
|
|
|
| Run without a visible browser |
|
| Browser action delay in milliseconds |
|
| Browser timeout in milliseconds |
|
| Browser viewport width |
|
| Browser viewport height |
| unset | Optional Chromium executable |
| unset | Optional browser user agent |
|
| Persistent browser profile |
No username, password, cookie, API key, or token belongs in .env.
Safety model
Browser navigation is limited to HTTPS LinkedIn hosts.
Raw page HTML is not returned through MCP tools.
Persistent profiles are created with restrictive permissions and a marker used for safe logout.
HTTP transport is local-only;
stdiois preferred.All profile slugs, job IDs, and search input are validated.
Writes require explicit confirmation.
See SECURITY.md for handling local session data and reporting vulnerabilities.
Architecture
src/linkedin_mcp_server/
├── domain/ # Models, parsers, validation, and domain errors
├── ports/ # Browser, authentication, and configuration interfaces
├── application/ # Scrape, search, session, and connection use cases
├── adapters/
│ ├── driven/ # Patchright browser, profile auth, environment config
│ └── driving/ # CLI, FastMCP server, tools, serialization
└── container.py # Dependency composition rootDevelopment
uv sync --locked --group dev
uv run pre-commit install
uv run ruff check .
uv run ruff format --check .
uv run pytest
uv buildBrowser-backed integration testing requires a separately authenticated local session. Unit tests and CI must not depend on real credentials.
See CONTRIBUTING.md for the contribution workflow.
Acknowledgments
This project is built on top of eliasbiondo/linkedin-mcp-server
by Elias Biondo, which provided the original hexagonal architecture, Patchright-based browser
automation, and read-only profile, company, and job scraping tools. This fork adds the
send_connection_request write tool, additional navigation and session-safety hardening, and
test coverage on top of that foundation.
License
MIT. See LICENSE. Original copyright retained; see the LICENSE file for details.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- 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/aarnav-hariramani/linkedin-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server