Skip to content

Commit 70a7448

Browse files
authored
Merge pull request #25 from Countly/ar2rsawseen/main
Home page and analytics
2 parents 82402c0 + 8c7abe7 commit 70a7448

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+13839
-725
lines changed

.env.example

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ COUNTLY_SERVER_URL=https://api.count.ly
3838
# Default: 30000 (30 seconds)
3939
COUNTLY_TIMEOUT=30000
4040

41+
# Analytics Tracking (optional)
42+
# Enable anonymous usage analytics to help improve the MCP server
43+
# All data is aggregated under device ID "mcp" - completely anonymous
44+
# NO authentication tokens, server URLs, or personal data is collected
45+
# Default: false (disabled)
46+
# ENABLE_ANALYTICS=true
47+
4148

4249
# ==============================================================================
4350
# AUTHENTICATION PRIORITY

.env.tools.example

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,39 +25,39 @@
2525
# These are read-only tools, typically should not be disabled
2626
# COUNTLY_TOOLS_CORE=R
2727

28-
# Apps Management (list_apps, get_app_by_name, create_app, update_app, delete_app, reset_app)
28+
# Apps Management (apps_list, apps_get_by_name, apps_create, apps_update, apps_delete, apps_reset)
2929
# Example: Allow read and create, but not update or delete
3030
# COUNTLY_TOOLS_APPS=CR
3131

32-
# Analytics & Dashboards (get_analytics_data, get_dashboard_data, get_events_data, get_slipping_away_users, etc.)
32+
# Analytics & Dashboards (get_analytics_data, dashboards_data, get_events_data, slipping_users, etc.)
3333
# Typically read-only
3434
# COUNTLY_TOOLS_ANALYTICS=R
3535

36-
# Crash Analytics (list_crash_groups, view_crash, add/edit/delete comments, resolve, etc.)
36+
# Crash Analytics (crash_groups_list, crashes_get, add/edit/delete comments, resolve, etc.)
3737
# Example: Allow read and comment creation, but not editing or deleting
3838
# COUNTLY_TOOLS_CRASHES=CR
3939

40-
# Notes Management (list_notes, create_note, delete_note)
40+
# Notes Management (notes_list, notes_create, notes_delete)
4141
# COUNTLY_TOOLS_NOTES=CRD
4242

43-
# Events Configuration (create_event)
43+
# Events Configuration (events_create)
4444
# COUNTLY_TOOLS_EVENTS=C
4545

46-
# Alerts Management (list_alerts, create_alert, delete_alert)
46+
# Alerts Management (alerts_list, alerts_create, alerts_delete)
4747
# COUNTLY_TOOLS_ALERTS=CRD
4848

49-
# Views Analytics (get_views_table, get_view_segments, get_views_data)
49+
# Views Analytics (views_table, views_segments, views_data)
5050
# COUNTLY_TOOLS_VIEWS=R
5151

52-
# Database Operations (query_database, list_databases, get_document, etc.)
52+
# Database Operations (databases_query, databases_list, databases_document, etc.)
5353
# Example: Read-only database access
5454
# COUNTLY_TOOLS_DATABASE=R
5555

56-
# Dashboard User Management (get_all_dashboard_users)
56+
# Dashboard User Management (dashboard_users)
5757
# Returns dashboard/admin users who access the Countly dashboard
5858
# COUNTLY_TOOLS_DASHBOARD_USERS=R
5959

60-
# App User Management (create_app_user, delete_app_user, export_app_users)
60+
# App User Management (apps_create_user, apps_delete_user, export_app_users)
6161
# Manages end-users of applications being tracked by Countly
6262
# COUNTLY_TOOLS_APP_USERS=CRD
6363

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
node_modules/
22
build/
33
dist/
4+
coverage/
45
*.log
56
.env
67
.env.local

