Skip to content

For engineersGuide

Connect Claude Code or Codex

Connect your coding agent when you want it to work with Emargen as you. It can leave you notes from its sessions and build an initiative’s tasks, or keep a long piece of work in a topic. You make a personal access token on your profile, with what the agent may do and for how long. The token comes with a line to run in your terminal. You do it once per computer and organisation.

  • Anyone in the organisation can connect their own agent. It works as you. It sees what you see, and what it writes is yours.
  • You choose what your agent may use, within your organisation’s limits. An administrator sets those under Admin › People › Agent access. You can allow less, never more.
  • You need Claude Code or Codex on your computer. Any other agent that speaks MCP works too, with the address and the token.
  • The pictures show Security for Jonas Berg, an engineer at ACME.
  1. Open your profile from your name at the bottom of the menu, and choose Security.

    Open Security (opens Emargen in a new tab)
  2. Under Connect an agent, keep Claude Code or Codex chosen.

Connect an agent, on Jonas's Security page: the kinds Claude Code or Codex (chosen), Claude and ChatGPT; three steps, Make a token below, Run the command shown with the new token, Start a new session; the Server address with a Copy button; a line on Codex and other clients; and New token.Connect an agent, on Jonas's Security page: the kinds Claude Code or Codex (chosen), Claude and ChatGPT; three steps, Make a token below, Run the command shown with the new token, Start a new session; the Server address with a Copy button; a line on Codex and other clients; and New token.
  1. Claude Code or Codex, Claude or ChatGPT. Claude and ChatGPT sign in instead of taking a token (see Claude and ChatGPT).
  2. The three steps.
  3. Server address, ending in /mcp/ and your organisation’s code.
  4. Copy: copies the address.
  5. New token: starts the token your agent will use.
  1. Click New token. New personal access token opens.
New personal access token: The token acts as you in ACME, with the permissions you set here, until it expires or you revoke it. Name, empty, with Claude Code on the MacBook greyed in it; Expires, 90 days chosen, Expires 28 Jan 2027; Permissions, Everything chosen, Topics 11 of 11 · Your notes 5 of 5 · Building 7 of 7 · Published requirements 3 of 3 · Initiatives 3 of 3; Show 29 tools; Cancel, and Create greyed out.New personal access token: The token acts as you in ACME, with the permissions you set here, until it expires or you revoke it. Name, empty, with Claude Code on the MacBook greyed in it; Expires, 90 days chosen, Expires 28 Jan 2027; Permissions, Everything chosen, Topics 11 of 11 · Your notes 5 of 5 · Building 7 of 7 · Published requirements 3 of 3 · Initiatives 3 of 3; Show 29 tools; Cancel, and Create greyed out.
  1. Name: where you’ll use it, so you can tell your tokens apart later.
  2. Expires: 30 days, 90 days or 1 year. A token lasts a year at most. Make a new one when it ends.
  3. Permissions: Read only, Topics and notes, Everything or Custom, with the number of tools allowed in each area.
  4. Show 29 tools: every tool, ticked or not, to change one by one.
  5. Create: greyed out until the token has a name.
  1. Give it a name, and choose how long it lasts.

  2. Choose its permissions. To build an initiative’s slices, your agent needs Everything, or Custom with the Building tools ticked. Topics and notes gives none of them, and Read only only lets it read the slices. The tools has every tool.

  3. Click Create. The dialog shows your new token, this once, with a copy button. Emargen keeps only a fingerprint of it, so it can’t show it to you again.

  4. Under the token, choose your coding agent, Claude Code or Codex. The dialog shows the line that adds Emargen to it, with your token already in it.

    For Claude Code, one line:

    Terminal window
    claude mcp add --transport http emargen-ORG https://app.emargen.com/mcp/ORG --header "Authorization: Bearer TOKEN"

    For Codex, two lines. The first adds Emargen, the second puts the token where Codex reads it.

    Terminal window
    codex mcp add emargen-ORG --url https://app.emargen.com/mcp/ORG --bearer-token-env-var EMARGEN_TOKEN
    export EMARGEN_TOKEN=TOKEN

    The dialog fills in ORG, your organisation’s code, and TOKEN. The name is emargen- plus your organisation’s code. Any other MCP client takes the address, with the header “Authorization: Bearer” and the token.

  5. Run the line in your terminal. For Claude Code, add --scope user after claude mcp add to connect every repository on this computer, not just the folder you’re in. For Codex, run both lines, and put the export in your shell’s profile, so every session has it.

    Claude Code keeps the token inside the connection, so connections to several organisations sit side by side. Codex reads the token from EMARGEN_TOKEN, so these lines give it one organisation’s token on this computer. For a second organisation, name its token differently in both lines, such as EMARGEN_TOKEN_2. Emargen refuses a token at another organisation’s address.

  6. Optional: open “Start each session with your notes”, folded under the lines. Its script gives your agent your open notes for the repository at the start of each session. Copy the script and the setting that runs it, each to the place the dialog names. For Claude Code, also copy the line that puts your token in EMARGEN_TOKEN. Codex runs a new hook only once you’ve trusted it. Type /hooks in your next Codex session, then review it and trust it. Notes says what the script hands over.

  7. Click Done. The token and its lines don’t show again. If you lose them, revoke the token and make a new one.

  8. Start a new session in a repository. Your agent finds Emargen’s tools, and the few sentences that say when to use them. In Claude Code, /mcp shows the connection as connected. In Codex, codex mcp list shows it.

  9. Ask it something small, like “list my recent topics in Emargen”. It answers with topics whose keys start with your organisation’s letters. If it’s refused, the refusal says what to fix, such as a token made for another organisation, or a tool you didn’t allow.

  • Your token is listed under Personal access tokens on Security, with what it may use, when it was last used, and when it expires.
