ワンクリックで
mcp-sync
同步 MCP Binary(.build → mcpb/server → ~/bin 一致性檢查和修復)
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
同步 MCP Binary(.build → mcpb/server → ~/bin 一致性檢查和修復)
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Turn a journal / reference article PDF into a faithful, compile-verified LaTeX "article record" — metadata frontmatter + every theorem, definition and numbered equation (original numbers preserved) + references + flagged editorial notes — saved next to the PDF as year_author_title.tex. Reach for this whenever the user wants to transcribe, OCR, extract, "make a record of", or pull the theorems / equations out of a paper or PDF into LaTeX, or adds a reference PDF and wants it turned into a structured .tex — even when they literally say "OCR it": this skill checks for a text layer first and deliberately avoids OCR on born-digital PDFs, because re-recognizing rendered math is less accurate than reading the embedded text. Especially valuable for math-heavy papers where equation fidelity matters.
發布或更新 MCP Server 到官方 MCP Registry 及第三方平台(Glama、awesome-mcp-servers)
Unblock Apple notarization / signed releases when blocked by an updated or expired Apple Developer Program License Agreement (the notarytool / Transporter HTTP 403 "A required agreement is missing or has expired"). Accepts the pending agreement on developer.apple.com via Safari + AppleScript, then re-verifies and resumes the release. Use when: `xcrun notarytool` / `make release-signed` fails with 403 "required agreement", or user says "notarization blocked", "公證被擋", "Apple 協議過期", "accept apple agreement", "Program License Agreement", "notary 403", "release 卡在 Apple 協議". Do NOT use for 401 "Invalid credentials" (that is an app-specific-password / key problem — re-run `xcrun notarytool store-credentials`, a user-only action).
macOS native browser automation via Safari + AppleScript. Use when the user needs to automate websites that require login (Plaud, Elementor, banking, social media) — Safari preserves localStorage and cookies permanently. Also use when agent-browser fails due to session/auth issues, or when the user explicitly asks to use Safari. Triggers on: "login to site", "automate with Safari", "use Safari", "session expired with agent-browser", "Plaud upload", or any website automation where persistent auth is needed.
更新 Plugin 到最新版本(marketplace.json 同步 + marketplace update + plugin update + 安裝檢查)。當修改了任何 plugin 原始碼後需要同步、或用戶提到「更新 plugin」、「同步 plugin」、「plugin 沒生效」、「reload plugins」時使用。
LaTeX source 編譯前的 static check — punct_check(半形/全形標點)+ fonts_check(字型缺字,需既有 .log)+ source-level pattern audit。當用戶說「precompile check」「編譯前檢查」「跑 make check」「source audit」「掃半形標點」「掃缺字」時使用。對應暑期班 typesetting-checklist 的
| name | mcp-sync |
| description | 同步 MCP Binary(.build → mcpb/server → ~/bin 一致性檢查和修復) |
| argument-hint | ["--check-only"] |
| allowed-tools | Read, Bash(swift:*), Bash(lipo:*), Bash(file:*), Bash(shasum:*), Bash(cp:*), Bash(rm:*), Bash(ls:*), Bash(chmod:*), Bash(mkdir:*), Bash(grep:*), Bash(cat:*), Bash(zip:*), Bash(unzip:*), Bash(codesign:*), Grep, Glob, AskUserQuestion |
| disable-model-invocation | true |
確保 MCP 專案的三個 binary 副本保持一致。
只適用 Swift 專案(Python/TS 使用 wrapper script,不需要 binary 同步)
.build/arm64 + .build/x86_64
│ (lipo -create + codesign)
▼
mcpb/server/{Binary} [universal, signed]
│ (cp + codesign)
▼
~/bin/{Binary} [universal, signed]
$1 = --check-only(可選)— 只檢查不同步動任何事之前先用 TaskCreate 建 todo list:
TaskCreate(name="detect_project", description="Phase 0: 確認 MCP 專案 + 取 binary 名 + 偵測三位置 binary")
TaskCreate(name="consistency_check", description="Phase 1: hash + 架構比對 + 輸出一致性報告")
TaskCreate(name="execute_sync", description="Phase 2: 從 source of truth 同步到其他位置")
TaskCreate(name="repackage_mcpb", description="Phase 2.5: 刪舊 .mcpb + 重新打包 + 驗證")
TaskCreate(name="post_sync_verify", description="Phase 3: 最終驗證")
完成每一步立即 TaskUpdate → completed。靜默完成 = 違規。
pwd
ls -la Package.swift mcpb/manifest.json 2>/dev/null
必須存在:
Package.swift(Swift 專案)mcpb/manifest.json如果不是 Swift 專案(沒有 Package.swift),輸出:
⏭️ 非 Swift 專案,不需要 binary 同步。Python/TS 使用 wrapper script。
並結束。
BINARY_NAME=$(grep -A5 'executableTarget' Package.swift | grep 'name:' | head -1 | sed 's/.*"\([^"]*\)".*/\1/')
echo "Binary: $BINARY_NAME"
# 位置 1: .build/release (可能有多個架構)
ls -la .build/arm64-apple-macosx/release/$BINARY_NAME 2>/dev/null
ls -la .build/x86_64-apple-macosx/release/$BINARY_NAME 2>/dev/null
ls -la .build/release/$BINARY_NAME 2>/dev/null
# 位置 2: mcpb/server
ls -la mcpb/server/$BINARY_NAME 2>/dev/null
# 位置 3: ~/bin
ls -la ~/bin/$BINARY_NAME 2>/dev/null
記錄哪些位置存在 binary。
對每個存在的 binary 執行:
# mcpb/server
shasum -a 256 mcpb/server/$BINARY_NAME 2>/dev/null
file mcpb/server/$BINARY_NAME 2>/dev/null
lipo -info mcpb/server/$BINARY_NAME 2>/dev/null
# ~/bin
shasum -a 256 ~/bin/$BINARY_NAME 2>/dev/null
file ~/bin/$BINARY_NAME 2>/dev/null
lipo -info ~/bin/$BINARY_NAME 2>/dev/null
情況 A — mcpb/server 和 ~/bin 都是 universal:
情況 B — mcpb/server 是 universal,~/bin 是 single-arch (arm64):
TMPFILE="/tmp/_mcpb_sync_arm64_$$"
lipo -thin arm64 mcpb/server/$BINARY_NAME -output "$TMPFILE"
shasum -a 256 "$TMPFILE" ~/bin/$BINARY_NAME
rm -f "$TMPFILE"
情況 C — 其中一個不存在:
如果 .build/arm64 和 .build/x86_64 都存在:
# 合併後與 mcpb/server 比對
TMPFILE="/tmp/_mcpb_sync_universal_$$"
lipo -create \
.build/arm64-apple-macosx/release/$BINARY_NAME \
.build/x86_64-apple-macosx/release/$BINARY_NAME \
-output "$TMPFILE"
shasum -a 256 "$TMPFILE" mcpb/server/$BINARY_NAME
rm -f "$TMPFILE"
如果只有一個架構(如只有 arm64):
## Binary 一致性檢查
Binary: {BINARY_NAME}
專案: {project-name}
| 位置 | 存在 | 架構 | Hash (SHA-256 前 12 碼) | 狀態 |
|------|------|------|------------------------|------|
| .build/arm64 | ✅/❌ | arm64 | abc123... | - |
| .build/x86_64 | ✅/❌ | x86_64 | def456... | - |
| mcpb/server | ✅/❌ | universal/arm64 | ghi789... | ✅/⚠️ |
| ~/bin | ✅/❌ | universal/arm64 | ghi789.../xxx... | ✅/❌ |
### 比對結果
- .build → mcpb/server: ✅ 一致 / ❌ 不一致 / ⚠️ .build 較新
- mcpb/server → ~/bin: ✅ 一致 / ❌ 不一致
如果 $1 是 --check-only,到此結束。
如果有任何不一致,使用 AskUserQuestion 詢問同步方式:
選項:
從 .build 重建(推薦,如果 .build 存在)
只複製 mcpb/server → ~/bin
完整重編譯
swift build -c release --arch arm64swift build -c release --arch x86_64取消
# 合併 universal binary
lipo -create \
.build/arm64-apple-macosx/release/$BINARY_NAME \
.build/x86_64-apple-macosx/release/$BINARY_NAME \
-output mcpb/server/$BINARY_NAME
# 重新簽名(lipo 會破壞原始 code signature)
codesign --force --sign - mcpb/server/$BINARY_NAME
# 複製到 ~/bin
cp mcpb/server/$BINARY_NAME ~/bin/$BINARY_NAME
chmod +x ~/bin/$BINARY_NAME
codesign --force --sign - ~/bin/$BINARY_NAME
cp mcpb/server/$BINARY_NAME ~/bin/$BINARY_NAME
chmod +x ~/bin/$BINARY_NAME
codesign --force --sign - ~/bin/$BINARY_NAME
# 清理
rm -rf .build 2>/dev/null || true
# 編譯兩個架構
swift build -c release --arch arm64
swift build -c release --arch x86_64
# 合併
lipo -create \
.build/arm64-apple-macosx/release/$BINARY_NAME \
.build/x86_64-apple-macosx/release/$BINARY_NAME \
-output mcpb/server/$BINARY_NAME
# 重新簽名(lipo 會破壞原始 code signature)
codesign --force --sign - mcpb/server/$BINARY_NAME
# 複製到 ~/bin
cp mcpb/server/$BINARY_NAME ~/bin/$BINARY_NAME
chmod +x ~/bin/$BINARY_NAME
codesign --force --sign - ~/bin/$BINARY_NAME
重要:
lipo -create和cp都會破壞 macOS code signature。 未簽名的 binary 會被 macOS runtime enforcement 以 SIGKILL (exit 137) 終止。 每次 lipo/cp 後必須執行codesign --force --sign -重新 ad-hoc 簽名。
mcpb/server 的 binary 已更新,必須重新打包 .mcpb 以保持一致。
rm -f mcpb/*.mcpb 2>/dev/null || true
PROJECT_NAME=$(cat mcpb/manifest.json | grep '"name"' | head -1 | sed 's/.*"\([^"]*\)".*/\1/' | tr -d ' ')
cd mcpb && zip -r ${PROJECT_NAME}.mcpb . -x ".*" -x "*.mcpb" && cd ..
ls -lh mcpb/*.mcpb
unzip -l mcpb/*.mcpb | head -10
echo "=== Post-sync Verification ==="
shasum -a 256 mcpb/server/$BINARY_NAME ~/bin/$BINARY_NAME
兩者 hash 必須完全一致。
echo "=== mcpb/server ==="
file mcpb/server/$BINARY_NAME
lipo -info mcpb/server/$BINARY_NAME
echo "=== ~/bin ==="
file ~/bin/$BINARY_NAME
lipo -info ~/bin/$BINARY_NAME
rm -f /tmp/_mcpb_sync_* 2>/dev/null
# MCPB Sync 完成
## 專案資訊
- 專案: {project-name}
- Binary: {BINARY_NAME}
## 同步結果
| 位置 | 架構 | Hash (前 12 碼) | 狀態 |
|------|------|-----------------|------|
| mcpb/server/{Binary} | universal (arm64 + x86_64) | abc123... | ✅ |
| ~/bin/{Binary} | universal (arm64 + x86_64) | abc123... | ✅ |
## MCPB 套件
- 已重新打包: mcpb/{project-name}.mcpb
## Binary Consistency: ✅ 全部一致
| 情況 | 建議操作 |
|---|---|
剛 swift build 但沒 deploy | 選項 1(從 .build 重建) |
| deploy 後 ~/bin 不一致 | 選項 2(mcpb → ~/bin) |
| 不確定 .build 是否最新 | 選項 3(完整重編譯) |
| 只想確認狀態 | --check-only |
| MCP Server | Binary 名稱 |
|---|---|
| che-things-mcp | CheThingsMCP |
| che-ical-mcp | CheICalMCP |
| che-apple-mail-mcp | CheAppleMailMCP |
| che-word-mcp | CheWordMCP |
| che-duckdb-mcp | CheDuckDBMCP |
| che-blender-mcp | CheBlenderMCP |
| che-logic-pro-mcp | CheLogicProMCP |
| che-claude-desktop-mcp | CheClaudeDesktopMCP |