Telegram and MAX in ChatGPT, Claude or Gemini on the web

Connect Telegram and MAX to an AI chat such as ChatGPT, Claude or Gemini in your browser or mobile app. You do not need their desktop apps.

Use Telegram and MAX from an AI chat in your browser or mobile app: find messages, gather context and prepare replies. Setup takes a few commands and adding an address in your chat settings. You do not need to install the ChatGPT or Claude desktop apps. The app must support remote MCP over HTTP and OAuth sign-in compatible with this server; choose your app below.

This guide connects your chosen messenger and checks it with a request for your own chats. A program on your computer talks to the messenger; your AI chat reaches that program through a public address. MCP is the way these tools connect to an agent. Below, we will obtain the address and add it to the app. Keep the computer, the CLI’s MCP server and the HTTPS tunnel running while you use the connection. The messenger’s desktop app is not required.

On this page:

  1. Before starting
  2. 1. Prepare a public address
  3. 2. Get the address and start the connection
  4. 3. Add the connection to your AI chat
  5. Try reading first
  6. Choose what the agent may do
  7. It worked before, but stopped
  8. Run both messengers
  9. Stop, restart or revoke
  10. Troubleshooting
  11. How the connection works
  12. Connect without keeping your laptop awake

Before starting

  • Install the command-line tool for Telegram or MAX and sign into your account. A local agent is unnecessary for browser use: tg personal setup --agent none or max personal setup --agent none.
  • Use the computer running the tool for initial setup, and keep it awake while connected. The end of this page explains an always-on server option.
  • Your AI chat account needs an option for adding a custom connection. If it is missing in a work account, check with your administrator. The OpenAI instructions and Claude instructions show current options.

We will install the additional program for the public address in the next step, with instructions for what to click.

1. Prepare a public address

We use Tailscale, a program that makes the connection on your computer reachable over the internet. You do not need it on the phone or other device where you open your chat.

In WireCat Desktop, the Connect guide does this step for you. Open the tool, then MCP server (or connect web), Start and connect, and under Public address choose Tailscale Funnel. All your tools share one address, with a path for each tool. The guide Set up Tailscale Funnel for WireCat MCP has the steps for macOS, Windows and Linux.

Install Tailscale and sign in

  1. Open the download page and choose Windows, macOS or Linux.
  2. On Windows or macOS, download and run the installer, then open the app. Select the Tailscale icon near the Windows clock or in the macOS menu bar, then Log in. For Linux, follow the installation and login instructions.
  3. Sign in or create a Tailscale account in the browser that opens, and approve connecting your computer. It should appear in the device list.

Enable the secure address

  1. Open the DNS page in the Tailscale console.
  2. Under MagicDNS, select Enable MagicDNS if disabled. This gives the computer a name for its address.
  3. Under HTTPS Certificates, select Enable HTTPS and accept the displayed notice. This enables secure addresses; see the Tailscale instructions.
  4. The first command in the next step may show an approval link for Funnel, the public-access feature. Open it, sign into the same account and approve enabling it. Tailscale prepares the certificate and permission automatically. If access is refused, an administrator can use Access controls → Funnel → Add Funnel to policy: Funnel instructions.

2. Get the address and start the connection

Choose your operating system and open two terminal windows. Paste the first block into window 1: it prints an address such as https://computer.network.ts.net. If it first shows an approval link, complete item 4 above and return here.

Paste the second block into window 2 and supply the printed HTTPS address when asked, without /mcp. Keep :8443 if the address contains it. Leave both windows open. The profile's permissions decide what the agent may do; see choose what the assistant may do.

Windows · PowerShell

Install the Windows Tailscale app and sign in through its tray menu. Open fresh PowerShell windows after installing Node.js, the CLI and Tailscale so they see the updated PATH. Use .cmd CLI shims to avoid PowerShell execution-policy errors; initial setup is tg.cmd personal setup --agent none or max.cmd personal setup --agent none.

Run window 1 as Administrator for Funnel. & handles the space in the default installation path; adjust it if Tailscale is installed elsewhere. Run window 2 as your normal user, who logged into the messenger.

