Claude Model Context Protocol(MCP),在 Windows 環境中 Step By Step 安裝步驟!

環境確認:

  1. Enable Develop Mode Claude Desktop 左上角選項 -> Help -> Enable Develop Mode Enable Develop Mode
    按 Enable Imgur
    之後重啟就能在看到 左上角選項 -> Developer -> Open MCP Log File

  2. 確認 Node.js and Python Env

    • 版本要求:

      • Node.js >= 18
      • Python >= 3.10
    • Node:

      • install node.js or npm
    # Check Version Command
    node --version
    or
    npm --version
    # Check root Path Command
    where node
    or
    npm root -g
    
    # Record the paths returned by the last two commands - you'll need them later
    # Ex: C:\Users\<UserName>\AppData\Roaming\npm\node_modules
    
    • Python:
      • install python>=3.10 and “Add Python to PATH”
    # PowerShell or Cmd
    ➜ python -V
    Python 3.12.8
    

Install Package Managers

Open Command Prompt (CMD) as administrator and run:

# For Python-based servers
npm install -g uv

uv_install

Install MCP Servers

  • Global NPM Installation (Recommended for getting started)

    # Install core servers globally
    npm install -g @modelcontextprotocol/server-filesystem
    npm install -g @modelcontextprotocol/server-memory
    npm install -g @modelcontextprotocol/server-brave-search
    
  • Python-based Servers

    # Install the fetch server using pip
    pip install mcp-server-fetch
    
  • Configure Claude Desktop

    1. Claude 文件位置:%AppData%\Claude Desktop\

    2. 創建或修改 Claude Config 文件:claude_desktop_config.json

    3. Config 使用以下 json 配置 (請自行替換成你環境中的 Node.js 或 npm 路徑):

      {
        "globalShortcut": "Ctrl+Space",
        "mcpServers": {
          "sqlite": {
            "command": "uvx",
            "args": ["mcp-server-sqlite", "--db-path", "C:\\Users\\YourUsername\\test.db"]
          },
          "filesystem": {
            "command": "npx",
            "args": [
              "-y",
              "@modelcontextprotocol/server-filesystem",
              "C:\\Users\\<UserName>\\Downloads",
              "C:\\Users\\<UserName>\\Documents",
              "C:\\Users\\<UserName>\\Desktop"
            ],
            "env": {
              "DEBUG": "*"
            }
          },
          "memory": {
            "command": "C:\\Program Files\\nodejs\\node.exe",
            "args": [
              "C:\\Users\\<UserName>\\AppData\\Roaming\\npm\\node_modules\\@modelcontextprotocol\\server-memory\\dist\\index.js"
            ],
            "env": {
              "DEBUG": "*"
            }
          },
          "mcp-installer": {
            "command": "npx",
            "args": [
              "@anaisbetts/mcp-installer"
            ]
          }
        }
      }
      
  • 補充:

    • MCP安裝與資料設定好後重啟 Claude Desktop
    • 開進去因該就有顯示 MCP Tool
    • 因為我們還沒設定好 SQLite 所以會有 Error
    • SQLite 我是用Docker架設所以等等會修改
    • filesystem 裡的 args 中的 Path 是他能使用到的地方
    • memory 中的 args 要設定成剛剛 node or npm 的 path 中的 model 位置

SQLite - Docker版

modelcontextprotocol/servers - sqlite · GitHub

先把檔案下載下來並執行下列 command:

docker build -t mcp/sqlite .
docker volume create claude_sqlite

修改 claude_desktop_config.json:

//claude_desktop_config.json
"mcpServers": {
    "sqlite": {
      "command": "docker",
      "args": ["run","--rm","-i","-v","claude_sqlite:/mcp","mcp/sqlite","--db-path","/mcp/claude_sqlite.db"]
      },
}

SQLite-Docker

嘗試執行 Claude 使用 MCP:
嘗試叫他幫我找尋 D:\Project 底下有哪些專案的資料夾
他會先跟你確認要用哪個 MCP Serve 並之後執行 run-mcp 完美的找出 Project 下的資料夾有哪些!! find_project

之後要使用別的套件基本上也是參照 MCP Server 安裝方式安裝即可使用!
檢查 MCP Server 錯誤時可以透過 Developer 中的 Open MCP Log File 檢查 Log

Reference

MCP-Windows · GitHub

modelcontextprotocol/servers: Model Context Protocol Servers · GitHub

modelcontextprotocol.io