{"title":"MCP 故障排查","slug":"troubleshooting","category":"mcp","summary":"解决常见 MCP 集成问题 — 服务器不启动、工具不出现、认证错误。","audience":["human","llm"],"tags":["mcp","troubleshooting","errors","debugging"],"difficulty":"intermediate","updated":"2026-06-27","word_count":342,"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":"zh","translated":true,"requested_lang":"zh","content_markdown":"\n# MCP 故障排查\n\n把 Synapse MCP 集成到 LLM 客户端时的常见问题与解决方案。\n\n## 快速诊断清单\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. ✅ 配置文件是否为有效 JSON？（无尾随逗号、无注释）\n6. ✅ 配置更改后是否重启客户端？\n7. ✅ MCP Server 是否能手动启动？（`npx -y synapse-mcp-api@latest`）\n\n## 问题：客户端中没有工具出现\n\n### 症状\n\n- Claude Desktop / Cursor / Continue 显示 0 个工具\n- 没有 🔌 图标或 MCP Server 列表中没有 “synapse” 条目\n\n### 解决方案\n\n1. **完全重启客户端** — macOS 上 Cmd+Q（不是只关窗口）\n2. **检查配置文件位置**：\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** — 把配置粘到 <https://jsonlint.com>\n4. **查看客户端日志**中的 MCP 错误：\n   - Claude Desktop：`~/Library/Logs/Claude/mcp.log`（macOS）\n   - Cursor：View → Output → MCP\n5. **手动运行 MCP Server** 以查看启动错误：\n   ```bash\n   SYNAPSE_MIND_KEY=mk_... npx -y synapse-mcp-api@latest\n   ```\n\n## 问题：“Mind Key invalid” 错误\n\n### 症状\n\n- 工具出现，但调用失败返回 “401 Unauthorized”\n- 错误：“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. **检查环境变量是否设置** — 对于 stdio 传输，环境变量必须在 MCP Server 配置中，而不是你的 shell\n4. **获取新的 Mind Key**：\n   ```bash\n   # 登录获取 JWT\n   curl -X POST .../login -d '{\"email\":\"...\",\"password\":\"...\"}'\n   # 创建新 Mind\n   curl -X POST .../minds -H \"Authorization: Bearer YOUR_JWT\" -d '{\"name\":\"new mind\"}'\n   ```\n\n## 问题：npx 未找到\n\n### 症状\n\n- 错误：“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. 安装后**重启终端**\n3. **验证**：`node --version && npx --version`\n\n## 问题：SYNAPSE_URL 不可达\n\n### 症状\n\n- MCP Server 启动但工具调用超时\n- 错误：“fetch failed” 或 “ECONNREFUSED”\n\n### 解决方案\n\n1. **测试连通性**：\n   ```bash\n   curl https://synapse.schaefer.zone/health\n   ```\n2. **检查公司防火墙** — 可能阻挡出站 HTTPS\n3. **尝试备用 URL**：\n   - 生产环境：`https://synapse.schaefer.zone`\n   - MCP Server：`https://synapse-mcp.schaefer.zone`\n4. **自托管**：确保 Synapse 实例正在运行且可访问\n\n## 问题：MCP Server 崩溃\n\n### 症状\n\n- MCP Server 启动后立即退出\n- 客户端日志显示 “MCP server disconnected”\n\n### 解决方案\n\n1. **手动运行查看错误**：\n   ```bash\n   SYNAPSE_MIND_KEY=mk_... SYNAPSE_URL=https://synapse.schaefer.zone \\\n     npx -y synapse-mcp-api@latest\n   ```\n2. **检查端口冲突** — MCP Server 默认使用端口 13100\n3. **清除 npx 缓存**：\n   ```bash\n   npx clear-npx-cache\n   # 或\n   rm -rf ~/.npm/_npx\n   ```\n4. **更新到最新版**：\n   ```bash\n   npx -y synapse-mcp-api@latest --version\n   ```\n\n## 问题：工具调用返回 429\n\n### 症状\n\n- 错误：“Rate limit exceeded”\n\n### 解决方案\n\nMCP 不应出现此问题（用头部认证，无限制）。如果出现：\n\n1. **检查是否在某处用了 `?key=`** — 改用头部认证\n2. **验证 `SYNAPSE_URL`** — 确保指向正确实例\n3. 若问题持续，**联系支持**\n\n## 问题：工具出现但不工作\n\n### 症状\n\n- 客户端列出了工具\n- 调用工具返回错误或无结果\n\n### 解决方案\n\n1. **检查工具名** — 必须精确（如 `memory_recall`，不是 `memory.recall`）\n2. **验证参数** — 检查工具的输入 schema\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   - 客户端名称与版本\n   - 操作系统\n   - 相关日志片段\n   - 复现步骤\n\n## 下一步\n\n- [Claude Desktop 配置](/docs/mcp/claude-desktop)\n- [Claude Code 配置](/docs/mcp/claude-code)\n- [API 错误](/docs/api/errors)\n","content_html":"<h1>MCP 故障排查</h1>\n<p>把 Synapse MCP 集成到 LLM 客户端时的常见问题与解决方案。</p>\n<h2>快速诊断清单</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>✅ 配置文件是否为有效 JSON？（无尾随逗号、无注释）</li>\n<li>✅ 配置更改后是否重启客户端？</li>\n<li>✅ MCP Server 是否能手动启动？（<code>npx -y synapse-mcp-api@latest</code>）</li>\n</ol>\n<h2>问题：客户端中没有工具出现</h2>\n<h3>症状</h3>\n<ul>\n<li>Claude Desktop / Cursor / Continue 显示 0 个工具</li>\n<li>没有 🔌 图标或 MCP Server 列表中没有 “synapse” 条目</li>\n</ul>\n<h3>解决方案</h3>\n<ol>\n<li><strong>完全重启客户端</strong> — macOS 上 Cmd+Q（不是只关窗口）</li>\n<li><strong>检查配置文件位置</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> — 把配置粘到 <a href=\"https://jsonlint.com\">https://jsonlint.com</a></li>\n<li><strong>查看客户端日志</strong>中的 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> 以查看启动错误：<pre><code class=\"hljs language-bash\">SYNAPSE_MIND_KEY=mk_... npx -y synapse-mcp-api@latest</code></pre></li>\n</ol>\n<h2>问题：“Mind Key invalid” 错误</h2>\n<h3>症状</h3>\n<ul>\n<li>工具出现，但调用失败返回 “401 Unauthorized”</li>\n<li>错误：“Mind Key fehlt oder ungültig”</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>检查环境变量是否设置</strong> — 对于 stdio 传输，环境变量必须在 MCP Server 配置中，而不是你的 shell</li>\n<li><strong>获取新的 Mind Key</strong>：<pre><code class=\"hljs language-bash\"><span class=\"hljs-comment\"># 登录获取 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\"># 创建新 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>错误：“npx: command not found”</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>重启终端</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 启动但工具调用超时</li>\n<li>错误：“fetch failed” 或 “ECONNREFUSED”</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>检查公司防火墙</strong> — 可能阻挡出站 HTTPS</li>\n<li><strong>尝试备用 URL</strong>：<ul>\n<li>生产环境：<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>自托管</strong>：确保 Synapse 实例正在运行且可访问</li>\n</ol>\n<h2>问题：MCP Server 崩溃</h2>\n<h3>症状</h3>\n<ul>\n<li>MCP Server 启动后立即退出</li>\n<li>客户端日志显示 “MCP server disconnected”</li>\n</ul>\n<h3>解决方案</h3>\n<ol>\n<li><strong>手动运行查看错误</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>检查端口冲突</strong> — MCP Server 默认使用端口 13100</li>\n<li><strong>清除 npx 缓存</strong>：<pre><code class=\"hljs language-bash\">npx clear-npx-cache\n<span class=\"hljs-comment\"># 或</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>问题：工具调用返回 429</h2>\n<h3>症状</h3>\n<ul>\n<li>错误：“Rate limit exceeded”</li>\n</ul>\n<h3>解决方案</h3>\n<p>MCP 不应出现此问题（用头部认证，无限制）。如果出现：</p>\n<ol>\n<li><strong>检查是否在某处用了 <code>?key=</code></strong> — 改用头部认证</li>\n<li><strong>验证 <code>SYNAPSE_URL</code></strong> — 确保指向正确实例</li>\n<li>若问题持续，<strong>联系支持</strong></li>\n</ol>\n<h2>问题：工具出现但不工作</h2>\n<h3>症状</h3>\n<ul>\n<li>客户端列出了工具</li>\n<li>调用工具返回错误或无结果</li>\n</ul>\n<h3>解决方案</h3>\n<ol>\n<li><strong>检查工具名</strong> — 必须精确（如 <code>memory_recall</code>，不是 <code>memory.recall</code>）</li>\n<li><strong>验证参数</strong> — 检查工具的输入 schema</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>客户端名称与版本</li>\n<li>操作系统</li>\n<li>相关日志片段</li>\n<li>复现步骤</li>\n</ul>\n</li>\n</ol>\n<h2>下一步</h2>\n<ul>\n<li><a href=\"/docs/mcp/claude-desktop\">Claude Desktop 配置</a></li>\n<li><a href=\"/docs/mcp/claude-code\">Claude Code 配置</a></li>\n<li><a href=\"/docs/api/errors\">API 错误</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"]}