feat: implement MCP Server for real-time sync#5
Closed
Conversation
- Created mcp-server directory with src/ subdirectory - Added package.json with all required dependencies - Added tsconfig.json with TypeScript configuration - Added placeholder index.ts entry point - Verified server starts correctly Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Implements Task 1.2 with Bun's native SQLite support: - Type definitions for Feature and related types - Database initialization with schema and indexes - FeatureStore class with full CRUD operations - Comprehensive test suite with 12 passing tests Note: Uses bun:sqlite instead of better-sqlite3 for Bun compatibility. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add event-driven architecture for Feature synchronization: - EventBus class with typed events (feature:created/updated/deleted, sync, conflict) - Convenience methods (featureCreated, featureUpdated, featureDeleted, conflictDetected) - Comprehensive test coverage (4 test cases) All tests pass (16/16 total). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove any[] type usage with proper EventMap type definitions - Add maxListeners(20) in constructor to prevent memory leaks - Add dispose() method for proper cleanup - Add missing tests for sync:started and sync:completed events - Add test for dispose() cleanup functionality All type checks and tests passing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add BranchScanner class to scan git repo branches (main, feature/*, fix/*) and parse .supercrew/features/* directories. Implement parseMetaYaml to extract feature metadata from YAML. Include deduplication logic where feature/fix branches override main branch features. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add MCP Protocol integration to enable Claude Code to call SuperCrew tools via MCP. Changes: - Create src/mcp/tools.ts: Define 5 MCP tools (list_features, get_feature, create_feature, update_feature_status, log_progress) using Zod schemas - Create src/mcp/server.ts: McpServer setup with StdioServerTransport - Update src/index.ts: Initialize DB, FeatureStore, EventBus, BranchScanner, and start MCP server Uses @modelcontextprotocol/sdk McpServer.registerTool() API with Zod schemas for type-safe tool definitions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Implement dual-mode operation for MCP Server: - MCP mode (stdio): used by Claude Code - HTTP + WebSocket mode: used by Web UI Features: - HTTP REST API with CORS support for feature CRUD operations - WebSocket server for real-time feature updates - Auto-detection of runtime mode based on stdin.isTTY - Periodic branch scanning (30s interval) in HTTP mode - Event broadcast to all connected WebSocket clients Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add Zod input validation for POST /api/features and PATCH /api/features/:id/status - Add global error handling middleware using Hono's onError - Define strict WebSocket message types (WSMessage) to replace any types - Add try-catch error handling to all store operations - Remove unused src/http/server.ts file - Replace unsafe 'as any' type assertion with 'as unknown as WebSocket' All tests passing and type checking clean. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Create mcp/settings.json template for MCP server config - Update plugin.json with MCP server command configuration - Bump version to 0.2.0 - Add 'mcp' to keywords Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add GitHubSyncWorker to asynchronously sync features from SQLite to git repository: - Queue-based sync with deduplication - Support create/update/delete operations - Write features to .supercrew/features/<id>/ with meta.yaml and markdown files - Auto-commit changes to git Add ConflictResolver to detect and resolve sync conflicts: - Detect conflicts when both local and remote updated since last sync - Register conflicts and emit events via EventBus - Resolve conflicts with local or remote choice Add comprehensive test coverage for ConflictResolver Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Security fixes:
- Replace execSync('rm -rf') with fs.rmSync() to prevent command injection
- Add isValidFeatureId() validation to prevent path traversal attacks
- Add sanitizeCommitMessage() to escape special characters in git commit messages
- Add explicit utf-8 encoding to all writeFileSync() calls
All tests passing (26 tests, 0 failures)
TypeScript typecheck successful
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add comprehensive integration tests for the MCP Server HTTP API covering: - Feature CRUD operations (create, read, list, update, delete) - Status updates - Board aggregation - Health check endpoint - Error handling (404, 400 validation errors) All tests use in-memory SQLite database for isolation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Document: - Quick start guide - Configuration options - HTTP API endpoints - MCP tools - Dual mode operation - Architecture diagram - WebSocket events - Development commands Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Collaborator
Author
|
I plan to testing first . I will merge pr after testing completed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
实现 SuperCrew MCP Server,支持 Web UI 和 Claude Code 之间的实时双向同步。
核心功能
双模式运行
新增文件
测试
Test plan
bun test- 所有测试通过bun run typecheck- 类型检查通过curl http://localhost:3456/health🤖 Generated with Claude Code