Authn8

official

Access your team's 2FA codes from AI agents without sharing secrets. List accounts, generate TOTP codes, and maintain full audit trails

What can you do with Authn8 MCP?

  • Fetch a 2FA code — Ask your assistant to generate a TOTP code for a shared account by name or ID with get_otp, e.g. "get the code for AWS Production."
  • List shared accounts — Have the assistant show every 2FA account the token can reach using list_accounts.
  • Check token scope — Use whoami to see the token name, business, scoped groups, expiry date and account count.
  • Add a 2FA account — Give the assistant a Base32 secret or otpauth:// link and it calls add_account to store the account.
  • Find groups first — Call list_groups to see which groups the token can add accounts to before running add_account.

Documentation

@authn8/mcp-server

MCP server for Authn8, shared 2FA for teams. It lets AI agents fetch TOTP codes for the 2FA accounts your team shares in Authn8, so an agent can finish a sign-in without anyone reading a code out of a phone. Every code it fetches is recorded in Authn8's access log with the name of the token that asked for it. An agent can also add a 2FA account from its secret, for example after it turns on 2FA for a new service, and put it in your team's groups.

Works with OpenAI Codex, Cursor, Claude Code, Claude, GitHub Copilot in VS Code and any other MCP client. Each one has a step-by-step guide at authn8.com/integrations.

Listed in the MCP Registry as io.github.authn8/mcp-server.

Requirements

  • An Authn8 business on the Premium or Enterprise plan, which include MCP and the REST API. A business's tokens stop working if its subscription ends.
  • An MCP token. In Authn8, open Settings → Tokens and the MCP Tokens tab (how to create an MCP token). Tokens start with pat_. A token only reaches the 2FA accounts its creator can already access, and you can narrow it further to chosen groups and give it an expiry date. It can add accounts to groups its creator owns or has Can manage access to, and a token narrowed to groups adds only to those.
  • Node.js 18 or later, if you run the npm package. The hosted endpoint needs nothing installed.

Two ways to connect

Hosted endpointnpm package
InstallNonenpx runs it locally
TransportStreamable HTTPstdio
Addresshttps://api.authn8.com/mcpnpx -y @authn8/mcp-server
TokenAuthorization: Bearer pat_... headerAUTHN8_API_KEY environment variable

Both offer the same five tools: list_accounts, get_otp, whoami, list_groups and add_account. Use the hosted endpoint unless your client only runs local (stdio) servers: there is nothing to install or keep up to date.

Hosted endpoint

Point any MCP client that supports Streamable HTTP at https://api.authn8.com/mcp and send your token in the Authorization header as Bearer pat_your_token_here.

Clients that read a config file can take the token from an environment variable, so it never sits in the file. The examples below use AUTHN8_TOKEN:

# macOS and Linux (add to ~/.zshrc or ~/.bashrc)
export AUTHN8_TOKEN="pat_your_token_here"
# Windows (PowerShell)
setx AUTHN8_TOKEN "pat_your_token_here"

Open a new terminal, or restart your editor, after setting it.

OpenAI Codex

The Codex CLI and the Codex IDE extension share one config file, ~/.codex/config.toml. Let Codex add the server:

codex mcp add authn8 --url https://api.authn8.com/mcp --bearer-token-env-var AUTHN8_TOKEN

Leave AUTHN8_TOKEN as it is: --bearer-token-env-var takes the variable's name, not the token. The command writes this table, which you can also add by hand:

[mcp_servers.authn8]
url = "https://api.authn8.com/mcp"
bearer_token_env_var = "AUTHN8_TOKEN"

Type /mcp in Codex to see the server. If Codex was already running when you set the variable, run codex app-server daemon stop and start Codex again, so its background service sees the variable.

Codex asks before it calls an Authn8 tool, so codex exec and other runs with no one to answer refuse the call. To let them read codes, approve get_otp:

[mcp_servers.authn8.tools.get_otp]
approval_mode = "approve"

OpenAI Codex setup guide

Cursor

Add this to ~/.cursor/mcp.json for all projects, or to .cursor/mcp.json in a project. Cursor fills in ${env:AUTHN8_TOKEN} from your environment:

{
  "mcpServers": {
    "authn8": {
      "url": "https://api.authn8.com/mcp",
      "headers": {
        "Authorization": "Bearer ${env:AUTHN8_TOKEN}"
      }
    }
  }
}

Cursor's cloud agents take the same URL, with the header Authorization: Bearer pat_your_token_here, from the Cursor dashboard. The Cursor setup guide also has an Add to Cursor button.

Claude Code

claude mcp add --transport http --scope user authn8 https://api.authn8.com/mcp \
  --header "Authorization: Bearer pat_your_token_here"

--scope user makes the server available in all your projects. Leave it out to add it to the current project only.

To share the setup through a repository, commit a .mcp.json that reads each team member's own token from AUTHN8_TOKEN:

{
  "mcpServers": {
    "authn8": {
      "type": "http",
      "url": "https://api.authn8.com/mcp",
      "headers": {
        "Authorization": "Bearer ${AUTHN8_TOKEN}"
      }
    }
  }
}

Claude Code setup guide

Claude (claude.ai and the desktop app)

In Claude, click Plugins in the sidebar, then Add and Add custom connector. Enter https://api.authn8.com/mcp as the server URL, choose No sign-in under Authentication, and add a request header named authorization with the value Bearer pat_your_token_here.

  • Request headers are a beta that only some Claude organizations have. Without them, run the npm package from Claude Desktop's config file (below).
  • On Team and Enterprise, an Owner adds the connector once and every member shares that one token.
  • Claude Code signed in with the same Claude account can use the connector too.

