Skip to content

Path duplication bug: Drive letter doubled (C:\C:) when saving Google Drive credentials on Windows #699

@musoukun

Description

@musoukun

Describe the bug
Path duplication bug in Google Drive MCP server causing authentication failure. The credential file path is incorrectly constructed with a duplicated drive letter (C:\C:) on Windows systems, preventing proper authentication.

To Reproduce
Steps to reproduce the behavior:

  1. Set up Google Drive MCP server on Windows
  2. Run the authentication flow using node ./dist auth
  3. Complete the OAuth process in browser
  4. Attempt to use the server with Claude desktop app

Expected behavior
The credential file should be saved with the correct path structure (C:\Users...) and the server should properly authenticate with Google Drive.

Logs

Error: ENOENT: no such file or directory, open 'C:\C:\Users\w\npm-cache\_npx\901beb8b1a496dd2\node_modules\.gdrive-server-credentials.json'
    at Object.writeFileSync (node:fs:2426:20)
    at authenticateAndSaveCredentials (file:///C:/Users/w/npm-cache/_npx/901beb8b1a496dd2/node_modules/@modelcontextprotocol/server-gdrive/dist/index.js:154:8)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5) {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'open',
  path: 'C:\\C:\\Users\\w\\npm-cache\\_npx\\901beb8b1a496dd2\\node_modules\\.gdrive-server-credentials.json'
}

Additional context
The issue appears to be in the path handling code when constructing credential paths. The problem specifically occurs in the authenticateAndSaveCredentials function when using fileURLToPath and path.join together on Windows systems. The code is using path manipulations that seem to be causing drive letter duplication (C:\C:) in the final path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions