|
| 1 | +# @browserkit/adapter-linkedin |
| 2 | + |
| 3 | +[LinkedIn](https://www.linkedin.com) adapter for [browserkit](https://github.com/browserkit-dev/browserkit) — exposes LinkedIn as MCP tools over your authenticated local browser session. Runs entirely on your machine; no credentials leave localhost. |
| 4 | + |
| 5 | +## Tools |
| 6 | + |
| 7 | +| Tool | Key inputs | Description | |
| 8 | +|---|---|---| |
| 9 | +| `get_person_profile` | `linkedin_username`, `sections?` | Scrape a person's profile. Optional sections: `experience`, `education`, `interests`, `honors`, `languages`, `contact_info`, `posts` | |
| 10 | +| `get_company_profile` | `company_id`, `sections?` | Scrape a company page. Optional sections: `about`, `jobs`, `people`, `insights` | |
| 11 | +| `get_company_posts` | `company_id`, `count?` | Recent posts from a company page | |
| 12 | +| `search_people` | `keywords`, `count?` | Search LinkedIn people | |
| 13 | +| `search_jobs` | `keywords`, `location?`, `count?` | Search LinkedIn job listings | |
| 14 | +| `get_job_details` | `job_id` | Full details for a specific job posting | |
| 15 | +| `get_feed` | `count?` | Your personalised LinkedIn feed | |
| 16 | + |
| 17 | +Plus auto-registered management tools from the framework: `browser` (health check, screenshot, page state, mode switch, navigate), `close_session`. |
| 18 | + |
| 19 | +## Setup |
| 20 | + |
| 21 | +```bash |
| 22 | +# Install |
| 23 | +pnpm add @browserkit/adapter-linkedin |
| 24 | + |
| 25 | +# One-time login (opens a browser window — sign in normally) |
| 26 | +browserkit login linkedin |
| 27 | + |
| 28 | +# Start |
| 29 | +browserkit start --config browserkit.config.js |
| 30 | +``` |
| 31 | + |
| 32 | +```js |
| 33 | +// browserkit.config.js |
| 34 | +import { defineConfig } from "@browserkit/core"; |
| 35 | + |
| 36 | +export default defineConfig({ |
| 37 | + adapters: { |
| 38 | + "@browserkit/adapter-linkedin": { |
| 39 | + port: 3848, |
| 40 | + channel: "chrome", // use real Chrome — avoids bot detection on login |
| 41 | + }, |
| 42 | + }, |
| 43 | +}); |
| 44 | +``` |
| 45 | + |
| 46 | +Connect your MCP client (Cursor, Claude Desktop, etc.) to `http://127.0.0.1:3848/mcp`. |
| 47 | + |
| 48 | +## How it works |
| 49 | + |
| 50 | +LinkedIn's DOM changes frequently. This adapter uses an **`innerText` extraction strategy** rather than CSS class selectors: it navigates directly to section URLs and reads raw text content. This makes it resilient to React component upgrades and class-name churn. |
| 51 | + |
| 52 | +For the feed tool, post cards are located by walking up from their social action buttons (`aria-label` containing "like"/"comment"/"repost") — stable semantic anchors that don't rotate. |
| 53 | + |
| 54 | +Auth uses a persistent browser profile (`~/Library/Application Support/browserkit/profiles/linkedin` on macOS). Cookies survive daemon restarts — you only need to `browserkit login linkedin` once. |
| 55 | + |
| 56 | +## Session notes |
| 57 | + |
| 58 | +- Use `channel: "chrome"` in your adapter config to use real Google Chrome. This avoids LinkedIn's bot detection on the login page. |
| 59 | +- The adapter runs headless by default. Use the `browser` MCP tool with `action: "set_mode"` and `mode: "watch"` to make it visible for debugging. |
| 60 | +- Rate limit is 3 seconds between tool calls by default to avoid triggering LinkedIn's anti-scraping measures. |
| 61 | + |
| 62 | +## Tests |
| 63 | + |
| 64 | +```bash |
| 65 | +pnpm test # unit tests (schema, scraper logic, URL building) |
| 66 | +pnpm test:integration # live browser tests against real LinkedIn (requires login) |
| 67 | +``` |
| 68 | + |
| 69 | +## License |
| 70 | + |
| 71 | +MIT |
0 commit comments