A macOS application for managing cursor:// URL protocol handling with SwiftUI interface.
This application provides reliable control over which application responds to cursor:// URL schemes on macOS. It features a modern SwiftUI interface for monitoring protocol status, switching handlers, and managing URL history.
- Protocol Control: One-click take/release control of cursor:// protocol
- Real-time Monitoring: Live status updates of current protocol handler
- URL History: Track and manage received URL calls with detailed information
- MCP Server Support: Handle MCP (Model Context Protocol) installation requests
- Modern Interface: Native SwiftUI design with intuitive controls
- Menu Integration: Full macOS menu bar integration with keyboard shortcuts
The application uses macOS LaunchServices framework to manage URL protocol handlers:
- Handler Detection: Uses modern
NSWorkspace.urlForApplication(toOpen:)API - Protocol Registration: Implements
LSSetDefaultHandlerForURLSchemefor control - Status Monitoring: Real-time updates with automatic refresh
Supports multiple URL patterns:
- Basic cursor:// URLs
- MCP installation:
cursor://anysphere.cursor-deeplink/mcp/install?name=<name>&config=<base64> - Custom protocols with parameters
Sources/
├── DeepLinkApp.swift # Main application entry point
├── Models/
│ ├── URLSchemeManager.swift # Protocol management
│ ├── DeepLinkStore.swift # State management
│ └── URLRecord.swift # URL data models
├── Views/
│ ├── ContentView.swift # Main interface
│ ├── StatusCardView.swift # Status display
│ ├── ControlPanelView.swift # Control buttons
│ └── URLHistoryView.swift # History management
└── Utils/
└── MenuCommands.swift # Menu bar integration
-
Prerequisites:
- macOS 12.0 or later
- Xcode with Swift 5.7+
-
Build:
./build.sh
-
Launch:
open DeepLink.app
Use the included test script to verify functionality:
./test_urls.shTest options include:
- Basic URL protocol tests
- MCP server installation simulations
- Continuous testing scenarios
The application declares cursor:// protocol support:
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>cursor</string>
</array>
</dict>
</array>Protocol handlers are managed through macOS LaunchServices:
| Method | Use Case | Modifies plist |
|---|---|---|
| User manual selection | GUI-based selection | ✅ |
| Command-line tools (duti) | Batch deployment | ✅ |
| Programmatic API | Application control | ✅ |
# Install duti
brew install duti
# Set handler
duti -s com.loocor.deeplink cursor all
# Verify
duti -x cursorimport CoreServices
// Take control
LSSetDefaultHandlerForURLScheme("cursor" as CFString, "com.loocor.deeplink" as CFString)
// Check current handler
let handler = NSWorkspace.shared.urlForApplication(toOpen: URL(string: "cursor://test")!)The application supports Model Context Protocol server installation through URL schemes:
cursor://anysphere.cursor-deeplink/mcp/install?name=<name>&config=<base64-config>
{
"command": "npm exec @modelcontextprotocol/server-filesystem",
"env": {
"HOME": "/Users/username"
}
}Filesystem MCP:
CONFIG='{"command":"npm exec @modelcontextprotocol/server-filesystem","env":{"HOME":"/Users/username"}}'
CONFIG_B64=$(echo "$CONFIG" | base64)
open "cursor://anysphere.cursor-deeplink/mcp/install?name=filesystem&config=$CONFIG_B64"- Permission Denied: Ensure application has necessary permissions
- Handler Not Found: Verify target applications are installed
- Protocol Conflicts: Check for competing protocol handlers
# Check current handler
defaults read ~/Library/Preferences/com.apple.LaunchServices/com.apple.launchservices.secure LSHandlers | grep -A5 -B5 "cursor"
# Reset LaunchServices (if needed)
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -seed
# Re-register application
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -f DeepLink.app- Security: No sandbox restrictions for protocol handling
- Permissions: Standard application permissions required
- Compatibility: Works with macOS 12.0+ systems
- Signing: Compatible with both signed and unsigned builds
The application uses current macOS APIs:
- ✅
NSWorkspace.urlForApplication(toOpen:)for handler detection - ✅ SwiftUI for modern interface design
- ✅ Combine for reactive state management
Requirements:
- Swift 5.7+
- macOS deployment target: 12.0
- SwiftUI framework
Build configuration automatically handles:
- Application bundle creation
- Info.plist integration
- Executable permissions
- Resource management
This project demonstrates modern macOS URL protocol handling techniques and SwiftUI application development patterns.
- Bundle ID:
com.loocor.deeplink - Supported Schemes:
cursor:// - Target Systems: macOS 12.0+
- Framework: SwiftUI + AppKit integration