Telegram Ads

v0.1.3
io.github.furkankoykiran/telegram-ads Checked 9 hours ago Published 10 days ago

MCP server for the official Telegram Ads API: ads, budgets, stats, audiences and pixels.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

tg_get_account Get Telegram Ads account

Get the current Telegram Ads account: account_id, title, currency, remaining budget and ad budget. Set include_related to also list accounts whose budgets this account can replenish. Start here to learn the account currency, which determines valid CPM and budget precision.

ParameterTypeDescription
include_relatedbooleanAlso list related accounts that this account can fund.
limitinteger
offsetinteger

tg_get_account_info Get account profile

Get the billing/profile details of an account (company name, email, phone, country, city). Omit account_id to read the current account.

ParameterTypeDescription
account_idstring

tg_account_budget Move budget between accounts

Increase or decrease the budget of a related account from the current account. amount uses the currency's amount precision (EUR/TON: 5 decimals, XTR: 3). Requires confirm: true and TG_ADS_MODE=write.

ParameterTypeDescription
account_id *stringRelated account to fund or withdraw from.
amount *number
direction *string
confirmboolean
idempotency_keystring

tg_list_ads List ads

List advertisements for an account, newest first, with status, budgets and lifetime metrics. Use next_offset from the response to fetch the next page. Set include_targeting to receive targeting settings (larger response).

ParameterTypeDescription
account_idstring
include_targetingboolean
limitinteger
offsetstringPagination cursor from a previous response.

tg_get_ads Get ads by ID

Fetch up to 100 advertisements by ad_id, including status, budgets, metrics and decline reasons.

ParameterTypeDescription
ad_ids *array
account_idstring
include_targetingboolean

tg_create_ad Create ad

Create one advertisement. New ads are paused with a zero budget unless you pass is_paused: false and initial_budget. Money values must match the account currency precision (EUR/TON: 2 decimals, XTR: 0). Telegram requires text unless target.type is search, and at most one of photo_id/video_id. Use dry_run: true to validate without calling the API. Requires confirm: true and TG_ADS_MODE=write.

ParameterTypeDescription
cpm *numberPrice per 1000 impressions in the account currency.
placement *string
promote_url *string
target *
title *string
account_idstring
activate_dateintegerUnix seconds.
additional_infostring
buttonstring
confirmboolean
conversion_event_idstring
daily_budget_limitnumber0 disables the daily limit.
deactivate_dateintegerUnix seconds.
dry_runboolean
idempotency_keystring
impression_frequencyinteger
initial_budgetnumberDefaults to 0, which keeps the ad unfunded.
is_pausedbooleanDefaults to true.
photo_idstring
scheduleobject
show_userpicboolean
textstring
video_idstring
website_namestring
website_photo_idstring

tg_update_ad Update ad

Edit an existing advertisement. Only provided fields change. Use is_paused to pause or resume. Set submit_for_review: true to move a ready_for_review ad into review after editing. Changing cpm or budget requires the same currency precision rules as creation. Use dry_run: true to validate without calling the API. Requires confirm: true and TG_ADS_MODE=write.

ParameterTypeDescription
ad_id *integer
account_idstring
activate_dateinteger
additional_infostring
buttonstring
confirmboolean
conversion_event_idstring
cpmnumber
daily_budget_limitnumber
deactivate_dateinteger
dry_runboolean
impression_frequencyinteger
include_targetingboolean
is_pausedboolean
photo_idstring
promote_urlstring
scheduleobject
show_userpicboolean
submit_for_reviewboolean
textstring
titlestring
video_idstring
website_namestring
website_photo_idstring

tg_ad_budget Increase or decrease ad budget

Move funds into or out of an ad. amount is in the account currency and must respect its precision. Telegram only allows decreasing budget when the ad has been inactive for at least 10 minutes. Requires confirm: true and TG_ADS_MODE=write.

ParameterTypeDescription
ad_id *integer
amount *number
direction *string
account_idstring
confirmboolean
include_targetingboolean

tg_delete_ad Delete ad

Permanently delete an advertisement. Telegram requires the ad to be inactive for at least 10 minutes and to have no remaining budget. Requires confirm: true and TG_ADS_MODE=write.

ParameterTypeDescription
ad_id *integer
account_idstring
confirmboolean

tg_upload_media Upload ad media

Upload a local file to Telegram Ads and return its media ID. Limits: ad_photo JPEG/PNG up to 5 MiB and at least 640px wide; ad_video MP4 up to 20 MiB, 16:9, 3-60 seconds; website_photo JPEG/PNG up to 1 MiB and at least 150x150. Requires confirm: true and TG_ADS_MODE=write.

