# LinkedIn MCP for Codex: connect LinkedIn and X to Codex

To connect LinkedIn and X to Codex, add Flaghand's MCP server and sign in:

```sh
codex mcp add flaghand --url https://app.flaghand.com/mcp
```

Codex opens Flaghand's sign-in in your browser. Once you allow it, Codex can draft LinkedIn and X posts from your work
and send them to you for approval. You approve each exact post with your passkey, and Flaghand posts it.

Checked on October 28, 2026, with Codex CLI 0.164.0, against OpenAI's Codex docs and Flaghand's setup docs, linked
under [Sources](#sources).

## Connect it in four steps

1. **Get a Flaghand account and connect your accounts.** [Start here](/schedule), 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. Or let Codex do the setup: ask it to read `https://app.flaghand.com/docs/setup.md`
   and set Flaghand up for you. It signs you up over Flaghand's API and hands you only the links that need you:
   sign-up, billing, and LinkedIn's and X's own consent screens.
2. **Add the server.** Run the command above. 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 post as LinkedIn will show it, 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:

```sh
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, create a token in Flaghand under **Settings › Agents › Create token**
(it's shown once), keep it in your secret store, and save only the variable's name:

```sh
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:

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

Start Codex with `FLAGHAND_TOKEN` set from your secret store.

## 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](/docs/guides/connect-linkedin-and-x-to-claude),
[ChatGPT](/docs/guides/connect-linkedin-and-x-to-chatgpt), [Claude Code](/docs/guides/connect-linkedin-and-x-to-claude-code),
[Cursor](/docs/guides/connect-linkedin-and-x-to-cursor) and [Gemini](/docs/guides/connect-linkedin-and-x-to-gemini).
[The LinkedIn MCP server](/linkedin-mcp-server) explains what Flaghand does on LinkedIn;
[the X MCP server](/x-mcp-server) and [the X API and MCP servers, compared](/docs/guides/x-api-and-mcp-servers-for-ai-agents) covers X, and
[Flaghand compared](/compare) sets it beside other schedulers and posting APIs.

## Sources

All read on October 28, 2026.

- OpenAI: [Codex and MCP](https://learn.chatgpt.com/docs/extend/mcp?surface=cli)
- Flaghand: [set up and connect](https://app.flaghand.com/docs/setup), [agents: Codex CLI](https://app.flaghand.com/docs/agents#codex-cli),
  [sign-in and tokens](https://app.flaghand.com/docs/sign-in-and-tokens)

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

[All guides](/docs/guides.md)