Personal access tokens: For agents on your computer: Claude Code, Codex, Cursor or a script; a New token button; one row, Claude Code on my laptop, Permissions Everything 29 tools, Last used 12 Oct, Expires 22 Sept 2027.Personal access tokens: For agents on your computer: Claude Code, Codex, Cursor or a script; a New token button; one row, Claude Code on my laptop, Permissions Everything 29 tools, Last used 12 Oct, Expires 22 Sept 2027.
  1. The token’s name. Click its row for Permissions, to change what it may use, and Revoke, which stops it at once.
  2. What it may use: the choice, and how many tools that is.
  • Your agent leaves you notes in Agent Notes, builds tasks for you, and writes topics as you. Tasks show your name and the agent’s. Topic versions show your name “with Claude Code”.
  • Your organisation’s administrators see under Admin › People › Agent access that you have a token, its name and when it was last used. They can revoke it. They never see your notes.
  • If your agent calls a tool you didn’t allow, Emargen refuses, and says you can allow it on Security. A change to Permissions applies from the agent’s next call. A tool you add shows in its list when it next reads Emargen’s tools, at the latest in a new session.

Claude and ChatGPT, on the web, the desktop or a phone, can’t take a pasted token. They sign in to Emargen themselves. Choose Claude or ChatGPT under Connect an agent for their steps.

Connect an agent with the Claude tab chosen: In Claude, open Settings → Connectors and add a custom connector named “Emargen · ACME”; Give it Emargen's address, below; Press Connect, sign in to Emargen, and choose what Claude may do; then the Server address with Copy, and a line saying an admin on Claude Team or Enterprise can add the connector once for everyone.Connect an agent with the Claude tab chosen: In Claude, open Settings → Connectors and add a custom connector named “Emargen · ACME”; Give it Emargen's address, below; Press Connect, sign in to Emargen, and choose what Claude may do; then the Server address with Copy, and a line saying an admin on Claude Team or Enterprise can add the connector once for everyone.
  1. Claude, chosen. ChatGPT has its own steps.
  2. The steps in Claude.
  3. Server address, to give the connector.

When you press Connect in Claude or ChatGPT, it sends you to Emargen’s connect page, where you choose what it may do. Once allowed, it shows under Connected assistants on Security.

Guides

How to