{"slug": "giving-claude-access-to-your-telegram-the-two-setups-and-why-the-difference", "title": "Giving Claude access to your Telegram: the two setups, and why the difference matters", "summary": "A developer's comparison of Telegram MCP servers reveals two distinct setups with vastly different security implications: Bot API servers authenticate with a revocable bot token and only access chats the bot is added to, while MTProto servers log in as the user via a session file, exposing all private messages and contacts. The developer warns that session files are live logins that can be stolen or manipulated through prompt injection, and highlights configuration pitfalls such as Codex CLI requiring TOML instead of JSON.", "body_md": "You can give Claude access to your Telegram in about five minutes. Whether that is a good idea depends entirely on which of two very different setups you pick — and most tutorials do not tell you there are two.\n\nI went through the available Telegram MCP servers while writing a setup guide, and the gap between them is much bigger than the feature lists suggest.\n\nMCP — the Model Context Protocol — is the standard that lets AI clients call outside tools. Write one server, and Claude Desktop, Cursor, Windsurf and Codex CLI can all use it. For Telegram, that means an agent can read, search and send messages.\n\nThe important question is what the server *logs in as*.\n\n**Bot API servers** authenticate with a bot token from `@BotFather`\n\n. A bot can only see chats it was explicitly added to. Your private conversations are invisible to it, and the token is revocable from BotFather in one command.\n\n**MTProto servers** authenticate with your phone number and store a session file. They log in *as you*. That means every private DM, every group you lurk in, your saved messages, your contacts — all of it becomes reachable by the agent.\n\nBoth are described as \"a Telegram MCP server.\" Only one of them hands over your account.\n\n**Bot API** — no install step, `uvx`\n\nfetches it:\n\n```\n{\n  \"mcpServers\": {\n    \"telegram-bot\": {\n      \"command\": \"uvx\",\n      \"args\": [\"telegram-bot-mcp\"],\n      \"env\": {\n        \"TELEGRAM_BOT_TOKEN\": \"<token from @BotFather>\"\n      }\n    }\n  }\n}\n```\n\n**Send-only** — the narrowest option. The agent can push build alerts and job results to one chat and read nothing at all:\n\n```\n{\n  \"mcpServers\": {\n    \"telegram-notifier\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@harnyk/telegram-notifier-mcp\"],\n      \"env\": {\n        \"TELEGRAM_BOT_TOKEN\": \"<token from @BotFather>\",\n        \"TELEGRAM_CHAT_ID\": \"<your chat id>\"\n      }\n    }\n  }\n}\n```\n\n**MTProto** — needs a real install and a one-time interactive login:\n\n```\nuv tool install mcp-telegram\nmcp-telegram login\n{\n  \"mcpServers\": {\n    \"mcp-telegram\": {\n      \"command\": \"mcp-telegram\",\n      \"args\": [\"start\"],\n      \"env\": {\n        \"API_ID\": \"<from my.telegram.org>\",\n        \"API_HASH\": \"<from my.telegram.org>\"\n      }\n    }\n  }\n}\n```\n\nNote the env var names: `API_ID`\n\nand `API_HASH`\n\n, not `TELEGRAM_API_ID`\n\n. I got that wrong on my first pass by assuming, and the server simply refused to start. Read the README rather than pattern-matching from another server's config.\n\nThis trips people up more than the servers themselves, because every client puts it somewhere different:\n\n| Client | Path |\n|---|---|\n| Claude Desktop | `~/Library/Application Support/Claude/claude_desktop_config.json` |\n| Cursor | `~/.cursor/mcp.json` |\n| Windsurf | `~/.codeium/windsurf/mcp_config.json` |\n| Codex CLI | `~/.codex/config.toml` |\n\n**Codex CLI takes TOML, not JSON.** Pasting the block above into it will not parse, and the error message does not make the reason obvious. The equivalent is:\n\n```\n[mcp_servers.telegram-bot]\ncommand = \"uvx\"\nargs = [\"telegram-bot-mcp\"]\n\n[mcp_servers.telegram-bot.env]\nTELEGRAM_BOT_TOKEN = \"<token from @BotFather>\"\n```\n\nAlso: with Claude Desktop, closing the window is not enough. Quit it properly, or the server will not appear.\n\nA session file is not a scoped token. It is a live login. Anything that can read it can read your Telegram, and it does not expire the way a rotated password would — revoking means terminating the session from Telegram's device list.\n\nThat alone is a reason to keep it out of synced folders and off anything you might `git push`\n\n. But there is a second issue that needs no theft at all.\n\nYour agent reads messages. It also sends them. To an LLM there is no structural difference between \"data\" and \"instruction\" — it is all text in the context window. So a message crafted to look like a command is an attack surface, and someone wanting to try it only has to message you.\n\nThe blast radius on a bot token is your bot's chats. On a session file, it is your whole account.\n\nNone of this makes MTProto servers unusable. It makes them a deliberate choice rather than a default. If you need to search your own history across every chat, that is what it takes. In that case: use a secondary account, keep the session file out of any repo or synced directory, and give the agent read tools before you give it send tools, so a bad prompt cannot message a real person while you are still testing.\n\nEvery one of these servers is a community project. Open source, useful, and with no security audit behind them. Read what you are running before you point it at an account that matters.\n\nI wrote the full version up with a config generator — pick your client and access level, and it outputs the exact block plus the right file path for that client, including the TOML variant: [Telegram MCP Server: Connect Telegram to Claude, Cursor & AI Agents](https://starsearn.com/guides/telegram-mcp-server)\n\nIf you have shipped something with a Telegram MCP setup, I would genuinely like to hear which type you went with and why — especially if you picked MTProto and have a workflow for keeping it contained.", "url": "https://wpnews.pro/news/giving-claude-access-to-your-telegram-the-two-setups-and-why-the-difference", "canonical_source": "https://dev.to/starsearn/giving-claude-access-to-your-telegram-the-two-setups-and-why-the-difference-matters-3mej", "published_at": "2026-08-03 23:05:50+00:00", "updated_at": "2026-08-03 23:40:03.255999+00:00", "lang": "en", "topics": ["developer-tools", "ai-agents", "ai-safety"], "entities": ["Claude", "Telegram", "MCP", "BotFather", "Cursor", "Windsurf", "Codex CLI"], "alternates": {"html": "https://wpnews.pro/news/giving-claude-access-to-your-telegram-the-two-setups-and-why-the-difference", "markdown": "https://wpnews.pro/news/giving-claude-access-to-your-telegram-the-two-setups-and-why-the-difference.md", "text": "https://wpnews.pro/news/giving-claude-access-to-your-telegram-the-two-setups-and-why-the-difference.txt", "jsonld": "https://wpnews.pro/news/giving-claude-access-to-your-telegram-the-two-setups-and-why-the-difference.jsonld"}}