All posts
July 12, 2026·2 min read

How to Connect Telegram to an AI Model Through MCP

A step-by-step walkthrough of giving an AI agent access to Telegram through MCP — reading messages from chats and channels, building summaries, and sending replies, using the Doka desktop agent as the example.

Telegram is where half of work conversations happen. It makes sense to give an agent access to it: let it build a summary from a work channel on its own, find a specific message, or send a reply. This is done through MCP — here's how, step by step.

What this gets you

With Telegram connected, an agent can:

  • Build summaries — "recap what was discussed in the work chat today."
  • Search — "find the message where we discussed the project deadline."
  • Send — draft and send a reply or notification.

It's especially useful paired with schedules: the agent brings you a digest of channels by morning while you're asleep.

What you'll need

Three things:

  1. Telegram API keys. Telegram issues these at my.telegram.org — the "API development tools" section. You'll get an api_id and api_hash there. These are your personal keys, treat them like a password.
  2. A ready-made Telegram MCP server. There are several open implementations — pick one and check its README: it lists the launch command and which environment variables you'll need.
  3. Doka with the "MCP Servers" tab (it's in the desktop app).

api_id and api_hash are access to your account. Don't post them anywhere or paste them into chats. In Doka they're stored locally, in the server's settings on your own machine.

Connecting it, step by step

  1. Get your api_id and api_hash at my.telegram.org.
  2. Pick a Telegram MCP server and check its README — grab the launch command and the list of environment variables from there (usually api_id, api_hash, and a session identifier).
  3. In Doka, open the right panel → "MCP Servers""+ Add server."
  4. Fill in the form: a name (like "Telegram"), the launch command, and its arguments.
  5. Under environment variables, enter the keys as KEY=VALUE, one per line — take the variable names from the server's README.
  6. Flip the toggle and save.

Done. On the next task the agent will see the Telegram tools and be able to use them. The exact command and variable names depend on which server implementation you picked — check its documentation.

How this works under the hood

The MCP server runs locally, as a regular process on your computer. It connects to Telegram directly using your own keys — Doka doesn't proxy the conversation through anyone else's cloud. The general pattern for connecting any server is covered in the article on useful MCP servers.

The bottom line

With Telegram access, an agent goes through the conversation and brings you a summary instead of you scrolling chats by hand. All you need is your own keys from my.telegram.org and a ready-made server — everything else is a couple of fields in settings. Download Doka for free.