CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Development Commands
Environment Setup:
- Use
uv for dependency management: uv sync (installs all dependencies)
- Development dependencies:
uv sync --group dev
- Bump version:
uv version --bump minor (or major, patch) - this is the only manual step for a release. The GitHub Actions release workflow (.github/workflows/release.yml) automatically handles: manifest.json/docker-compose.yml version updates, git tag, Docker build & push, DXT extension, GitHub release, and PyPI publish. After the workflow completes, manually file a PR in the MCP registry to update the version.
- Install browser:
uv run patchright install chromium
- Run server locally:
uv run -m linkedin_mcp_server --no-headless
- Run via uvx (PyPI):
uvx linkedin-scraper-mcp
- Run in Docker:
docker run -it --rm -v ~/.linkedin-mcp:/home/pwuser/.linkedin-mcp stickerdaniel/linkedin-mcp-server:latest
Code Quality:
- Lint:
uv run ruff check . (auto-fix with --fix)
- Format:
uv run ruff format .
- Type check:
uv run ty check (using ty, not mypy)
- Tests:
uv run pytest (with coverage: uv run pytest --cov)
- Pre-commit hooks:
uv run pre-commit install then uv run pre-commit run --all-files
Docker Commands:
- Build:
docker build -t linkedin-mcp-server .
- Get session: Use uvx locally first:
uvx linkedin-scraper-mcp --get-session
Architecture Overview
This is a LinkedIn MCP (Model Context Protocol) Server that enables AI assistants to interact with LinkedIn through web scraping. The codebase follows a two-phase startup pattern:
- Authentication Phase (
authentication.py) - Validates LinkedIn browser profile exists
- Server Runtime Phase (
server.py) - Runs FastMCP server with tool registration
Core Components:
cli_main.py - Entry point with CLI argument parsing and orchestration
server.py - FastMCP server setup and tool registration
tools/ - LinkedIn scraping tools (person, company, job profiles)
drivers/browser.py - Patchright browser management with persistent profile
config/ - Configuration management (schema, loaders)
authentication.py - LinkedIn profile-based authentication
Tool Categories:
- Person Tools (
tools/person.py) - Profile scraping with contacts, interests, experiences, education
- Company Tools (
tools/company.py) - Company profile and posts extraction
- Job Tools (
tools/job.py) - Job posting details and search functionality
Available MCP Tools:
| Tool |
Description |
get_person_profile |
Get profile with contacts (email/phone/social), interests, experiences, education |
get_company_profile |
Get company info with employees, affiliated companies, showcase pages |
get_company_posts |
Get recent posts from company feed with reactions/comments/images |
get_job_details |
Get job posting details including description and benefits |
search_jobs |
Search jobs by keywords and location |
close_session |
Close browser session and clean up resources |
Authentication Flow:
- Uses persistent browser profile at
~/.linkedin-mcp/profile/
- Run with
--get-session to create a profile via browser login
Transport Modes:
stdio (default) - Standard I/O for CLI MCP clients
streamable-http - HTTP server mode for web-based MCP clients
Development Notes
- Python Version: Requires Python 3.12+
- Package Manager: Uses
uv for fast dependency resolution
- Browser: Uses Patchright (anti-detection Playwright fork) with Chromium
- Logging: Configurable levels, JSON format for non-interactive mode
- Error Handling: Comprehensive exception handling for LinkedIn rate limits, captchas, etc.
Key Dependencies:
fastmcp - MCP server framework
linkedin_scraper - LinkedIn web scraping (v3 with Patchright)
patchright - Anti-detection browser automation (Playwright fork)
Configuration:
- CLI arguments with comprehensive help (
--help)
- Browser profile stored at
~/.linkedin-mcp/profile/
Commit Message Format:
- Follow conventional commits:
type(scope): subject
- Types: feat, fix, docs, style, refactor, test, chore, perf, ci
- Keep subject <50 chars, imperative mood
Commit Message Guidelines
Commit Message Rules:
- Always use the commit message format type(scope): subject
- Types: feat, fix, docs, style, refactor, test, chore, perf, ci
- Keep subject <50 chars, imperative mood
Important Development Notes
Development Workflow
- Never sign a PR or commit with Claude Code
- When implementing a new feature/fix, follow this process:
- Check open issues. If no issue exists for the feature, create one that follows the feature issue template.
- Create a new branch from
main and name it feature/issue-number-short-description
- Implement the feature
- Test the feature
- Make sure the README.md, docs/docker-hub.md and AGENTS.md is updated with the new feature
- Create a PR with a short description of the feature/fix
- First review the PR with ai agents.
- Manually review the PR and merge it if it's approved. Do not squash the commits.
- Delete the branch after the PR is merged.
btca
When you need up-to-date information about technologies used in this project, use btca to query source repositories directly.
Available resources: fastmcp, linkedinScraper, patchright, pytest, ruff, ty, uv, inquirer, pythonDotenv, pyperclip, preCommit
Usage
btca ask -r <resource> -q "<question>"
Use multiple -r flags to query multiple resources at once:
btca ask -r fastmcp -r patchright -q "How do I set up browser context with FastMCP tools?"
1---2name: development-commands-23description: This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.4---5# CLAUDE.md67This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.89## Development Commands1011**Environment Setup:**1213- Use `uv` for dependency management: `uv sync` (installs all dependencies)14- Development dependencies: `uv sync --group dev`15- Bump version: `uv version --bump minor` (or `major`, `patch`) - this is the **only manual step** for a release. The GitHub Actions release workflow (`.github/workflows/release.yml`) automatically handles: manifest.json/docker-compose.yml version updates, git tag, Docker build & push, DXT extension, GitHub release, and PyPI publish. After the workflow completes, manually file a PR in the MCP registry to update the version.16- Install browser: `uv run patchright install chromium`17- Run server locally: `uv run -m linkedin_mcp_server --no-headless`18- Run via uvx (PyPI): `uvx linkedin-scraper-mcp`19- Run in Docker: `docker run -it --rm -v ~/.linkedin-mcp:/home/pwuser/.linkedin-mcp stickerdaniel/linkedin-mcp-server:latest`2021**Code Quality:**2223- Lint: `uv run ruff check .` (auto-fix with `--fix`)24- Format: `uv run ruff format .`25- Type check: `uv run ty check` (using ty, not mypy)26- Tests: `uv run pytest` (with coverage: `uv run pytest --cov`)27- Pre-commit hooks: `uv run pre-commit install` then `uv run pre-commit run --all-files`2829**Docker Commands:**3031- Build: `docker build -t linkedin-mcp-server .`32- Get session: Use uvx locally first: `uvx linkedin-scraper-mcp --get-session`3334## Architecture Overview3536This is a **LinkedIn MCP (Model Context Protocol) Server** that enables AI assistants to interact with LinkedIn through web scraping. The codebase follows a two-phase startup pattern:37381. **Authentication Phase** (`authentication.py`) - Validates LinkedIn browser profile exists392. **Server Runtime Phase** (`server.py`) - Runs FastMCP server with tool registration4041**Core Components:**4243- `cli_main.py` - Entry point with CLI argument parsing and orchestration44- `server.py` - FastMCP server setup and tool registration45- `tools/` - LinkedIn scraping tools (person, company, job profiles)46- `drivers/browser.py` - Patchright browser management with persistent profile47- `config/` - Configuration management (schema, loaders)48- `authentication.py` - LinkedIn profile-based authentication4950**Tool Categories:**5152- **Person Tools** (`tools/person.py`) - Profile scraping with contacts, interests, experiences, education53- **Company Tools** (`tools/company.py`) - Company profile and posts extraction54- **Job Tools** (`tools/job.py`) - Job posting details and search functionality5556**Available MCP Tools:**5758| Tool | Description |59|------|-------------|60| `get_person_profile` | Get profile with contacts (email/phone/social), interests, experiences, education |61| `get_company_profile` | Get company info with employees, affiliated companies, showcase pages |62| `get_company_posts` | Get recent posts from company feed with reactions/comments/images |63| `get_job_details` | Get job posting details including description and benefits |64| `search_jobs` | Search jobs by keywords and location |65| `close_session` | Close browser session and clean up resources |6667**Authentication Flow:**6869- Uses persistent browser profile at `~/.linkedin-mcp/profile/`70- Run with `--get-session` to create a profile via browser login7172**Transport Modes:**7374- `stdio` (default) - Standard I/O for CLI MCP clients75- `streamable-http` - HTTP server mode for web-based MCP clients7677## Development Notes7879- **Python Version:** Requires Python 3.12+80- **Package Manager:** Uses `uv` for fast dependency resolution81- **Browser:** Uses Patchright (anti-detection Playwright fork) with Chromium82- **Logging:** Configurable levels, JSON format for non-interactive mode83- **Error Handling:** Comprehensive exception handling for LinkedIn rate limits, captchas, etc.8485**Key Dependencies:**8687- `fastmcp` - MCP server framework88- `linkedin_scraper` - LinkedIn web scraping (v3 with Patchright)89- `patchright` - Anti-detection browser automation (Playwright fork)9091**Configuration:**9293- CLI arguments with comprehensive help (`--help`)94- Browser profile stored at `~/.linkedin-mcp/profile/`9596**Commit Message Format:**9798- Follow conventional commits: `type(scope): subject`99- Types: feat, fix, docs, style, refactor, test, chore, perf, ci100- Keep subject <50 chars, imperative mood101102## Commit Message Guidelines103104**Commit Message Rules:**105106- Always use the commit message format type(scope): subject107- Types: feat, fix, docs, style, refactor, test, chore, perf, ci108- Keep subject <50 chars, imperative mood109110## Important Development Notes111112### Development Workflow113114- Never sign a PR or commit with Claude Code115- When implementing a new feature/fix, follow this process:116 1. Check open issues. If no issue exists for the feature, create one that follows the feature issue template.117 2. Create a new branch from `main` and name it `feature/issue-number-short-description`118 3. Implement the feature119 4. Test the feature120 5. Make sure the README.md, docs/docker-hub.md and AGENTS.md is updated with the new feature121 6. Create a PR with a short description of the feature/fix122 7. First review the PR with ai agents.123 8. Manually review the PR and merge it if it's approved. Do not squash the commits.124 9. Delete the branch after the PR is merged.125126## btca127128When you need up-to-date information about technologies used in this project, use btca to query source repositories directly.129130**Available resources**: fastmcp, linkedinScraper, patchright, pytest, ruff, ty, uv, inquirer, pythonDotenv, pyperclip, preCommit131132### Usage133134```bash135btca ask -r <resource> -q "<question>"136```137138Use multiple `-r` flags to query multiple resources at once:139140```bash141btca ask -r fastmcp -r patchright -q "How do I set up browser context with FastMCP tools?"142```