MCTL
Developer reference

Developer reference

Connection details, tool catalog, scopes, and account controls for the MCTL MCP server.

Deploying your own services? See the MCTL platform documentation for platform setup, GitOps deployment and MCP integrations, or explore the MCTL developer platform.

Connect a client

  1. Claude (claude.ai, desktop, mobile): open Customize → Connectors and click Add custom connector. Set the name to MCTL Assistant, the MCP server URL to https://tg-preview.mctl.ai/mcp, and keep the default sign-in settings. Team and Enterprise Owners add it under Organization settings → Connectors. For a step-by-step guide, see Connect in Claude.
  2. Claude Code: add the server, then run /mcp to sign in.
    claude mcp add --transport http --scope user mctl https://tg-preview.mctl.ai/mcp
  3. ChatGPT: open Plugins → Personal, choose Add → Add custom MCP server, set the name to MCTL Assistant, the server URL to https://tg-preview.mctl.ai/mcp, authentication to OAuth, and click Create as a plugin. MCTL is not listed in the public plugin directory; adding it as your own plugin is the supported path.
  4. Any other MCP client (for example Gemini, Cursor, VS Code, Notion, Rayrun or Hermes Agent, all not tested): add https://tg-preview.mctl.ai/mcp as a remote MCP server (Streamable HTTP) by URL, choose OAuth, and sign in with Telegram when the client opens the browser. No client ID or secret is needed. A client works only if its sign-in host is admitted on tg.mctl.ai; if the client reports a rejected redirect or a failed registration, it is not admitted yet. See the status table below, and for per-client snippets the Other MCP clients tab.

Client status

Status words follow the compatibility matrix: works means a recorded run completed sign-in and a tool call against tg.mctl.ai; works with caveats means it completed with a stated limitation; not tested means anything else, including a host that is only admitted. A client is never listed as working without a recorded run.

ClientStatusNotes
Claude (web, desktop, mobile)worksConnects by URL through CIMD. Signed in and called tools against tg.mctl.ai (observed 2026-11-22).
Claude CodeworksLoopback sign-in is always accepted. Signed in and called tools against tg.mctl.ai (observed 2026-11-22).
ChatGPT (by URL)worksCIMD. Signed in and called tools against tg.mctl.ai (observed 2026-11-22). MCP Apps are deferred.
Grok (grok.com)worksAdmitted on 2026-11-21. Signed in and called tools against tg.mctl.ai (observed 2026-11-22). Matrix run tracked in #1381.
Gemini and Google (Gemini custom connectors, Antigravity)not testedHosts are admitted; no sign-in is verified. Tracked in #1386.
Cursornot testedHosted callback is admitted; the cursor:// scheme is refused, so sign-in may fail. Tracked in #1385.
Notion (app.notion.com)not testedNot admitted yet. Tracked in #1382.
Rayrun (ray.run)not testedNot admitted yet. Tracked in #1383.
Hermes Agentnot testedSigns in from a per-user subdomain of agentspodium.com, which cannot be admitted as one host. Tracked in #1384.
VS Codenot testedCIMD host admitted; no run is recorded.
TownworksAdmitted with a restricted reply-only tool profile, which applies. Signed in and called tools against tg.mctl.ai (observed 2026-11-22).

Your client does not work? Write to [email protected].

OAuth

  • Discovery: MCTL is its own authorization server. Clients find it through https://tg-preview.mctl.ai/.well-known/oauth-protected-resource and https://tg-preview.mctl.ai/.well-known/oauth-authorization-server.
  • Client registration: tg.mctl.ai supports both Client ID Metadata Documents (CIMD — what Claude uses by default) and Dynamic Client Registration, so no client ID or secret has to be entered by hand. A self-hosted deployment advertises CIMD only when it is enabled; /platforms shows this deployment's live setting. Authorization code with PKCE S256 only. Platforms that connect many users: see /platforms.

First sign-in

  1. Sign in with Telegram in the browser window your client opens (Telegram's own OpenID Connect login). On Telegram’s sign-in screen, turn on Allow messages so the MCTL login bot can send you setup help and the notifications you choose. Telegram leaves it off unless you switch it on, and you can sign in either way.
  2. Permissions: if the server has no Telegram session for you yet, choose Read only (the default) or Read + send. You can change it later with set_send_consent or on the manage page.
  3. Phone number: enter it, then the login code Telegram sends to your Telegram app, and your two-step verification password if you use one. The server stores an AES-256-GCM-encrypted MTProto session keyed to your Telegram identity, and the connector is ready.

Available tools

A connection sees only the tools its scopes allow: tools/list is filtered by the token, and a call to any other tool is refused as an unknown tool. The full surface, with input schemas and readOnlyHint/destructiveHint annotations, is committed as docs/tool-descriptors.json, and every change to it is announced in product updates.

Send gate

Every write tool that acts in Telegram runs only when the send gate is open: the server has ALLOW_SEND=true (on for tg.mctl.ai), the connection holds the tool's scope, and your own account has send_enabled=true. A new read-only account starts with send_enabled=false. While the gate is closed, send_message and send_media return a preview (sent=false with a dry_reason) and the other write tools are refused with the reason, so nothing changes in Telegram.

ToolModeScope requiredNotes
list_dialogsreadtelegram:dialogs:readYour chats with type, title, username, and unread count. limit (default 50, up to 200), optional query.
get_messagesreadtelegram:messages:readRecent history of one chat, not just unread.
get_unread_messagesreadtelegram:messages:readUnread messages, optionally for one chat. limit up to 200.
search_messagesreadtelegram:messages:readquery, optional peer, limit (default 20, up to 100), min_date/max_date (inclusive UTC, RFC 3339 or YYYY-MM-DD). Newest first.
prepare_get_media, get_mediareadtelegram:messages:readInspect a message's media, then download it with the returned confirmation_id.
send_message, prepare_send_messagewritetelegram:messages:sendSend a text message; prepare_send_message snapshots it for confirmation first. No mode argument: the send gate decides between a real send and a preview.
send_mediawritetelegram:messages:sendPhoto, video, document, animation, or voice note with an optional caption. Send gate applies; a closed gate returns a preview.
edit_message, delete_messages, forward_messages, set_reactionwritetelegram:messages:sendEdit your own message, delete, forward between chats, add or remove a reaction. Send gate applies.
prepare_pin_message, pin_messagewritetelegram:messages:pinPin or unpin after a confirmation step. Needs pin rights in the chat; send gate applies, with this scope in place of telegram:messages:send.
draft_reply, send_replywritetelegram:messages:sendOnly on connections bound to the restricted core-reply profile. draft_reply sends nothing and returns the exact recipient, the forum topic when topic_id is given, and the text; send_reply takes only the server-issued confirmation and sends once. Send gate applies.
get_my_identity, get_my_send_status, get_my_audit_logreadany signed-in connectionWho you are signed in as, whether a send would really be delivered, and your own audit log.
set_send_consentwriteaccount:manageTurn real sending on or off for your own account.
get_my_notification_preferences, set_my_notification_preferencesread writeaccount:manageProduct update, maintenance, and security notices from the login bot.
disconnect_telegram_account, delete_telegram_accountwriteaccount:manageSoft revoke or hard delete — see Your controls.
list_assistantsreadany signed-in connectionThe assistants you can install, the values each asks for, and which one your account runs, with its install revision. Never your stored values or notes.
install_assistant, update_installwriteaccount:manageInstall an exact assistant version on your own account (paused and not listening until you say otherwise), or change it with a merge patch against its install_revision; a stale revision changes nothing.
revoke_local_bridge_devicewriteaccount:manageRevoke one of your Local Bridge devices and evict a live daemon. See owner controls.

Operator tools (admin:users, admin:users:read) and broadcast tools (admin:broadcast) are listed in the descriptor file and are never shown to a regular user's connection.

Scopes and permissions

Scopes come from your Telegram identity. On tg.mctl.ai registration is open, so every signed-in user is in the client tier (a self-hosted deployment may instead require an operator grant, see below) and gets the scopes below for their own account. A client asks for a subset by naming scopes in the authorization request; omitting scope grants the full entitled set. Administrative scopes cannot be requested.

ScopeGrants
telegram:dialogs:readList chats
telegram:messages:readRead, search, and download media
telegram:messages:sendSend, edit, delete, forward, and react — subject to your own send consent
telegram:messages:pinPin and unpin, through a confirmation step
account:manageYour own account: send consent, notifications, Local Bridge devices, disconnect, and delete

An operator can also bind a client to a restricted tool profile, which can only remove tools: core-readonly (reads only) or core-reply (reads plus the two-step draft_reply/send_reply). The design is in docs/design/core-profiles.md.

Self-hosting: operators on TG_LOGIN_ADMINS also get admin:users (and admin:broadcast when listed in BROADCAST_OPERATORS); TG_LOGIN_LOOKUP_ADMINS get only the read-only admin:users:read. Without AUTO_APPROVE_CLIENTS, the client tier comes from TG_LOGIN_CLIENTS or an operator grant, and an operator can revoke any user with set_telegram_access.

What we store

  • Telegram session: an AES-256-GCM-sealed MTProto session blob with a per-user HKDF-derived key, kept until you disconnect (erased, row marked revoked) or delete (row removed). Either one also asks Telegram to end the session.
  • Audit log: tool name, redacted peer reference, status, and error — never the message body, phone number, or session bytes. Kept for 90 days by default.
  • Account row: your Telegram ID and access tier. Deleting your account clears your username, names, and last-seen time; the ID stays so a later sign-in is matched and an authorization code issued before the delete cannot be used after it.

The main stores and their retention are listed in the privacy policy.

Your controls

  • Disconnect (soft): call MCP tool disconnect_telegram_account, or POST /api/account/disconnect, from a connection granted account:manage; or, on deployments with the Telegram manage page enabled, sign in at /telegram/connect/manage in a browser and press Disconnect, which works whatever a connector was narrowed to. Marks the session revoked, erases the sealed session, immediately tears down the in-memory MTProto client, and asks Telegram to end the session.
  • Delete (hard): call MCP tool delete_telegram_account, or DELETE /api/account, from a connection granted account:manage. Removes the encrypted session blob and per-account data, asks Telegram to end the session, and revokes every credential issued for the account: every OAuth client's refresh tokens, every worker token, and every Local Bridge device with its credential. Audit rows stay until their retention window ends, and the account row keeps your Telegram ID; the privacy policy has the details.
  • Status: GET /api/account returns connection state, display name, and the per-account send_enabled flag.
  • Audit log: get_my_audit_log MCP tool or GET /api/account/audit — newest-first, RFC 3339 before cursor for keyset pagination.
  • Verify your audit chain: GET /api/account/audit/verify recomputes the SHA-256 hash chain over your rows and reports {ok, verified} or {ok:false, first_bad_id, reason}.
  • Revoke from Telegram's side: Telegram app → Settings → Devices → close the session named after this app. This will not delete data here but will sever the MTProto link Telegram-side. Use it if a device stays listed after a disconnect, because the request to Telegram is best effort.
  • Read-only and device credentials: worker tokens and Local Bridge device credentials never carry account:manage, so they cannot disconnect or delete the account they were issued for. The refusal is a 403 on the HTTP paths, the tool is not listed over MCP, and every refusal is recorded in your audit log.

Smoke test from your terminal

Confirm the well-known and the OAuth challenge before adding the connector. Without a token, the second call returns 401 with a WWW-Authenticate header that points at the well-known:

curl -s https://tg-preview.mctl.ai/.well-known/oauth-protected-resource

curl -si -X POST https://tg-preview.mctl.ai/mcp \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize",
       "params":{"protocolVersion":"2025-03-26","capabilities":{},
                 "clientInfo":{"name":"smoke","version":"0"}}}'

Local Bridge (beta)

Local Bridge is an optional mode in which the Telegram session lives on a machine you control and this server forwards each tool call to a daemon running there, instead of opening Telegram itself. It costs you a machine that stays on, so it is not part of the standard install path — but a new account can be provisioned so this server never holds a session at all, and turning it on is self-service: init, login, activate, daemon. Migrating an existing hosted account into this mode still uses set_account_mode (support, not onboarding).