---
updatedAt: 2026-03-13T08:04:18.000Z
agentTools:
  projectIndex: https://developers.piwik.pro/llms.txt
---

# MCP Server

Connect your AI assistant to Piwik PRO and use everyday language to work with your analytics.

The Piwik PRO MCP Server lets you connect AI assistants, such as Claude, Cursor, or other MCP-compatible clients, directly to your Piwik PRO account. It lets you use natural language to query analytics data, manage tags, and configure tracking without working through the interface manually.

It's based on the open [Model Context Protocol](https://modelcontextprotocol.io/) (MCP) standard and is available as an open-source project on [GitHub](https://github.com/PiwikPRO/mcp).

## What can you do with the MCP Server?

* Run flexible queries with custom date ranges and filters
* Discover available dimensions and metrics
* Get answers to analytics questions in seconds

### Have a conversation with your analytics data

Ask questions about your visitors, page views, conversions, and more. The Query API lets you explore data using natural language, so you don’t need to build reports manually.

<HTMLBlock>
{`
<style>
.pp-tw {
  --pp-tw-bg: #f6f8fa;
  --pp-tw-border: #d0d7de;
  --pp-tw-color: #24292f;
  --pp-tw-prefix: #656d76;
  --pp-tw-cursor: #24292f;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.9rem;
  line-height: 1.6;
  padding: 1rem 1.25rem;
  border-radius: 8px;
  background: var(--pp-tw-bg);
  border: 1px solid var(--pp-tw-border);
  color: var(--pp-tw-color);
  display: flex;
  align-items: center;
  margin: 1.5rem 0;
}
.pp-tw-prefix {
  color: var(--pp-tw-prefix);
  margin-right: 0.75rem;
  flex-shrink: 0;
  user-select: none;
}
.pp-tw-prompts {
  position: relative;
  height: 1.6em;
  flex-grow: 1;
}
.pp-tw-p {
  position: absolute;
  top: 0;
  left: 0;
  white-space: nowrap;
  overflow: hidden;
  width: 0;
  border-right: 2px solid transparent;
}
.pp-tw-p:nth-child(1) { animation: ppTw1 35s linear infinite; }
.pp-tw-p:nth-child(2) { animation: ppTw2 35s linear infinite; }
.pp-tw-p:nth-child(3) { animation: ppTw3 35s linear infinite; }
.pp-tw-p:nth-child(4) { animation: ppTw4 35s linear infinite; }
.pp-tw-p:nth-child(5) { animation: ppTw5 35s linear infinite; }

@keyframes ppTw1 {
0% { width: 0; border-right-color: var(--pp-tw-cursor); animation-timing-function: steps(38, end); }
4% { width: 38ch; border-right-color: var(--pp-tw-cursor); animation-timing-function: steps(1, end); }
10% { width: 38ch; border-right-color: var(--pp-tw-cursor); animation-timing-function: steps(38, end); }
12.5% { width: 0; border-right-color: transparent; animation-timing-function: steps(1, end); }
100% { width: 0; border-right-color: transparent; }
}
@keyframes ppTw2 {
0% { width: 0; border-right-color: transparent; animation-timing-function: steps(1, end); }
16% { width: 0; border-right-color: var(--pp-tw-cursor); animation-timing-function: steps(86, end); }
24% { width: 86ch; border-right-color: var(--pp-tw-cursor); animation-timing-function: steps(1, end); }
30% { width: 86ch; border-right-color: var(--pp-tw-cursor); animation-timing-function: steps(86, end); }
36% { width: 0; border-right-color: transparent; animation-timing-function: steps(1, end); }
100% { width: 0; border-right-color: transparent; }
}
@keyframes ppTw3 {
0% { width: 0; border-right-color: transparent; animation-timing-function: steps(1, end); }
39.5% { width: 0; border-right-color: var(--pp-tw-cursor); animation-timing-function: steps(68, end); }
47% { width: 68ch; border-right-color: var(--pp-tw-cursor); animation-timing-function: steps(1, end); }
53% { width: 68ch; border-right-color: var(--pp-tw-cursor); animation-timing-function: steps(68, end); }
59% { width: 0; border-right-color: transparent; animation-timing-function: steps(1, end); }
100% { width: 0; border-right-color: transparent; }
}
@keyframes ppTw4 {
0% { width: 0; border-right-color: transparent; animation-timing-function: steps(1, end); }
62.5% { width: 0; border-right-color: var(--pp-tw-cursor); animation-timing-function: steps(67, end); }
69.5% { width: 67ch; border-right-color: var(--pp-tw-cursor); animation-timing-function: steps(1, end); }
75.5% { width: 67ch; border-right-color: var(--pp-tw-cursor); animation-timing-function: steps(67, end); }
81% { width: 0; border-right-color: transparent; animation-timing-function: steps(1, end); }
100% { width: 0; border-right-color: transparent; }
}
@keyframes ppTw5 {
0% { width: 0; border-right-color: transparent; animation-timing-function: steps(1, end); }
84.5% { width: 0; border-right-color: var(--pp-tw-cursor); animation-timing-function: steps(65, end); }
90% { width: 65ch; border-right-color: var(--pp-tw-cursor); animation-timing-function: steps(1, end); }
94% { width: 65ch; border-right-color: var(--pp-tw-cursor); animation-timing-function: steps(65, end); }
97.5% { width: 0; border-right-color: transparent; animation-timing-function: steps(1, end); }
100% { width: 0; border-right-color: transparent; }
}

@media (prefers-color-scheme: dark) {
[data-color-mode="system"] .pp-tw {
--pp-tw-bg: #161b22;
--pp-tw-border: #30363d;
--pp-tw-color: #e6edf3;
--pp-tw-prefix: #8b949e;
--pp-tw-cursor: #e6edf3;
}
}
[data-color-mode="dark"] .pp-tw {
--pp-tw-bg: #161b22;
--pp-tw-border: #30363d;
--pp-tw-color: #e6edf3;
--pp-tw-prefix: #8b949e;
--pp-tw-cursor: #e6edf3;
}

</style>
<div class="pp-tw">
  <span class="pp-tw-prefix">&gt;</span>
  <div class="pp-tw-prompts">
    <span class="pp-tw-p">Which source had the most conversions?</span>
    <span class="pp-tw-p">List the top 5 most visited blog posts (pages with /blog/ in the URL) from last month.</span>
    <span class="pp-tw-p">Show the most common sources of LLM/AI traffic from the last quarter</span>
    <span class="pp-tw-p">Which country generated the highest traffic over the past 3 months?</span>
    <span class="pp-tw-p">List the top 10 landing pages from the last month for domain.com.</span>
  </div>
</div>
`}
</HTMLBlock>