.well-known/mcp-manifest.json

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
{
2+
"name": "countly-mcp-server",
3+
"version": "1.0.1",
4+
"description": "Model Context Protocol server for Countly Analytics Platform",
5+
"protocol": {
6+
"version": "2025-06-18",
7+
"name": "Model Context Protocol"
8+
},
9+
"endpoints": {
10+
"mcp": "/mcp",
11+
"health": "/health"
12+
},
13+
"transports": [
14+
"stdio",
15+
"http-sse"
16+
],
17+
"capabilities": {
18+
"tools": {
19+
"count": 134,
20+
"categories": 30,
21+
"listChanged": true
22+
},
23+
"resources": {
24+
"supported": true,
25+
"subscribe": false,
26+
"listChanged": false,
27+
"types": [
28+
"app-config",
29+
"event-schemas",
30+
"analytics-overview"
31+
],
32+
"uri_scheme": "countly://"
33+
},
34+
"prompts": {
35+
"supported": true,
36+
"count": 8,
37+
"listChanged": false,
38+
"templates": [
39+
"analyze_crash_trends",
40+
"generate_engagement_report",
41+
"compare_app_versions",
42+
"user_retention_analysis",
43+
"funnel_optimization",
44+
"event_health_check",
45+
"identify_churn_risk",
46+
"performance_dashboard"
47+
]
48+
},
49+
"features": [
50+
"analytics",
51+
"crash-analytics",
52+
"app-management",
53+
"user-management",
54+
"events",
55+
"views",
56+
"dashboards",
57+
"alerts",
58+
"hooks",
59+
"database-operations",
60+
"resources",
61+
"prompts"
62+
]
63+
},
64+
"authentication": {
65+
"methods": [
66+
"environment-variables",
67+
"http-headers",
68+
"url-parameters",
69+
"token-file"
70+
],
71+
"required": true
72+
},
73+
"documentation": {
74+
"readme": "https://github.com/countly/countly-mcp-server/blob/main/README.md",
75+
"tools": "https://github.com/countly/countly-mcp-server/blob/main/TOOLS_CONFIGURATION.md",
76+
"contributing": "https://github.com/countly/countly-mcp-server/blob/main/CONTRIBUTING.md"
77+
},
78+
"repository": {
79+
"type": "git",
80+
"url": "https://github.com/countly/countly-mcp-server"
81+
},
82+
"license": "MIT",
83+
"vendor": "Countly",
84+
"homepage": "https://count.ly"
85+
}

