Enables interaction with the Telegram Bot API across multiple accounts. It provides tools for sending various message types (text, photos, documents, polls, stickers, location), managing chat content (editing, deleting, pinning), and retrieving chat or member information.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Straight ConnectCheck for new messages on my Nietzsche account"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Straight Connect

MCP server for communication service connectors. Currently supports Telegram with multi-account configuration. Designed for extensibility — more services (Slack, Discord, email, etc.) can be added later.
Architecture
mcp/
├── server.py # FastAPI + FastMCP entry point
├── telegram_service.py # Shared Telegram service layer
├── telegram_api.py # REST API routes
├── telegram.py # MCP tool definitions + config
├── requirements.txt # Server dependencies
└── Dockerfile
src/
├── config.py # Generates mcp.json from .env
└── chat.py # Gradio + LangChain ReAct chat app
docker-compose.yaml
pyproject.toml
.env # Your configuration (not committed)
.env.example # Configuration templateThe server exposes two interfaces:
MCP for AI agent tool use
REST API for direct HTTP access
Both interfaces use the same underlying TelegramService layer, ensuring consistent behavior.
Setup
Copy the environment template and fill in your values:
cp .env.example .envGet bot tokens from @BotFather on Telegram and add them to
.env.Start the MCP server:
docker compose up --build -dVerify it's running:
docker compose logs mcpConfiguration
All configuration lives in .env. See .env.example for the full template.
Telegram Accounts
# Comma-separated account labels
TELEGRAM_ACCOUNTS=nietzsche,aurelia
# Per-account bot tokens (label uppercased)
TELEGRAM_NIETZSCHE_BOT_TOKEN=your-token-here
TELEGRAM_AURELIA_BOT_TOKEN=your-token-hereTool Levels
Control which Telegram tools are available per account. Set a global default and optionally override per account:
# Global default
TELEGRAM_LEVEL=basic
# Per-account override
TELEGRAM_NIETZSCHE_LEVEL=standard
TELEGRAM_AURELIA_LEVEL=fullLevel | Tools (cumulative) |
basic |
|
standard | + |
advanced | + |
full | + |
Allowed Chats
Optionally restrict which chats a bot account can interact with. If set, any tool call targeting a chat not in the list will be rejected. If not set, all chats are allowed.
# Comma-separated chat IDs (user IDs, group IDs, @channel_usernames)
TELEGRAM_NIETZSCHE_ALLOWED_CHATS=123456789,-1001234567890
TELEGRAM_AURELIA_ALLOWED_CHATS=987654321,@mychannelThis applies to all tools that take a chat_id parameter. For forward_message and copy_message, both source and destination chats are checked.
Allowed User IDs
Restrict which Telegram users a bot account will interact with. Incoming updates from non-listed users are silently filtered out by get_updates. If not set, all users are allowed and a warning is logged at startup.
TELEGRAM_NIETZSCHE_ALLOWED_USER_IDS=123456789
TELEGRAM_AURELIA_ALLOWED_USER_IDS=5138099108,987654321MCP Port
MCP_PORT=9831Chat Model
Used by uv run chat for the Gradio test interface:
OPENAI_API_BASE=http://localhost:8000/v1
OPENAI_API_KEY=not-needed
CHAT_MODEL=openai:your-model-nameMCP Endpoints
Each account gets its own endpoint scoped by service and account label:
http://localhost:9831/mcp/telegram/<account>Examples:
http://localhost:9831/mcp/telegram/nietzschehttp://localhost:9831/mcp/telegram/aurelia
There is no shared /mcp endpoint — each URL is exclusive to one account. This enables MCP clients to connect per-account with distinct tool namespaces.
REST API
A REST API is available alongside MCP for direct HTTP access. Both interfaces use the same underlying service layer.
Base URL: http://localhost:9831/api/telegram/{account}/...
Swagger docs: http://localhost:9831/docs
Endpoints
Method | Endpoint | Description | Level |
GET |
| Get bot info | basic |
POST |
| Send a message | basic |
GET |
| Get updates (with auto-acknowledge) | basic |
POST |
| Forward a message | standard |
PUT |
| Edit a message | standard |
DELETE |
| Delete a message | standard |
POST |
| Send a photo | standard |
POST |
| Send a document | standard |
GET |
| Get chat info | advanced |
POST |
| Send a location | advanced |
POST |
| Send a poll | advanced |
POST |
| Pin a message | advanced |
POST |
| Unpin a message | advanced |
GET |
| Get member count | advanced |
GET |
| Get member info | advanced |
POST |
| Send audio | full |
POST |
| Send video | full |
POST |
| Send voice message | full |
POST |
| Send sticker | full |
POST |
| Copy a message | full |
POST |
| Set reaction | full |
POST |
| Leave chat | full |
POST |
| Send contact | full |
POST |
| Send venue | full |
Examples
# Get bot info
curl http://localhost:9831/api/telegram/aurelia/me
# Send a message
curl -X POST http://localhost:9831/api/telegram/aurelia/chats/123456789/messages \
-H "Content-Type: application/json" \
-d '{"text": "Hello!"}'
# Get updates (auto-acknowledged)
curl "http://localhost:9831/api/telegram/aurelia/updates?limit=10"
# Get updates without acknowledging
curl "http://localhost:9831/api/telegram/aurelia/updates?auto_acknowledge=false"Client Tools
Generate mcp.json
Print the MCP client configuration derived from your .env:
uv run configOutput:
{
"mcpServers": {
"nietzsche": {
"url": "http://localhost:9831/mcp/telegram/nietzsche"
},
"aurelia": {
"url": "http://localhost:9831/mcp/telegram/aurelia"
}
}
}Chat Interface
Launch a Gradio web UI that connects to all configured MCP servers with a LangChain ReAct agent:
uv run chatOn startup it will:
Connect to each configured MCP server
List all available tools per account
Test the configured chat model
Launch the Gradio interface
Tool names are prefixed with the account label for disambiguation (e.g., nietzsche_telegram_send_message, aurelia_telegram_get_updates).
How It Works
Shared service layer: Both MCP tools and REST API use
TelegramServicefor all Telegram operations, ensuring consistent behaviorURL routing: ASGI middleware rewrites
/mcp/<service>/<account>to the internal FastMCP endpoint and sets the account context viacontextvarsDynamic registration: Only configured services register their tools. If
TELEGRAM_ACCOUNTSis empty, no Telegram tools existLevel gating: Tools are registered based on the maximum level across all accounts. Per-account level checks happen at call time, returning an error if the account's level is insufficient
Chat whitelisting: Optional per-account
ALLOWED_CHATSrestricts which chats the bot can interact withUser filtering: Optional per-account
ALLOWED_USER_IDSfilters incoming updates to only include messages from specified usersAuto-acknowledge updates: By default,
get_updatesautomatically acknowledges retrieved updates so they won't be returned again on subsequent callsExtensibility: New services follow the same pattern — add a config class, register tools conditionally, and the middleware routes automatically via
/mcp/<service>/<account>
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.