Yandex Metrika MCP

io.github.expremiental由 GitHub 帳號 expremiental 發布v0.1.0更新於 Oct 25, 2026

Read-only Yandex Metrika MCP. Query visits, sources, geo, devices and more in plain language.

已驗證Streamable HTTP可網頁執行網頁搜尋與抓取資料與分析

概覽

AI 產生的概覽

唯讀的 Yandex Metrika MCP 伺服器,讓助理列出計數器並執行 Reporting API 查詢,取得造訪、來源、裝置與地理資料。

可以做什麼
列出權杖可存取的 Yandex Metrika 計數器,包含 id、名稱與網站,方便為查詢挑選計數器。以 Metrika 欄位名稱對計數器執行 Reporting API 查詢,支援指標、維度、日期範圍、篩選、排序與列數上限。用自然語言回答造訪、使用者、瀏覽量、跳出率、流量來源、裝置、地理與 UTM 相關問題。
適用情境
當你希望助理直接回答 Yandex Metrika 的流量與受眾統計問題,而不必建立儀表板或手寫查詢時適用。適合對已有權限的一個或多個計數器做唯讀報表分析。
執行需求
可使用託管的遠端端點,以 Yandex 帳號登入並授權;也可在本機自行架設,需要 Python 3.10+ 與 uv。自行架設需要具備 metrika:read 權限的 Yandex OAuth 權杖,透過環境變數 YANDEX_METRIKA_TOKEN 提供。需要能連線至 Yandex Metrika 的網路。
安裝前請注意
託管服務會接收你的 Yandex 登入與分析資料,請確認是否可接受。自行架設可讓資料留在本機,但需在 YANDEX_METRIKA_TOKEN 中保存 OAuth 權杖。此服務聲明為唯讀,不會寫入你的 Metrika 帳戶。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Yandex Metrika MCP,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Web executable,透過 Streamable HTTP。 遠端服務在工作區中設定後即可從網頁執行環境執行。

交給代理程式安裝

把這段提示詞貼上到 Claude Code、Codex、Cursor 等代理程式,或 SourceWeft 對話中。代理程式會讀取該伺服器的安裝指南,先向你展示發布者、端點和登入方式,經你同意後再把它新增到你的客戶端。金鑰不會寫進任何命令。

閱讀 https://sourceweft.com/mcp/io.github.expremiental%2Fyandex-metrika-mcp/install.md,並按其中說明把這個 MCP 伺服器接入我的客戶端。修改任何設定之前,先告訴我它的發布者、端點和登入方式,等我確認。不要把 API 金鑰寫進命令或我會提交的檔案;問我金鑰應從哪裡取得。

檢視代理程式所依據的安裝指南

其他 MCP 客戶端

把它新增到你客戶端的 mcpServers 設定中。

{
  "mcpServers": {
    "yandex-metrika": {
      "type": "http",
      "url": "https://mcp.getaiaiai.ru/yandex-metrika"
    }
  }
}

README

yandex-metrika-mcp

[License: MIT] [Python 3.10+] [FastMCP] [MCP]

Query Yandex Metrika analytics in plain language, right inside Claude. "How many visits this week?", "Top traffic sources for June", "Mobile share today?" — the assistant queries Metrika and answers directly. No dashboards, no SQL, no API keys to manage.

Open-source by aiaiai — we build what we teach.


Задавай вопросы по Яндекс.Метрике обычным языком прямо в Claude. «Сколько визитов за неделю?», «топ источников за июнь», «доля мобильных?» — ассистент сам сходит в Метрику и ответит. Без дашбордов.

[Спросил про географию аудитории обычным языком — агент сам построил карту из живой Яндекс.Метрики]

Works with

Claude.ai  ·  Claude Code  ·  Claude Desktop  ·  Cursor  ·  any MCP-compatible client

Connect in one minute (hosted)

No installation needed — connect to the hosted service.

Claude.ai (Settings → Connectors → Add):

https://mcp.getaiaiai.ru/yandex-metrika

Click Connect → sign in with Yandex → allow access.

Claude Code CLI:

bash
claude mcp add --transport http yandex-metrika https://mcp.getaiaiai.ru/yandex-metrika/claude mcp login yandex-metrika

A browser window opens → sign in with Yandex → done. On headless/SSH: add --no-browser to mcp login and paste the redirect URL when prompted.

Claude Desktop / Cursor — add to mcpServers:

json
{  "mcpServers": {    "yandex-metrika": {      "type": "http",      "url": "https://mcp.getaiaiai.ru/yandex-metrika/"    }  }}

No app registration, no tokens to manage. Read-only — the service never writes to your Metrika account.

Подключение на русском

Claude.ai (Настройки → Коннекторы → Добавить):

https://mcp.getaiaiai.ru/yandex-metrika

Нажмите Подключить → войдите через Яндекс → разрешите доступ.

Claude Code CLI:

bash
claude mcp add --transport http yandex-metrika https://mcp.getaiaiai.ru/yandex-metrika/claude mcp login yandex-metrika

Откроется браузер → войти через Яндекс → готово.

Tools

ToolDescription
list_countersList all Yandex Metrika counters available to the token (id, name, site)
queryRun a Reporting API query — visits, users, pageviews, bounce rate, traffic sources, devices, geography, UTMs, and more

query parameters

ParameterDefaultDescription
counter_idrequiredCounter ID from list_counters
metricsrequiredComma-separated metrics, e.g. ym:s:visits,ym:s:users
dimensions—Group-by fields: ym:s:date, ym:s:lastTrafficSource, ym:s:deviceCategory, …
date1 / date27daysAgo / todayDate range: YYYY-MM-DD or relative (today, yesterday, NdaysAgo)
filters—Filter expression, e.g. ym:s:deviceCategory=='mobile'
sort—Sort field; prefix - for descending, e.g. -ym:s:visits
limit100Max rows returned

Common metrics: ym:s:visits, ym:s:users, ym:s:pageviews, ym:s:bounceRate, ym:s:avgVisitDurationSeconds, ym:s:newUsers

Common dimensions: ym:s:date, ym:s:lastTrafficSource, ym:s:startURL, ym:s:deviceCategory, ym:s:regionCountry, ym:s:lastsourceUTMSource


Self-host with your own token

For developers — run the engine locally with full control over your data.

Requires Python 3.10+ and uv.

bash
git clone https://github.com/expremiental/yandex-metrika-mcp.gitcd yandex-metrika-mcpuv sync

Get a token. Go to oauth.yandex.ru, create an app (platform: "Web services"), enable Yandex Metrika → Read statistics (metrika:read), then get an OAuth token:

bash
export YANDEX_METRIKA_TOKEN="<your-token>"

Connect (Claude Desktop / Cursor — add to mcpServers):

json
{  "mcpServers": {    "yandex-metrika": {      "command": "uv",      "args": ["run", "yandex-metrika-mcp"],      "env": { "YANDEX_METRIKA_TOKEN": "<your-token>" }    }  }}

Run over HTTP:

bash
MCP_TRANSPORT=http PORT=8000 uv run yandex-metrika-mcp# endpoint: http://localhost:8000/mcp

Embed in your own backend. The engine accepts an injectable async token resolver — wrap it with your own auth:

python
from yandex_metrika_mcp import build_server
async def my_token_resolver() -> str:    return "<metrika:read token>"
build_server(token_resolver=my_token_resolver).run(transport="stdio")

Public API: build_server, YandexMetrikaClient, TokenResolver, env_token_resolver, main.

License

MIT · made by aiaiai

來源:README.md,提交 4e708b3

工具

2

list_counters

List Yandex Metrika counters available to the token. Returns each counter's id, name and site so you can pick a `counter_id` for `query`. Read scope is enough.

無需輸入參數。

query

Run a Reporting API query against a Metrika counter (aggregated stats). Pass Metrika field names directly. Common ones: Metrics (comma-separated): ym:s:visits, ym:s:users, ym:s:pageviews, ym:s:bounceRate, ym:s:avgVisitDurationSeconds, ym:s:newUsers Dimensions (comma-separated, optional — groups the result): ym:s:date, ym:s:lastTrafficSource, ym:s:startURL, ym:s:deviceCategory, ym:s:regionCountry, ym:s:<attribution>UTMSource date1 / date2: YYYY-MM-DD or relative (today, yesterday, NdaysAgo). filters: Metrika filter expression, e.g. "ym:s:deviceCategory=='mobile'". sort: field to sort by; prefix with '-' for descending, e.g. "-ym:s:visits". Returns the raw Reporting API response (query meta, totals and data rows).

輸入參數sortdate1date2limitfiltersmetrics必填counter_id必填dimensions

版本歷史

1
  1. v0.1.0最新Sep 16, 2026

評分

已滿足適用檢查項的 100%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通必需25 分
  • 已宣告認證方式必需10 分
  • 已列出工具必需15 分
  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分