KosmoKrator

communication

Telegram MCP Integration for OpenAI Agents SDK

Connect Telegram to OpenAI Agents SDK through the local KosmoKrator MCP gateway with scoped tools, credentials, and write policy.

7 functions 5 read 2 write Bearer token auth

Connect Telegram to OpenAI Agents SDK

Attach KosmoKrator integration tools to OpenAI Agents SDK workflows through a local MCP gateway.

Start the KosmoKrator MCP gateway locally and point the OpenAI Agents SDK MCP tool at that process or wrapper. The gateway is local, scoped to this integration, and starts with --write=deny so OpenAI Agents can inspect read-capable tools without receiving write access by default.

Telegram MCP Config for OpenAI Agents SDK

Use headless JSON commands for CI-style execution and MCP for agent tool discovery.

{
  "mcpServers": {
    "kosmokrator-telegram": {
      "type": "stdio",
      "command": "kosmo",
      "args": [
        "mcp:serve",
        "--integration=telegram",
        "--write=deny"
      ]
    }
  }
}

Run the Gateway Manually

kosmokrator mcp:serve --integration=telegram --write=deny

Why Use KosmoKrator Here

Scoped tools

Expose only Telegram instead of a broad multi-service tool list.

Local credentials

Reuse credentials already configured for the KosmoKrator CLI and Lua runtime.

Write policy

Start read-only, then opt into ask or allow for trusted workspaces.

Telegram Tools Visible to OpenAI Agents

OpenAI Agents sees stable MCP tool names generated from the Telegram integration catalog.

MCP toolSource functionTypeDescription
integration__telegram__telegram_send_message telegram.telegram_send_message Write Send a text message to a Telegram chat. Provide the chat_id and message text. The chat_id can be a numeric ID or @channelusername. Supports optional parse_mode (Markdown, MarkdownV2, HTML) and other formatting options.
integration__telegram__telegram_list_updates telegram.telegram_list_updates Read Get incoming updates (messages, callback queries, inline queries, etc.) for the Telegram bot. Use offset to acknowledge previously received updates. Returns an array of update objects.
integration__telegram__telegram_get_me telegram.telegram_get_me Read Get information about the authenticated Telegram bot. Returns the bot ID, username, display name, and capability flags.
integration__telegram__telegram_list_chats telegram.telegram_list_chats Read List recent chats the bot has interacted with. Since Telegram Bot API does not have a native list-chats endpoint, this fetches recent updates and extracts unique chats. Returns chat IDs, types, and titles.
integration__telegram__telegram_get_chat telegram.telegram_get_chat Read Get information about a specific Telegram chat by its ID or @username. Returns chat type, title, description, member count, and other metadata.
integration__telegram__telegram_send_photo telegram.telegram_send_photo Write Send a photo to a Telegram chat. Provide the chat_id and a photo URL or file_id. Supports optional caption with formatting and other options.
integration__telegram__telegram_get_current_user telegram.telegram_get_current_user Read Get the profile of the currently authenticated Telegram bot. Returns bot ID, username, display name, and capability flags.

Related Telegram Pages