Install gramcp

You need a Telegram api_id and api_hash from my.telegram.org → API development tools. Prebuilt archives include the embedded web panel and GitHub build provenance attestations.

Option 1: Let a coding agent install it

Paste this prompt into Claude Code, Codex, or Antigravity. It stops at three explicit checkpoints so your Telegram API keys, login session, and send whitelist stay strictly in your hands:

Install gramcp by following https://github.com/ilodezis/gramcp/blob/main/docs/agent-install.md step by step. Stop at every step marked STOP and wait for me.

Option 2: Prebuilt binary (Linux, macOS, Windows)

Download the archive for your platform alongside SHA256SUMS from the latest release (Linux x86_64/arm64 glibc 2.35+, macOS Apple Silicon/Intel, Windows x86_64):

sha256sum --ignore-missing -c SHA256SUMS     # macOS: shasum -a 256 --ignore-missing -c SHA256SUMS
tar -xzf gramcp-v*-x86_64-unknown-linux-gnu.tar.gz && cd gramcp-v*-x86_64-unknown-linux-gnu
cp config.example.toml config.local.toml

On macOS, clear the quarantine attribute on unsigned binaries first: xattr -d com.apple.quarantine gramcp. Put api_id and api_hash under [telegram] in config.local.toml, then sign in and allow Saved Messages as a safe first destination:

./gramcp --config config.local.toml login     # QR code, or phone + 2FA
./gramcp --config config.local.toml chats allow me --label "Saved Messages"
./gramcp --config config.local.toml doctor

Option 3: Docker (ghcr.io/ilodezis/gramcp)

The multi-arch distroless image (linux/amd64, linux/arm64, nonroot UID 65532) stores state under /data:

# 1. One-time Telegram sign-in stored in the volume
docker run --rm -it -v gramcp-data:/data \
  -e TELEGRAM_API_ID=123456 -e TELEGRAM_API_HASH=your_api_hash \
  ghcr.io/ilodezis/gramcp:0.2.0 login

# 2. Allow Saved Messages
docker run --rm -v gramcp-data:/data \
  -e TELEGRAM_API_ID=123456 -e TELEGRAM_API_HASH=your_api_hash \
  ghcr.io/ilodezis/gramcp:0.2.0 chats allow me --label "Saved Messages"

# 3. Run MCP over HTTP on localhost with a bearer token
export GRAMCP_BEARER_TOKEN="$(openssl rand -hex 32)" && echo "$GRAMCP_BEARER_TOKEN"
docker run -d --name gramcp -p 127.0.0.1:8020:8020 -v gramcp-data:/data \
  -e TELEGRAM_API_ID=123456 -e TELEGRAM_API_HASH=your_api_hash -e GRAMCP_BEARER_TOKEN \
  ghcr.io/ilodezis/gramcp:0.2.0

Connect MCP clients

Claude Desktop, Antigravity, or any stdio client

Use absolute paths for the binary, config file, and paths inside config.local.toml (state_db_path, session_db_path, outbox_dir):

{
  "mcpServers": {
    "telegram": {
      "command": "/absolute/path/to/gramcp",
      "args": ["--config", "/absolute/path/to/config.local.toml", "serve", "--stdio"]
    }
  }
}

Claude Code (CLI)

claude mcp add --scope user telegram -- /absolute/path/to/gramcp --config /absolute/path/to/config.local.toml serve --stdio

Claude.ai custom connector (OAuth 2.1)

Enable [oauth] and [settings_auth] behind TLS (Caddy, Nginx, Tailscale Serve, or Cloudflare Tunnel), then add https://mcp.example.com/mcp (or a single-account pinned endpoint https://mcp.example.com/mcp/work) in Claude.ai. See docs/deployment.md for all five deployment topologies.