Skip to content

[Feature]: SPM support #47

@GLinnik21

Description

@GLinnik21

Feature Description

The Xcode Build MCP currently supports building .xcodeproj and .xcworkspace files, but doesn't have direct support for building Swift Package Manager packages using swift build commands.

Current Behavior

When attempting to build an SPM package (e.g., a project with Package.swift), users need to:

  1. Either use the automatically generated .swiftpm/xcode/package.xcworkspace (which can be unreliable)
  2. Or fall back to using standard terminal commands like swift build

Error Encountered

When trying to use list_schems_ws on an SPM-generated workspace (.swiftpm/xcode/package.xcworkspace), we encountered:

** INTERNAL ERROR: Unable to load workspace '/path/to/.swiftpm/xcode/package.xcworkspace' **
Uncaught Exception: -[Swift.__SwiftDeferredNSArray intersectsSet:]: unrecognized selector sent to instance

Suggested Implementation

The implementation could wrap swift build, swift test, and other Swift Package Manager commands, similar to how the current MCP wraps xcodebuild commands.

Use Cases

  • Building Swift Package Manager libraries and frameworks
  • Testing SPM packages across multiple platforms (iOS, macOS, tvOS, watchOS)
  • Integrating SPM packages into CI/CD pipelines
  • Developing modular Swift codebases with multiple SPM packages
  • Building command-line tools and server-side Swift applications

Example Interactions

You: "Build the Library SPM package for macOS"
AI: Uses build_spm_package to execute swift build --target Library --platform macos

You: "Run tests for my networking package on iOS simulator"
AI: Uses test_spm_package_ios_sim to execute swift test --target NetworkingTests --destination 'platform=iOS Simulator,name=iPhone 15'

You: "Clean and rebuild my SPM package with release configuration"
AI: Uses clean_spm_package then build_smp_package --configuration release

You: "Check if my SPM package builds for all supported platforms"
AI: Uses build_spm_package_multiplatform to test builds across iOS, macOS, tvOS, watchOS

You: "Generate and build documentation for my SPM package"
AI: Uses generate_spm_docs to execute swift package generate-documentation

This would make the feature request more comprehensive and show the practical value for Swift developers working with SPM packages.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions