NetGram
Enables AI agents to scoped, permissioned access to Telegram chats with per-chat read/write levels and human approval for sending messages.
README
NetGram
The Telegram MCP that doesn't YOLO your account.
A self-hosted bridge that gives an AI agent scoped, permissioned access to your Telegram — you decide, per chat, what it may read and write, and every outgoing message or button click needs your approval before it hits Telegram. Runs locally in Docker with a small web UI to manage access.
Most Telegram MCP servers log in as a userbot and hand the AI full access to everything — all your DMs, groups and channels, with send rights. NetGram is the opposite bet: least-privilege by default, human-in-the-loop for anything that leaves your account.
<!-- TODO: demo GIF — permissions screen + approving a draft -->
Why NetGram
| Typical Telegram MCP | NetGram | |
|---|---|---|
| Reads your chats | all, always | only chats you allow |
| Sends messages | immediately, silently | queued as a draft you approve |
| Per-chat permissions | ✗ | ✅ off / read / write / full |
| Web UI to manage access | ✗ | ✅ |
| Your own Telegram API credentials | usually shared | ✅ your own, never shared |
| Autonomous mode when you want it | all-or-nothing | ✅ opt-in per chat (full) |
The whole idea: an agent can read the chats you picked and propose actions, but you stay the one who presses send.
Quick start (Docker)
git clone https://github.com/<you>/netgram.git
cd netgram
docker compose up -d --build
Open http://localhost:3000 and follow the setup screen:
- Paste your own
api_id/api_hashfrom my.telegram.org/apps and your phone — nothing to edit in files, it's stored locally in./data. - Enter the Telegram login code (and 2FA password if you have one).
Then open /permissions and switch on the chats the AI may touch.
All state (credentials, session, allowlist, drafts) lives in the ./data
volume, so it survives restarts and rebuilds.
Use it from your AI (MCP)
NetGram ships a Model Context Protocol server (mcp/server.mjs) so any MCP client
— Claude Desktop, Claude Code, Cursor, Cline — can drive it. Install deps once,
then point your client at the server:
npm install # once, for the MCP server's dependencies
{
"mcpServers": {
"netgram": {
"command": "node",
"args": ["/absolute/path/to/netgram/mcp/server.mjs"],
"env": { "NETGRAM_BASE_URL": "http://localhost:3000" }
}
}
}
Tools exposed (deliberately read + propose only):
| Tool | What it does |
|---|---|
list_chats |
list dialogs with access level + kind; filter by kind/title |
read_messages |
recent messages of a read-allowed chat (incl. inline buttons) |
propose_message |
queue a text message as a draft (needs write) |
propose_button_click |
queue an inline-button click as a draft (needs write) |
list_drafts |
list pending/sent drafts |
Notably absent by design: there is no tool to grant permissions or to approve/send a draft. Those are human-only, in the web UI. So the worst an AI can do is read chats you allowed and pile up drafts you can ignore.
Prefer curl or a Claude Code skill? The same actions are available over the raw HTTP API.
Permission model
One escalating level per chat (full ⊃ write ⊃ read), set by you on
/permissions:
| Level | The AI can… |
|---|---|
| off | nothing (server rejects reads/writes) |
| read | read that chat's messages |
| write | propose messages & clicks — you approve each one in /drafts |
| full | act autonomously — proposals execute immediately, no approval |
full is your explicit opt-in to autonomy for a specific chat. Everything is
enforced server-side — a request outside the allowlist never reaches Telegram.
How it works
AI (MCP client) ──stdio──▶ mcp/server.mjs ──HTTP──▶ NetGram (Next.js)
│ allowlist gate (per chat)
you (browser) ──────────────────────────────────▶ │ drafts + approval
└─ GramJS / MTProto ─▶ Telegram
- Next.js app: web UI (
/permissions,/drafts) + HTTP API. - GramJS (MTProto): logs in with your account and session.
- MCP server: thin, safe bridge over the HTTP API for AI clients.
- State in
./data:config.json(creds),session,allowlist.json,drafts.json— all git-ignored.
Safety & caveats
- Self-hosted, single-user. You run it on your own machine with your own Telegram app credentials. Nothing is shared with a third party.
- MTProto userbot = ToS gray area. Like every "userbot" tool, this logs into your account via MTProto, which Telegram's ToS doesn't officially bless — there is a non-zero account-ban risk. Use a burner/secondary account if that worries you. This is true of all Telegram MCPs; NetGram just doesn't hide it.
- Approval is the safety net. Drafts require a deliberate click, and the confirm dialog's prominent button is Cancel — an accidental (or automated) single click cancels rather than fires.
- Don't grant
fullunless you mean it. It removes the approval step for that chat.
Run without Docker (dev)
npm install
npm run dev # http://localhost:3000, state in ./data
Power users can skip the setup screen by providing creds via env instead
(.env with TG_API_ID / TG_API_HASH / TG_PHONE); env takes precedence
over the wizard.
API
| Method | Path | Purpose |
|---|---|---|
| GET | /api/me |
logged-in user |
| GET | /api/chats |
all dialogs + read/write/full + kind; ?refresh=1 |
| PATCH | /api/chats/:id/allow |
{ level: 'off'|'read'|'write'|'full' } |
| GET | /api/chats/:id/messages |
?limit=, 403 without read; includes buttons |
| GET · POST | /api/drafts |
list / create (message or {kind:'click'}) |
| POST | /api/drafts/:id/send |
approve + execute a draft |
| DELETE | /api/drafts/:id |
discard a draft |
License
MIT — see LICENSE.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。