
GhostPaw Telegram
io.github.GhostPawJS由 GitHub 帳號 GhostPawJS 發布v0.7.8更新於 Oct 29, 2026
Telegram message mirror, search, sending, and moderation tools.
概覽
本機 stdio MCP 伺服器,讓助理檢索 Telegram 機器人聊天與訊息的 SQLite 鏡像,並規劃或執行傳送與群組管理動作。
- 可以做什麼
- 檢索與讀取鏡像資料:訊息全文搜尋、聊天、使用者、成員、表情回應、編輯歷史與回覆鏈
- 傳送、編輯、刪除、轉寄、置頂訊息,設定回應與群發;未設定權杖時僅回傳計畫
- 管理群組:封鎖、解除封鎖、限制、提升、踢出成員並查詢成員狀態
- 查看機器人統計、鍵值狀態與活躍聊天清單
- 附帶六份工作流程指南,涵蓋對話管理、審核、群組管理、群發、訊息檢索與串流回覆
- 適用情境
- 適合透過此套件的函式庫傳輸執行 Telegram 機器人,並希望助理查詢機器人所見內容,或在聊天用戶端中草擬、並在有權杖時執行傳送與群組管理動作的情境。
- 執行需求
- 以本機程序執行(npm 套件 @ghostpaw/telegram,需 Node 24+ 以使用 node:sqlite,或使用發行版二進位檔)。SQLite 鏡像須已由函式庫傳輸寫入,伺服器本身不輪詢更新。執行傳送與群組管理需要 TELEGRAM_BOT_TOKEN。資料庫路徑預設為 ~/.ghostpaw/telegram.db,可用 GHOSTPAW_TELEGRAM_DB 或 --db 覆寫。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 GhostPaw Telegram,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
[GhostPaw telegram: Your bot remembers the chat, including what was edited.]
@ghostpaw/telegram
[npm] [CI] [site] [runtime deps] [MCP Registry] [node] [license]
Agent Telegram bots: every update mirrored into SQLite before your handler runs.
Telegram bot channel engine — fetch transport with zero runtime dependencies, SQLite message mirror with FTS5 full-text search, eager file BLOB storage, markdown rendering, and a structured LLM tool facade.
Every incoming update is mirrored into a local SQLite database before your handler runs, giving you a persistent, queryable record of everything the bot sees — including the raw bytes of every photo, document, voice message, and video, which are downloaded in the background after the update is stored and kept once per SHA-256 hash. A failed download leaves the file row without a checksum, so you can retry it with write.downloadFile. It ships as a single prebundled blob designed for two audiences at once: human developers building bot backends in code, and LLM agents operating through a structured tool facade.
MCP server
Every client below starts the same stdio server: ghostpaw-telegram mcp.
For npm-based environments, use npx -y @ghostpaw/telegram mcp.
Messages live in ~/.ghostpaw/telegram.db unless the GHOSTPAW_TELEGRAM_DB
environment variable (absolute path) or --db <path> says otherwise.
Claude Code
or as a plugin, which also installs the skill:
Codex CLI (~/.telegram/config.toml)
Cursor (.cursor/mcp.json), Claude Desktop (claude_desktop_config.json)
or a project .mcp.json:
Claude Desktop users can also install server.mcpb from the
latest GitHub release.
A Dockerfile is included for container hosts:
docker build -t ghostpaw-telegram . && docker run -i --rm -v telegram:/data ghostpaw-telegram.
The server speaks MCP 2026-07-28 (stateless, server/discover) and the
initialize-based revisions 2025-11-25, 2025-06-18, 2025-03-26 and 2024-11-05.
Set TELEGRAM_BOT_TOKEN in the server environment to execute send and moderation actions.
Without a token, these tools return plans; local reads and tool discovery work offline.
The .mcp.json token placeholder must be supplied by the client environment.
The server reads the mirror populated by your library transport; it does not poll for updates.
Noun-verb CLI
The 27 command paths derive from the 4 tool schemas:
Use help <noun> or <noun> <verb> --help for schema flags. Fields accept
kebab-case flags, such as --can-send-messages true and --is-admin false.
Objects accept JSON; arrays accept repeated flags or JSON. Values are literal,
including a leading @; no flag reads a file.
A single - reads stdin JSON; explicit flags override stdin fields.
-- ends option parsing.
Global flags: --db <path>, --json, --quiet, --compact, --help/-h,
--version/-V/-v, --no-color. Piped output defaults to JSON;
--quiet suppresses stdout. completions bash|zsh|fish prints completion
setup and version prints the package version and installation variant.
Existing tools [--json], describe <tool>, call <tool> [JSON|-], flat
tg_<tool> --parameter value, mcp and skill forms keep their behavior.
The noun-verb send and moderation commands always return plans, including
when TELEGRAM_BOT_TOKEN is set. Execution remains available through
createTelegramToolFacade({ client, execute: true }); the existing tool-level
CLI and MCP forms execute when TELEGRAM_BOT_TOKEN is set.
Local mirror reads and plans work offline without credentials.
GHOSTPAW_TELEGRAM_DB sets the default database, otherwise
~/.ghostpaw/telegram.db is used; --db overrides both.
Offline examples:
The empty mirror returns no chats or messages. The send returns an action descriptor without sending a Telegram message.
CLI
The send example returns a plan unless TELEGRAM_BOT_TOKEN is set.
Use ghostpaw-telegram skill --short for the compact CLI cheat sheet,
ghostpaw-telegram skill --list to list guides, and
ghostpaw-telegram skill <guide> to read one.
On POSIX, CLI and MCP mirror databases are created with mode 0600, including
new SQLite WAL/SHM files. Directories created for the database use mode 0700.
Existing database and directory permissions are preserved. The mirror may contain
private chat content and file blobs.
Agent Skill
SKILL.md and skills/telegram/ ship in the package. Print the skill with
ghostpaw-telegram skill or copy skills/telegram/ into your skills folder.
Install
Release binary (default)
Each line downloads the latest release asset, checks it against the release's SHA256SUMS and installs it on the PATH (~/.local/bin on Linux/macOS; the Windows script adds its folder to the user PATH).
These lines never edit ~/.profile or other shell startup files: export PATH applies to the current shell only. To keep it in new shells, use the ~/.profile line below.
linux-x64:
linux-arm64:
darwin-arm64:
darwin-x64:
windows-x64 (PowerShell; persistently adds the install folder to the user PATH):
To skip the persistent user PATH edit:
Pinned to a release:
Also adding ~/.local/bin to ~/.profile (edits ~/.profile once; skipped if it already mentions ~/.local/bin; zsh login shells read ~/.zprofile instead, so use that file name there):
Scripts that compare versions should use --version --short or --version --json.
A session with the 0.7.1 linux-x64 binary against a fresh database, with no token set, so outbound commands only return the planned action and nothing is sent (output piped through jq to keep it short):
The same session as an animated GIF.
Other release installers:
For aqua, define a
github_release package in aqua.yaml:
telegram-registry.yaml:
Install scripts verify SHA256SUMS. To verify a downloaded archive's build attestation:
Set GHOSTPAW_VERIFY=attestation for attestation verification in install.sh.
Binaries are unsigned; macOS binaries carry an ad-hoc signature. For a browser
download on macOS, remove quarantine with
xattr -d com.apple.quarantine /path/to/ghostpaw-telegram.
Linux binaries require glibc 2.28+; use npx on Alpine.
See the binary build workflow.
Sizes for 0.7.1 (Node 26.12.1 inside each binary):
Release installation is checked on ubuntu-24.04, macos-15 and windows-2025.
npx / npm (for npm-based environments)
Requires Node 24+ for the built-in node:sqlite module. The npm package is 816 KB unpacked.
Library (for harnesses embedding it in code)
See library usage.
Quick Start
Webhook mode — pass a webhook config instead:
Docs
Read the manual for usage guides, recipes, architecture and entity references.
- Overview: what the manual covers and where to start
- Human usage: using the library directly in code
- LLM usage: tools, skills and the soul prompt for agents
- Recipes: patterns for menus, keyboards and replies
- Architecture: how the code is laid out
- Chats: every conversation the bot has seen
- Messages: inbound and outbound messages
- Users: bot and human accounts
- Members: who is in which chat, with status
- Callbacks: inline keyboard button presses
- Files: photos, documents and voice notes
- Reactions: emoji reactions and their counts
What It Stores
Every update is mirrored into SQLite before your handler runs:
- Messages — text, media, edits, reply edges, albums, threads (FTS5 full-text index with Unicode diacritic folding)
- Users — first name, last name, username, language code
- Chats — title, type, member count, forum flag
- Members — status, permissions, admin title per chat
- Reactions — emoji per user per message, with per-emoji counts and event log
- Files — metadata + raw bytes stored as BLOB, SHA-256 deduplicated; downloaded in the background for every incoming file (
DEFAULTS.autoDownloadis deprecated and unused; it does not change this behaviour) - Callbacks — inline button presses with data and answered state
- Bot state — arbitrary key/value store and running statistics
All eight tables are created in one call: initTelegramTables(db).
Two Audiences
Human developers
Use the read, write, and network namespaces for direct-code access to every domain operation:
See docs/HUMAN.md for the full human-facing guide with worked examples.
LLM agents
Use the tools, skills, and soul namespaces for a structured runtime surface:
Every tool returns a discriminated result with outcome: 'success' | 'no_op' | 'error', structured data, and next-step hints. No thrown exceptions to parse.
See docs/LLM.md for the full AI-facing guide covering soul, tools, and skills.
Package Surface
Tools
Tools return plans by default; existing synchronous handlers perform no outbound actions. To execute send and moderation actions, create an async facade explicitly:
Omit execute to retain plan-only behavior. Execution reuses the outbound
executors, returns the shared result shape with action data and sent message
IDs where applicable, and masks bot tokens in errors. Capacity-one token buckets
limit each API call per chat and globally; Telegram 429 retry_after responses
pause retries, with two retries by default. Limits apply per facade instance;
reuse one facade for callers sharing a bot. Partial execution can occur when a
multi-call action fails (for example, kick bans then unbans).
Four tools shaped around operator intent:
Each tool exports runtime metadata — name, description, JSON Schema, side-effect level, readOnly flag — so agent harnesses can wire them without reading docs.
Skills
Six workflow playbooks as markdown strings:
The package has zero runtime dependencies. It uses Node 24 global fetch for Bot API requests and an in-repo synchronous Markdown parser. grammy and marked are development dependencies used for compatibility tests.
createBot accepts optional api: { fetch, apiRoot } settings for an injected
fetch implementation or a custom Bot API endpoint. The default endpoint is
https://api.telegram.org.
adaptBot continues to accept grammy Bot instances. Calls without uploads use
api.raw; file uploads use the built-in client, so grammy API transformers do
not apply to uploads. Its optional second argument accepts { fetch, apiRoot }.
Remote media URLs
Media sends accept { url: 'https://example.com/image.jpg' }. Downloads use
Node HTTP/HTTPS directly, independently of the Bot API fetch option. Only
HTTP and HTTPS are supported. Every DNS result and redirect target is checked;
private, local, link-local, multicast and reserved targets are blocked. Connections
use a validated address to prevent DNS rebinding.
Downloads default to 50 MiB, a 30 second overall timeout (including DNS and
redirects), and at most five redirects. Oversized bodies and non-2xx final
responses fail with TELEGRAM_FILE errors.
Set api: { allowPrivateMediaUrls: true } in createBot, or set
GHOSTPAW_TELEGRAM_ALLOW_PRIVATE_URLS=1, to permit private targets. Either
opt-in permits access to local services and metadata endpoints; use it only
with trusted media URLs. Client options mediaMaxBytes and mediaTimeoutMs
override the size and timeout limits, for example:
Development
The repo is pinned to Node 24.14.0 via Volta. Use whichever version manager you prefer.
Support
If this package helps your project, consider sponsoring its maintenance:
來源:README.md,提交 2e0bddc
工具
0版本歷史
2- v0.7.8最新Oct 29, 2026
- v0.6.2Oct 25, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分