{"title":"การแก้ปัญหา MCP","slug":"troubleshooting","category":"mcp","summary":"แก้ปัญหา integration MCP ทั่วไป — server ไม่เริ่ม, tool ไม่ปรากฏ, error auth","audience":["human","llm"],"tags":["mcp","troubleshooting","errors","debugging"],"difficulty":"intermediate","updated":"2026-06-27","word_count":451,"read_minutes":2,"llm_context":"Common issues:\n1. Node.js < 18 → upgrade to 18+\n2. Mind Key invalid → check format (mk_...), get fresh via POST /minds\n3. npx not found → install Node.js\n4. Tools not appearing → restart client, check config JSON validity\n5. SYNAPSE_URL unreachable → curl /health to verify\n6. MCP server crashes → check logs, run npx manually to see error\nDebug steps: run `npx -y synapse-mcp-api@latest` manually, check stderr\nLogs: Claude Desktop ~/Library/Logs/Claude/mcp.log, Cursor ~/.cursor/logs/\n","lang":"th","translated":true,"requested_lang":"th","content_markdown":"\n# การแก้ปัญหา MCP\n\nปัญหาและวิธีแก้ทั่วไปเมื่อผสานรวม Synapse MCP กับ LLM client ของคุณ\n\n## Checklist Diagnostic ด่วน\n\n1. ✅ ติดตั้ง Node.js 18+? (`node --version`)\n2. ✅ Mind Key ขึ้นต้นด้วย `mk_`? (ไม่ใช่ JWT `eyJ...`)\n3. ✅ เข้าถึง Synapse API ได้? (`curl https://synapse.schaefer.zone/health`)\n4. ✅ Mind Key ทำงาน? (`curl -H \"Authorization: Bearer mk_...\" .../memory/recall`)\n5. ✅ Config file เป็น JSON ที่ถูกต้อง? (ไม่มี trailing comma, ไม่มี comment)\n6. ✅ รีสตาร์ท client หลังเปลี่ยน config?\n7. ✅ MCP server เริ่มด้วยตนเอง? (`npx -y synapse-mcp-api@latest`)\n\n## ปัญหา: ไม่มี tool ปรากฏใน Client\n\n### อาการ\n\n- Claude Desktop / Cursor / Continue แสดง 0 tool\n- ไม่มีไอคอน 🔌 หรือรายการ \"synapse\" ในรายการ MCP server\n\n### วิธีแก้\n\n1. **รีสตาร์ท client ให้เต็มรูปแบบ** — Cmd+Q บน macOS (ไม่ใช่แค่ปิดหน้าต่าง)\n2. **ตรวจตำแหน่ง config file**:\n   - Claude Desktop macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`\n   - Claude Desktop Windows: `%APPDATA%\\Claude\\claude_desktop_config.json`\n   - Cursor: `~/.cursor/config.json`\n   - Continue: `~/.continue/config.json`\n3. **ตรวจ JSON ให้ถูกต้อง** — วาง config ใน <https://jsonlint.com>\n4. **ตรวจ log client** หา error MCP:\n   - Claude Desktop: `~/Library/Logs/Claude/mcp.log` (macOS)\n   - Cursor: View → Output → MCP\n5. **รัน MCP server ด้วยตนเอง** เพื่อดู startup error:\n   ```bash\n   SYNAPSE_MIND_KEY=mk_... npx -y synapse-mcp-api@latest\n   ```\n\n## ปัญหา: Error \"Mind Key invalid\"\n\n### อาการ\n\n- tool ปรากฏแต่การเรียกล้มเหลวด้วย \"401 Unauthorized\"\n- Error: \"Mind Key fehlt oder ungültig\"\n\n### วิธีแก้\n\n1. **ตรวจรูปแบบ Mind Key** — ขึ้นต้นด้วย `mk_`, ~40 ตัวอักษร\n2. **ทดสอบโดยตรง**:\n   ```bash\n   curl -H \"Authorization: Bearer mk_YOUR_KEY\" \\\n        https://synapse.schaefer.zone/memory/recall\n   ```\n3. **ตรวจ env var ตั้งแล้ว** — สำหรับ transport stdio, env var ต้องอยู่ใน MCP server config, ไม่ใช่ shell ของคุณ\n4. **รับ Mind Key ใหม่**:\n   ```bash\n   # Login to get JWT\n   curl -X POST .../login -d '{\"email\":\"...\",\"password\":\"...\"}'\n   # Create new mind\n   curl -X POST .../minds -H \"Authorization: Bearer YOUR_JWT\" -d '{\"name\":\"new mind\"}'\n   ```\n\n## ปัญหา: ไม่พบ npx\n\n### อาการ\n\n- Error: \"npx: command not found\"\n- MCP server ล้มเหลวตอนเริ่ม\n\n### วิธีแก้\n\n1. **ติดตั้ง Node.js 18+**:\n   - macOS: `brew install node` หรือดาวน์โหลดจาก <https://nodejs.org>\n   - Linux: `curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - && sudo apt install -y nodejs`\n   - Windows: ดาวน์โหลดจาก <https://nodejs.org>\n2. **รีสตาร์ท terminal** หลังติดตั้ง\n3. **ตรวจสอบ**: `node --version && npx --version`\n\n## ปัญหา: SYNAPSE_URL เข้าถึงไม่ได้\n\n### อาการ\n\n- MCP server เริ่มแต่การเรียก tool หมดเวลา\n- Error: \"fetch failed\" หรือ \"ECONNREFUSED\"\n\n### วิธีแก้\n\n1. **ทดสอบการเชื่อมต่อ**:\n   ```bash\n   curl https://synapse.schaefer.zone/health\n   ```\n2. **ตรวจ corporate firewall** — อาจบล็อก HTTPS ขาออก\n3. **ลอง URL ทางเลือก**:\n   - Production: `https://synapse.schaefer.zone`\n   - MCP server: `https://synapse-mcp.schaefer.zone`\n4. **สำหรับ self-hosted**: ตรวจว่า instance Synapse ของคุณรันและเข้าถึงได้\n\n## ปัญหา: MCP Server Crash\n\n### อาการ\n\n- MCP server ออกทันทีหลังเริ่ม\n- Log client แสดง \"MCP server disconnected\"\n\n### วิธีแก้\n\n1. **รันด้วยตนเองเพื่อดู error**:\n   ```bash\n   SYNAPSE_MIND_KEY=mk_... SYNAPSE_URL=https://synapse.schaefer.zone \\\n     npx -y synapse-mcp-api@latest\n   ```\n2. **ตรวจ conflict port** — MCP server ใช้ port 13100 โดยค่าเริ่มต้น\n3. **ล้าง npx cache**:\n   ```bash\n   npx clear-npx-cache\n   # or\n   rm -rf ~/.npm/_npx\n   ```\n4. **อัปเดตเป็นเวอร์ชันล่าสุด**:\n   ```bash\n   npx -y synapse-mcp-api@latest --version\n   ```\n\n## ปัญหา: การเรียก Tool ส่งกลับ 429\n\n### อาการ\n\n- Error: \"Rate limit exceeded\"\n\n### วิธีแก้\n\nสิ่งนี้ไม่ควรเกิดกับ MCP (ใช้ header auth, ไม่จำกัดอัตรา) หากเกิด:\n\n1. **ตรวจว่าคุณใช้ `?key=` ที่ไหน** — เปลี่ยนเป็น header auth\n2. **ตรวจ `SYNAPSE_URL`** — ตรวจให้แน่ใจว่าชี้ไปยัง instance ที่ถูกต้อง\n3. **ติดต่อ support** หากปัญหายังคงอยู่\n\n## ปัญหา: Tool ปรากฏแต่ไม่ทำงาน\n\n### อาการ\n\n- tool อยู่ในรายการ client\n- การเรียก tool ส่งกลับ error หรือไม่มีผลลัพธ์\n\n### วิธีแก้\n\n1. **ตรวจชื่อ tool** — ต้องตรง (เช่น `memory_recall`, ไม่ใช่ `memory.recall`)\n2. **ตรวจ arguments** — ตรวจ input schema ของ tool\n3. **ทดสอบผ่าน API โดยตรง**:\n   ```bash\n   curl -X POST https://synapse.schaefer.zone/memory \\\n     -H \"Authorization: Bearer mk_...\" \\\n     -H \"Content-Type: application/json\" \\\n     -d '{\"category\":\"fact\",\"key\":\"test\",\"content\":\"hello\"}'\n   ```\n4. **ตรวจสุขภาพ Synapse**:\n   ```bash\n   curl https://synapse.schaefer.zone/health\n   ```\n\n## การขอความช่วยเหลือ\n\nหากไม่มีวิธีข้างต้นแก้ปัญหาของคุณ:\n\n1. **ตรวจ issue ที่มี**: <https://gitlab.com/schaefer-services/synapse-mcp/-/issues>\n2. **เปิด issue ใหม่** พร้อม:\n   - เวอร์ชัน MCP server (`npx -y synapse-mcp-api@latest --version`)\n   - ชื่อและเวอร์ชัน client\n   - ระบบปฏิบัติการ\n   - ส่วนที่เกี่ยวข้องของ log\n   - ขั้นตอนการ reproduce\n\n## ขั้นตอนถัดไป\n\n- [Claude Desktop Setup](/docs/mcp/claude-desktop)\n- [Claude Code Setup](/docs/mcp/claude-code)\n- [API Errors](/docs/api/errors)\n","content_html":"<h1>การแก้ปัญหา MCP</h1>\n<p>ปัญหาและวิธีแก้ทั่วไปเมื่อผสานรวม Synapse MCP กับ LLM client ของคุณ</p>\n<h2>Checklist Diagnostic ด่วน</h2>\n<ol>\n<li>✅ ติดตั้ง Node.js 18+? (<code>node --version</code>)</li>\n<li>✅ Mind Key ขึ้นต้นด้วย <code>mk_</code>? (ไม่ใช่ JWT <code>eyJ...</code>)</li>\n<li>✅ เข้าถึง Synapse API ได้? (<code>curl https://synapse.schaefer.zone/health</code>)</li>\n<li>✅ Mind Key ทำงาน? (<code>curl -H &quot;Authorization: Bearer mk_...&quot; .../memory/recall</code>)</li>\n<li>✅ Config file เป็น JSON ที่ถูกต้อง? (ไม่มี trailing comma, ไม่มี comment)</li>\n<li>✅ รีสตาร์ท client หลังเปลี่ยน config?</li>\n<li>✅ MCP server เริ่มด้วยตนเอง? (<code>npx -y synapse-mcp-api@latest</code>)</li>\n</ol>\n<h2>ปัญหา: ไม่มี tool ปรากฏใน Client</h2>\n<h3>อาการ</h3>\n<ul>\n<li>Claude Desktop / Cursor / Continue แสดง 0 tool</li>\n<li>ไม่มีไอคอน 🔌 หรือรายการ &quot;synapse&quot; ในรายการ MCP server</li>\n</ul>\n<h3>วิธีแก้</h3>\n<ol>\n<li><strong>รีสตาร์ท client ให้เต็มรูปแบบ</strong> — Cmd+Q บน macOS (ไม่ใช่แค่ปิดหน้าต่าง)</li>\n<li><strong>ตรวจตำแหน่ง config file</strong>:<ul>\n<li>Claude Desktop macOS: <code>~/Library/Application Support/Claude/claude_desktop_config.json</code></li>\n<li>Claude Desktop Windows: <code>%APPDATA%\\Claude\\claude_desktop_config.json</code></li>\n<li>Cursor: <code>~/.cursor/config.json</code></li>\n<li>Continue: <code>~/.continue/config.json</code></li>\n</ul>\n</li>\n<li><strong>ตรวจ JSON ให้ถูกต้อง</strong> — วาง config ใน <a href=\"https://jsonlint.com\">https://jsonlint.com</a></li>\n<li><strong>ตรวจ log client</strong> หา error MCP:<ul>\n<li>Claude Desktop: <code>~/Library/Logs/Claude/mcp.log</code> (macOS)</li>\n<li>Cursor: View → Output → MCP</li>\n</ul>\n</li>\n<li><strong>รัน MCP server ด้วยตนเอง</strong> เพื่อดู startup error:<pre><code class=\"hljs language-bash\">SYNAPSE_MIND_KEY=mk_... npx -y synapse-mcp-api@latest</code></pre></li>\n</ol>\n<h2>ปัญหา: Error &quot;Mind Key invalid&quot;</h2>\n<h3>อาการ</h3>\n<ul>\n<li>tool ปรากฏแต่การเรียกล้มเหลวด้วย &quot;401 Unauthorized&quot;</li>\n<li>Error: &quot;Mind Key fehlt oder ungültig&quot;</li>\n</ul>\n<h3>วิธีแก้</h3>\n<ol>\n<li><strong>ตรวจรูปแบบ Mind Key</strong> — ขึ้นต้นด้วย <code>mk_</code>, ~40 ตัวอักษร</li>\n<li><strong>ทดสอบโดยตรง</strong>:<pre><code class=\"hljs language-bash\">curl -H <span class=\"hljs-string\">&quot;Authorization: Bearer mk_YOUR_KEY&quot;</span> \\\n     https://synapse.schaefer.zone/memory/recall</code></pre></li>\n<li><strong>ตรวจ env var ตั้งแล้ว</strong> — สำหรับ transport stdio, env var ต้องอยู่ใน MCP server config, ไม่ใช่ shell ของคุณ</li>\n<li><strong>รับ Mind Key ใหม่</strong>:<pre><code class=\"hljs language-bash\"><span class=\"hljs-comment\"># Login to get JWT</span>\ncurl -X POST .../login -d <span class=\"hljs-string\">&#x27;{&quot;email&quot;:&quot;...&quot;,&quot;password&quot;:&quot;...&quot;}&#x27;</span>\n<span class=\"hljs-comment\"># Create new mind</span>\ncurl -X POST .../minds -H <span class=\"hljs-string\">&quot;Authorization: Bearer YOUR_JWT&quot;</span> -d <span class=\"hljs-string\">&#x27;{&quot;name&quot;:&quot;new mind&quot;}&#x27;</span></code></pre></li>\n</ol>\n<h2>ปัญหา: ไม่พบ npx</h2>\n<h3>อาการ</h3>\n<ul>\n<li>Error: &quot;npx: command not found&quot;</li>\n<li>MCP server ล้มเหลวตอนเริ่ม</li>\n</ul>\n<h3>วิธีแก้</h3>\n<ol>\n<li><strong>ติดตั้ง Node.js 18+</strong>:<ul>\n<li>macOS: <code>brew install node</code> หรือดาวน์โหลดจาก <a href=\"https://nodejs.org\">https://nodejs.org</a></li>\n<li>Linux: <code>curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - &amp;&amp; sudo apt install -y nodejs</code></li>\n<li>Windows: ดาวน์โหลดจาก <a href=\"https://nodejs.org\">https://nodejs.org</a></li>\n</ul>\n</li>\n<li><strong>รีสตาร์ท terminal</strong> หลังติดตั้ง</li>\n<li><strong>ตรวจสอบ</strong>: <code>node --version &amp;&amp; npx --version</code></li>\n</ol>\n<h2>ปัญหา: SYNAPSE_URL เข้าถึงไม่ได้</h2>\n<h3>อาการ</h3>\n<ul>\n<li>MCP server เริ่มแต่การเรียก tool หมดเวลา</li>\n<li>Error: &quot;fetch failed&quot; หรือ &quot;ECONNREFUSED&quot;</li>\n</ul>\n<h3>วิธีแก้</h3>\n<ol>\n<li><strong>ทดสอบการเชื่อมต่อ</strong>:<pre><code class=\"hljs language-bash\">curl https://synapse.schaefer.zone/health</code></pre></li>\n<li><strong>ตรวจ corporate firewall</strong> — อาจบล็อก HTTPS ขาออก</li>\n<li><strong>ลอง URL ทางเลือก</strong>:<ul>\n<li>Production: <code>https://synapse.schaefer.zone</code></li>\n<li>MCP server: <code>https://synapse-mcp.schaefer.zone</code></li>\n</ul>\n</li>\n<li><strong>สำหรับ self-hosted</strong>: ตรวจว่า instance Synapse ของคุณรันและเข้าถึงได้</li>\n</ol>\n<h2>ปัญหา: MCP Server Crash</h2>\n<h3>อาการ</h3>\n<ul>\n<li>MCP server ออกทันทีหลังเริ่ม</li>\n<li>Log client แสดง &quot;MCP server disconnected&quot;</li>\n</ul>\n<h3>วิธีแก้</h3>\n<ol>\n<li><strong>รันด้วยตนเองเพื่อดู error</strong>:<pre><code class=\"hljs language-bash\">SYNAPSE_MIND_KEY=mk_... SYNAPSE_URL=https://synapse.schaefer.zone \\\n  npx -y synapse-mcp-api@latest</code></pre></li>\n<li><strong>ตรวจ conflict port</strong> — MCP server ใช้ port 13100 โดยค่าเริ่มต้น</li>\n<li><strong>ล้าง npx cache</strong>:<pre><code class=\"hljs language-bash\">npx clear-npx-cache\n<span class=\"hljs-comment\"># or</span>\n<span class=\"hljs-built_in\">rm</span> -rf ~/.npm/_npx</code></pre></li>\n<li><strong>อัปเดตเป็นเวอร์ชันล่าสุด</strong>:<pre><code class=\"hljs language-bash\">npx -y synapse-mcp-api@latest --version</code></pre></li>\n</ol>\n<h2>ปัญหา: การเรียก Tool ส่งกลับ 429</h2>\n<h3>อาการ</h3>\n<ul>\n<li>Error: &quot;Rate limit exceeded&quot;</li>\n</ul>\n<h3>วิธีแก้</h3>\n<p>สิ่งนี้ไม่ควรเกิดกับ MCP (ใช้ header auth, ไม่จำกัดอัตรา) หากเกิด:</p>\n<ol>\n<li><strong>ตรวจว่าคุณใช้ <code>?key=</code> ที่ไหน</strong> — เปลี่ยนเป็น header auth</li>\n<li><strong>ตรวจ <code>SYNAPSE_URL</code></strong> — ตรวจให้แน่ใจว่าชี้ไปยัง instance ที่ถูกต้อง</li>\n<li><strong>ติดต่อ support</strong> หากปัญหายังคงอยู่</li>\n</ol>\n<h2>ปัญหา: Tool ปรากฏแต่ไม่ทำงาน</h2>\n<h3>อาการ</h3>\n<ul>\n<li>tool อยู่ในรายการ client</li>\n<li>การเรียก tool ส่งกลับ error หรือไม่มีผลลัพธ์</li>\n</ul>\n<h3>วิธีแก้</h3>\n<ol>\n<li><strong>ตรวจชื่อ tool</strong> — ต้องตรง (เช่น <code>memory_recall</code>, ไม่ใช่ <code>memory.recall</code>)</li>\n<li><strong>ตรวจ arguments</strong> — ตรวจ input schema ของ tool</li>\n<li><strong>ทดสอบผ่าน API โดยตรง</strong>:<pre><code class=\"hljs language-bash\">curl -X POST https://synapse.schaefer.zone/memory \\\n  -H <span class=\"hljs-string\">&quot;Authorization: Bearer mk_...&quot;</span> \\\n  -H <span class=\"hljs-string\">&quot;Content-Type: application/json&quot;</span> \\\n  -d <span class=\"hljs-string\">&#x27;{&quot;category&quot;:&quot;fact&quot;,&quot;key&quot;:&quot;test&quot;,&quot;content&quot;:&quot;hello&quot;}&#x27;</span></code></pre></li>\n<li><strong>ตรวจสุขภาพ Synapse</strong>:<pre><code class=\"hljs language-bash\">curl https://synapse.schaefer.zone/health</code></pre></li>\n</ol>\n<h2>การขอความช่วยเหลือ</h2>\n<p>หากไม่มีวิธีข้างต้นแก้ปัญหาของคุณ:</p>\n<ol>\n<li><strong>ตรวจ issue ที่มี</strong>: <a href=\"https://gitlab.com/schaefer-services/synapse-mcp/-/issues\">https://gitlab.com/schaefer-services/synapse-mcp/-/issues</a></li>\n<li><strong>เปิด issue ใหม่</strong> พร้อม:<ul>\n<li>เวอร์ชัน MCP server (<code>npx -y synapse-mcp-api@latest --version</code>)</li>\n<li>ชื่อและเวอร์ชัน client</li>\n<li>ระบบปฏิบัติการ</li>\n<li>ส่วนที่เกี่ยวข้องของ log</li>\n<li>ขั้นตอนการ reproduce</li>\n</ul>\n</li>\n</ol>\n<h2>ขั้นตอนถัดไป</h2>\n<ul>\n<li><a href=\"/docs/mcp/claude-desktop\">Claude Desktop Setup</a></li>\n<li><a href=\"/docs/mcp/claude-code\">Claude Code Setup</a></li>\n<li><a href=\"/docs/api/errors\">API Errors</a></li>\n</ul>\n","urls":{"html":"/docs/mcp/troubleshooting","text":"/docs/mcp/troubleshooting?format=text","json":"/docs/mcp/troubleshooting?format=json","llm":"/docs/mcp/troubleshooting?format=llm"},"translations_available":["en","zh","hi","es","fr","ar","pt","ru","ja","de","it","ko","nl","pl","tr","sv","vi","th","id","uk"]}