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) - git tag is created automatically by release workflow. Once Docker image and PyPI package are published, manually file a PR in the MCP registry to update the version.
- 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 session file 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 - Playwright browser management with session handling
config/ - Configuration management (schema, loaders)
authentication.py - LinkedIn session management
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 session files stored at
~/.linkedin-mcp/session.json
- Run with
--get-session to create a session 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 Playwright with Chromium for browser automation
- 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 Playwright)
playwright - Browser automation
Configuration:
- CLI arguments with comprehensive help (
--help)
- Session stored at
~/.linkedin-mcp/session.json
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, playwright, 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 playwright -q "How do I set up browser context with FastMCP tools?"
1---2name: development-commands3description: 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`) - git tag is created automatically by release workflow. Once Docker image and PyPI package are published, manually file a PR in the MCP registry to update the version.16- Run server locally: `uv run -m linkedin_mcp_server --no-headless`17- Run via uvx (PyPI): `uvx linkedin-scraper-mcp`18- Run in Docker: `docker run -it --rm -v ~/.linkedin-mcp:/home/pwuser/.linkedin-mcp stickerdaniel/linkedin-mcp-server:latest`1920**Code Quality:**2122- Lint: `uv run ruff check .` (auto-fix with `--fix`)23- Format: `uv run ruff format .`24- Type check: `uv run ty check` (using ty, not mypy)25- Tests: `uv run pytest` (with coverage: `uv run pytest --cov`)26- Pre-commit hooks: `uv run pre-commit install` then `uv run pre-commit run --all-files`2728**Docker Commands:**2930- Build: `docker build -t linkedin-mcp-server .`31- Get session: Use uvx locally first: `uvx linkedin-scraper-mcp --get-session`3233## Architecture Overview3435This 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:36371. **Authentication Phase** (`authentication.py`) - Validates LinkedIn session file exists382. **Server Runtime Phase** (`server.py`) - Runs FastMCP server with tool registration3940**Core Components:**4142- `cli_main.py` - Entry point with CLI argument parsing and orchestration43- `server.py` - FastMCP server setup and tool registration44- `tools/` - LinkedIn scraping tools (person, company, job profiles)45- `drivers/browser.py` - Playwright browser management with session handling46- `config/` - Configuration management (schema, loaders)47- `authentication.py` - LinkedIn session management4849**Tool Categories:**5051- **Person Tools** (`tools/person.py`) - Profile scraping with contacts, interests, experiences, education52- **Company Tools** (`tools/company.py`) - Company profile and posts extraction53- **Job Tools** (`tools/job.py`) - Job posting details and search functionality5455**Available MCP Tools:**5657| Tool | Description |58|------|-------------|59| `get_person_profile` | Get profile with contacts (email/phone/social), interests, experiences, education |60| `get_company_profile` | Get company info with employees, affiliated companies, showcase pages |61| `get_company_posts` | Get recent posts from company feed with reactions/comments/images |62| `get_job_details` | Get job posting details including description and benefits |63| `search_jobs` | Search jobs by keywords and location |64| `close_session` | Close browser session and clean up resources |6566**Authentication Flow:**6768- Uses session files stored at `~/.linkedin-mcp/session.json`69- Run with `--get-session` to create a session via browser login7071**Transport Modes:**7273- `stdio` (default) - Standard I/O for CLI MCP clients74- `streamable-http` - HTTP server mode for web-based MCP clients7576## Development Notes7778- **Python Version:** Requires Python 3.12+79- **Package Manager:** Uses `uv` for fast dependency resolution80- **Browser:** Uses Playwright with Chromium for browser automation81- **Logging:** Configurable levels, JSON format for non-interactive mode82- **Error Handling:** Comprehensive exception handling for LinkedIn rate limits, captchas, etc.8384**Key Dependencies:**8586- `fastmcp` - MCP server framework87- `linkedin_scraper` - LinkedIn web scraping (v3 with Playwright)88- `playwright` - Browser automation8990**Configuration:**9192- CLI arguments with comprehensive help (`--help`)93- Session stored at `~/.linkedin-mcp/session.json`9495**Commit Message Format:**9697- Follow conventional commits: `type(scope): subject`98- Types: feat, fix, docs, style, refactor, test, chore, perf, ci99- Keep subject <50 chars, imperative mood100101## Commit Message Guidelines102103**Commit Message Rules:**104105- Always use the commit message format type(scope): subject106- Types: feat, fix, docs, style, refactor, test, chore, perf, ci107- Keep subject <50 chars, imperative mood108109## Important Development Notes110111### Development Workflow112113- Never sign a PR or commit with Claude Code114- When implementing a new feature/fix, follow this process:115 1. Check open issues. If no issue exists for the feature, create one that follows the feature issue template.116 2. Create a new branch from `main` and name it `feature/issue-number-short-description`117 3. Implement the feature118 4. Test the feature119 5. Make sure the README.md, docs/docker-hub.md and AGENTS.md is updated with the new feature120 6. Create a PR with a short description of the feature/fix121 7. First review the PR with ai agents.122 8. Manually review the PR and merge it if it's approved. Do not squash the commits.123 9. Delete the branch after the PR is merged.124125## btca126127When you need up-to-date information about technologies used in this project, use btca to query source repositories directly.128129**Available resources**: fastmcp, linkedinScraper, playwright, pytest, ruff, ty, uv, inquirer, pythonDotenv, pyperclip, preCommit130131### Usage132133```bash134btca ask -r <resource> -q "<question>"135```136137Use multiple `-r` flags to query multiple resources at once:138139```bash140btca ask -r fastmcp -r playwright -q "How do I set up browser context with FastMCP tools?"141```