CHANGELOG.md

Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,192 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.1.0] - 2025-11-12
9+
10+
### Added
11+
- **MCP Resources Support**: Implemented full resources capability for providing read-only context to AI assistants
12+
- `resources/list`: List all available resources across applications
13+
- `resources/read`: Read specific resource content by URI
14+
- Resource types: app configuration (`countly://app/{id}/config`), event schemas (`countly://app/{id}/events`), analytics overview (`countly://app/{id}/overview`)
15+
- Resources provide AI context without requiring tool calls, improving efficiency
16+
17+
- **MCP Prompts Support**: Implemented full prompts capability with 8 pre-built analysis templates
18+
- `prompts/list`: List all available prompt templates
19+
- `prompts/get`: Get specific prompt with arguments
20+
- Prompt templates:
21+
* `analyze_crash_trends`: Analyze crash and error patterns over time
22+
* `generate_engagement_report`: Comprehensive user engagement analysis
23+
* `compare_app_versions`: Compare performance metrics between versions
24+
* `user_retention_analysis`: Analyze retention patterns and cohort behavior
25+
* `funnel_optimization`: Conversion funnel analysis with optimization suggestions
26+
* `event_health_check`: Event tracking implementation quality check
27+
* `identify_churn_risk`: Find users showing signs of decreased engagement
28+
* `performance_dashboard`: Comprehensive application performance overview
29+
- Prompts can be exposed as slash commands in MCP clients for guided workflows
30+
31+
- **Hooks Module** (6 tools): Webhook and automation management based on `hooks` plugin
32+
- `hooks_list`: List all webhooks/hooks configured for an app
33+
- `hooks_test`: Test hook configuration with mock data before creating
34+
- `hooks_create`: Create webhooks with multiple trigger types (IncomingDataTrigger, APIEndPointTrigger, InternalEventTrigger, ScheduledTrigger) and effects (HTTPEffect, EmailEffect, CustomCodeEffect)
35+
- `hooks_update`: Update existing webhook configurations
36+
- `hooks_delete`: Delete webhooks by ID
37+
- `hooks_internal_triggers_get`: Get list of 23 available internal Countly events for triggers
38+
39+
- **Times of Day Module** (1 tool): User behavior pattern analysis based on `times-of-day` plugin
40+
- `times_of_day`: Analyze when users are most active throughout the day/week in their local time
41+
42+
- **Dashboards Module** (8 tools): Custom dashboard management based on `dashboards` plugin
43+
- `dashboards_list`: List all available dashboards
44+
- `dashboards_data`: Get widgets and data for specific dashboard
45+
- `dashboards_create`: Create dashboards with sharing, auto-refresh, and themes
46+
- `dashboards_update`: Update dashboard configuration
47+
- `dashboards_delete`: Delete dashboards
48+
- `dashboards_widget_add`: Add widgets with full configuration
49+
- `dashboards_update_widget`: Update widget position/size in grid layout
50+
- `dashboards_widget_remove`: Remove widgets from dashboard
51+
52+
- **Email Reports Module** (7 tools): Periodic email report management based on `reports` plugin
53+
- `email_reports_list`: List all configured email reports
54+
- `email_reports_core_create`: Create reports with analytics, events, crashes, and star-rating metrics
55+
- `email_reports_dashboard_create`: Create reports for specific dashboards
56+
- `email_reports_update`: Update report configuration
57+
- `email_reports_preview`: Preview reports before sending
58+
- `email_reports_send`: Manually trigger report sending
59+
- `email_reports_delete`: Delete report configurations
60+
61+
- **Server Logs Module** (2 tools): Server log file access based on `errorlogs` plugin
62+
- `server_logs_files_list`: List available log files (api, dashboard, jobs)
63+
- `server_logs_contents`: View log file contents (non-Docker deployments only)
64+
65+
- **Datapoint Module** (3 tools): Data point monitoring for billing/capacity planning based on `server-stats` plugin
66+
- `datapoints_stats`: Get overall data point collection statistics
67+
- `get_top_apps_by_datapoints`: Rank apps by data point usage
68+
- `datapoints_punch_card`: Hourly load pattern visualization
69+
70+
- **Filtering Rules Module** (4 tools): Request blocking management based on `blocks` plugin
71+
- `filtering_rules_list`: List all configured blocking rules
72+
- `filtering_rules_create`: Create rules to block requests by IP, version, or properties
73+
- `filtering_rules_update`: Update existing blocking rules
74+
- `filtering_rules_delete`: Delete blocking rules
75+
76+
- **Compliance Hub Module** (4 tools): Data consent and privacy management based on `compliance-hub` plugin
77+
- `list_consents`: List all consent features configured for an app
78+
- `get_consent_history`: Get change history for a specific consent feature
79+
- `export_user_data`: Request data export for a specific user
80+
- `anonymize_user`: Anonymize user data while preserving analytics
81+
82+
- **SDKs Module** (2 tools): SDK version monitoring based on `sdks` plugin
83+
- `get_sdks_list`: List SDK versions used by apps
84+
- `get_sdks_stats`: Get detailed SDK usage statistics
85+
86+
- **Logger Module** (1 tool): System log viewing based on `logger` plugin
87+
- `get_logger_data`: Retrieve and filter system logs
88+
89+
- **AB Testing Module** (8 tools): A/B test experiment management based on `ab-testing` plugin
90+
- `list_experiments`: List all A/B testing experiments
91+
- `get_experiment`: Get detailed experiment information
92+
- `create_experiment`: Create new experiments with control/variant groups
93+
- `update_experiment`: Update experiment configuration
94+
- `start_experiment`: Start running an experiment
95+
- `stop_experiment`: Stop a running experiment
96+
- `finish_experiment`: Mark experiment as finished
97+
- `delete_experiment`: Delete experiments
98+
99+
- **Remote Config Module** (8 tools): Remote configuration management based on `remote-config` plugin
100+
- `list_remote_config_parameters`: List all parameters
101+
- `get_remote_config_parameter`: Get specific parameter details
102+
- `create_remote_config_parameter`: Create new parameters
103+
- `remote_config_parameters_update`: Update parameters
104+
- `remote_config_parameters_delete`: Delete parameters
105+
- `list_remote_config_conditions`: List targeting conditions
106+
- `create_remote_config_condition`: Create targeting conditions
107+
- `remote_config_conditions_delete`: Delete conditions
108+
109+
- **Retention Module** (1 tool): User retention analysis based on `retention_segments` plugin
110+
- `retention_data`: Analyze user retention cohorts over time
111+
112+
- **Live Users Module** (6 tools): Real-time concurrent user monitoring based on `concurrent_users` plugin
113+
- `live_users`: Get current concurrent users
114+
- `get_live_user_details`: Get detailed information about live users
115+
- `get_live_cities`: See cities with active users
116+
- `get_live_countries`: See countries with active users
117+
- `get_live_durations`: Analyze session durations of live users
118+
- `get_live_sources`: See traffic sources of live users
119+
120+
- **Formulas Module** (6 tools): Custom metric formula management based on `formulas` plugin
121+
- `formulas_list`: List all configured formulas
122+
- `get_formula`: Get specific formula details
123+
- `create_formula`: Create custom metric formulas
124+
- `update_formula`: Update formula configuration
125+
- `formulas_delete`: Delete formulas
126+
- `get_formula_data`: Get calculated formula data
127+
128+
- **Funnels Module** (7 tools): Conversion funnel analysis based on `funnels` plugin
129+
- `funnels_list`: List all configured funnels
130+
- `funnels_data`: Get funnel conversion data
131+
- `funnels_step_users`: Get users who reached a specific step
132+
- `funnels_dropoff_users`: Get users who dropped off between steps
133+
- `funnels_create`: Create conversion funnels with multiple steps
134+
- `funnels_update`: Update funnel configuration
135+
- `funnels_delete`: Delete funnels
136+
137+
- **Cohorts Module** (8 tools): User cohort management based on `cohorts` plugin
138+
- `cohorts_list`: List all cohorts
139+
- `cohorts_data`: Get cohort data over a period
140+
- `cohorts_create`: Create user cohorts with conditions
141+
- `cohorts_update`: Update cohort configuration
142+
- `cohorts_delete`: Delete cohorts
143+
- `cohorts_details_users`: Get users in a cohort
144+
- `recalculate_cohort`: Trigger cohort recalculation
145+
- `cohorts_details_user_count`: Get current user count
146+
147+
- **User Profiles Module** (4 tools): App user profile management based on `users` plugin
148+
- `search_user_profiles`: Search users with filters and sorting
149+
- `get_user_profile`: Get detailed user profile
150+
- `export_user_profiles`: Export user data to CSV
151+
- `get_user_profile_schema`: Get available user properties
152+
153+
- **Drill Module** (5 tools): Advanced query and segmentation based on `drill` plugin
154+
- `drill_query`: Execute custom drill queries
155+
- `get_drill_meta`: Get available drill properties
156+
- `get_drill_bookmarks`: List saved drill queries
157+
- `drill_bookmarks_create`: Save drill queries
158+
- `drill_bookmarks_delete`: Delete saved queries
159+
160+
- **Core Module Enhancements** (2 additional tools):
161+
- `jobs_list`: List background jobs with pagination and sorting
162+
- `job_runs`: Get execution history for specific jobs
163+
164+
- **Analytics Module Enhancements** (4 additional tools):
165+
- `user_loyalty`: Analyze user loyalty and session count distribution
166+
- `session_durations`: Analyze session duration patterns
167+
- `session_frequency`: Analyze time between user sessions
168+
- `slipping_users`: Identify users becoming inactive
169+
170+
### Changed
171+
- **Tool Count**: Expanded from 27 tools to 132 tools across 30 categories
172+
- **Plugin Coverage**: Added support for 21 additional Countly plugins
173+
- **Plugin Availability**: Automatically check plugin availability for specific tools, ensuring only compatible tools are exposed based on server configuration
174+
- **URL Parameter Authentication**: Added support for passing Server URL and auth token as URL parameters for flexible authentication
175+
- **Analytics Tracking**: Added comprehensive anonymous usage analytics with opt-out capability
176+
- **Error Handling**: Improved API error messages and formatting throughout all modules
177+
- **Testing**: Expanded test suite with 223 tests including analytics, transport, and tool configuration tests
178+
- **Documentation**: Updated README with all new modules and tool descriptions
179+
- **Configuration**: Added plugin-based tool filtering and availability checks
180+
- **Home Page**: Added informational home page with basic project information and links
181+
- **Server Discovery**: Added `.well-known/mcp-manifest.json` endpoint for automated server discovery and capability detection
182+
183+
### Fixed
184+
- **Security Updates**: Updated SECURITY.md with vulnerability levels and reward structure
185+
- **URL Handling**: Improved URL parameter support for server URL and auth token
186+
187+
### Testing
188+
- Added 748 new analytics tests covering tracking, sessions, events, and error handling
189+
- Added 141 core tools tests for new job management features
190+
- Added 399 error handler tests for improved error scenarios
191+
- Added comprehensive transport integration tests for stdio and HTTP/SSE modes
192+
- Updated tool configuration tests to cover all 30 categories and 132 tools
193+
8194
## [1.0.1] - 2025-11-07
9195