ParameterTypeDescription
kind *string
path *stringAbsolute path, or a path relative to the server process.
account_idstring
confirmboolean

tg_get_stats Get advertising stats

Get account or per-ad statistics for a time range. from/to accept Unix seconds, milliseconds, or ISO 8601. interval is 86400 (daily, default) or 300 (5 minutes). Ranges above 1000 intervals are split automatically. Always returns totals and derived CTR/CPM/CPC; set include_series for the raw time series. Timestamps are inclusive for from and exclusive for to.

ParameterTypeDescription
from *
scope *string
to *
account_idstring
ad_idsarray
include_seriesbooleanInclude raw per-interval rows (default false).
interval

tg_get_report Get monthly account report

Get Telegram's monthly report for all active ads in an account, including views, opens, clicks, actions and spend per ad.

ParameterTypeDescription
month *integer
year *integer
account_idstring

tg_list_targeting List targeting options

Look up targeting catalogs. kind=languages, topics or countries takes no extra arguments. kind=locations searches by country_code and/or query, or resolves location_ids. kind=channel resolves a channel by @username or numeric ID; kind=bot does the same for bots. Prefer @username for channels and bots: numeric IDs only work after this account has resolved them.

ParameterTypeDescription
kind *string
account_idstring
bot
channel
country_codestringRequired for location search.
for_excludingboolean
limitinteger
location_idsarray
offsetstring
querystringLocation search text.

tg_list_audiences List audiences

List retargeting audiences for an account, or fetch specific audiences by ID. Audience sizes are in phone numbers.

ParameterTypeDescription
account_idstring
audience_idsarray
limitinteger
offsetinteger

tg_manage_audience Create, update or delete an audience

Manage phone-number retargeting audiences. action=create needs title and add_phones; action=update needs audience_id plus at least one change; action=delete needs audience_id. Phone numbers are sent to Telegram and are never written to the audit log. Requires confirm: true and TG_ADS_MODE=write.

ParameterTypeDescription
action *string
account_idstring
add_phonesarray
audience_idinteger
confirmboolean
remove_phonesarray
reset_phonesboolean
titlestring

tg_get_pixel Get pixel

Get the account's Pixel Tag, including its ID and the HTML code snippet used to install it on a website.

ParameterTypeDescription
account_idstring

tg_list_pixel_events List pixel events

List conversion events for the account's pixel, or fetch specific events by ID.

ParameterTypeDescription
account_idstring
event_idsarray
limitinteger
offsetinteger

tg_manage_pixel Manage pixel and conversion events

action=create_pixel creates the account's Pixel Tag (only one per account); action=create_event needs title and type; action=update_event renames an event; action=delete_event removes an event that is not used by any ad. Requires confirm: true and TG_ADS_MODE=write.

ParameterTypeDescription
action *string
account_idstring
confirmboolean
event_idstring
titlestring
typestringEvent type, for example purchase or lead.

tg_list_transactions List transactions

List account-level or ad-level transactions. Use next_offset to page. Transactions explain where budget was added or spent.

ParameterTypeDescription
scope *string
account_idstring
ad_idinteger
limitinteger
offsetinteger

tg_get_transaction Get transaction status

Check the status of a budget transaction by its transaction ID.

ParameterTypeDescription
transaction_id *string

tg_get_sdk Get the Code Mode TypeScript SDK

Return the TypeScript declarations for the tg namespace available inside tg_execute. Read this before writing a non-trivial script; it documents every method signature.

tg_execute Execute a Telegram Ads script

Run JavaScript in an isolated QuickJS sandbox with a typed tg object, for multi-step work that would otherwise need many tool calls: bulk edits, cross-ad analysis, pagination, joins and reports. Only console.log output and the returned value come back. No network, filesystem, process or env access. Calls run sequentially; the limit is 25 API calls, 15 seconds and 64 KB of output. Example: `const ads = await tg.getAdsList({limit: 100}); return ads.ads.length`. Write methods require TG_ADS_MODE=write, TG_ADS_CODE_MODE=write and confirm: true.

ParameterTypeDescription
code *stringAn async arrow function, a function expression, or a plain statement body.
confirmbooleanRequired before any write method can run.
idempotency_keystringPrefix for write idempotency keys, useful when retrying a script.

tg_api_call Call any Telegram Ads API method

Escape hatch for methods that do not have a dedicated tool. Pass the exact method name from tg_search and its parameters. Read methods run immediately; write methods require TG_ADS_MODE=write and confirm: true, and receive an idempotency key automatically.

ParameterTypeDescription
method *stringExact method name, for example getTargetLocationsList.
confirmboolean
idempotency_keystring
paramsobject