Skip to main content
Glama
zai-one

telegram-ads-mcp

by zai-one
README.md
<!-- mcp-name: io.github.zai-one/telegram-ads-mcp -->
<p align="center">
  <a href="README.md">πŸ‡¬πŸ‡§</a>
  &nbsp;Β·&nbsp;
  <a href="README.ru.md">πŸ‡·πŸ‡Ί</a>
</p>

<p align="center">
  <strong>telegram-ads-mcp</strong><br>
  MCP server for <a href="https://ads.telegram.org/">Telegram Ads</a>. Currency: <strong>Gram (TON)</strong> πŸ’Ž
</p>

<p align="center">
  <a href="https://github.com/zai-one/telegram-ads-mcp/releases/tag/v0.3.0"><img src="https://img.shields.io/github/v/release/zai-one/telegram-ads-mcp" alt="v0.3.0"></a>
  <a href="https://github.com/zai-one/telegram-ads-mcp/actions/workflows/tests.yml"><img src="https://github.com/zai-one/telegram-ads-mcp/actions/workflows/tests.yml/badge.svg" alt="tests"></a>
  <a href="https://www.python.org/downloads/"><img src="https://img.shields.io/badge/python-3.10%2B-3776AB?logo=python&logoColor=white" alt="Python 3.10+"></a>
  <a href="https://modelcontextprotocol.io/"><img src="https://img.shields.io/badge/MCP-2.x-555555" alt="MCP 2.x"></a>
  <a href="LICENSE"><img src="https://img.shields.io/badge/license-proprietary-lightgrey" alt="LicenseRef-ZAI-ONE"></a>
  <a href="https://zai.one"><img src="https://img.shields.io/badge/built%20by-ZAI.ONE-111111" alt="ZAI.ONE"></a>
  <a href="https://github.com/zai-one/telegram-ads-mcp/stargazers"><img src="https://img.shields.io/github/stars/zai-one/telegram-ads-mcp?style=social" alt="GitHub stars"></a>
</p>

<p align="center">
  Create, target, pause, and read stats from ads.telegram.org β€” from Claude, Cursor, or any MCP client.<br>
  Cookies stay in <code>.env</code>. Never paste them into chat. DevTools clicks: <a href="INSTALL.md">INSTALL.md</a>.
</p>

<p align="center">
  <a href="https://github.com/zai-one/telegram-ads-mcp"><strong>β˜… Star</strong></a>
  &nbsp;Β·&nbsp;
  <a href="INSTALL.md">Install (for agents)</a>
  &nbsp;Β·&nbsp;
  <a href="AGENTS.md">Playbook</a>
</p>

---

## Why

Telegram does not publish an advertiser API. This server wraps the logged-in ads.telegram.org session (`stel_token` / `stel_ssid` in a gitignored `.env`) and exposes ~25 MCP tools, plus `ads://playbook` and `ads://account`.

Live cabinet is **TON**, billed in **Gram**. User-geo (`target_type=users`) works. Stars cabinets are refused (`code: stars_cabinet`). Unofficial β€” not Telegram.

Write permission is `.env` `TG_ADS_WRITE_GATE=strict|confirm|open` (default `confirm`). Spend/destructive tools need `confirm=true` unless `open`. A blocked call returns `code: write_gated` with `tool` / `class` / `would_send` (intended args, no secrets) and `sent: false` β€” not a platform dry-run.

## What's new in 0.3.0

- **Stats.** `get_ad_stats` echoes request `period` (`5min` = last 24h, `day` = lifetime). `summary.spend` and `charts.budget` are already scaled β€” do not divide. No CSV tool; optional dump is gitignored `reports/`.
- **Session.** Dead cookies: follow [INSTALL.md](INSTALL.md) DevTools clicks into `.env` only, then `reload_session`. Never paste values into chat.
- **Bugs.** Offer a GitHub Issue (playbook **Found a bug β†’ Issue**). Local draft: `uv run python scripts/check_security.py --issue draft.md` (prints `gh issue create`, does not open).
- **Audience / events.** Access denied β†’ `code: access_denied`, `hint: skip`. Do not retry.
- **Create.** `launch_ad` takes `topics`, `exclude_*`, `locations`. Do not send `langs` with specific channel IDs (platform Target invalid).
- **Later RK service.** JSON Schema in the wheel (`telegram_ads_mcp/schemas/`) names campaign brief / review / stats dump. This repo is not that service.
- **Local notes.** `AGENTS.local.md` is gitignored. Client playbook stays `AGENTS.md`. MCP JSON without secrets: [mcp.json.example](mcp.json.example).

