Skip to content

LinkedIn MCP in Claude Code: Post From Your Repo

Set up the TimeToPost MCP server in Claude Code and turn a merged pull request into a LinkedIn draft: the command, the 3,000 character rule and a headless run.

Connect Claude Code to TimeToPost

Set up TimeToPost in Claude Code

  1. Register the hosted server once for every project with the command below.
  2. Run claude mcp login timetopost (or open /mcp in a session) and finish the browser sign in.
  3. Ask Claude Code to call whoami and check that the workspace is yours.
  4. For unattended runs, sign in interactively first: a claude -p run has no /mcp panel, so it reuses the stored login.
terminal
claude mcp add --transport http --scope user timetopost https://api.timetopost.co/mcp
claude mcp login timetopost
headless run, drafts only
claude -p "Read CHANGELOG.md and file one draft per network with create_drafts" \
  --allowedTools "Read,mcp__timetopost__create_drafts"

OAuth in the browser through /mcp or claude mcp login; no API key is stored in the config.

From a merged pull request to a LinkedIn draft

LinkedIn rewards a plain account of what you built and why, and Claude Code already has the material: the pull request description, the diff and the tests. Ask it to read them and write one profile post in your own voice, then file it with create_drafts so it waits in your approval queue.

LinkedIn strips formatting on the way out. TimeToPost escapes the characters @ [ ] ( ) # * _ ~ and removes @mentions, so the Markdown habits of a terminal session show up as typed. Tell Claude Code to write plain sentences with line breaks, and to keep the screenshot to one image, since a profile post carries one image or one MP4.

Because the login is stored after the first interactive sign in, the same job runs from a release script with claude -p. Allow only Read and mcp__timetopost__create_drafts, and the script can never schedule a post by itself.

Example prompt and the tool calls it makes

Prompt: “Read the description and diff of the last merged PR, write one LinkedIn post in plain text under 1,500 characters about why we built it, and file it with create_drafts for Tuesday 08:30 Paris time.”

1. create_drafts

Reusing external_ref pr-1412-linkedin on a second run updates the pending draft instead of adding a copy.

input
{"external_ref":"pr-1412-linkedin","variants":[{"platform":"linkedin","segments":["<post text from the PR>"],"schedule_hint":"2026-12-08T08:30:00+01:00"}]}

2. list_approvals

Claude Code reads back what is waiting, so you can check the text in the terminal before you approve it in the dashboard.

input
{}

LinkedIn rules the server enforces

RuleLinkedIn
Text3,000 characters, checked when the post is created
Media per postOne image or one video
ImagesJPEG, PNG or GIF, up to 10 MB
VideoMP4 only; uploaded in parts, then LinkedIn processes it before the post is created
FormattingPlain text. @mentions are removed and the characters @ [ ] ( ) # * _ ~ are escaped, so Markdown shows as typed
  • Approval queue: create_drafts accepts LinkedIn.
  • Numbers back: none for LinkedIn through TimeToPost.
  • One image or one MP4 per post, plain text only, and no analytics come back.

Limits and gotchas

  • Markdown headings, bold and bullet asterisks are escaped by the LinkedIn publisher, so ask for plain text from the start.
  • In a claude -p run, a call to schedule_post is denied unless you add it to --allowedTools; keep it out and the job can only draft.
  • get_post_metrics returns nothing for LinkedIn, so a follow-up prompt asking how the post did has no data to read.
  • A claude -p run cannot complete an OAuth sign in, so the first login has to happen in an interactive session.

Related pages

Claude Code setup checked on 2026-12-02 against Claude Code MCP docs, Claude Code headless docs. LinkedIn rules read from the TimeToPost server code on 2026-11-07.

Frequently asked questions

Can Claude Code attach a screenshot from my repo to a LinkedIn post?

Yes, one image. Claude Code calls prepare_media_upload with the file name, type and exact size, PUTs the bytes to the returned URL with curl, then finalize_media_upload gives the media URL for the post. LinkedIn takes JPEG, PNG or GIF up to 10 MB.

Will the release script publish to LinkedIn on its own?

Not if --allowedTools lists only Read and mcp__timetopost__create_drafts. The script files a draft, and the post is scheduled when someone approves it.

Does Claude Code see my LinkedIn password or token?

No. LinkedIn is connected once in TimeToPost through connect_account_link, and Claude Code only holds its own TimeToPost login.

Can Claude Code post on a schedule without me?

Yes, through claude -p from cron or CI after one interactive login. Allow only the tools the job needs, for example --allowedTools "mcp__timetopost__create_drafts", so the run files drafts and a person still approves them.

I build TimeToPost.

Connect Claude Code to LinkedIn through TimeToPost. The MCP server and its 126 tools are on every plan, from $12 a month.