A comprehensive Swift Coding MCP (Model Context Protocol) Server with 50+ tools for creating scripts, shortcuts, widgets, apps, and managing Swift projects through AI assistants.
- Project Scaffolding: Create Swift packages, apps, widgets, and macros with templates
- Code Generation: Generate structs, enums, protocols, SwiftUI views, and tests
- Package Management: Manage SPM dependencies, updates, and conflicts
- Build Automation: Build, test, and archive with advanced options
- Widget Development: Create WidgetKit extensions and Live Activities
- Macro Development: Build Swift macros with full debugging support
- Code Refactoring: Rename symbols, extract methods, format code
- Scripting: Create CLI tools, Swift scripts, and Shortcuts integration
- Testing: Generate unit tests, snapshot tests, and performance benchmarks
- Swift 5.9+ (
swift --version) - Git
- Network access for Swift Package Manager dependencies
Raspberry Pi 4 support: this project is designed to run on Linux ARM64 (including Raspberry Pi OS 64-bit on Pi 4) as long as a compatible Swift toolchain is installed.
- Use a 64-bit OS image (Raspberry Pi OS 64-bit Bookworm or Ubuntu Server 22.04/24.04 ARM64).
- Install Swift for Linux ARM64 from the official Swift download instructions:
- Verify toolchain:
swift --version
- Clone and build:
git clone <your-fork-or-repo-url> cd SwiftCoderMCP ./build.sh
- Install binary:
sudo cp .build/release/swift-coder-mcp /usr/local/bin/
- Run diagnostics:
./diagnose.sh swift-coder-mcp --version
git clone <your-fork-or-repo-url>
cd SwiftCoderMCP
./build.sh
sudo cp .build/release/swift-coder-mcp /usr/local/bin/If you already built the binary, you can install with:
./install.sh --build- If build memory is tight, reduce parallelism:
swift build -c release -j 2
- Ensure your shell can find Swift (
which swift) and the installed binary (which swift-coder-mcp). - If dependencies fail to resolve, re-run:
swift package resolve
create_swift_package- Create new Swift packagesscaffold_project- Generate complete project structuresadd_target- Add targets to existing packagesanalyze_project- Analyze project structure and dependenciessetup_xcode_project- Configure Xcode project settings
generate_struct- Generate structs with Codable/Equatablegenerate_enum- Generate enums with associated valuesgenerate_protocol- Generate protocols with requirementsgenerate_extension- Generate extensionsgenerate_swiftui_view- Generate SwiftUI views with previewsgenerate_test_cases- Generate XCTest/Swift Testing testsgenerate_mock- Generate mock implementations
add_dependency- Add package dependenciesremove_dependency- Remove dependenciesupdate_dependencies- Update to latest versionsresolve_dependencies- Resolve without updatingshow_dependencies- Display dependency treeedit_package- Modify Package.swiftclean_package- Clean build artifacts
build_target- Build with configuration optionsrun_executable- Build and run executablestest_package- Run tests with coveragearchive_build- Create archives for distributionbenchmark_build- Performance benchmark buildscheck_compatibility- Check API compatibility
create_widget_extension- Create WidgetKit extensionscreate_intent_configuration- Configurable widgetscreate_live_activity- Dynamic Island/Lock Screen activitiesgenerate_widget_preview- Xcode preview codecreate_app_clip- App Clip with associated domains
create_macro_package- Full macro package structuregenerate_macro_expansion_test- Test macro expansionsdebug_macro_expansion- Debug macro issuescreate_macro_diagnostic- Diagnostic messages and fix-itsanalyze_swift_syntax- SwiftSyntax AST analysis
rename_symbol- Rename across codebaseextract_method- Extract to new methodextract_variable- Extract to variableorganize_imports- Sort and organize importsformat_code- Format with swift-formatmigrate_to_swift6- Swift 6 migration assistance
create_swift_script- Executable Swift scriptscreate_shortcut_intent- Shortcuts app integrationcreate_cli_tool- ArgumentParser CLI toolscreate_automation_script- macOS automationbundle_script- Bundle as standalone executable
apply_template- Use predefined templatescreate_template- Create custom templateslist_templates- List available templatescustomize_template- Modify templates
analyze_dependencies- Full dependency analysischeck_vulnerabilities- Security vulnerability checksuggest_updates- Update suggestionsgenerate_dependency_report- Reports in multiple formats
generate_unit_tests- XCTest/Swift Testing testsgenerate_snapshot_tests- Snapshot testing setupgenerate_performance_tests- Performance benchmarksanalyze_test_coverage- Coverage analysis
{
"tool": "scaffold_project",
"arguments": {
"name": "MyApp",
"path": "/Users/dev/projects",
"template": "ios-app",
"features": ["swiftui", "widget"]
}
}{
"tool": "generate_swiftui_view",
"arguments": {
"name": "UserProfileView",
"stateVariables": [
{"name": "user", "type": "User", "initialValue": "User()"}
],
"body": "VStack { Text(user.name) }"
}
}{
"tool": "create_cli_tool",
"arguments": {
"name": "FileFinder",
"path": "/Users/dev/tools",
"arguments": [
{"name": "pattern", "type": "String", "help": "Search pattern"}
],
"flags": [
{"name": "recursive", "help": "Search recursively"}
]
}
}{
"tool": "add_dependency",
"arguments": {
"packagePath": "/Users/dev/MyProject",
"url": "https://github.com/Alamofire/Alamofire",
"version": "5.8.0",
"products": ["Alamofire"]
}
}Add to claude_desktop_config.json:
{
"mcpServers": {
"swift-coder": {
"command": "/usr/local/bin/swift-coder-mcp",
"args": [],
"env": {
"SWIFT_CODER_TEMPLATES": "~/.swift-coder-mcp/templates"
}
}
}
}Add to .cursor/mcp.json:
{
"servers": [
{
"name": "swift-coder",
"command": "/usr/local/bin/swift-coder-mcp"
}
]
}- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
MIT License - see LICENSE file