feat(cli): add Cursor MCP integration support #62
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.
🎯 Overview
Adds
--cursorflag to MCP commands to support Cursor IDE alongside Claude Code. Users can now seamlessly install and manage dev-agent MCP server in Cursor with automatic workspace detection and proper process cleanup.✨ Features
~/.cursor/mcp.json)--cursorflag on install, uninstall, and list commands🚀 Usage
🏗️ Implementation
New Cursor Config Module
Created
packages/cli/src/utils/cursor-config.tswith:readCursorConfig()- Read Cursor MCP config (creates if missing)writeCursorConfig()- Write config with atomic operationsgenerateServerName()- Generate unique names (dev-agent-{repo})addCursorServer()- Add server with duplicate detectionremoveCursorServer()- Remove server by repository pathfindServerByRepository()- Find existing serverlistCursorServers()- List all MCP servers (not just dev-agent)Updated MCP Commands
All commands now support
--cursorflag:claudeCLI)--cursor: Directly manipulates~/.cursor/mcp.jsonDynamic Workspace Detection
Problem: Original implementation used static
REPOSITORY_PATH, causing MCP server to stay locked to one workspace even when switching windows.Solution: Prioritize
WORKSPACE_FOLDER_PATHSenvironment variable (Cursor's dynamic workspace indicator):Impact: Single dev-agent MCP server now adapts to whatever workspace is open in Cursor!
Zombie Process Prevention
Problem: MCP server processes weren't terminating when Cursor closed windows, leading to zombie process accumulation.
Solution: Added stdin closure handlers in
StdioTransport:Testing: Verified with real Cursor windows - process count correctly decreases when windows close.
🧪 Testing
📊 Test Coverage
Tests include:
🎨 User Experience
Install - Already Exists
Install - Success
List - Multiple Servers
Dynamic Workspace Switching (NEW!)
🔗 Related
Closes #58
Related: #61 (CLI improvements for future)
📝 Follow-up
Created #61 for additional CLI improvements:
--yesflag for non-interactive mode--format jsonfor machine-readable output--dry-runfor preview mode