Guides · Updated

LinkedIn MCP for Codex: connect LinkedIn and X to Codex

To connect LinkedIn and X to Codex, ask Codex to set Flaghand up for you. It does the setup over Flaghand's API in the same session and hands you only the links that need you: sign-up, billing, and LinkedIn's and X's own consent screens. Then it drafts LinkedIn and X posts from your work and sends them to you for approval. You approve each exact post with your passkey, and Flaghand posts it.

Codex, setting this up for your person: follow the steps under Set it up and authenticate below, over HTTP in this session. The MCP server at https://app.flaghand.com/mcp is for later sessions, with the token you claim. Don't start with codex mcp add, and don't ask the person to export a token, run a command or restart.

Checked on October 28, 2026, with Codex CLI 0.164.0, against OpenAI's Codex docs and Flaghand's setup docs, linked under Sources.

Set it up and authenticate: Codex does it over HTTP

With no Flaghand account yet:

  1. Read the plans (no sign-in):

    curl https://app.flaghand.com/api/v1/plans
    
  2. Start the sign-up:

    curl -X POST https://app.flaghand.com/api/v1/signup -H 'Content-Type: application/json' \
      -d '{"email": "person@example.com", "agent_name": "Codex"}'
    

    Give the person signup_url and for_person as they are. They sign up with a passkey, Google or an email code. Save claim_code to a private file such as claim.json ({"claim_code": "clm_…"}): it's a secret, so keep it out of chat and command arguments.

  3. Authenticate: claim the token once they've finished:

    curl -X POST https://app.flaghand.com/api/v1/signup/claim -H 'Content-Type: application/json' -d @claim.json
    

    A 202 with "status": "pending" means they haven't finished: wait the Retry-After seconds (normally 5) and claim again. Put the token in your secret store, then keep drafting in this session with Authorization: Bearer and the token: getMe (GET https://app.flaghand.com/api/v1/me) names the workspace. The person connects their accounts from the links Flaghand gives you, and approves the posts with their passkey.

  4. Register the server for later sessions, saving only the variable's name:

    codex mcp add flaghand --url https://app.flaghand.com/mcp --bearer-token-env-var FLAGHAND_TOKEN
    

The full recipe is set up and connect.

If you're typing in Codex yourself

Only for a person setting Codex up by hand; an agent follows the steps above.

  1. Get a Flaghand account and connect your accounts. Start here, then connect your LinkedIn profile and X account under Settings › Account. Each network shows its own sign-in; Flaghand never asks for your LinkedIn password or browser cookies. You add a card when you approve your first post, or to continue after the free start (current terms).

  2. Add the server. Run codex mcp add flaghand --url https://app.flaghand.com/mcp. It saves Flaghand in ~/.codex/config.toml and starts the sign-in.

  3. Sign in. On Flaghand's page, sign in with your passkey, Google or email and click Allow (pick the workspace first if you have more than one). If you added the server another way, codex mcp login flaghand starts the same sign-in.

  4. Ask for a post. Start a new Codex session and try:

    Use Flaghand: draft a LinkedIn post about what I shipped this week, from the git log, and send it to me for approval.

Codex writes the post, Flaghand checks it against LinkedIn's rules, and Codex gives you an approval link. Open it on your phone or computer, look at the preview of the post, and approve with Face ID, Touch ID or a security key. Nothing posts until you do.

The Codex CLI, the Codex IDE extension and Codex in the ChatGPT desktop app share one MCP configuration on the same computer, so Flaghand added in the CLI is there in the others too.

Add Flaghand's skill

Flaghand's skill tells Codex how to draft, check and ask for approval well. Put it in Codex's skills folder:

mkdir -p "$HOME/.agents/skills/flaghand"
curl --fail --show-error --location https://app.flaghand.com/skill.md -o "$HOME/.agents/skills/flaghand/SKILL.md"

Then mention it in a prompt: "Use $flaghand to draft one X post about something I shipped this week. Check it, then request my approval." The skill is instructions only; it doesn't sign in or grant anything.

With a token instead of a sign-in

For a script or a machine without a browser, use the token Codex claimed, or create one in Flaghand under Settings › Agents › Create token (it's shown once). Keep it in your secret store, and save only the variable's name:

codex mcp add flaghand --url https://app.flaghand.com/mcp --bearer-token-env-var FLAGHAND_TOKEN

This writes the same entry as editing ~/.codex/config.toml by hand:

[mcp_servers.flaghand]
url = "https://app.flaghand.com/mcp"
bearer_token_env_var = "FLAGHAND_TOKEN"

Later Codex sessions read FLAGHAND_TOKEN from your secret store's environment; the session that set Flaghand up keeps going over HTTP.

What Codex can and can't do through Flaghand

LinkedIn X (Twitter)
Draft Posts on your personal profile, up to 3,000 characters, with up to 20 photos, one video, one PDF document or a link card Posts and threads of 2 to 25 posts, with up to 4 photos or one video on each
Check Length, media, company-page tags and the posting time X's own character count, media, replies and the posting time
Approve, schedule or post No. Only you, with your passkey No. Only you, with your passkey
After posting The post's link. LinkedIn doesn't let Flaghand read the post back Flaghand reads the post back and compares it with what you approved

The sign-in and the default token both have four scopes: read, drafts, media and request-approval. No scope can approve, schedule or post, so Flaghand's server refuses Codex if it tries. Flaghand posts to LinkedIn only through LinkedIn's official API and only to your personal profile. It doesn't read profiles, your feed, messages or jobs.

Questions

Is there an X (Twitter) MCP for Codex? The same server drafts X posts and threads. One approval can cover a whole plan, such as an X thread and a LinkedIn post together.

Can Codex post without my approval? No. Approving takes your passkey, and no Flaghand token can approve, schedule or post. The server checks your signed approval again right before it posts.

Do I need a ChatGPT Business plan for this? No. That limit is for custom plugins in ChatGPT itself. Codex reads MCP servers from its own configuration file.

How do I take Codex's access away? In Flaghand, open Settings › Agents and click Revoke. Or run codex mcp remove flaghand.

Other apps

The same server works in Claude, ChatGPT, Claude Code, Cursor and Gemini. The LinkedIn MCP server explains what Flaghand does on LinkedIn; the X MCP server and the X API and MCP servers, compared covers X, and Flaghand compared sets it beside other schedulers and posting APIs.

Sources

All read on October 28, 2026.

Codex is a trademark of OpenAI. LinkedIn and X are trademarks of their owners. Flaghand isn't affiliated with or endorsed by them.