Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to configure windows filesystem? #75

Closed
TristanLib opened this issue Nov 27, 2024 · 14 comments
Closed

How to configure windows filesystem? #75

TristanLib opened this issue Nov 27, 2024 · 14 comments

Comments

@TristanLib
Copy link

This is my config file:

{
  "mcpServers": {
    "sqlite": {
        "command": "uvx",
        "args": [
          "mcp-server-sqlite",
          "--db-path",
          "D:\\temp\\test.db"
        ]
    },
    "filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
		"E:\\temp"
      ]
    }
  }
}

The claude app can connect sqlite,
however, the file system cannot be connected, and the MCP console displays the following information:

Secure MCP Filesystem Server running on stdio                                                                           
Allowed directories: [ 'e:\\temp' ]    

How to configure windows filesystem?

@ChanMeng666
Copy link

Solution for MCP Servers Connection Issues with NVM/NPM

Background

This solution is inspired by and builds upon the workaround discussed in Issue #64. While the original solution was for macOS, this implementation is specifically for Windows systems using NVM (Node Version Manager).

Problem

When using NVM or standard Node.js installation, the default configuration using npx commands fails to connect MCP servers in Claude Desktop.

Solution Overview

The solution involves:

  1. Installing MCP server packages globally instead of using npx
  2. Using absolute paths to both the Node executable and server scripts
  3. Modifying the configuration file to use these absolute paths

Step-by-Step Guide

1. Locate Node.js and npm paths

Open Command Prompt (CMD) as administrator and run:

where node

This will show your Node.js executable path. Example output:

D:\Program\nvm\node.exe

Then find your global npm packages location:

npm root -g

Example output:

D:\Program\nvm\node_modules

2. Install Required Packages Globally

Run these commands in CMD:

npm install -g @modelcontextprotocol/server-filesystem
npm install -g @modelcontextprotocol/server-github
npm install -g @modelcontextprotocol/server-memory
npm install -g @modelcontextprotocol/server-puppeteer
npm install -g @modelcontextprotocol/server-brave-search
npm install -g @modelcontextprotocol/server-google-maps
npm install -g @modelcontextprotocol/server-postgres

3. Verify Installations

Check each package installation:

npm list -g @modelcontextprotocol/server-filesystem
npm list -g @modelcontextprotocol/server-github
npm list -g @modelcontextprotocol/server-memory
npm list -g @modelcontextprotocol/server-puppeteer
npm list -g @modelcontextprotocol/server-brave-search
npm list -g @modelcontextprotocol/server-google-maps
npm list -g @modelcontextprotocol/server-postgres

Expected output format:

