tg-secretary-mcp
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| MCP_AUTH_TOKEN | No | Bearer token generated by `npm run secrets`, used to authenticate the /api/setup and /api/mcp endpoints. Required for the Vercel deployment. | |
| KV_REST_API_URL | No | Upstash Redis REST URL (Vercel deployment). Alternatively use UPSTASH_REDIS_REST_URL. | |
| KV_REST_API_TOKEN | No | Upstash Redis REST token (Vercel deployment). Alternatively use UPSTASH_REDIS_REST_TOKEN. | |
| TELEGRAM_BOT_TOKEN | No | Telegram bot token (from @BotFather). Required in both local and Vercel modes; can be placed in .env for local mode or set as a project environment variable on Vercel. | |
| TG_SECRETARY_DATA_DIR | No | Local mode only: an alternative location for the message archive (defaults to ./data). | |
| TG_SECRETARY_READONLY | No | Set to 1 to forbid sending messages, marking as read, and deleting messages. | |
| UPSTASH_REDIS_REST_URL | No | Alternative Upstash Redis REST URL (Vercel deployment) instead of KV_REST_API_URL. | |
| TELEGRAM_WEBHOOK_SECRET | No | Webhook secret generated by `npm run secrets`. Required for the Vercel deployment. | |
| TG_SECRETARY_NO_ARCHIVE | No | Set to 1 (local mode only) to avoid writing messages to disk; the archive lives only in the session's memory. | |
| UPSTASH_REDIS_REST_TOKEN | No | Alternative Upstash Redis REST token (Vercel deployment) instead of KV_REST_API_TOKEN. |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
The owner connected a Telegram bot to their account (Secretary Mode). The tools see incoming private messages only: no groups, channels, or history older than the connection, and nothing the owner replied manually from the app ("out" messages are those sent through secretary_reply). Nothing is pushed — call secretary_chats and secretary_read to see what is new. secretary_reply writes as the owner: use it only for text the owner has approved.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": true
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| secretary_statusA | Health check: does the bot receive updates, is a Telegram account connected, which rights did the owner grant, what is in the archive. Call this first when something does not work. |
| secretary_chatsA | List the private chats the archive has seen, most recent first. The bot only sees private chats that wrote to the owner after it was connected (Settings → Chat Automation), and only while the server was running. Groups, channels and older history are never available. |
| secretary_readA | Read the archived conversation with one person, oldest first. The bot only sees private chats that wrote to the owner after it was connected (Settings → Chat Automation), and only while the server was running. Groups, channels and older history are never available. |
| secretary_searchA | Search message text across the archive, or within one chat. Full phrase matches come first, then messages with all the words. The bot only sees private chats that wrote to the owner after it was connected (Settings → Chat Automation), and only while the server was running. Groups, channels and older history are never available. |
| secretary_replyA | Send a text message to a private chat AS THE OWNER: the recipient sees it written by the owner, not by a bot. Use only for text the owner has approved for this chat. Replies only work in private chats that wrote to the owner during the last 24 hours. |
| secretary_waitA | Wait for new incoming messages from one chat and return them. Resolves as soon as a message arrives (a short burst is collected together), or when the time is out. Use after secretary_reply to get the answer. |
| secretary_mark_readA | Mark an incoming message as read on the owner's behalf; everything before it in that chat is read too. Pass the latest message_id to clear the whole chat. |
| secretary_delete_sentA | Delete a message that was sent through secretary_reply, on the owner's behalf. Only this bot's own messages can be deleted this way. |
| secretary_forgetA | Drop the archived conversation with one person for good. Nothing changes on Telegram. Use when the owner asks to remove stored messages. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
TDQS
Scored across 9 tools
Each tool targets a distinct operation: status, chat listing, reading, searching, replying, waiting, marking read, deleting sent messages, and forgetting an archive. The descriptions clearly separate potentially adjacent tools such as delete_sent versus forget and read versus search.
All tools use the same secretary_ prefix with snake_case operation names. The set is predictable and readable, even though some suffixes are nouns (status, chats) and others are verbs.
Nine tools is well-scoped for a Telegram secretary server. Each tool earns its place and there is no obvious redundancy.
The core private-chat lifecycle is covered: health, listing, reading, searching, replying, waiting, marking read, deleting sent messages, and forgetting archives. Minor gaps remain around editing sent messages and sending non-text media, but the stated text-focused scope is largely complete.