Yandex Metrika MCP Server (ymetrika-mcp)
Yandex Metrika MCP Server
A FastMCP-based MCP server for Yandex Metrika reports: visits, traffic sources, demographics, goal conversions
Low risk
We rate an entry low when it mostly gives the agent instructions and reference material.
Why this level
- All tools only read Metrika reporting data
- Issue the token with metrika:read scope only, without write access
Install
Manual install
docker build -t yandex-metrika-mcp . && docker run -p 8000:8000 -e YANDEX_API_KEY=your_api_key_here yandex-metrika-mcpBuild and run the container as shown in the README; the server listens on port 8000.
This is third-party code. Review the repository files before installing.
What it does
A Python and FastMCP server exposes MCP over streamable HTTP and provides five tools on top of the Metrika Reporting API: counter info, visits for a period, traffic source breakdown, user demographics and goal conversions. A diagnostic ping tool checks the transport. Every call is wrapped in an OpenTelemetry trace, the server exposes Prometheus metrics at /metrics and status at /health. It runs locally via uv or in Docker under a non-root user.
Who it is for. For teams that want an observable Metrika reporting MCP server with tracing and metrics for their own infrastructure.
Good fit when
- You need basic Metrika reports (visits, sources, demographics, goals) over MCP
- Observability matters: OpenTelemetry traces and Prometheus metrics on your own server
- You plan to deploy it in Docker alongside your monitoring stack
Not a fit when
- You need the full Stat API or Logs API surface: only five ready tools are implemented here
- You need Direct or Webmaster support in the same server
Example request
Show visits and traffic sources for counter 12345678 over the last weekLimitations
Only five reporting tools plus ping are implemented; other Metrika methods (Logs API, management, import) are not covered. The server only speaks streamable HTTP, no stdio mode. A Yandex OAuth token with Metrika access is required. The README has no npx or uvx one-liner, only clone and uv sync.
How to disable. Stop the server process or container and remove its address from your MCP client settings.
MCP
- Transport
- http
- Authentication
- API key
| Environment variables | |
|---|---|
| YANDEX_API_KEY required, secret | Yandex OAuth token with read access to Metrika |
| YANDEX_COUNTER_ID | Default Metrika counter ID |
| PORT | Server port, defaults to 8000 |
| ENVIRONMENT | development or production mode; production enforces YANDEX_API_KEY validation |
Security check
- All tools only read Metrika reporting data
- Issue the token with metrika:read scope only, without write access
README in short
The README covers quick start via uv and Docker, the endpoint list (mcp, metrics, health) and detailed parameters for each of the five tools with JSON request and response examples. Separate sections cover environment variables, getting a metrika:read OAuth token, OpenTelemetry tracing, Prometheus metrics and project layout. A roadmap at the end marks the basic tools phase done, with batch reports and multi-counter support planned next.
FAQ
Can it run without Docker?
Yes, via uv sync and uv run python src/server.py; the server comes up at http://0.0.0.0:8000.
Does the server change anything in the Metrika account?
No, all five tools only read reports, there is no write access to the account.
Related
Official DataLens (Yandex) skills for Claude Code, Codex and OpenCode: SDK, HTML reports and RLS resolution
A Yandex Metrika MCP server generated from the API spec: 108 methods, 10 tools declared by default, transparent filters and response metadata
An open MCP server and agent skill set for SEO: keyword research, competitors, backlinks and site audits powered by DataForSEO
A Claude Code plugin for SEO audits: technical SEO, E-E-A-T, schema, local and AI search via parallel subagents