keos-linkedin-memberdata-mcp

v0.1.0
keos-linkedin-memberdata-mcp Checked 4 days ago Published 11 days ago

LinkedIn Member Data Portability MCP server (official APIs only): member snapshots, activity changelog and connections.

Official-API LinkedIn tools (no scraping) for the Member Data Portability API (3rd Party): the authenticated member's profile, their archived data snapshots by domain, the 28-day activity changelog, and their 1st-degree connections. Standalone bundle. It shares no code with keos-linkedin-leadsync-mcp and runs on its own. LinkedIn does not allow Lead Sync and Member Data Portability to be requested on the same developer app, so the two products need two apps with two client ids. One app, one client id, one token, one MCP server.

Summary extracted from the README.

LinkedIn Member Data Portability MCP Server

Official-API LinkedIn tools (no scraping) for the Member Data Portability API (3rd Party): the authenticated member's profile, their archived data snapshots by domain, the 28-day activity changelog, and their 1st-degree connections.

Standalone bundle. It shares no code with keos-linkedin-leadsync-mcp and runs on its own.

Why this is a separate bundle, and why there is no profile tool

LinkedIn does not allow Lead Sync and Member Data Portability to be requested on the same developer app, so the two products need two apps with two client ids. One app, one client id, one token, one MCP server.

The app behind this bundle was denied Sign In with LinkedIn using OpenID Connect, so its token carries only r_dma_portability_3rd_party. There is therefore no linkedin_get_profile tool here and no userinfo call anywhere in the code — requesting openid, profile or email on this app would make LinkedIn reject the whole authorization request.

For the member's profile, use dma_get_snapshot(domain='PROFILE'). That is the archived profile record from the portability API rather than the live OIDC claims, and the portability scope already covers it.

This server does not log in. The calling application owns the LinkedIn OAuth flow, user consent, token storage and re-authentication, and passes one access token with every request. The server writes nothing to disk and needs no client id or secret.

Run

uvx keos-linkedin-memberdata-mcp                                            # stdio, from PyPI
uvx --from . keos-linkedin-memberdata-mcp                                   # stdio, from this folder
python -m linkedin_memberdata_mcp                                           # stdio, from source
python -m linkedin_memberdata_mcp --http --port 8766                        # streamable HTTP at /mcp
keos-linkedin-memberdata-mcp --http --remote --host 0.0.0.0 --port 8766     # hosted / multi-user

Tools (8)

Tool What it does
linkedin_auth_status() Whether a token reached the server, where it came from, and the scope your app must request. Never returns token values.
dma_list_snapshot_domains() The 60+ valid, case-sensitive domain names accepted by dma_get_snapshot.
dma_get_authorization_status() Whether LinkedIn is archiving changelog events for the consenting member.
dma_enable_changelog() Manually turns on changelog event generation (normally automatic after consent).
dma_get_snapshot(domain, start=0) One page of archived data for a domain — PROFILE, POSITIONS, CONNECTIONS, SKILLS, JOB_APPLICATIONS, and so on. Use domain='PROFILE' as the profile lookup for this bundle.
dma_get_changelog(start_time_ms, count=10) Activity events (posts, comments, reactions) from the trailing 28 days.
dma_get_connections(max_pages=20, limit=200) 1st-degree connections, paged out of the CONNECTIONS snapshot and normalized to name / company / position / connected-on / profile URL / email.
dma_find_connections_by_company(company, exact=False, max_pages=20) The same set filtered by employer, case- and punctuation-insensitive, substring or exact.

Token

One token covers every tool here.

Source Value
HTTP header Authorization: Bearer <token>
Local fallback LINKEDIN_ACCESS_TOKEN env / .env

The single scope your application must request on it:

r_dma_portability_3rd_party

That is the whole list. Do not add openid, profile or email — this app is not approved for OpenID Connect, and including those scopes makes LinkedIn reject the entire authorization request rather than just dropping the extras.

Only EEA members can consent to the portability scope. Snapshot data may also take time to become available after consent — dma_get_snapshot reports "Snapshot not available yet." until LinkedIn has built it.

What the calling application must implement

  1. Send the user to https://www.linkedin.com/oauth/v2/authorization with response_type=code, your client_id, a redirect_uri registered on your LinkedIn app (HTTPS, not localhost, for a hosted app), a state value, and the scopes above.
  2. Exchange the returned code at https://www.linkedin.com/oauth/v2/accessToken.
  3. Store the token per user and send it on every MCP request.

There is no token refresh in this server. LinkedIn access tokens last about 60 days and refresh tokens are only issued to approved apps, so your application has to track expiry and re-run consent. A lapsed token surfaces here as HTTP 401.

Configuration

Key Purpose
LINKEDIN_ACCESS_TOKEN Local-only token fallback. Ignored with --remote.
LINKEDIN_ENV_FILE Path to the .env file. Defaults to ./.env.
LINKEDIN_REMOTE_MODE 1 is equivalent to --remote.
LINKEDIN_DMA_API_VERSION Linkedin-Version header. Defaults to 202312, the only version memberSnapshotData supports.

.env is read, never written. Process env overrides .env.

Responses

{ "ok": true, "data": ... } or { "ok": false, "error": "linkedin_error", "message": "..." }.

Remote / hosted mode

keos-linkedin-memberdata-mcp --http --remote --host 0.0.0.0 --port 8766  # or LINKEDIN_REMOTE_MODE=1

Use this whenever more than one user's tokens pass through the server.

  • The token comes only from the request header. The env/.env fallback is refused, so a request without a header errors instead of borrowing another caller's stored credential.
  • --remote requires --http.
  • Serve it behind HTTPS and restrict who can reach it (API key or network rules at the proxy). The server has no TLS or authentication of its own.
  • If your gateway uses Authorization for its own API key, it will collide with the LinkedIn token. Use a different header for gateway auth, or have the proxy rewrite it.

Without --remote, an --http server falls back to the environment or .env. That is for local development only; do not expose it to a network.

Scope of the data

Every tool is limited to the consenting member's own data. There is no company-wide access and no 2nd-degree network access. dma_get_connections returns that member's own connections only, with each connection's employer as listed on their profile at snapshot time. This is personal data about third parties: handle it accordingly.