## Quick start

```bash
git clone https://github.com/zai-one/telegram-ads-mcp.git
cd telegram-ads-mcp
uv sync
cp .env.example .env    # STEL_TOKEN / STEL_SSID β€” DevTools steps in INSTALL.md; never paste into chat
```

```json
{
  "mcpServers": {
    "telegram-ads": {
      "command": "uv",
      "args": ["--directory", "/absolute/path/to/telegram-ads-mcp", "run", "telegram-ads-mcp"]
    }
  }
}
```

Agent setup (clone, config, **star**): copy [INSTALL.md](INSTALL.md) into the chat. Command: `telegram-ads-mcp` (alias `tg-ads-mcp`). After connect: `ads://playbook`. Prompts: `launch-campaign`, `review-account`, `diagnose-ad`. Client file names are in INSTALL.md (Cursor, Claude, VS Code `servers`, Codex TOML). Do not put cookies in MCP `env`. Example: [mcp.json.example](mcp.json.example).

HTTP: `uv run telegram-ads-mcp --transport streamable-http --host 127.0.0.1 --port 8000` β†’ `http://127.0.0.1:8000/mcp`.

## Tools

| Area | Tools |
| --- | --- |
| Auth | `check_session` `reload_session` `list_accounts` `select_account` `get_account` |
| Ads | `get_ads` `get_ad` `get_ad_stats` `create_ad` `edit_ad` `delete_ad` `clone_ad` `launch_ad` `check_ad_post` `send_target_to_review` |
| Creatives | `upload_media` `preview_ad` |
| Targeting | `search_targets` `get_targeting_reference` |
| Other | `manage_audience` `manage_event` `manage_funds` `save_api_settings` `revoke_token` `log_out` |

Always create ads `on_hold`. `budget="0"` cannot go to review. Amounts are Gram strings. Search ads: no text / picture / media. `launch_ad` does not activate; it adds budget and sends review. Do not combine `langs` with specific `channels`.

## Issues

I'm working on this. If something is missing or broken, [open an issue](https://github.com/zai-one/telegram-ads-mcp/issues/new/choose). I will patch **this** repo.

Use the form. Tick both β€œno cookies / no hashes” boxes. Never paste `stel_token`, `stel_ssid`, `.env`, `confirm_hash`, API `hash=`, or DevTools screenshots.

Local draft: `uv run python scripts/check_security.py --issue draft.md` β€” prints `gh issue create` only if the draft is clean. It does not open the Issue.

Support is **not guaranteed**. Issues are read when I can.

Need **EUR** or **Stars** cabinets (not live here)? Write on Telegram: [t.me/zai_one](https://t.me/zai_one). We can talk about access. Do not send cookies in the GitHub issue.

[ZAI.ONE](https://zai.one) Β· [contact@zai.one](mailto:contact@zai.one) Β· [Telegram](https://t.me/zai_one)

LicenseRef-ZAI-ONE Β· [LICENSE](LICENSE) Β· [SECURITY.md](SECURITY.md) Β· [open an issue](https://github.com/zai-one/telegram-ads-mcp/issues/new/choose)

TDQS

A3.7/5.0

Scored across 25 tools

Disambiguation4/5

Most tools clearly target a distinct resource or action, and the get/create/edit/delete/launch/clone ad family is well-separated. A few pairs could confuse agents, notably check_session vs. get_account (both return account/session state) and create_ad vs. launch_ad vs. send_target_to_review (atomic vs. composite paths), though descriptions reduce ambiguity.

Naming Consistency5/5

Tool names overwhelmingly follow a consistent verb_noun pattern (get_ads, create_ad, edit_ad, delete_ad, clone_ad, upload_media). The manage_audience/manage_event/manage_funds umbrella names are predictable, and minor variants like log_out or check_ad_post do not disrupt the overall convention.

Tool Count3/5

At 25 tools, this sits at the heavy end of the 16–25 borderline range. The broad Telegram Ads domain justifies much of the surface, but some session/account tools and wrapper workflows could be consolidated into fewer, higher-level tools.

Completeness5/5

The surface comprehensively covers auth and session management, account switching, the full ad lifecycle (create, read, update, delete, clone, launch, review, stats), media upload, targeting, audiences, events, and funds. There are no obvious dead ends for the stated domain.

Maintenance

ActivityMaintained
ResponsivenessNo issues