& "$env:ProgramFiles\Tailscale\tailscale.exe" funnel 8765
$mcpPublicUrl = Read-Host 'HTTPS origin from Funnel (no /mcp)'
tg.cmd personal mcp serve --http --port 8765 --public-url $mcpPublicUrl

For MAX, replace tg.cmd with max.cmd in window 2. Run both processes in native Windows. WSL has separate paths and loopback networking; do not mix its server with this Windows setup.

The server listens on 127.0.0.1:8765 and prints a one-time login code. A named profile goes before the command, for example tg work mcp serve; on Windows, tg.cmd work mcp serve.

Only the --http server has this login. Never point a tunnel at tg <profile> mcp serve or max <profile> mcp serve started without --http: that connection has no login at all.

3. Add the connection to your AI chat

Append /mcp to the HTTPS address. For example, https://computer.network.ts.net becomes https://computer.network.ts.net/mcp. This is the connection address, not the Telegram or MAX website. Create a separate connection for each messenger.

ChatGPT

  1. Open Plugins → + Add custom MCP server, give it a name such as “My Telegram”, and paste the address with /mcp.
  2. Choose OAuth, not a manually copied token. Choose automatic registration (DCR) if offered: the server supports DCR and the S256 check that OpenAI's OAuth requirements ask for. Sign in with the one-time code from window 2.
  3. Install the plugin, open a Work chat and select it with @. Then write ordinary requests. Official OpenAI instructions.

The same steps add the connection for Codex on the web. A local Codex config.toml configures only the local Codex client, not this connection.

Before entering the code, check that the sign-in page names the app you are connecting. The code works once and expires after 10 minutes; the server prints a new code after each login. After five wrong codes, login is locked until you restart the server.

Try reading first

Start a chat with the plugin or connector enabled:

Request
List my five most recent Telegram chats with their unread counts.

Then ask for a draft or, when you intend to send, name the recipient and exact text. Writing requests explains how to ask for review before sending.

Choose what the agent may do

The server can do what the profile's saved permissions allow. To narrow them for this running server only, add --permission messages.send=deny or --permission messages=readonly to the startup command; the flag only tightens, and an override that would loosen the profile is refused at startup. To allow sending, change the profile's permissions. The app controls its own approval prompts. Over MCP, ask does not force a server confirmation. For a connection that only reads, use a read-only profile.

The app's approval settings and the server's permission checks are separate controls. If you always allow a tool in the app and the server permits it, another call can send without asking again. Ask for a draft when you want to review the text first. Recipient restrictions and hourly limits still apply. See permissions for examples and how to change access.

It worked before, but stopped

A browser connection needs the computer running the command-line tool, its MCP server and the HTTPS tunnel. After sleep or a restart, use this order:

  1. Wake the computer and check the account in a terminal with tg personal account show or max personal account show. Use tg.cmd or max.cmd in PowerShell. If this fails, follow the login guide for Telegram or MAX.
  2. Restart the tunnel and server using the two windows above. Use the same profile and check that the HTTPS address still matches the connector. If it changed, update the server's public URL and the connector URL.
  3. Retry the five-chat request. If the app asks you to connect again, use the new one-time code printed by the running server.

Success means the agent lists the expected account’s chats. If it still fails, the checks below help distinguish a local account problem from a tunnel or app problem. Files need one additional step: a path on this computer does not give a browser agent the file. See file transfer for Telegram or MAX.

Run both messengers

Use separate local ports and public HTTPS endpoints. For example: Telegram on local 8765 and public 443; MAX on local 8766 and public 8443. For the second tunnel, use your OS's Tailscale invocation with funnel --https=8443 8766, and add --port 8766 to MAX. Copy its printed HTTPS origin including :8443 into MAX's startup command and append /mcp for its connector. Funnel's permitted public ports are 443, 8443 and 10000 (reference).

Stop, restart or revoke

  • Stop: Ctrl-C in both foreground windows stops that server and tunnel.
  • In the background: tg personal mcp server start --public-url "$mcpPublicUrl" runs the same server without a window. tg personal mcp server status shows it and its login code; tg personal mcp server stop stops it.
  • Restart: repeat the commands with the same profile and public URL. Browser logins survive ordinary restarts; they expire after 30 days without renewal.
  • Background Funnel: if you used --bg, Ctrl-C does not disable it. Check tailscale funnel status, then disable only that route with tailscale funnel --https=443 off (or 8443 for the second server). Use your OS's executable path and elevation above. Avoid funnel reset if you have another route: it clears them all.
  • Revoke app access: run tg personal mcp revoke or max personal mcp revoke; use tg.cmd / max.cmd in PowerShell. Apps must log in again. Your messenger account stays logged in.