### Manage analytics configuration

Keep your analytics setup organized without leaving the conversation with your AI assistant:

* **Annotations** — Mark important events, campaigns, or deployments
* **Goals** — Create and manage conversion tracking
* **Custom dimensions** — Extend your tracking with custom data points

### Control Tag Manager

Manage your tracking setup without touching your website code:

* **Tags** — Create and configure tracking tags
* **Triggers** — Define when and where tags fire
* **Variables** — Store and reuse dynamic values
* **Version Control** — Publish changes when you're ready

### Build audiences with Data Activation (DA)

Create targeted audiences based on user behavior and update segmentation rules in real time.

### Manage settings

Fine-tune your Piwik PRO setup — manage apps, configure tracker settings, and access container installation code.

## Prerequisites

* A Piwik PRO account with API credentials
* [uv](https://docs.astral.sh/uv/getting-started/installation/) or [Docker](https://docs.docker.com/get-started/get-docker/)
* An MCP-compatible client, such as Claude Desktop, Claude Code, or Cursor

## Generate API credentials

Go to the API credentials page in your account:

```
https://YOUR_ACCOUNT.piwik.pro/profile/api-credentials
```

Generate new credentials and note the following values:

| Variable                  | Description                                                |
| ------------------------- | ---------------------------------------------------------- |
| `PIWIK_PRO_HOST`          | Your Piwik PRO host, for example, `YOUR_ACCOUNT.piwik.pro` |
| `PIWIK_PRO_CLIENT_ID`     | Client ID from the generated credentials                   |
| `PIWIK_PRO_CLIENT_SECRET` | Client secret from the generated credentials               |

## Installation

All MCP clients use a JSON configuration file to register MCP servers. The file name and location depend on the client:

* **Claude Desktop** — Go to `Settings > Developer > Edit Config` to open the folder containing `claude_desktop_config.json`.
* **Cursor** — See the [Cursor MCP documentation](https://docs.cursor.com/en/context/mcp#configuration-locations) for config file locations.
* **Claude Code** — See the [Claude Code MCP documentation](https://docs.anthropic.com/en/docs/claude-code/mcp#installing-mcp-servers) for installation instructions.

Choose one of the options below, paste the configuration into your client's config file, and enter your credentials.

```json uv
{
  "mcpServers": {
    "piwik-pro-analytics": {
      "command": "uvx",
      "args": ["piwik-pro-mcp"],
      "env": {
        "PIWIK_PRO_HOST": "YOUR_ACCOUNT.piwik.pro",
        "PIWIK_PRO_CLIENT_ID": "YOUR_CLIENT_ID",
        "PIWIK_PRO_CLIENT_SECRET": "YOUR_CLIENT_SECRET"
      }
    }
  }
}
```
```json Docker
{
  "mcpServers": {
    "piwik-pro-analytics": {
      "command": "docker",
      "args": ["run", "-i", "--rm", "ghcr.io/piwikpro/mcp:latest"],
      "env": {
        "PIWIK_PRO_HOST": "YOUR_ACCOUNT.piwik.pro",
        "PIWIK_PRO_CLIENT_ID": "YOUR_CLIENT_ID",
        "PIWIK_PRO_CLIENT_SECRET": "YOUR_CLIENT_SECRET"
      }
    }
  }
}
```

After updating the configuration, restart your MCP client to apply the changes.

## First use

The server starts in **safe mode** by default, so you can explore your data without worrying about accidental changes. Try these prompts to get started:

```
List my Piwik PRO apps.

Which source had the most conversions?

Show me conversion trends for the past month.

List tags in my "app name" app.

Show the most common sources of LLM/AI traffic from the last quarter.

Which country generated the highest traffic over the past 3 months?

List the top 5 most visited blog posts (pages with /blog/ in the URL) from last month.
```

### Ready to make changes?

Once you're comfortable, disable safe mode to enable create, update, and delete operations. Add this to your environment variables:

```
PIWIK_PRO_SAFE_MODE=0
```

Then try prompts like:

```
Add an annotation for today's marketing campaign launch.
Create a new goal to track signups on the /thank-you page.
In app "app name", add a tag that fires on all page views.
```

## Feedback and contributions

This project is open source, and we welcome your feedback. If you have suggestions, run into issues, or want to request a feature, open an issue on the [GitHub repository](https://github.com/PiwikPRO/mcp/issues) or contact our support team.