Skip to content

Commit 6c51b0f

Browse files
committed
fix(swift): use binary target and versioned macOS framework for Xcode 26 compatibility
1 parent 228f4f1 commit 6c51b0f

7 files changed

Lines changed: 61 additions & 116 deletions

File tree

.github/workflows/main.yml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ jobs:
177177
codesign --sign "${{ secrets.APPLE_TEAM_ID }}" --timestamp --options runtime dist/mcp.xcframework
178178
ditto -c -k --keepParent dist/mcp.xcframework dist/mcp.xcframework.zip
179179
xcrun notarytool submit dist/mcp.xcframework.zip --apple-id "${{ secrets.APPLE_ID }}" --password "${{ secrets.APPLE_PASSWORD }}" --team-id "${{ secrets.APPLE_TEAM_ID }}" --wait
180-
rm dist/mcp.xcframework.zip
180+
rm -rf dist/mcp.xcframework
181181
182182
- name: cleanup keychain for codesign
183183
if: matrix.os == 'macos-15'
@@ -269,7 +269,11 @@ jobs:
269269
if [[ "$name" != "mcp-apple-xcframework" && "$name" != "mcp-android-aar" ]]; then
270270
tar -czf "${name}-${VERSION}.tar.gz" -C "$folder" .
271271
fi
272-
if [[ "$name" != "mcp-android-aar" ]]; then
272+
if [[ "$name" == "mcp-apple-xcframework" ]]; then
273+
# Use the ditto-created zip that preserves macOS symlinks and extract for other steps
274+
cp "$folder/mcp.xcframework.zip" "${name}-${VERSION}.zip"
275+
unzip -q "$folder/mcp.xcframework.zip" -d "$folder/"
276+
elif [[ "$name" != "mcp-android-aar" ]]; then
273277
(cd "$folder" && zip -rq "../../${name}-${VERSION}.zip" .)
274278
else
275279
cp "$folder"/*.aar "${name}-${VERSION}.aar"
@@ -363,6 +367,23 @@ jobs:
363367
echo " Main: @sqliteai/sqlite-mcp@${{ steps.tag.outputs.version }}"
364368
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
365369
370+
- name: update Package.swift checksum and version
371+
if: steps.tag.outputs.version != ''
372+
run: |
373+
VERSION=${{ steps.tag.outputs.version }}
374+
ZIP="mcp-apple-xcframework-${VERSION}.zip"
375+
if [ -f "$ZIP" ]; then
376+
CHECKSUM=$(swift package compute-checksum "$ZIP")
377+
URL="https://github.com/sqliteai/sqlite-mcp/releases/download/${VERSION}/${ZIP}"
378+
sed -i "s|url: \".*apple-xcframework.*\"|url: \"${URL}\"|" Package.swift
379+
sed -i "s|checksum: \".*\"|checksum: \"${CHECKSUM}\"|" Package.swift
380+
git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com"
381+
git config --global user.name "$GITHUB_ACTOR"
382+
git add Package.swift
383+
git commit -m "Update Package.swift checksum for ${VERSION} [skip ci]" || true
384+
git push origin main || true
385+
fi
386+
366387
- uses: softprops/action-gh-release@v2.2.1
367388
if: steps.tag.outputs.version != ''
368389
with:

Makefile

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ endef
302302
LIB_NAMES = ios.dylib ios-sim.dylib macos.dylib
303303
FMWK_NAMES = ios-arm64 ios-arm64_x86_64-simulator macos-arm64_x86_64
304304
$(DIST_DIR)/%.xcframework: $(LIB_NAMES)
305-
@$(foreach i,1 2 3,\
305+
@$(foreach i,1 2,\
306306
lib=$(word $(i),$(LIB_NAMES)); \
307307
fmwk=$(word $(i),$(FMWK_NAMES)); \
308308
mkdir -p $(DIST_DIR)/$$fmwk/mcp.framework/Headers; \
@@ -313,6 +313,21 @@ $(DIST_DIR)/%.xcframework: $(LIB_NAMES)
313313
mv $(DIST_DIR)/$$lib $(DIST_DIR)/$$fmwk/mcp.framework/mcp; \
314314
install_name_tool -id "@rpath/mcp.framework/mcp" $(DIST_DIR)/$$fmwk/mcp.framework/mcp; \
315315
)
316+
@lib=$(word 3,$(LIB_NAMES)); \
317+
fmwk=$(word 3,$(FMWK_NAMES)); \
318+
mkdir -p $(DIST_DIR)/$$fmwk/mcp.framework/Versions/A/Headers; \
319+
mkdir -p $(DIST_DIR)/$$fmwk/mcp.framework/Versions/A/Modules; \
320+
mkdir -p $(DIST_DIR)/$$fmwk/mcp.framework/Versions/A/Resources; \
321+
cp $(SRC_DIR)/sqlite-mcp.h $(DIST_DIR)/$$fmwk/mcp.framework/Versions/A/Headers; \
322+
printf "$(PLIST)" > $(DIST_DIR)/$$fmwk/mcp.framework/Versions/A/Resources/Info.plist; \
323+
printf "$(MODULEMAP)" > $(DIST_DIR)/$$fmwk/mcp.framework/Versions/A/Modules/module.modulemap; \
324+
mv $(DIST_DIR)/$$lib $(DIST_DIR)/$$fmwk/mcp.framework/Versions/A/mcp; \
325+
install_name_tool -id "@rpath/mcp.framework/mcp" $(DIST_DIR)/$$fmwk/mcp.framework/Versions/A/mcp; \
326+
ln -sf A $(DIST_DIR)/$$fmwk/mcp.framework/Versions/Current; \
327+
ln -sf Versions/Current/mcp $(DIST_DIR)/$$fmwk/mcp.framework/mcp; \
328+
ln -sf Versions/Current/Headers $(DIST_DIR)/$$fmwk/mcp.framework/Headers; \
329+
ln -sf Versions/Current/Modules $(DIST_DIR)/$$fmwk/mcp.framework/Modules; \
330+
ln -sf Versions/Current/Resources $(DIST_DIR)/$$fmwk/mcp.framework/Resources;
316331
xcodebuild -create-xcframework $(foreach fmwk,$(FMWK_NAMES),-framework $(DIST_DIR)/$(fmwk)/mcp.framework) -output $@
317332
rm -rf $(foreach fmwk,$(FMWK_NAMES),$(DIST_DIR)/$(fmwk))
318333

Package.swift

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
//
2-
// Package.swift
3-
// sqlitemcp
4-
//
5-
// Created by Gioele Cantoni on 05/11/25.
6-
//
7-
81
// swift-tools-version: 6.1
92
// The swift-tools-version declares the minimum version of Swift required to build this package.
103

@@ -14,27 +7,20 @@ let package = Package(
147
name: "mcp",
158
platforms: [.macOS(.v11), .iOS(.v11)],
169
products: [
17-
// Products can be used to vend plugins, making them visible to other packages.
18-
.plugin(
19-
name: "mcpPlugin",
20-
targets: ["mcpPlugin"]),
2110
.library(
2211
name: "mcp",
2312
targets: ["mcp"])
2413
],
2514
targets: [
26-
// Build tool plugin that invokes the Makefile
27-
.plugin(
28-
name: "mcpPlugin",
29-
capability: .buildTool(),
30-
path: "packages/swift/plugin"
15+
.binaryTarget(
16+
name: "mcpBinary",
17+
url: "https://github.com/sqliteai/sqlite-mcp/releases/download/0.1.7/mcp-apple-xcframework-0.1.7.zip",
18+
checksum: "0000000000000000000000000000000000000000000000000000000000000000"
3119
),
32-
// mcp library target
3320
.target(
3421
name: "mcp",
35-
dependencies: [],
36-
path: "packages/swift/extension",
37-
plugins: ["mcpPlugin"]
22+
dependencies: ["mcpBinary"],
23+
path: "packages/swift"
3824
),
3925
]
4026
)

packages/swift/extension/mcp.swift

Lines changed: 0 additions & 25 deletions
This file was deleted.

packages/swift/mcp.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// mcp.swift
2+
// Provides the path to the mcp SQLite extension for use with sqlite3_load_extension.
3+
4+
import Foundation
5+
6+
public struct mcp {
7+
/// Returns the absolute path to the mcp dylib for use with sqlite3_load_extension.
8+
public static var path: String {
9+
#if os(macOS)
10+
return Bundle.main.bundlePath + "/Contents/Frameworks/mcp.framework/mcp"
11+
#else
12+
return Bundle.main.bundlePath + "/Frameworks/mcp.framework/mcp"
13+
#endif
14+
}
15+
}

packages/swift/plugin/mcp.swift

Lines changed: 0 additions & 67 deletions
This file was deleted.

src/sqlite-mcp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
extern "C" {
2828
#endif
2929

30-
#define SQLITE_MCP_VERSION "0.1.6"
30+
#define SQLITE_MCP_VERSION "0.1.7"
3131

3232
/**
3333
* SQLite extension entry point

0 commit comments

Comments
 (0)