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
- Claude (claude.ai, desktop, mobile): open Customize → Connectors and click Add custom connector. Set the name to
MCTL Assistant, the MCP server URL tohttps://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. - Claude Code: add the server, then run
/mcpto sign in.claude mcp add --transport http --scope user mctl https://tg-preview.mctl.ai/mcp - ChatGPT: open Plugins → Personal, choose Add → Add custom MCP server, set the name to
MCTL Assistant, the server URL tohttps://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. - Any other MCP client (for example Gemini, Cursor, VS Code, Notion, Rayrun or Hermes Agent, all not tested): add
https://tg-preview.mctl.ai/mcpas 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.
| Client | Status | Notes |
|---|---|---|
| Claude (web, desktop, mobile) | works | Connects by URL through CIMD. Signed in and called tools against tg.mctl.ai (observed 2026-11-22). |
| Claude Code | works | Loopback sign-in is always accepted. Signed in and called tools against tg.mctl.ai (observed 2026-11-22). |
| ChatGPT (by URL) | works | CIMD. Signed in and called tools against tg.mctl.ai (observed 2026-11-22). MCP Apps are deferred. |
| Grok (grok.com) | works | Admitted 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 tested | Hosts are admitted; no sign-in is verified. Tracked in #1386. |
| Cursor | not tested | Hosted callback is admitted; the cursor:// scheme is refused, so sign-in may fail. Tracked in #1385. |
| Notion (app.notion.com) | not tested | Not admitted yet. Tracked in #1382. |
| Rayrun (ray.run) | not tested | Not admitted yet. Tracked in #1383. |
| Hermes Agent | not tested | Signs in from a per-user subdomain of agentspodium.com, which cannot be admitted as one host. Tracked in #1384. |
| VS Code | not tested | CIMD host admitted; no run is recorded. |
| Town | works | Admitted with a restricted reply-only tool profile, which applies. Signed in and called tools against tg.mctl.ai (observed 2026-11-22). |
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
S256only. Platforms that connect many users: see /platforms.
First sign-in
- 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.
- 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_consentor on the manage page. - 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.
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.
| Tool | Mode | Scope required | Notes |
|---|---|---|---|
list_dialogs | read | telegram:dialogs:read | Your chats with type, title, username, and unread count. limit (default 50, up to 200), optional query. |
get_messages | read | telegram:messages:read | Recent history of one chat, not just unread. |
get_unread_messages | read | telegram:messages:read | Unread messages, optionally for one chat. limit up to 200. |
search_messages | read | telegram:messages:read | query, 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_media | read | telegram:messages:read | Inspect a message's media, then download it with the returned confirmation_id. |
send_message, prepare_send_message | write | telegram:messages:send | Send 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_media | write | telegram:messages:send | Photo, 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_reaction | write | telegram:messages:send | Edit your own message, delete, forward between chats, add or remove a reaction. Send gate applies. |
prepare_pin_message, pin_message | write | telegram:messages:pin | Pin 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_reply | write | telegram:messages:send | Only 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_log | read | any signed-in connection | Who you are signed in as, whether a send would really be delivered, and your own audit log. |
set_send_consent | write | account:manage | Turn real sending on or off for your own account. |
get_my_notification_preferences, set_my_notification_preferences | read write | account:manage | Product update, maintenance, and security notices from the login bot. |
disconnect_telegram_account, delete_telegram_account | write | account:manage | Soft revoke or hard delete — see Your controls. |
list_assistants | read | any signed-in connection | The 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_install | write | account:manage | Install 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_device | write | account:manage | Revoke 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.
| Scope | Grants |
|---|---|
telegram:dialogs:read | List chats |
telegram:messages:read | Read, search, and download media |
telegram:messages:send | Send, edit, delete, forward, and react — subject to your own send consent |
telegram:messages:pin | Pin and unpin, through a confirmation step |
account:manage | Your 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, orPOST /api/account/disconnect, from a connection grantedaccount:manage; or, on deployments with the Telegram manage page enabled, sign in at/telegram/connect/managein 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, orDELETE /api/account, from a connection grantedaccount: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/accountreturns connection state, display name, and the per-accountsend_enabledflag. - Audit log:
get_my_audit_logMCP tool orGET /api/account/audit— newest-first, RFC 3339beforecursor for keyset pagination. - Verify your audit chain:
GET /api/account/audit/verifyrecomputes 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 a403on 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).
- Overview: /docs/local-bridge — when to use it and what it changes.
- Quick start: /docs/local-bridge/quickstart — install and the four commands.
- Owner: /docs/local-bridge/owner —
set_send_consent, manage page, revoke a device. - How it works: /docs/local-bridge/how-it-works — activation, proof of possession, read-only first token.
- Support: /docs/local-bridge/support — migration, troubleshooting, emergency. Not onboarding.
- Legacy: /docs/local-bridge/legacy —
connect --token.