# How to connect Codex to LinkedIn, step by step

Source: https://finchreach.com/guides/codex
Third-party facts checked on 2026-10-28.

Create an API key at finchreach.com/api-keys, connect LinkedIn at finchreach.com/accounts, then add `https://mcp.finchreach.com/mcp` to Codex with the header `Authorization: Bearer lk_…`. Test with a read, and approve the first draft under Approvals.

## What you need

- A Finchreach account (sign in at [finchreach.com](https://finchreach.com/sign-in)) and the LinkedIn account you want Codex to work on.
- Codex.
- About five minutes.

## Step 1: Create a Finchreach API key

1. Sign in at finchreach.com and open [API keys](https://finchreach.com/api-keys).
2. Create a key and name it after the tool, for example “Codex”.
3. Copy it right away: it starts with `lk_` and is shown only once.

## Step 2: Connect your LinkedIn account

1. Open [Accounts](https://finchreach.com/accounts) and click to connect LinkedIn.
2. Follow the steps until the account shows as connected.

Approval mode is on by default: nothing the assistant drafts reaches LinkedIn until you approve it.

## Step 3: Add Finchreach to Codex

1. Add the server to `~/.codex/config.toml` (or to a trusted project’s `.codex/config.toml`) as below. `codex mcp add finchreach --url https://mcp.finchreach.com/mcp` writes the same entry; then add the `bearer_token_env_var` line.
2. Set the key in the shell you start Codex from: `export FINCHREACH_API_KEY=lk_YOUR_KEY`.
3. Start Codex and run `/mcp` to see `finchreach` and its tools.

~/.codex/config.toml:
```toml
[mcp_servers.finchreach]
url = "https://mcp.finchreach.com/mcp"
bearer_token_env_var = "FINCHREACH_API_KEY"
```

Shell:
```bash
export FINCHREACH_API_KEY=lk_YOUR_KEY
codex
```

> Replace `lk_YOUR_KEY` with your key. Keep the key out of shared files and repos; where Codex can read it from an environment variable, prefer that.

`bearer_token_env_var` sends `Authorization: Bearer <value>` and takes precedence over OAuth. Codex can also send static headers (`http_headers`) or headers read from env (`env_http_headers`); `X-Api-Key` works with Finchreach too.

## Step 4: Test the connection

In Codex, start with a read. It runs right away and proves the key and the account work:

> Ask your assistant: “List my connected LinkedIn accounts, then summarize my five latest notifications.”

You should see calls to `linkedin_list_accounts` and `linkedin_get_notifications`. Then try a write, which goes to your approval queue instead of LinkedIn:

> Ask your assistant: “Draft a short LinkedIn post saying I’m trying a new AI assistant workflow. Submit it for my approval.”

## Step 5: Approve or reject it in Finchreach

1. Open [Approvals](https://finchreach.com/approvals). The draft is there with its exact text and the account it would go out from.
2. Approve it to publish, or reject it (reject the test post if you don’t want it live).
3. Codex can check the result with `linkedin_get_action`: pending, approved, rejected, executed, failed or expired.

## Troubleshooting

- Don’t run `codex mcp login finchreach`: it is for OAuth servers only.
- If Codex reports a 401, the variable isn’t set in the shell that started Codex. `echo $FINCHREACH_API_KEY` should print your key.
- A project `.codex/config.toml` is only read in a trusted project.
- 401 or “unauthorized”: the key is wrong, revoked or missing its prefix. Finchreach accepts `Authorization: Bearer lk_…` or `X-API-Key: lk_…`; check for a missing `Bearer `, quotes or a trailing space.
- A tool is missing: the key’s permissions don’t include it. Create a key with the permissions you need under [API keys](https://finchreach.com/api-keys).
- “No LinkedIn account”: connect one under [Accounts](https://finchreach.com/accounts), or reconnect it if its session expired.
- A post or message “didn’t go out”: it is probably still waiting under [Approvals](https://finchreach.com/approvals). Writes run only after you approve them.

Still stuck? Compare your setup with [Codex’s documentation](https://developers.openai.com/codex/mcp), checked on 2026-10-28; client screens change often.

## What to ask Codex next

> Ask your assistant: “Read the changelog in this repo and draft a LinkedIn post announcing the release.”

> Ask your assistant: “Find the LinkedIn profiles of the contributors to this release and draft a thank-you message to each.”

> Ask your assistant: “Check my LinkedIn notifications for comments on my last post and list the questions people asked.”

More ideas on the [Codex integration page](https://finchreach.com/integrations/codex).

## Questions

### I lost my API key. Can I see it again?

No, a key is shown only once. Create a new one under [API keys](https://finchreach.com/api-keys), put it in your config, and revoke the old one.

### Does Codex see my LinkedIn password?

No. Codex only gets your Finchreach API key. Your LinkedIn connection stays in Finchreach, and you can revoke the key at any time without touching LinkedIn.

### Can I use the same key in several tools?

Yes, but one key per tool (for example one named “Codex”) lets you revoke one without breaking the others.

### How do I disconnect Codex?

Revoke its key under [API keys](https://finchreach.com/api-keys); Codex gets a 401 from then on. Then remove the server from its config.

## Sources

- [Codex docs](https://developers.openai.com/codex/mcp)
- [learn.chatgpt.com](https://learn.chatgpt.com/docs/extend/mcp?surface=cli)

## Related

- [What Codex can do on LinkedIn](https://finchreach.com/integrations/codex)
- [Triage your LinkedIn sales inbox with ChatGPT-style prompts](https://finchreach.com/blog/chatgpt-linkedin-inbox-triage)
- [Answer LinkedIn posts about your open-source project with Codex](https://finchreach.com/blog/codex-linkedin-library-mentions)
- [Quickstart and tools](https://finchreach.com/docs)
- [All setup guides](https://finchreach.com/guides)