D:\Program\nvm -> .\
`-- @modelcontextprotocol/server-[package-name]@0.5.1

4. Update Configuration File

Modify your claude_desktop_config.json with the following content (adjust paths according to your system):

{
  "mcpServers": {
    "sqlite": {
      "command": "uvx",
      "args": [
        "mcp-server-sqlite",
        "--db-path",
        "D:\\github_repository\\test.db"
      ]
    },
    "filesystem": {
      "command": "D:\\Program\\nvm\\node.exe",
      "args": [
        "D:\\Program\\nvm\\node_modules\\@modelcontextprotocol\\server-filesystem\\dist\\index.js",
        "D:\\github_repository",
        "D:\\github_repository\\image-generator"
      ]
    },
    "github": {
      "command": "D:\\Program\\nvm\\node.exe",
      "args": [
        "D:\\Program\\nvm\\node_modules\\@modelcontextprotocol\\server-github\\dist\\index.js"
      ],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": ""
      }
    },
    "postgres": {
      "command": "D:\\Program\\nvm\\node.exe",
      "args": [
        "D:\\Program\\nvm\\node_modules\\@modelcontextprotocol\\server-postgres\\dist\\index.js",
        "postgresql://localhost/mydb"
      ]
    },
    "memory": {
      "command": "D:\\Program\\nvm\\node.exe",
      "args": [
        "D:\\Program\\nvm\\node_modules\\@modelcontextprotocol\\server-memory\\dist\\index.js"
      ]
    },
    "puppeteer": {
      "command": "D:\\Program\\nvm\\node.exe",
      "args": [
        "D:\\Program\\nvm\\node_modules\\@modelcontextprotocol\\server-puppeteer\\dist\\index.js"
      ]
    },
    "brave-search": {
      "command": "D:\\Program\\nvm\\node.exe",
      "args": [
        "D:\\Program\\nvm\\node_modules\\@modelcontextprotocol\\server-brave-search\\dist\\index.js"
      ],
      "env": {
        "BRAVE_API_KEY": ""
      }
    },
    "google-maps": {
      "command": "D:\\Program\\nvm\\node.exe",
      "args": [
        "D:\\Program\\nvm\\node_modules\\@modelcontextprotocol\\server-google-maps\\dist\\index.js"
      ],
      "env": {
        "GOOGLE_MAPS_API_KEY": ""
      }
    },
    "fetch": {
      "command": "uvx",
      "args": [
        "mcp-server-fetch"
      ]
    }
  },
  "globalShortcut": "Ctrl+Q"
}

5. Important Notes

  1. Replace all path references with your actual Node.js and npm paths
  2. Use double backslashes (\\) in all Windows paths
  3. Keep uvx commands unchanged
  4. Make sure to add your API keys in the corresponding env sections if needed

6. Apply Changes

  1. Save the modified configuration file
  2. Close Claude Desktop completely
  3. Restart Claude Desktop as administrator

Verification

After restart, all MCP servers should connect successfully. The uvx-based servers will continue to work as before, and the npm-based servers should now connect properly with the new configuration.

Troubleshooting

If you encounter issues:

  1. Verify all paths exist using dir command
  2. Check global package installations using npm list -g
  3. Ensure Claude Desktop is running with administrator privileges
  4. Double-check all backslashes in paths

This solution has been tested on Windows 11 (Build 22631.4460) with Node.js managed by NVM.

@TristanLib
Copy link
Author

It works, good job! Thx!

@RamK777-stack
Copy link

RamK777-stack commented Dec 1, 2024

@TristanLib
I done all the configs
MCP only works with 3.5 sonnet? currently I am free version. its always using haiku model by default and mcp is not working!
image

@heerthiraja
Copy link

@RamK777-stack Same for me too

@TristanLib
Copy link
Author

@TristanLib I done all the configs MCP only works with 3.5 sonnet? currently I am free version. its always using haiku model by default and mcp is not working! image

image
image

I am a user who subscribes to Pro, and I don't know what the free version supports. I took a screenshot of my interface, and you can see that I can switch to the haiku model. Before talking to Claude, you can see the red box on the right, where all the supported MCP functions are. If you can see these, it should be normal.

@AutomatedMarketer
Copy link

worked!!!

@tagoraiinc
Copy link

Hi All, all the mcp tools seem to be working fine on windows but i am having issues with the mcp gdrive server:

this is my set up"
"gdrive": {
"command": "C:\Program Files\nodejs\node.exe",
"args": [
"C:\Users\shont\AppData\Roaming\npm\node_modules\@modelcontextprotocol\server-gdrive\dist\index.js"
]
}

Error: Cannot find module 'C:\C:\Users\shont\AppData\Roaming\npm\node_modules\gcp-oauth.keys.json'

Require stack:

  • C:\Users\shont\AppData\Roaming\npm\node_modules@modelcontextprotocol\server-gdrive\node_modules@google-cloud\local-auth\build\src\index.js
    at Function._resolveFilename (node:internal/modules/cjs/loader:1239:15)
    at Function._load (node:internal/modules/cjs/loader:1064:27)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:218:24)
    at Module.require (node:internal/modules/cjs/loader:1325:12)
    at require (node:internal/modules/helpers:136:16)
    at authenticate (C:\Users\shont\AppData\Roaming\npm\node_modules@modelcontextprotocol\server-gdrive\node_modules@google-cloud\local-auth\build\src\index.js:49:21)
    at authenticateAndSaveCredentials (file:///C:/Users/shont/AppData/Roaming/npm/node_modules/@modelcontextprotocol/server-gdrive/dist/index.js:150:24)
    at file:///C:/Users/shont/AppData/Roaming/npm/node_modules/@modelcontextprotocol/server-gdrive/dist/index.js:171:5
    at ModuleJob.run (node:internal/modules/esm/module_job:271:25) {
    code: 'MODULE_NOT_FOUND',
    requireStack: [
    'C:\Users\shont\AppData\Roaming\npm\node_modules\@modelcontextprotocol\server-gdrive\node_modules\@Google-Cloud\local-auth\build\src\index.js'
    ]
    }
    (node:22640) [DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead.
    (Use node --trace-deprecation ... to show where the warning was created)

this is the error i get when i try to auth.

help/advice on fixing, please?

@jspahrsummers
Copy link
Member

@tagoraiinc Please open a new issue and we can debug.

@RamK777-stack
Copy link

@tagoraiinc Are you using paid version or free?

@jspahrsummers
Copy link
Member

@RamK777-stack That's not relevant.

@TristanLib
Copy link
Author

I think you should use double '\' base on the example

this is my set up" "gdrive": { "command": "C:\Program Files\nodejs\node.exe", "args": [ "C:\Users\shont\AppData\Roaming\npm\node_modules@modelcontextprotocol\server-gdrive\dist\index.js" ] }

@mehmetaliuluc
Copy link

mehmetaliuluc commented Dec 7, 2024

Uploading SNAG-0025.jpg…
I am using the pro version and I could not run the file system even though I did what you wrote. when I asked the claude, it gave the result as follows, but it was still not successful. am I wasting my time dealing with this?

{
"mcpServers": {
"filesystem": {
"command": "C:\Program Files\nodejs\node.exe",
"args": {
"mcpServers": {
"filesystem": {
"command": "C:\Program Files\nodejs\node.exe",
"args": [
"C:\Users\mehme\AppData\Roaming\npm\node_modules\@modelcontextprotocol\server-filesystem\dist\index.js",
"--allow-write",
"--allow-read",
"--allow-delete",
"--allow-create",
"C:\cloude"
],
"permissions": {
"write": true,
"read": true,
"delete": true,
"create": true,
"list": true
}

@ChrisTorng
Copy link

I've success using filesystem on free account.
I can use 3.5 Sonnet. Maybe Claude is having issues at that time (that restricts free users to use 3.5 Sonnet).

globalShortcut is not working for me.
Remember to enable Developer mode in ≡ - Help - Enable Developer mode.
After restart, you'll see ≡ - Developer - Open MCP Log File...

Run as Administrator seems not necessary?
If not working, Run as Administrator doesn't resolve. Reinstall Claude Desktop resolved.
For my testing, every changes in the json needs to reinstall to make it update.

@CinderZhang
Copy link

{
"mcpServers": {
"brave-search": {
"command": "C:\Users\username\AppData\Roaming\npm\mcp-server-brave-search.cmd",
"args": [],
"env": {
"BRAVE_API_KEY": "brave-api-key"
}
}
},
"globalShortcut": "Ctrl+Q"
}

I went through quite a bit of troubleshooting and came out with this solution. I just directly point the server to the CMD file, which can be found in the npm folder.

Here is the ...\npm folder content:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants