Skip to content

Commit 7e1789b

Browse files
committed
feat(backend): Add MCP client activity metrics cleanup job and worker
1 parent c02f022 commit 7e1789b

File tree

25 files changed

+4723
-51
lines changed

25 files changed

+4723
-51
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ VS Code → HTTPS Request → DeployStack Satellite → MCP Server Process → E
148148
- **[Done]** **Resource Management** - process isolation (remote MCP) and limits
149149
- **[Done]** **GitHub README and Stars Integration** - automatic GitHub data fetching, secure storage, XSS prevention, DoS protection, and comprehensive audit logging for MCP server catalog enhancement
150150
- **[Done]** **Background Job Queue System** - complete 4-phase custom SQLite-based job queue with worker infrastructure, admin API, frontend monitoring UI, and comprehensive documentation for long-running tasks
151+
- **[Done]** **Cron Job Scheduling System** - recurring task scheduler using node-cron with integration into the job queue system, standard cron expression support, automatic lifecycle management, and complete separation of scheduling logic from execution for reliability and monitoring
151152
- **[Done]** **Frontend Syntax Highlighting** - reusable CodeHighlight component with Prism.js for JSON, JavaScript, TypeScript, Bash, and YAML code blocks
152153
- **[Done]** **Resource Management** - process isolation (stdio) and limits
153154
- **[Done]** **MCP Registry** - integration of the official MCP Registry
@@ -164,6 +165,7 @@ VS Code → HTTPS Request → DeployStack Satellite → MCP Server Process → E
164165
- **[Done]** **Satellite Job System** - recurring background task management with JobManager, abstract BaseJob class, automatic error handling, execution metrics tracking, and extensible architecture for health checks, cleanup tasks, and periodic maintenance operations
165166
- **[Done]** **Satellite Backend Events System** - real-time event processing with convention-based auto-discovery handler pattern, batch processing (1-100 events), partial success handling, JSON schema validation per event type, and extensible architecture supporting MCP client connections, tool executions, server crashes, and custom event types
166167
- **[Done]** **MCP Client Activity Tracking** - personal dashboard feature tracking active MCP clients per user across all components (backend database with mcpClientActivity table, satellite in-memory tracker with 30-second background job reporting via event system, dashboard API endpoint with dual authentication and pagination, client name detection from OAuth/headers/user-agent)
168+
- **[Done]** **Time-Series Metrics System** - production-ready metrics infrastructure with 15-minute bucket aggregation, 3-day retention, automated cleanup
167169
- **[To Do]** **Comprehensive Monitoring** - satellite health and usage analytics
168170
- **[To Do]** **Enterprise Security** - audit logging and compliance features
169171

services/backend/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,7 @@ npm run start
9191
npm run lint
9292

9393
# Database migrations
94-
npm run db:generate # Generate new migrations
95-
npm run db:up # Apply migrations
94+
npm run db:generate # Generate new migrations (applied automatically on server startup)
9695

9796
# API documentation
9897
npm run api:spec # Generate OpenAPI spec

services/backend/api-spec.json

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5203,27 +5203,25 @@
52035203
"6h",
52045204
"12h",
52055205
"24h",
5206-
"7d",
5207-
"30d"
5206+
"3d"
52085207
]
52095208
},
52105209
"in": "query",
52115210
"name": "time_range",
52125211
"required": false,
5213-
"description": "Time range for metrics (e.g., 3h, 24h, 7d)"
5212+
"description": "Time range for metrics (maximum 3 days for MCP client activity)"
52145213
},
52155214
{
52165215
"schema": {
52175216
"type": "string",
52185217
"enum": [
5219-
"15m",
5220-
"1h"
5218+
"15m"
52215219
]
52225220
},
52235221
"in": "query",
52245222
"name": "interval",
52255223
"required": false,
5226-
"description": "Bucket interval for aggregation"
5224+
"description": "Bucket interval for aggregation (only 15m supported for MCP client activity)"
52275225
},
52285226
{
52295227
"schema": {

services/backend/api-spec.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3590,21 +3590,20 @@ paths:
35903590
- 6h
35913591
- 12h
35923592
- 24h
3593-
- 7d
3594-
- 30d
3593+
- 3d
35953594
in: query
35963595
name: time_range
35973596
required: false
3598-
description: Time range for metrics (e.g., 3h, 24h, 7d)
3597+
description: Time range for metrics (maximum 3 days for MCP client activity)
35993598
- schema:
36003599
type: string
36013600
enum:
36023601
- 15m
3603-
- 1h
36043602
in: query
36053603
name: interval
36063604
required: false
3607-
description: Bucket interval for aggregation
3605+
description: Bucket interval for aggregation (only 15m supported for MCP client
3606+
activity)
36083607
- schema:
36093608
type: string
36103609
in: query
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
DROP INDEX `mcp_activity_metrics_unique_bucket`;--> statement-breakpoint
2+
CREATE UNIQUE INDEX `mcp_activity_metrics_unique_bucket` ON `mcpClientActivityMetrics` (`user_id`,`team_id`,`satellite_id`,`auth_identifier`,`bucket_timestamp`,`bucket_interval`);

0 commit comments

Comments
 (0)