Skip to main content
Glama

@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.

Related MCP server: keywarden

Two ways to connect

Hosted endpoint

npm package

Install

None

npx runs it locally

Transport

Streamable HTTP

stdio

Address

https://api.authn8.com/mcp

npx -y @authn8/mcp-server

Token

Authorization: Bearer pat_... header

AUTHN8_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

Variable

Required

Default

Description

AUTHN8_API_KEY

Yes

-

Your MCP token (pat_...)

AUTHN8_API_URL

No

https://api.authn8.com

API 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" }
  ]
}

Available Tools

5 tools
add_accountAInspect

Adds one shared 2FA account from its secret and puts it in the chosen groups. Call list_groups first: only groups from list_groups are accepted, and a token limited to groups must put the account in at least one of them. All or nothing: if any input or group id is refused, nothing is added. Returns the new account's id, name, issuerDomain and groups, never a code: call get_otp with the id to read one. Errors start with a code, for example GROUP_REQUIRED or SECRET_INVALID.

Inputs: secret (required), name, group_ids, description, +1 more. Returns: id, name, error, groups, +1 more

get_otpAInspect

Generates a TOTP code for a specific account. REQUIRED: Provide either account_id OR account_name (at least one must be specified). Returns name, code, length and remainingSeconds, the seconds until the code changes: if you need a fresh code, wait that long instead of calling again. Errors: Returns 'No account found' if the name doesn't match any account. Returns 'Multiple accounts match' with a list of matches in the 'multipleMatches' field if the name is ambiguous - use the returned account_id to retry.

Inputs: account_id, account_name. Returns: code, name, error, length, +2 more

list_accountsAInspect

Returns all 2FA accounts accessible to this token. Use this to see what accounts are available before requesting an OTP code. Each account includes: id (UUID for get_otp), name, and issuerDomain. Returns an empty list if no accounts are accessible.

Inputs: no named parameters. Returns: error, accounts

list_groupsAInspect

Returns the groups this token can add accounts to: groups its team member owns or is a group admin of, and only the token's own groups if it is limited to some. Each group includes: id (UUID for add_account's group_ids) and name. Call this before add_account. Returns an empty list if there are none.

Inputs: no named parameters. Returns: groups

whoamiAInspect

Returns information about the current token and what it has access to, including the business name, token name, scoped groups, account count, and expiration date.

Inputs: no named parameters. Returns: error, expiresAt, tokenName, accountCount, +2 more

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.1/5.0

    Scored across 5 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: listing accounts, generating an OTP, checking token identity, listing groups, and adding an account. list_accounts and list_groups both list resources but target different entities and are well explained.

    Naming Consistency4/5

    Four tools follow a consistent verb_noun pattern: list_accounts, get_otp, list_groups, add_account. whoami is a minor deviation but is a conventional command name and remains understandable.

    Tool Count5/5

    Five tools are well-scoped for a 2FA account server focused on discovery, OTP retrieval, identity, and adding shared accounts. Each tool has a clear role without excessive surface area.

    Completeness3/5

    The set covers listing accounts, adding shared accounts, retrieving OTPs, and checking identity/groups. However, it lacks obvious lifecycle operations such as updating or removing accounts, which limits full account management.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI agents to securely perform privileged actions like creating GitHub issues by minting short-lived, single-purpose tokens on demand, with policy enforcement and audit logging.
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Enables AI agents to make authenticated API calls and run commands with secrets injected, while keeping credentials completely hidden from the model, with policy enforcement, grants, and audit logging.
      6
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Enables AI agents to securely manage local credentials, obtain short-lived tokens for authenticated API access, and audit every use by purpose.
      9
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables AI agents to look up stored logins by URL, name, or alias and use them without seeing the secrets, injecting authentication into HTTP requests, running commands with credentials in the environment and scrubbed output, and fetching 2FA codes, subject to per-credential policies and user approval.
      23
      MIT