flin-linkedin-posts-mcp
flin-linkedin-posts-mcp is a local MCP server for reading and analyzing the authenticated member's own LinkedIn post/share data.
It uses LinkedIn member OAuth login and the Member Data Portability API. Each user runs the MCP locally, signs into their own LinkedIn account in the system browser, and stores their token on their own machine.
The MCP supports two login flows:
- Regular 3-legged OAuth with a client secret. This is the recommended local setup for most LinkedIn Developer apps.
- Native OAuth PKCE. This does not require a client secret, but LinkedIn must explicitly enable the Native PKCE protocol for your app.
Important Access Requirement
This MCP does not bypass LinkedIn API approval. Each user should create their own LinkedIn Developer app with access to Member Data Portability API (Member) and the r_dma_portability_self_serve permission. Without that product/scope, LinkedIn returns 403 ACCESS_DENIED for memberSnapshotData.
Native PKCE is a separate LinkedIn app capability. If LinkedIn shows Not enough permissions to access Native PKCE protocol, use the regular 3-legged OAuth setup below or ask LinkedIn to enable Native PKCE for the app.
Relevant LinkedIn docs:
- 3-legged OAuth: https://learn.microsoft.com/en-us/linkedin/shared/authentication/authorization-code-flow
- Native OAuth PKCE: https://learn.microsoft.com/en-us/linkedin/shared/authentication/authorization-code-flow-native
- Member Snapshot API: https://learn.microsoft.com/en-us/linkedin/dma/member-data-portability/shared/member-snapshot-api
- Snapshot domains: https://learn.microsoft.com/en-us/linkedin/dma/member-data-portability/shared/snapshot-domain
- API access overview: https://learn.microsoft.com/en-us/linkedin/shared/authentication/getting-access
Features
- Browser-based LinkedIn login with regular OAuth or native PKCE
- Local token storage outside the repository
- Auth status and logout tools
- Snapshot domain count/debug tool
- Authenticated member post/share listing from
MEMBER_SHARE_INFO - Post analysis for counts, text length, hashtags, mentions, and top terms
- Best-effort extraction of engagement counters when they are present in snapshot rows
- Draft-to-published matching based on provided draft texts
- Optional engagement enrichment via LinkedIn
socialMetadataandmemberCreatorPostAnalytics
MCP Tools
auth_statusloginlogoutlist_snapshot_domainslist_member_postsanalyze_member_postsmatch_drafts_to_member_postsget_post_social_metadataget_member_post_analyticsget_member_analyticsget_member_follower_statisticsenrich_member_posts_with_engagement
Two LinkedIn connections (0.3.1+)
Version 0.3.1 introduces separate Portability and Community Management credentials and automatic stable PyPI updates at server startup. Import the 0.3.1 MCPB once to obtain the new configuration fields and launcher, then restart the server. Subsequent server updates are picked up at restart without another import; configuration-form changes still require a new MCPB.
- Portability supplies post text, dates and links through the existing app and token.
- Analytics supplies metrics through a second Community Management app with
r_member_postAnalytics. - Authenticate the same LinkedIn member in both connections. The server does not compare app-scoped member IDs. LinkedIn checks ownership on each analytics request; an ownership error is returned rather than treated as zero engagement.
- The analytics permission does not grant post-content access through the Posts API; that requires the separately restricted
r_member_socialpermission.
Use login {"connection":"analytics"} for the second login. login {} continues to use portability. auth_status {} includes both local connection states; it does not prove API approval. logout {"connection":"analytics"} removes only the second token. Explicit auth_status {"connection":"analytics"} inspects that connection on its own.
See activation and live verification.
Personal analytics with Community Management access
The Development tier supports the personal analytics tools when the app has the relevant permissions and the member has consented through login {"connection":"analytics"}. Product approval does not update an existing token automatically.
get_member_post_analytics: metrics for one confirmedshare/ugcPostURN.get_member_analytics: LinkedIn's aggregate metrics across your posts, including deduplicated reach; no post URN or portability login needed.- Both accept
metric_types,start_date,end_date(exclusive), andaggregation: "TOTAL"or"DAILY". Dates useYYYY-MM-DD; omit them for lifetime results. Totals are inmetrics_by_type, daily points with their original date ranges inseries_by_type. Missing data stays missing. get_member_follower_statistics: lifetime follower count or daily follower statistics with the same date filters; requiresr_member_profileAnalytics. The original response is preserved understatistics.- Daily metrics exclude reach, link clicks, follower gains and profile views; single-post daily impressions are also unsupported. Daily defaults automatically select supported metrics. Explicit unsupported combinations are rejected before any API request.
For a low-quota first check, call get_member_analytics {"metric_types":["IMPRESSION"],"start_date":"2026-11-01","end_date":"2026-11-21"}. For a single post, add its confirmed post_urn and use get_member_post_analytics.
Each selected metric costs one API request plus retries, including aggregate requests. Aggregate requests avoid one request per post and metric. The Development tier allows 100 calls/member/day and 500 calls/app/day; these tools use GET/FINDER only, never BATCH_GET. A 429 stops the invocation immediately. The per-invocation safety budget does not track daily usage. See the activation guide for permissions and live verification.
Configuration
Required for login:
LINKEDIN_CLIENT_ID: LinkedIn Developer app client ID
Recommended for regular 3-legged OAuth:
LINKEDIN_CLIENT_SECRET: LinkedIn Developer app client secret. If set,LINKEDIN_OAUTH_FLOWdefaults toauthorization_code.LINKEDIN_REDIRECT_URI: exact local callback URI registered in the LinkedIn app, for examplehttp://127.0.0.1:63141/callback.
Optional:
LINKEDIN_OAUTH_FLOW:authorization_codeornative_pkce. Defaults toauthorization_codewhenLINKEDIN_CLIENT_SECRETis set, otherwisenative_pkce.LINKEDIN_SCOPES: defaults tor_dma_portability_self_serveLINKEDIN_API_VERSION: defaults to202610for Marketing API requests; engagement requests use at least202610. Member Snapshot requests always use202312.LINKEDIN_RESTLI_PROTOCOL_VERSION: defaults to2.0.0LINKEDIN_TIMEOUT_SECONDS: defaults to30LINKEDIN_MAX_RETRIES: defaults to3LINKEDIN_OAUTH_TIMEOUT_SECONDS: defaults to300LINKEDIN_TOKEN_FILE: defaults to~/.flin-linkedin-posts-mcp/tokens.json
Optional second-app configuration (leave all fields empty until ready):
LINKEDIN_ANALYTICS_CLIENT_ID: Community Management app ID.LINKEDIN_ANALYTICS_CLIENT_SECRET: second app secret for regular OAuth.LINKEDIN_ANALYTICS_REDIRECT_URI: registered callback, e.g.http://127.0.0.1:63142/callback.LINKEDIN_ANALYTICS_SCOPES: defaults tor_member_postAnalytics. Addr_member_profileAnalyticsfor follower statistics if approved, then log into analytics again. Available as an optional desktop setting; leaving it empty keeps the default.LINKEDIN_ANALYTICS_OAUTH_FLOW: inferred from the second secret, independently of the first app.LINKEDIN_ANALYTICS_TOKEN_FILE: defaults to a sibling of the first token file, normallytokens.analytics.json. The two token files must differ.
New tokens are bound to the app ID. Changing an app ID requires login again. The first app's existing tokens remain compatible. Approved installations that already have a member analytics scope on the first app can continue using one connection when no second app is configured.
Additional LinkedIn access may be required for engagement enrichment:
socialMetadataaccess for comment and reaction summariesr_member_postAnalyticsfor member post impressions, reach, reactions, comments, and reshares
The Marketing API default remains the supported October 2026 version (202610).
The Member Snapshot API
only supports 202312. Post listing, analysis, draft matching, and snapshot-domain discovery
always use that version, regardless of LINKEDIN_API_VERSION. The Marketing API version
calendar does not apply to this endpoint. Engagement requests use 202610 when configured
with an older version, and preserve newer explicit versions.
Check the LinkedIn migration table
when upgrading. API version updates do not grant additional OAuth permissions.
See docs/linkedin-analytics-access-application.md for Community Management API application steps,
request copy, privacy-policy notes, and the MCP configuration to use after LinkedIn approves
r_member_postAnalytics.
The MCP intentionally does not require LINKEDIN_ACCESS_TOKEN anymore. Tokens are created through the login tool.
LinkedIn Developer App Setup
- Create or open a LinkedIn Developer app.
- Add/obtain access to
Member Data Portability API (Member). - Make sure the app can request
r_dma_portability_self_serve. - For regular 3-legged OAuth, add an exact loopback redirect URL in the app's Auth tab, for example
http://127.0.0.1:63141/callback. - Set
LINKEDIN_CLIENT_ID,LINKEDIN_CLIENT_SECRET, andLINKEDIN_REDIRECT_URIto the same redirect URL. - For native PKCE only, ask LinkedIn to enable Native PKCE OAuth for the app, omit
LINKEDIN_CLIENT_SECRET, and configure loopback redirect URIs as LinkedIn requires.
Claude Desktop on macOS: installable extension
Download the .mcpb file from GitHub Releases and install it in Claude Desktop's Extensions settings. The extension prompts for your LinkedIn app credentials; the client secret is marked sensitive. A current Claude Desktop with MCPB 0.4 / UV support manages Python. The extension fetches the latest stable server from PyPI at every server start; restarting Claude applies new server releases without reinstalling the extension.
Schritt-für-Schritt-Anleitung auf Deutsch · Security review · Security model
The LinkedIn API approval described above is still required. Releases include SHA256SUMS; the bundle is unsigned.
Claude Desktop Configuration (manual alternative)
For automatic stable PyPI updates at each start (requires uv):
{
"mcpServers": {
"flin-linkedin-posts-mcp": {
"command": "uvx",
"args": ["--refresh", "--prerelease", "disallow", "flin-linkedin-posts-mcp@latest"],
"env": {
"LINKEDIN_CLIENT_ID": "<YOUR_LINKEDIN_CLIENT_ID>",
"LINKEDIN_CLIENT_SECRET": "<YOUR_LINKEDIN_CLIENT_SECRET>",
"LINKEDIN_REDIRECT_URI": "http://127.0.0.1:63141/callback",
"LINKEDIN_SCOPES": "r_dma_portability_self_serve",
"LINKEDIN_API_VERSION": "202610"
}
}
}
}
For local development from this repository:
{
"mcpServers": {
"flin-linkedin-posts-mcp": {
"command": "uv",
"args": ["run", "flin-linkedin-posts-mcp"],
"cwd": "/path/to/flin-linkedin-posts-mcp",
"env": {
"LINKEDIN_CLIENT_ID": "<YOUR_LINKEDIN_CLIENT_ID>",
"LINKEDIN_CLIENT_SECRET": "<YOUR_LINKEDIN_CLIENT_SECRET>",
"LINKEDIN_REDIRECT_URI": "http://127.0.0.1:63141/callback",
"LINKEDIN_SCOPES": "r_dma_portability_self_serve",
"LINKEDIN_API_VERSION": "202610"
}
}
}
}
After adding the config, restart the MCP host and call:
auth_statusloginlist_snapshot_domainslist_member_postsoranalyze_member_postsmatch_drafts_to_member_postsif you want to compare draft text to published postsget_post_social_metadata,get_member_post_analytics, orenrich_member_posts_with_engagementif your LinkedIn app has the required engagement scopes
Local Development
python3 -m pip install -e '.[dev]'
pytest -q
ruff check .
Packaging
Build the desktop bundle with python scripts/build_mcpb.py after uv lock --check. Only the launcher, minimal dependency-free project metadata, and allowlisted documentation enter dist/desktop/; a SHA-256 checksum accompanies the archive. The runtime server comes from PyPI and is intentionally not fixed by the repository lockfile. See release requirements: every version release must publish both PyPI distributions and a new desktop bundle through the Release workflow.
python3 -m build
The package entry point is:
flin-linkedin-posts-mcp
Troubleshooting
LINKEDIN_CLIENT_ID is required before running login: setLINKEDIN_CLIENT_IDin the MCP config.Not enough permissions to access Native PKCE protocol: the LinkedIn app does not have Native PKCE enabled. SetLINKEDIN_CLIENT_SECRETandLINKEDIN_REDIRECT_URIto use regular 3-legged OAuth, or ask LinkedIn to enable Native PKCE for the app.LINKEDIN_REDIRECT_URI is required when LINKEDIN_OAUTH_FLOW=authorization_code: add the same exact local callback URL to the LinkedIn app's Auth tab and to the MCP config.403 ACCESS_DENIEDforpartnerApiMemberSnapshotData: the LinkedIn Developer app/token likely does not have Member Data Portability API access orr_dma_portability_self_serve.LinkedIn token has expired: runloginagain. If LinkedIn issued a refresh token, the MCP attempts a refresh automatically before requiring login.Timed out waiting for LinkedIn OAuth callback: rerunloginand complete the browser flow withinLINKEDIN_OAUTH_TIMEOUT_SECONDS.403 ACCESS_DENIEDonsocialMetadataormemberCreatorPostAnalytics: the LinkedIn app/token does not have the extra engagement permissions needed for those tools.426 NONEXISTENT_VERSIONonmemberSnapshotData: upgrade to0.2.9or later and restart the MCP host. Version0.2.8incorrectly sent the Marketing API version to the snapshot endpoint; the fix pins snapshot requests to202312.
Notes
- The MCP reads only the authenticated member's own snapshot data.
- It does not support arbitrary-author LinkedIn post lookup.
MEMBER_SHARE_INFOis snapshot/export-style data, so field names can vary. The normalizer is intentionally tolerant and keepsinclude_raw=trueavailable for debugging.- LinkedIn's portability data for
Sharesis documented around fields like date, link, commentary, media URL, and visibility. Likes, comments, and impressions are exposed only if they appear in the snapshot payload returned for that member. - Saved LinkedIn drafts are not exposed as a documented portability snapshot domain here.
match_drafts_to_member_postscompares draft texts you already have against published posts; it does not fetch drafts from LinkedIn. analyze_member_postscan return very large payloads wheninclude_posts=true. Usepost_limitto cap the embeddedpostslist, or setinclude_posts=falsewhen you only need aggregate metrics.enrich_member_posts_with_engagementkeeps export discovery and engagement lookup separate. It fetches exported posts first, derives post URNs, then merges insocialMetadataand analytics where available.- Bulk enrichment defaults to five posts and five base metrics.
max_api_callsdefaults to 50 and caps engagement HTTP attempts, including retries, for that invocation. It is not a persistent daily quota and excludes portability/OAuth calls. Reducelimitor the metric selection if the estimated request exceeds the budget. Monitor LinkedIn's daily quota across all sessions and clients. include_social_metadatadefaults tofalse: analytics approval does not grant social metadata access. Explicit social enrichment uses individual GETs, not BATCH_GET (unavailable in Development tier).- Analytics additionally accepts
POST_SAVE,POST_SEND,LINK_CLICKS,PREMIUM_CTA_CLICKS,FOLLOWER_GAINED_FROM_CONTENT, andPROFILE_VIEW_FROM_CONTENTthroughmetric_types/analytics_metric_types. Defaults remain the five base metrics to conserve quota. - Bulk lookups stop querying an endpoint on authentication or permission errors. A rate-limit response stops further engagement requests across both endpoints. Post content and completed metrics are retained with per-post
engagement_errors. Missing metrics remainnull; genuine zero counts remain0. - A confirmed
urn:li:share:...orurn:li:ugcPost:...is required. Generic activity URLs/IDs are not guessed into another URN type. If a snapshot has no usable URN, enrichment returns an explicit error and preserves its text. A supplied, confirmed URN can still be tested withget_member_post_analytics. - Analytics currently returns lifetime totals for single posts. Date-range, daily, aggregated-member and video analytics are not yet exposed by these tools.
Metadata
Release files for flin-linkedin-posts-mcp 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| flin_linkedin_posts_mcp-0.3.1.tar.gz | 137.7 kB | With provenance | Details for flin_linkedin_posts_mcp-0.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| flin_linkedin_posts_mcp-0.3.1-py3-none-any.whl | Python 3 | none | any | Details for flin_linkedin_posts_mcp-0.3.1-py3-none-any.whl |
Total release size: 171.7 kB
Release files / flin_linkedin_posts_mcp-0.3.1.tar.gz
| Download URL | flin_linkedin_posts_mcp-0.3.1.tar.gz |
|---|---|
| Size | 137.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
df0f11d9f4fc721363b16d6697f9d41bfdb3701a5db4dbcbe8f4ffc4371dced3
|
|
BLAKE2b-256 checksum How to use checksums |
37c6570af1a40a1a2777a758e6ba53dcfe22de2496273bcca67afc26e2fce66e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.
Transparency logRelease files / flin_linkedin_posts_mcp-0.3.1-py3-none-any.whl
| Download URL | flin_linkedin_posts_mcp-0.3.1-py3-none-any.whl |
|---|---|
| Size | 34.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ae7b6ec0469119674e5a98afe2587d8ba66dfc6591abdbf910f25d9d2d5fe46f
|
|
BLAKE2b-256 checksum How to use checksums |
302b3428e255b1d6e37cc70ba975d3c2ef06148f556c8b3129c871befc07b379
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.
Transparency logSecurity for flin-linkedin-posts-mcp 0.3.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for flin_linkedin_posts_mcp-0.3.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.