10196
### Added

CONTRIBUTING.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,10 @@ export const userManagementToolDefinitions = [
161161
// 4. Add to handlers map
162162
export const userManagementToolHandlers = {
163163
'get_all_users': 'getAllUsers',
164-
'create_app_user': 'createAppUser',
165-
'delete_app_user': 'deleteAppUser',
164+
'apps_create_user': 'createAppUser',
165+
'apps_delete_user': 'deleteAppUser',
166166
'export_app_users': 'exportAppUsers',
167-
'get_slipping_away_users': 'getSlippingAwayUsers',
167+
'slipping_users': 'getSlippingAwayUsers',
168168
'get_active_users': 'getActiveUsers', // Add here
169169
} as const;
170170

@@ -187,10 +187,10 @@ That's it! The tool is now automatically discovered and routed by the main serve
187187
**CRITICAL**: When adding a new tool, you **MUST** update the CRUD permissions configuration in `src/lib/tools-config.ts`. This allows administrators to control access to your tool through environment variables.
188188

189189
Each tool must be classified with one of these CRUD operations:
190-
- **C (Create)** - Tools that create new resources (e.g., `create_app`, `create_note`, `add_crash_comment`)
191-
- **R (Read)** - Tools that read/retrieve data (e.g., `list_apps`, `get_dashboard_data`, `view_crash`)
192-
- **U (Update)** - Tools that modify existing resources (e.g., `update_app`, `edit_crash_comment`, `resolve_crash`)
193-
- **D (Delete)** - Tools that delete resources (e.g., `delete_app`, `delete_note`, `reset_app`)
190+
- **C (Create)** - Tools that create new resources (e.g., `apps_create`, `notes_create`, `crashes_comment_add`)
191+
- **R (Read)** - Tools that read/retrieve data (e.g., `apps_list`, `dashboards_data`, `crashes_get`)
192+
- **U (Update)** - Tools that modify existing resources (e.g., `apps_update`, `crashes_comment_update`, `crashes_resolve`)
193+
- **D (Delete)** - Tools that delete resources (e.g., `apps_delete`, `notes_delete`, `apps_reset`)
194194

195195
**Example: Adding the `get_active_users` tool**
196196

@@ -202,10 +202,10 @@ export const TOOL_CATEGORIES: Record<string, { operations: Record<string, CrudOp
202202

203203
users: {
204204
operations: {
205-
'create_app_user': 'C',
206-
'delete_app_user': 'D',
205+
'apps_create_user': 'C',
206+
'apps_delete_user': 'D',
207207
'export_app_users': 'R',
208-
'get_slipping_away_users': 'R',
208+
'slipping_users': 'R',
209209
'get_all_users': 'R',
210210
'get_active_users': 'R', // ADD YOUR TOOL HERE with appropriate CRUD operation
211211
}

0 commit comments

Comments
 (0)