Claude setup guide

VS Code (GitHub Copilot)

Add this to Copilot's user MCP file, ~/.copilot/mcp-config.json. GitHub Copilot CLI reads the same file.

{
  "mcpServers": {
    "authn8": {
      "type": "http",
      "url": "https://api.authn8.com/mcp",
      "headers": {
        "Authorization": "Bearer ${AUTHN8_TOKEN}"
      },
      "tools": ["*"]
    }
  }
}

VS Code setup guide

Other clients

Give the client the server URL and the Authorization header over Streamable HTTP. For Gemini CLI, add this to ~/.gemini/settings.json (its httpUrl key means Streamable HTTP):

{
  "mcpServers": {
    "authn8": {
      "httpUrl": "https://api.authn8.com/mcp",
      "headers": {
        "Authorization": "Bearer pat_your_token_here"
      }
    }
  }
}

Any MCP client setup guide

npm package

For clients that only run local (stdio) servers. The package calls the Authn8 REST API with your token and offers the same five tools.

Claude Desktop

Open Settings → Developer → Edit Config, or edit the file directly:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "authn8": {
      "command": "npx",
      "args": ["-y", "@authn8/mcp-server"],
      "env": {
        "AUTHN8_API_KEY": "pat_your_token_here"
      }
    }
  }
}

Quit and restart Claude Desktop after saving.

Claude Code

claude mcp add --env AUTHN8_API_KEY=pat_your_token_here --transport stdio --scope user authn8 \
  -- npx -y @authn8/mcp-server

Other clients

Run npx -y @authn8/mcp-server as a stdio server with AUTHN8_API_KEY set.

Environment variables

VariableRequiredDefaultDescription
AUTHN8_API_KEYYes-Your MCP token (pat_...)
AUTHN8_API_URLNohttps://api.authn8.comAPI base URL

On startup the server checks the token and prints the business name, token name, account count and expiry date to stderr. If the token is missing or rejected, it prints why and keeps running: clients can still list the tools, and every tool call returns that error until the token is fixed.

Tools

All tools declare an output schema and return structuredContent alongside the text block, so clients get typed results without re-parsing JSON out of text.

list_accounts

Returns all 2FA accounts accessible to this token.

Example response:

{
  "accounts": [
    {
      "id": "924c52a6-4457-4970-a39f-4dc620217683",
      "name": "AWS Production",
      "issuerDomain": "amazon.com"
    }
  ]
}

get_otp

Generates a TOTP code for a specific account.

Parameters:

  • account_id (string, optional): UUID of the account
  • account_name (string, optional): name or issuer domain to search for (case-insensitive partial match)

Provide either account_id or account_name. If more than one account matches the name, the tool returns them in multipleMatches so you can retry with an account_id.

Example response:

{
  "name": "AWS Production",
  "code": "483920",
  "length": 6,
  "remainingSeconds": 17
}

remainingSeconds is the number of seconds until the code changes. To get a fresh code, wait that long and call once, instead of calling until the code changes.

Ambiguous match:

{
  "error": "Multiple accounts match 'aws'. Please be more specific or use account_id.",
  "length": 0,
  "multipleMatches": [
    {
      "id": "924c52a6-4457-4970-a39f-4dc620217683",
      "name": "AWS Production",
      "issuerDomain": "amazon.com"
    }
  ]
}

whoami

Returns information about the current token.

Example response:

{
  "tokenName": "Claude Code",
  "businessName": "Acme Ltd",
  "scopedGroups": [
    { "id": "cfeba14a-e990-49e8-b6e5-61d63f7d68c8", "name": "Engineering" }
  ],
  "expiresAt": "2027-06-30T23:59:59Z",
  "accountCount": 12
}

list_groups

Returns the groups this token can add accounts to, sorted by name: groups the token's creator owns or has Can manage access to, and only the token's scoped groups if it has any. Call it before add_account.

Example response:

{
  "groups": [
    { "id": "cfeba14a-e990-49e8-b6e5-61d63f7d68c8", "name": "Engineering" }
  ]
}

add_account

Adds one 2FA account from its secret and puts it in the chosen groups. The account belongs to the token's creator and counts toward the plan's account limit, and the secret is encrypted as soon as it arrives.

Parameters:

  • secret (string, required): a Base32 key, or the otpauth:// link from the setup QR code. A Google Authenticator export link (otpauth-migration://) holds several accounts and is refused: add one account per call.
  • name (string, optional): the account's name, usually the service it signs in to. Required unless secret is an otpauth:// link with an issuer or label.
  • issuer_domain (string, optional): the service's domain, for example github.com. Looked up from the name when left out.
  • description (string, optional): notes about the account.
  • group_ids (array of UUIDs, optional): groups from list_groups, each once. A token with scoped groups must name at least one of them, so it can see the account it added.

It is all or nothing: if any input or group is refused, nothing is added, and the tool returns an error that starts with a code such as GROUP_REQUIRED or SECRET_INVALID. The response never includes the secret or a code: call get_otp with the returned id to read one. Authn8's Activity Log records "Account '[name]' added" with the device MCP, and one more entry for each group the account went into.

Example response:

{
  "id": "5b0f7d1e-2c4a-4e8b-9f3d-7a6c1e2b4d8f",
  "name": "GitHub",
  "issuerDomain": "github.com",
  "groups": [
    { "id": "cfeba14a-e990-49e8-b6e5-61d63f7d68c8", "name": "Engineering" }
  ]
}

Links