feat: Add write operations to MCP server (v0.4.0)#46
Conversation
This release transforms the MCP server from read-only to full CRUD capabilities with end-to-end encryption. Breaking Changes: - Write operations require GSD_ENCRYPTION_PASSPHRASE environment variable - Security model updated to support encrypted read-write access New Features: - 5 write operation tools: create_task, update_task, complete_task, delete_task, bulk_update_tasks - Bulk operations support up to 50 tasks at once - Enhanced crypto module with encrypt() method for AES-256-GCM encryption - Interactive setup wizard (--setup) with step-by-step configuration - Configuration validator (--validate) with comprehensive diagnostics - 6 analytics MCP tools for productivity metrics - MCP Prompts support with 6 pre-configured conversation starters - get_help tool with topic-based filtering Improvements: - Fixed critical hardcoded device ID bug in tools.ts - Enhanced error messages with actionable guidance - Automatic task ID generation using crypto.randomUUID() - Vector clock support for conflict resolution - Comprehensive input validation and safety limits New Modules: - src/write-ops.ts - Write operation functions with encryption (447 lines) - src/cli.ts - Interactive CLI utilities - src/jwt.ts - JWT parsing and token utilities - src/analytics.ts - Productivity metrics calculation Documentation: - Comprehensive README updates with write operation examples - Detailed CHANGELOG.md with version history - Enhanced tool descriptions and usage guides 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
PR Review: Add write operations to MCP server (v0.4.0)🎯 Overall AssessmentThis is a major feature release that transforms the MCP server from read-only to full CRUD capabilities. The implementation is well-structured, maintains end-to-end encryption, and follows the project's coding standards. However, there are several critical areas that need attention before merging. Recommendation: ✅ Strengths1. Excellent Code Organization
2. Security Model
3. User Experience
4. Documentation
🚨 Critical Issues1. Missing Test Coverage (Blocker)Issue: No tests found for 3,095 lines of new code. # No test files found:
packages/mcp-server/**/*.test.ts # 0 files
packages/mcp-server/**/*.spec.ts # 0 filesRisk: High - Write operations directly modify user data. Without tests:
Required Actions:
Target Coverage: ≥80% per CLAUDE.md guidelines 2. Vector Clock Simplification (High Risk)Issue: body: JSON.stringify({
deviceId,
tasks,
vectorClock: {}, // Simplified: let server handle vector clock
}),Risk: This defeats the purpose of vector clocks for conflict resolution:
Questions:
Required Action:
3. Error Handling: Silent Conflicts (Medium Risk)Issue: if (result.conflicts && result.conflicts.length > 0) {
console.warn(`⚠️ Warning: ${result.conflicts.length} conflict(s) detected`);
console.warn('Last-write-wins strategy applied - your changes took precedence');
}Risk: Users won't know their changes conflicted with other devices. Claude Desktop won't see these console warnings. Required Action:
4. Hardcoded Device ID Fixed, But No Validation (Medium)Good: The critical bug fix in Concern: No validation that the device ID in the token matches the device making the request. Recommendation:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Critical bug fix for write operations that were 100% non-functional in v0.4.0
Changes:
- Fixed pushToSync() payload structure to match Worker's pushRequestSchema
- Changed 'tasks' array to 'operations' array
- Changed 'vectorClock' to 'clientVectorClock'
- Added required 'type' field to all operations ('create', 'update', 'delete')
- Changed operation field 'id' to 'taskId'
- Removed 'deleted' boolean in favor of type: 'delete'
- Added per-operation vectorClock field
Impact:
- v0.4.0 write operations would fail with 400 Bad Request from Worker
- Zod validation in worker/src/schemas.ts was rejecting all push requests
- All 5 write tools (create_task, update_task, complete_task, delete_task, bulk_update_tasks) were non-functional
Technical Details:
- Added SyncOperation interface matching Worker's syncOperationSchema
- Updated all write operation callers to pass correct structure
- All operations now conform to Zod schema validation
Version: 0.4.0 → 0.4.1
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Code Review: MCP Server Write OperationsOverall AssessmentThis is a major feature release (v0.4.0) that adds full CRUD capabilities to the MCP server while maintaining end-to-end encryption. The implementation is well-structured, but there are critical issues that must be addressed before merging. CRITICAL ISSUES (BLOCKERS)1. Missing Test Coverage
2. Hardcoded Vector Clock Strategy
3. Incomplete Bulk Error Handling
MAJOR CONCERNS4. No Rollback Mechanism
5. Rate Limiting Missing
6. JWT Parsing Without Validation
7. Version Inconsistency
STRENGTHSArchitecture
Security
Developer Experience
CODE QUALITY ISSUES
PERFORMANCE ISSUES
SPECIFIC FIXES NEEDEDwrite-ops.ts:234Change from listTasks to getTask for single task lookup write-ops.ts:143Document why empty vector clock is acceptable OR implement properly write-ops.ts:330Extract MAX_BULK_OPERATION_TASKS constant TESTING GAPSNeed tests for:
BEFORE MERGING CHECKLISTBLOCKERS:
HIGH PRIORITY:
MEDIUM:
REFACTORING:
RECOMMENDATIONStatus: CHANGES REQUESTED Excellent work adding critical functionality, but lack of tests and incomplete vector clock are blockers. High code quality otherwise, but these gaps pose significant risks. Priority Actions:
Once tests and vector clock are addressed, ready to merge. Reviewed with: CLAUDE.md, coding-standards.md |
Summary
This PR transforms the GSD MCP server from read-only access to full CRUD capabilities with maintained end-to-end encryption. This is a major feature release (v0.2.1 → v0.4.0) that enables Claude Desktop to create, update, and delete tasks using natural language.
🔥 Breaking Changes
GSD_ENCRYPTION_PASSPHRASEfor all write operationsnpx gsd-mcp-server --setupto configure encryption✨ New Features
Write Operations (5 New Tools)
create_task- Create new tasks with all properties (title, description, quadrant, tags, subtasks, recurrence, dependencies)update_task- Update existing tasks (any property, automatic quadrant moves)complete_task- Quick toggle for task completion statusdelete_task- Permanently delete tasks (cannot be undone)bulk_update_tasks- Update up to 50 tasks at once with 6 operation types:Enhanced Encryption (crypto.ts)
encrypt()method for encrypting task data before pushderiveKey()to support both encrypt and decrypt capabilitiesInteractive CLI (v0.3.0)
--setup) - Step-by-step guided configuration with API testing--validate) - Comprehensive diagnostics and troubleshooting--help) - Detailed usage documentationAnalytics & Insights (v0.3.0)
lib/analytics.tswith full metrics calculationMCP Prompts (v0.3.2)
get_helptool with topic-based filtering🐛 Bug Fixes
tools.ts:223causing multi-device sync issuesjwt.tsmodule🔒 Security
📦 Technical Details
New Modules
src/write-ops.ts(447 lines) - Write operation functions with encryptionsrc/cli.ts- Interactive CLI utilitiessrc/jwt.ts- JWT parsing and token utilitiessrc/analytics.ts- Productivity metrics calculationModified Files
src/crypto.ts- Added encrypt() method, updated deriveKey capabilitiessrc/index.ts- Added 5 write tool definitions and handlers (v0.2.0 → v0.4.0)src/tools.ts- Fixed device ID bug, enhanced error messagespackage.json- Version bump, description updateREADME.md- Comprehensive write operation documentationCHANGELOG.md- Detailed version history (NEW)API Integration
/api/sync/pushendpoint with encrypted task blobsEncryption Details
📊 Stats
🧪 Testing
📋 Checklist
🚀 Post-Merge
After merge, publish to npm:
cd packages/mcp-server npm publish🤖 Generated with Claude Code