This example shows how to configure VS Code's MCP support to connect to Countly MCP Server.
Note: VS Code's MCP support is currently in preview/experimental phase. Make sure you have the latest version of VS Code Insiders or the MCP extension installed.
- VS Code version 1.102. and higher
- Countly Server where you collect your data
- Log into your Countly dashboard
- Go to My Profile → Token manager or navigate to https://your-countly-instance.com/dashboard#/manage/token_manager
- Create your auth token with needed permissions, expiration and usage
- Copy your created auth token
cd /path/to/countly-mcp-server
npm install
npm run build- Open Command Palette (Ctrl+Shift+P / Cmd+Shift+P)
- Search for "MCP Open User Configuration" (if you do not have one, your VSCode might be too old)
- This should creare mcp.json file where you would provide server configuration
Method 1: Connecting to local server pass both Countly Server URL and your auth token
{
"servers": {
"countly": {
"type": "stdio",
"command": "node",
"args": [
"/absolute/path/to/countly-mcp-server/build/index.js"
],
"env": {
"COUNTLY_SERVER_URL": "https://your-countly-instance.com",
"COUNTLY_AUTH_TOKEN": "your-auth-token-here"
}
}
},
"inputs": []
}Method 2: Connecting to remote server pass your Countly Auth Token
{
"servers": {
"countly": {
"type": "sse",
"url": "http://localhost:3000/mcp",
"headers": {
"X-Countly-Server-Url": "https://your-countly-instance.com",
"X-Countly-Auth-Token": "your-auth-token-here"
}
}
},
"inputs": []
}Note: The VS Code MCP extension passes credentials via HTTP headers (X-Countly-Server-Url and X-Countly-Auth-Token). This allows multiple users to connect to the same Docker instance with their own credentials.
Method 3: Docker Container (stdio)
{
"servers": {
"countly": {
"type": "stdio",
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e", "COUNTLY_SERVER_URL=https://your-countly-instance.com",
"-e", "COUNTLY_AUTH_TOKEN=your-auth-token-here",
"countly-mcp-server",
"node", "build/index.js"
]
}
},
"inputs": []
}- Replace
/absolute/path/to/countly-mcp-serverwith your actual path - Replace
https://your-countly-instance.comwith your Countly URL - Replace
your-auth-token-herewith your actual token
Workspace-Specific Configuration
For project-specific configuration, create .vscode/mcp.json in your workspace:
- Use Command Palette → "MCP: Show Installed Servers"
- It should open pane with countly MCP server
- If it does not, restart your VS Code
Once configured, you can use the Countly MCP server through:
@countly list my apps
@countly show dashboard for MyApp
@countly get top events
The server will be available to any VS Code extension using the Language Model API with MCP support.
-
Check MCP Status:
- Open Command Palette
- Type "MCP: Show Status"
- Verify "countly" server is listed and connected
-
View Logs:
- Open Output panel (View → Output)
- Select "MCP" from the dropdown
- Check for connection messages
-
Test Connection:
@countly Can you list my Countly applications?
- Check VS Code Output logs (MCP channel)
- Verify Node.js path:
which node # macOS/Linux where node # Windows
- Test the server manually:
node /path/to/countly-mcp-server/build/index.js
-
Verify token is valid:
curl "https://your-countly-instance.com/o/apps/mine?auth_token=your-token" -
Check token permissions in Countly
-
Verify server is running:
curl http://localhost:3000/health
-
Check firewall settings
-
Verify port 3000 is not in use:
lsof -i :3000 # macOS/Linux netstat -ano | findstr :3000 # Windows
- Use workspace-specific settings for project-based configurations
- Use environment variables for sensitive data (tokens)
- Use HTTP/SSE mode for remote servers or shared instances
- Use stdio mode for local development (more secure, faster)
- Monitor logs through VS Code's Output panel
- Never commit
.vscode/mcp.jsonwith tokens to git - Add
.vscode/mcp.jsonto.gitignoreif it contains secrets - Use environment variables or token files for production
- Consider using VS Code's Secret Storage API for tokens (if extension supports it)