AI agents

2FA codes for your AI agents, without handing over the secret

The Share Auth MCP connector and 2FA skill give Claude, ChatGPT or Codex the 2FA code an agent needs, without ever passing it the TOTP seed. Source code public on GitHub.

Demo interface. The codes are fictional.
The 1-minute tutorial
Playing it loads YouTube’s player (Google). Privacy policy

Source code public on GitHub. The MCP connector and the 2FA skill for agents install in a few minutes with a token from your account.

The problem

An AI agent signing in to a service protected by 2FA gets stuck on the six-digit code. The usual workarounds are both bad. Pasting the TOTP seed into the agent’s configuration hands it a permanent credential that cannot be revoked, and making it wait for a human to type the code in defeats the point of automating anything.

What the connector does

It exposes the team’s vault over the MCP protocol, as two tools:

  • list_otp_secrets lists the team’s accounts, with an optional search, without returning any sensitive data;
  • get_otp_code returns the current code of an account, identified by its id or its exact name.

The agent gets the code when it needs it. It never receives the seed, which stays encrypted in the vault.

Install the connector

It requires Node.js 20 or later.

  1. Clone the repository and install its dependencies: git clone https://github.com/ShareAuth/mcp-server.git, then npm ci.
  2. In your Share Auth profile, under API tokens, create a token with the secrets:list and secrets:generate permissions.
  3. Declare the server in your client. For Claude Desktop, Codex CLI and other local clients, the command is node src/index.js, with the token in the OTP_API_TOKEN variable.

For a remote client such as ChatGPT, run the server in HTTP mode behind HTTPS, on your own infrastructure; the endpoint is /mcp. The repository README covers both modes in detail.

Agent skill

For an agent that can read a skill and run commands, such as Claude Code, the 2FA skill (shareauth-otp) can be cloned into its skills folder. It calls the API with Bash and curl to find an account and get its current code, never the seed. Token: secrets:list and secrets:generate.

Limited, logged access

The connector and the skill authenticate with an API token you create from your profile. That token carries only the permissions you choose, for 1, 7, 30 or 90 days, and you can revoke it at any time.

Every code obtained is recorded in the team’s access log, just like a code viewed on the website. The owner sees which account was used, when, and on whose behalf.

Good practice

  • One token per person and per device, so you can revoke just one.
  • Keep human confirmation switched on for get_otp_code in your client: its answer is an authentication factor.
  • Have the agent call list_otp_secrets first when the account name is uncertain.
  • Do not log MCP request headers or tool results.

Frequently asked questions

Local clients such as Claude Desktop or Codex CLI, and remote clients such as ChatGPT or the OpenAI Responses API, through an HTTPS endpoint that you host. Any client that speaks MCP can connect to it.