# MCP ใน Claude Code Claude Code เป็น coding agent แบบ terminal ของ Anthropic ด้วย Synapse MCP, Claude Code ได้ memory ถาวรข้าม coding session — จดจำ context โปรเจกต์, การตัดสินใจในอดีต, และรูปแบบ codebase ของคุณ ## การตั้งค่า ### วิธีที่ 1: CLI Command (แนะนำ) ```bash # Add Synapse as an MCP server claude mcp add synapse -- npx -y synapse-mcp-api@latest # Set your Mind Key as env var (add to ~/.bashrc or ~/.zshrc) export SYNAPSE_MIND_KEY="mk_YOUR_MIND_KEY_HERE" export SYNAPSE_URL="https://synapse.schaefer.zone" # optional, defaults to synapse.schaefer.zone ``` ### วิธีที่ 2: แก้ไข Config File แก้ไข `~/.claude/config.json`: ```json { "mcpServers": { "synapse": { "command": "npx", "args": ["-y", "synapse-mcp-api@latest"], "env": { "SYNAPSE_MIND_KEY": "mk_YOUR_MIND_KEY_HERE", "SYNAPSE_URL": "https://synapse.schaefer.zone" } } } } ``` ## ตรวจสอบว่าทำงาน เริ่ม Claude Code: ```bash claude ``` ใน prompt ของ Claude Code พิมพ์: ``` recall all my memories ``` Claude ควรเรียก `memory_recall` และตอบกลับด้วย memory ที่เก็บไว้ของคุณ ## รูปแบบทั่วไป ### ความคงทนของ context โปรเจกต์ ที่จุดเริ่มต้น coding session: ``` recalling my memories — what projects am I working on? ``` Claude เรียก `memory_recall`, เห็นรายการโปรเจกต์ของคุณ และทำงานต่อจากที่ค้างไว้ ### การตัดสินใจเกี่ยวกับ codebase เมื่อคุณตัดสินใจเชิงสถาปัตยกรรม: ``` store this: "We chose PostgreSQL over SQLite because of concurrent write performance. Decision made on 2026-06-27." ``` Claude เรียก `memory_store` ด้วย category `project`, priority `high` ### การหลีกเลี่ยง mistake ในอดีต ``` what mistakes have I made with this codebase? ``` Claude ค้นหา memory ด้วย category `mistake` และเตือนคุณเกี่ยวกับ error ในอดีต ### การติดตาม task ``` create a task: "Refactor auth module to use JWT refresh tokens" ``` Claude เรียก `task_create` และ task อยู่รอดข้าม session ## Tool Profile สำหรับ coding session ที่คุณไม่ต้องการ tool ทั้ง 119: ```bash # Set profile via env var export MCP_PROFILE="standard" # 25 tools, ~2500 tokens # Or in config.json "env": { "SYNAPSE_MIND_KEY": "mk_...", "MCP_PROFILE": "standard" } ``` ## การแก้ปัญหา ### MCP server ไม่เริ่ม ```bash # Test the MCP server manually npx -y synapse-mcp-api@latest # Should print: # [info] synapse-mcp Streamable HTTP server ready # [info] MCP: http://localhost:13100/mcp ``` ### Mind Key ไม่รู้จัก ```bash # Verify env var is set echo $SYNAPSE_MIND_KEY # Test directly curl -H "Authorization: Bearer $SYNAPSE_MIND_KEY" \ https://synapse.schaefer.zone/memory/recall ``` ### Claude Code ไม่เห็น tool - รีสตาร์ท Claude Code หลังการเปลี่ยน config - ตรวจ `claude mcp list` เพื่อยืนยันว่า Synapse ลงทะเบียนแล้ว - ดู [MCP Troubleshooting](/docs/mcp/troubleshooting) ## ขั้นตอนถัดไป - [Claude Desktop Setup](/docs/mcp/claude-desktop) - [Cursor Setup](/docs/mcp/cursor) - [Persistent LLM Agent Guide](/docs/guides/persistent-llm-agent)