Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions build-mcpb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,19 @@ mv manifest.json.tmp manifest.json
echo "Removing devDependencies and types from node_modules..."
rm -rf node_modules
npm ci --omit=dev --audit false --fund false

# Install all sharp platform binaries for cross-platform support
# (sharp uses optional deps that only install for current platform)
# --force is needed to bypass platform checks for non-native packages
# Note: darwin/linux need sharp-libvips-* for the libvips shared library,
# win32 bundles libvips directly in the sharp package
echo "Installing cross-platform sharp binaries..."
npm install --no-save --force --audit false --fund false \
@img/sharp-darwin-arm64 @img/sharp-libvips-darwin-arm64 \
@img/sharp-darwin-x64 @img/sharp-libvips-darwin-x64 \
@img/sharp-linux-x64 @img/sharp-libvips-linux-x64 \
@img/sharp-win32-x64

find node_modules -name "*.ts" -type f -delete 2>/dev/null || true

# Create the MCPB package
Expand Down
15 changes: 15 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
#!/usr/bin/env node
import {execSync} from 'node:child_process';
import {dirname} from 'node:path';
import {fileURLToPath} from 'node:url';

// Clear macOS quarantine attributes from native binaries before importing them
// This is needed for MCPB packages downloaded from the internet
if (process.platform === 'darwin') {
try {
const projectRoot = dirname(dirname(fileURLToPath(import.meta.url)));
execSync(`xattr -cr "${projectRoot}/node_modules"`, {stdio: 'ignore'});
} catch {
// Ignore errors - xattr may not exist or may fail on some files
}
}

import {StdioServerTransport} from '@modelcontextprotocol/sdk/server/stdio.js';
import {server} from './server.js';

Expand Down