home / mcp / otp mcp server

OTP MCP Server

Provides secure OTP generation via MCP with TOTP/HOTP and multiple transports.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "andreax79-otp-mcp": {
      "command": "otp-mcp-server",
      "args": [],
      "env": {
        "OTP_MCP_SERVER_DB": "YOUR_DATABASE_PATH",
        "OTP_MCP_SERVER_HOST": "YOUR_HOST",
        "OTP_MCP_SERVER_PATH": "YOUR_PATH",
        "OTP_MCP_SERVER_PORT": "YOUR_PORT",
        "OTP_MCP_SERVER_LOG_LEVEL": "YOUR_LOG_LEVEL",
        "OTP_MCP_SERVER_TRANSPORT": "YOUR_TRANSPORT"
      }
    }
  }
}

This MCP server provides secure One-Time Password generation using the Model Context Protocol. It supports both time-based (TOTP) and event-based (HOTP) algorithms and can communicate through multiple transports, making it easy to integrate OTP authentication into AI assistants and applications.

How to use

You interact with the OTP MCP server by connecting a compatible MCP client and requesting OTPs as needed. Choose the transport that fits your setup: standard input/output for local desktop workflows, or network transports to reach the server over HTTP Stream or SSE. The server is designed to generate secure OTP values on demand and can be integrated into authentication flows, MFA prompts, or any scenario requiring a short-lived, single-use code.

How to install

Prerequisites: ensure Python is available on your system.

# Install the MCP server from PyPI
pip install otp-mcp-server

# Or run in an isolated environment using uvx
uvx otp-mcp-server

Additional configuration and usage notes

You can run the server with different transports to suit your integration. The following commands illustrate common setups.

# Run with STDIO (default, suitable for Claude Desktop)
otp-mcp-server

# Run with HTTP Stream transport
otp-mcp-server --http-stream --host 127.0.0.1 --port 8000

# Run with SSE transport
otp-mcp-server --sse --host 127.0.0.1 --port 8000

Configuration essentials

Configuration can be done via command-line arguments or environment variables. The key environment variables shown are:

OTP_MCP_SERVER_DB
OTP_MCP_SERVER_HOST
OTP_MCP_SERVER_PORT
OTP_MCP_SERVER_TRANSPORT
OTP_MCP_SERVER_PATH
OTP_MCP_SERVER_LOG_LEVEL

Claude Desktop integration

To use this MCP server with Claude Desktop, define a server entry that runs the MCP command. The following example demonstrates a basic configuration:

{
  "mcpServers": {
    "otp": {
      "command": "uvx",
      "args": ["otp-mcp-server"]
    }
  }
}