You can connect Countly to Claude Desktop, or to GitHub Copilot in VS Code, so your AI assistant can work with your real analytics, events, crashes, and dashboards.
Once connected, you can ask things like:
- "Show me the top events for my app this week."
- "Analyze this code and suggest what I should track."
- "Which button placement drives better conversion?"
For more ideas, see What Can You Do with Countly MCP? at the end of this article.
This article guides you through setting up the Countly MCP Server package, which runs on your computer and connects your AI assistant to Countly with an auth token.
Getting Started
Privacy is at our core
If you connect an AI assistant to your Countly data, we recommend a self-hosted Countly instance together with a self-hosted or on-premise LLM. With a cloud-based assistant, such as Claude Desktop or GitHub Copilot, your questions and the data returned pass through that provider's infrastructure. Make sure this fits your data policy.
You need two things to get started:
- A Countly auth token. Create one in the Token Manager of your Countly Server. See this guide for the steps.
- Node.js 18 or later, a one-time setup. See the official download page.
Choosing the Token's Permissions
The token decides what your AI assistant can see and change in Countly. Give it only what you need:
- Endpoints: limit the token to the areas you want to explore, such as Events or Crashes. A token for all endpoints also allows the assistant to change settings and delete data.
- Expiration: a token without an expiration date is simplest to maintain. If you set one, create a new token when it expires and update your configuration.
The MCP Server allows everything by default
Unless you restrict it, the MCP Server offers your assistant every tool your token permits, including tools that delete apps and data. To start safely, add "COUNTLY_TOOLS_ALL": "R" to your configuration for read-only access. See Advanced Configuration.
Self-hosted Countly Users
If you use self-hosted Countly, we suggest running the MCP Server locally or inside your own infrastructure. This keeps your Countly URL and token away from external services.
Claude Desktop
Claude Desktop is the easiest way to get started. Follow the steps below.
Step 1: Opening the MCP Configuration
Option A (recommended): in Claude Desktop, go to Settings > Developer > Local MCP Servers and click Edit Config.
Option B (manual): open the configuration file directly.
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.jsonStep 2: Adding Countly MCP
If your configuration is empty, paste the following:
{
"mcpServers": {
"countly": {
"command": "npx",
"args": ["-y", "--prefer-online", "countly-mcp-server@latest"],
"env": {
"COUNTLY_SERVER_URL": "https://your-countly-url.com",
"COUNTLY_AUTH_TOKEN": "YOUR_TOKEN",
"COUNTLY_TOOLS_ALL": "R"
}
}
}
}If you already have other MCP servers, add Countly inside the existing mcpServers object. For example:
{
"mcpServers": {
"existing-server": {
"command": "..."
},
"countly": {
"command": "npx",
"args": ["-y", "--prefer-online", "countly-mcp-server@latest"],
"env": {
"COUNTLY_SERVER_URL": "https://your-countly-url.com",
"COUNTLY_AUTH_TOKEN": "YOUR_TOKEN",
"COUNTLY_TOOLS_ALL": "R"
}
}
}
}Replace https://your-countly-url.com with your Countly URL and YOUR_TOKEN with your Countly auth token, then save the file. "COUNTLY_TOOLS_ALL": "R" keeps the assistant read-only. Remove it or change it once you know which actions you want to allow.
Step 3: Restarting Claude Desktop
Quit Claude fully
Quit Claude Desktop completely, not just its window, then open it again.
Once Claude Desktop is open again, the Countly MCP Server appears in the list:
Step 4: Verifying the Connection
Open a new or existing chat and click the + (plus) icon. The Countly tools appear in the list:
Now ask "List my Countly apps". If you get a list of your apps, the Countly MCP Server works.
VS Code and GitHub Copilot
Step 1: Opening the MCP Configuration File
Open VS Code, then open the Command Palette with Show and Run Commands:
Run MCP: Open User Configuration:
This opens the mcp.json file, where you add the Countly configuration in the next step.
Step 2: Adding the Countly Configuration
{
"servers": {
"countly": {
"type": "stdio",
"command": "npx",
"args": ["-y", "--prefer-online", "countly-mcp-server@latest"],
"env": {
"COUNTLY_SERVER_URL": "https://your-countly-url.com",
"COUNTLY_AUTH_TOKEN": "YOUR_TOKEN",
"COUNTLY_TOOLS_ALL": "R"
}
}
}
}Replace the URL and token with your own, as described for Claude Desktop, then save the file.
Step 3: Verifying the Connection
Run MCP: Show Installed Servers from the Command Palette:
Countly appears as an installed server:
To check the server's status, run MCP: List Servers from the Command Palette:
If the countly server shows as Stopped:
Click countly and select Start Server:
Once the server starts, the VS Code output console shows logs similar to these:
2026-04-23 15:11:28.252 [info] Starting server countly
2026-04-23 15:11:28.253 [info] Connection state: Starting
2026-04-23 15:11:28.254 [info] Starting server from LocalProcess extension host
2026-04-23 15:11:28.254 [info] Connection state: Starting
2026-04-23 15:11:28.254 [info] Connection state: RunningWith the server running, try @countly list my apps in GitHub Copilot Chat in VS Code:
Advanced Configuration
By default, the MCP Server offers every tool that your Countly instance supports and your token permits, including tools that create, change, and delete data.
You can restrict it further with COUNTLY_TOOLS_* environment variables. This is useful when you want the AI assistant to:
- only read data
- create notes or alerts, but not delete anything
- read analytics, but not user profiles or the database
- work with a token that has broad permissions, while exposing less through MCP
Add every restriction to the env section of your MCP configuration file. This applies to both Claude Desktop and VS Code with GitHub Copilot.
Setting CRUD Permission Values
Each variable takes a value that sets which actions the AI can perform:
| Value | Meaning |
|---|---|
NONE |
Disable the tools |
R |
Read only |
CR |
Create and Read |
CRU |
Create, Read, and Update |
CRUD |
Create, Read, Update, and Delete. This is the default. |
Values are not case-sensitive. For example, add "COUNTLY_TOOLS_ALL": "R" to allow read-only access:
{
"servers": {
"countly": {
"type": "stdio",
"command": "npx",
"args": ["-y", "--prefer-online", "countly-mcp-server@latest"],
"env": {
"COUNTLY_SERVER_URL": "https://your-countly-url.com",
"COUNTLY_AUTH_TOKEN": "YOUR_TOKEN",
"COUNTLY_TOOLS_ALL": "R"
}
}
}
}Applying One Rule to Everything
"COUNTLY_TOOLS_ALL": "R" makes all tools read-only. "COUNTLY_TOOLS_ALL": "NONE" disables all tools, so you can then enable only the categories you need. A category variable always overrides COUNTLY_TOOLS_ALL.
Enabling Selected Categories Only
For example, to allow read-only analytics, events, and apps, and disable everything else:
"COUNTLY_TOOLS_ALL": "NONE",
"COUNTLY_TOOLS_ANALYTICS": "R",
"COUNTLY_TOOLS_EVENTS": "R",
"COUNTLY_TOOLS_APPS": "R"This setup suits users who only want to explore analytics. It also disables the core tools, such as ping and get_version. Add "COUNTLY_TOOLS_CORE": "R" if you want to keep them.
Setting Up Read-only Analytics
This setup allows general read-only access, and turns off the areas that hold personal data or give raw database access:
"COUNTLY_TOOLS_ALL": "R",
"COUNTLY_TOOLS_DATABASE": "NONE",
"COUNTLY_TOOLS_DASHBOARD_USERS": "NONE",
"COUNTLY_TOOLS_USER_PROFILES": "NONE"Allowing Limited Write Actions
For example, to let your AI assistant create and read notes, but not update or delete them:
"COUNTLY_TOOLS_ALL": "R",
"COUNTLY_TOOLS_NOTES": "CR"Use this when you want the AI to help document findings without changing existing notes.
Allowing Crash Workflow Actions
This keeps most tools read-only, and allows the AI to comment on crashes and to resolve, unresolve, hide, or show crash groups, if your token permits it:
"COUNTLY_TOOLS_ALL": "R",
"COUNTLY_TOOLS_CRASHES": "CRU"Understanding Why Token Permissions Still Matter
MCP restrictions do not override the permissions of your Countly token. Your assistant can do only what both of these allow:
- your Countly token
- your MCP Server configuration
For example, if your token does not allow deleting but your MCP configuration says CRUD, deleting still does not work.
Troubleshooting
If you do not see the Countly tools, try the following:
- Quit Claude Desktop completely and open it again.
- Check that the configuration file is valid JSON.
- Check that Node.js 18 or later is installed.
- Check the token.
Authentication errors usually have one of these causes:
- a wrong token
- an expired token
- a wrong Countly URL
Two settings limit which tools your assistant sees:
- Token permissions: check the token in the Token Manager and grant the endpoints you need.
-
MCP restrictions: check the
COUNTLY_TOOLS_*variables in your configuration, for example a read-only"COUNTLY_TOOLS_ALL": "R"hides every write action.
Some tools also need a Countly feature to be enabled on your server, such as Crashes, Alerts, or DB Viewer.
Security Notes
-
Your token is stored in plain text in the configuration file of your MCP client. Treat that file like a password. To keep the token out of it, save the token in a separate file and set
COUNTLY_AUTH_TOKEN_FILEto that file's path instead ofCOUNTLY_AUTH_TOKEN. -
Do not commit your configuration to Git. If it is inside a repository, add it to
.gitignore. - Use a dedicated token for MCP, created in the Token Manager. Do not reuse a personal API key or a token with broad admin permissions.
- Revoke the token in the Token Manager if it is ever exposed, lost, or no longer needed.
Countly 27.0 and Later
In Countly 27.0 and later, the MCP Server is built into Countly. You do not need an auth token: you sign in to Countly in your browser and approve the connection, and the assistant then acts as you.
It works like this:
- A global administrator turns MCP on in Manage > MCP Server, and chooses who may connect and what assistants may do. MCP is off on a new server.
- You open your user menu, click Connect AI assistant, and copy the MCP URL. How to connect? shows the steps for each assistant, such as Claude, ChatGPT, Claude Code, Cursor, and VS Code.
- Your assistant opens Countly in your browser. You sign in, choose the access and how long the connection lasts, and click Approve.
The assistant never gets more rights than you have, and you can revoke the connection at any time. Cloud assistants, such as Claude and ChatGPT, need your Countly Server to be reachable from the internet. Assistants on your computer work with a server on your network.
Read the full guide
For settings, access levels, and revoking connections, see MCP Server. The token-based setup in the rest of this article also works with Countly 27.0, for example when MCP is not turned on for your server.