Troubleshooting

  • No connection: append /.well-known/oauth-protected-resource/mcp to the origin and open it in a browser. You should see JSON. Otherwise check Funnel, its approval and the local port.
  • Reads work, sending fails after app approval: check the startup permissions and the effective permission. Use deny or readonly to refuse server-side changes; check the app's own approval settings.
  • PowerShell refuses scripts: use tg.cmd or max.cmd. If the command is missing, reopen PowerShell and check the CLI installation; do not change machine-wide execution policy.
  • No tools: tg personal mcp check or max personal mcp check checks the local handshake, not the tunnel or messenger login. An explicit account show command checks that account connection.
  • Port occupied: use another local port and point Funnel at the same number. For simultaneous servers, also give each route a distinct public HTTPS port as above.

How the connection works

From ChatGPT or Claude to your messages
ChatGPT · Claude
in your browser; their servers make the request
Tailscale Funnel
a public https address for one port of your computer
tg / max mcp serve --http
on your computer; asks for the login code, then a form before each change
Telegram · MAX
your own account

Connect without keeping your laptop awake

You can install tg or max on a separate server that stays running, and connect your AI chat to its address. You can then use your messenger from the chat while your laptop is off.

Install the tool on the server, sign into the chosen account, start its MCP connection and provide a public HTTPS address. Configure automatic startup after a reboot: both the CLI’s MCP server and its HTTPS tunnel must remain running. The server needs its own account login; your laptop installation does not connect it automatically.

Try this after the connection works on your computer. See remote setup for Telegram and MAX. Repeat the five-chat request after setup: if it works with your laptop off, the server is providing the connection.

Linux server: keep the connection running after logout and reboot
  1. Use one ordinary Linux user for installation, messenger login and the service. Install Node.js, the CLI and Tailscale, then log into the messenger as that user. First verify the five-chat request using the foreground commands above.
  2. Run tg personal mcp config or max personal mcp config. Take the absolute Node path from command and the CLI entry path from args; keep the profile name before mcp, because the server serves only the profile it names. Do not put account passwords or bot tokens in the service file.
  3. Create ~/.config/systemd/user/wirecat-mcp.service. Replace the two paths and public address in this template with the actual values. Use the same configuration/state directories as your successful login:
[Unit]
Description=WireCat messenger connection

[Service]
Type=simple
WorkingDirectory=%h
ExecStart=/absolute/path/to/node /absolute/path/to/cli-entry.js personal mcp serve --http --port 8765 --public-url https://server.tailnet.ts.net
Restart=on-failure
RestartSec=10

[Install]
WantedBy=default.target
  1. Enable the service with the commands below. An administrator must also enable lingering for that user, for example loginctl enable-linger wirecat, so user services can run without an active login. See systemd services and lingering.
systemctl --user daemon-reload
systemctl --user enable --now wirecat-mcp.service
systemctl --user status wirecat-mcp.service
  1. On the server, start the public address in the background with tailscale funnel --bg 8765, using the elevation required by your installation. The Funnel reference explains how it resumes after reboot. Its port must match the MCP service.
  2. Check that the service can access the same login and unlocked keyring. A running HTTP endpoint does not prove the messenger account is accessible. If login fails after reboot, restore the user’s keyring access; do not solve it by copying credentials into the unit.
  3. Close the SSH session, turn your laptop off and retry the chat request from the app. Repeat after a server reboot. Both the account access and the public address should work without a manual terminal launch.

To stop or disable automatic startup:

systemctl --user stop wirecat-mcp.service
systemctl --user disable wirecat-mcp.service

journalctl --user -u wirecat-mcp.service -n 30 helps diagnose startup. It can include the one-time app connection code; use that code for your own sign-in and do not publish the full log. Other server platforms use their own service manager with the same account/path checks.