com um clique
mcp-debug
MCP Server 功能除錯(框架分析、權限問題、錯誤診斷)
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Menu
MCP Server 功能除錯(框架分析、權限問題、錯誤診斷)
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Baseado na classificação ocupacional 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-debug |
| description | MCP Server 功能除錯(框架分析、權限問題、錯誤診斷) |
| argument-hint | <mcp-server-name> [error-message] |
| allowed-tools | Bash(sdef:*), Bash(osascript:*), Bash(claude mcp:*), Bash(pkill:*), Bash(swift:*), Bash(tccutil:*), Bash(open:*), Bash(lipo:*), Bash(file:*), Bash(shasum:*), Bash(cp:*), Bash(chmod:*), Bash(rm:*), Bash(ls:*), Bash(grep:*), Bash(codesign:*), Read, Write, Grep, Glob |
當 MCP Server 功能有問題時,使用此流程診斷。
連線問題請用 /mcp-tools:mcp-diagnose
完整測試請用 /mcp-tools:mcp-test
$1 = MCP Server 名稱(如 che-things-mcp、che-ical-mcp)$2 = 可選的錯誤訊息(用於快速判斷問題類型)動任何事之前先用 TaskCreate 建 todo list:
TaskCreate(name="quick_diagnose", description="Phase 0: 建除錯日誌目錄 + 檢查連線 + 快速測試 + 錯誤分析")
TaskCreate(name="identify_framework", description="Phase 1: 找原始碼 + 判斷框架(Swift/Python/TS)")
TaskCreate(name="diagnosis_report", description="Phase 2: 產生報告 + 儲存")
TaskCreate(name="post_fix_verify", description="Phase 3: 若修復了,重新 build + sync binary 驗證")
完成每一步立即 TaskUpdate → completed。靜默完成 = 違規。
在專案根目錄建立 logs/mcptools/debug/ 結構:
cd ~/Library/CloudStorage/Dropbox/che_workspace/projects/mcp/$1
mkdir -p logs/mcptools/debug
目錄結構:
<project>/
└── logs/
└── mcptools/
└── debug/ ← 除錯報告存放處
└── debug-report-<timestamp>.md
claude mcp list 2>&1 | grep -A1 "$1"
結果判讀:
✓ Connected → 連線正常,進入 Phase 1✗ Failed 或找不到 → 先用 /mcp-tools:mcp-diagnose直接呼叫 MCP tools 測試基本功能:
list_*、get_*)如果有錯誤訊息($2),快速判斷問題類型:
| 錯誤關鍵字 | 問題類型 | 進入流程 |
|---|---|---|
access denied / permission | 權限問題 | → B3 權限除錯 |
not found / does not exist | 資源不存在 | → 檢查參數 |
Can't set property | AppleScript 唯讀 | → A2 Dictionary 分析 |
connection / timeout | 連線問題 | → Phase 3 重啟 |
parse / invalid | 參數格式錯誤 | → 檢查參數格式 |
ls -la ~/Library/CloudStorage/Dropbox/che_workspace/projects/mcp/$1/
# 檢查 Swift imports
grep -r "^import" $1/Sources/ 2>/dev/null | head -20
| 特徵 | 框架類型 | 除錯流程 |
|---|---|---|
import EventKit | EventKit | → 框架 B |
tell application / NSAppleScript | AppleScript | → 框架 A |
import Contacts | Contacts | → 框架 C |
| HTTP/REST calls | Web API | → 框架 C |
適用於:che-things-mcp、che-apple-mail-mcp
sdef /Applications/<AppName>.app > /tmp/<AppName>-dictionary.xml
# 找唯讀屬性
grep 'access="r"' /tmp/<AppName>-dictionary.xml
# 找可用命令
grep 'command name=' /tmp/<AppName>-dictionary.xml
osascript -e 'tell application "<AppName>" to <test-code>'
| 錯誤 | 原因 | 解決 |
|---|---|---|
Can't set property | 屬性唯讀 | 用替代命令 |
Can't get list "Inbox" | localized 名稱 | 用 internal ID |
適用於:che-ical-mcp
cat $1/Sources/*/EventKitManager.swift
| 模式 | 功能 |
|---|---|
EKEventStore | 存取行事曆 |
requestAccess | 權限請求 |
predicateForEvents | 查詢事件 |
open "x-apple.systempreferences:com.apple.preference.security?Privacy_Calendars"
open "x-apple.systempreferences:com.apple.preference.security?Privacy_Reminders"
重要:要授權的是 IDE,不是 binary!
| 你使用的工具 | 要授權的項目 |
|---|---|
| Cursor | Cursor |
| VS Code | Code |
| Terminal | Terminal / iTerm |
| Claude Desktop | Claude |
# 重置權限
tccutil reset Calendars
tccutil reset Reminders
# 觸發權限請求
osascript -e 'tell application "Calendar" to get name of every calendar'
osascript -e 'tell application "Reminders" to get name of every list'
┌─────────────────────────────────────────────────────────┐
│ AppleScript (osascript) vs EventKit Framework │
├─────────────────────────────────────────────────────────┤
│ osascript 成功 │ MCP (EventKit) 失敗 │
│ ↓ │ ↓ │
│ Apple Events 權限 │ Privacy - Calendars/ │
│ (Automation) │ Reminders 權限 │
├─────────────────────────────────────────────────────────┤
│ 這是兩個不同的權限機制! │
│ AppleScript 能用不代表 EventKit 也能用 │
└─────────────────────────────────────────────────────────┘
grep -r "class.*Manager\|class.*Service" $1/Sources/
cat $1/Package.swift
將報告存到 logs/mcptools/debug/debug-report-<timestamp>.md:
# 報告檔案路徑
REPORT_FILE="logs/mcptools/debug/debug-report-$(date +%Y%m%d-%H%M%S).md"
# MCP Debug Report: <server-name>
Generated: <timestamp>
## 問題摘要
- 錯誤訊息: <error>
- 問題類型: 權限 / 參數 / 連線 / 其他
## 框架識別
- 類型: AppleScript / EventKit / Other
- 除錯流程: 框架 A / B / C
## 診斷結果
- 快速測試: ✅ / ❌
- 問題根因: <root-cause>
## 修復建議
1. <step-1>
2. <step-2>
使用 Write 工具將報告寫入 $REPORT_FILE。
完成後輸出:
✅ 除錯報告已儲存: logs/mcptools/debug/debug-report-<timestamp>.md
cd $1
swift build -c release
取得 Binary 名稱:
BINARY_NAME=$(grep -A5 'executableTarget' Package.swift | grep 'name:' | head -1 | sed 's/.*"\([^"]*\)".*/\1/')
if [ -f ".build/arm64-apple-macosx/release/$BINARY_NAME" ] && [ -f ".build/x86_64-apple-macosx/release/$BINARY_NAME" ]; then
echo "Building universal binary..."
lipo -create \
.build/arm64-apple-macosx/release/$BINARY_NAME \
.build/x86_64-apple-macosx/release/$BINARY_NAME \
-output mcpb/server/$BINARY_NAME
codesign --force --sign - mcpb/server/$BINARY_NAME
else
echo "Single-arch build detected, copying directly..."
# 找到可用的 release binary
BUILD_BIN=$(ls .build/arm64-apple-macosx/release/$BINARY_NAME .build/x86_64-apple-macosx/release/$BINARY_NAME .build/release/$BINARY_NAME 2>/dev/null | head -1)
if [ -n "$BUILD_BIN" ]; then
cp "$BUILD_BIN" mcpb/server/$BINARY_NAME
fi
fi
cp mcpb/server/$BINARY_NAME ~/bin/$BINARY_NAME
chmod +x ~/bin/$BINARY_NAME
codesign --force --sign - ~/bin/$BINARY_NAME
echo "=== Post-rebuild Sync Verification ==="
shasum -a 256 mcpb/server/$BINARY_NAME ~/bin/$BINARY_NAME
file mcpb/server/$BINARY_NAME
file ~/bin/$BINARY_NAME
pkill -f <BinaryName>
claude mcp list 2>&1 | grep -A1 "$1"
| MCP Server | 框架 | Binary |
|---|---|---|
| che-things-mcp | AppleScript | CheThingsMCP |
| che-apple-mail-mcp | AppleScript | CheAppleMailMCP |
| che-ical-mcp | EventKit | CheICalMCP |
| 清單 | ID |
|---|---|
| Inbox | TMInboxListSource |
| Today | TMTodayListSource |
| Upcoming | TMCalendarListSource |
| Anytime | TMNextListSource |
| Someday | TMSomedayListSource |
| Logbook | TMLogbookListSource |