Use TezTun from Claude Code & Claude Desktop

The TezTun CLI ships with a built-in Model Context Protocol server. Once configured, your AI assistant — Claude Code, Claude Desktop, Cursor, Zed, Windsurf — can read and manage your TezTun infrastructure directly in the conversation. Ask it "what's my webhook URL" or "show me my active tunnels" and it answers from your live account.

What you can do from the chat

Ask in chatTool called
"Am I logged in to TezTun? Which plan?"get_account
"List my active tunnels"list_tunnels
"Which subdomains have I reserved?"list_subdomains

More tools (create/revoke tokens, reserve/release subdomains, list custom domains) are shipping in upcoming releases.

Requirements

  1. The TezTun CLI installed on your machine, or the asadullokhn/teztun Docker image.
  2. A service token from app.teztun.uz/tokens. On Max plan tokens never expire — recommended for long-running editors. On Pro they're valid 3 days; on Free only 6 hours, which isn't practical.

Configuration

Three ways to run the server, pick whichever matches your setup. The npx one works everywhere Node.js is installed and is the recommended default.

Option A — npx (recommended)

No install. Works on any machine with Node 18+.

Claude Code

claude mcp add --scope user teztun \
  -e TEZTUN_TOKEN=tzt_your-token-here \
  -- npx -y @asadullokhn/teztun-mcp

Claude Desktop

{
  "mcpServers": {
    "teztun": {
      "command": "npx",
      "args": ["-y", "@asadullokhn/teztun-mcp"],
      "env": { "TEZTUN_TOKEN": "tzt_your-token-here" }
    }
  }
}

The @asadullokhn/teztun-mcp package is a thin launcher. It uses the teztun CLI if installed, otherwise falls back to the asadullokhn/teztun Docker image.

Option B — installed CLI

Faster to start (no docker / no npx). Install the TezTun CLI first.

Claude Code

claude mcp add --scope user teztun \
  -e TEZTUN_TOKEN=tzt_your-token-here \
  -- teztun mcp

Restart your Claude Code session. Type /mcp to confirm TezTun is listed and connected.

Claude Desktop

Edit the config file:

{
  "mcpServers": {
    "teztun": {
      "command": "teztun",
      "args": ["mcp"],
      "env": {
        "TEZTUN_TOKEN": "tzt_your-token-here"
      }
    }
  }
}

Quit and relaunch Claude Desktop. The tools show up in the tool picker.

Option C — explicit Docker

No Node, no CLI — just Docker. Useful for locked-down environments.

{
  "mcpServers": {
    "teztun": {
      "command": "docker",
      "args": [
        "run", "--rm", "-i",
        "-e", "TEZTUN_TOKEN",
        "asadullokhn/teztun:latest", "mcp"
      ],
      "env": { "TEZTUN_TOKEN": "tzt_your-token-here" }
    }
  }
}

Cursor, Zed, Windsurf

Each editor has its own MCP config file (~/.cursor/mcp.json, etc.) but the block shape is identical to Claude Desktop above. Paste the same "teztun" block.

What a session looks like

Once configured, a typical interaction:

You:  What's my current staging tunnel URL?
Claude:  [calls list_tunnels]
        You have 1 active tunnel:
          https://staging-api.ttn.uz  → app:3000
          1 active connection, started 18 minutes ago

You:  Which subdomains do I have reserved?
Claude:  [calls list_subdomains]
        You have 3 reserved subdomains on ttn.uz:
          staging-api  (in use by the tunnel above)
          hooks        (idle)
          demo         (idle)

Security

Troubleshooting

Tools don't show up in Claude Desktop. Check the client log: ~/Library/Logs/Claude/mcp*.log (macOS). Look for the teztun entry. Most common cause: teztun isn't in the PATH the GUI app inherits. Use an absolute path (/usr/local/bin/teztun) in the command field.

"TEZTUN_TOKEN environment variable is not set" in every tool result. The token didn't propagate — make sure it's in the env block of the config, not your shell environment. GUI apps don't inherit shell env.

All tool calls return 401. Token is revoked or expired. Mint a new one at app.teztun.uz/tokens and update your config.

Ready to wire it up?
Mint a service token, paste the config block, restart your editor.
Get a token