Skip to content

Feedback & Suggestions for Improving Windows + WSL Setup #44

@JeremyCSUMB

Description

@JeremyCSUMB

Hi there!

First off, thanks so much for creating and maintaining this project. I'm really excited to use it!

I just went through the process of setting up the server on my Windows machine using WSL to connect with Claude Desktop. I ran into a few hurdles along the way and wanted to share my troubleshooting journey and the final solution in case it's helpful for improving the documentation or the code.

My Setup

  • Host OS: Windows
  • Terminal: WSL (Ubuntu)
  • Client: Claude Desktop
  • Authentication: Service Account

Troubleshooting Journey

After following the development setup guide in the README, I encountered a series of "Server disconnected" errors. By checking the logs, I was able to work through three distinct issues:

  1. uv: command not found: Initially, it seems Claude Desktop was trying to run uv from the Windows side and couldn't find it. The first step was realizing the command needed to be executed inside WSL.
  2. Authentication Failure: My next configuration using wsl.exe still failed. The server log showed an All authentication methods failed exception. It looked like the environment variables (SERVICE_ACCOUNT_PATH, etc.) set in the env block of the config weren't making it into the WSL session.
  3. JSON Parsing Error: After fixing the environment variable issue, the server would start but then immediately disconnect. The logs showed an Unexpected token... is not valid JSON error. It turned out the server's helpful startup messages (like "Using service account authentication") were being sent to stdout and interfering with the client's communication.

What Worked for Me (The Solution!)

I was able to get a stable connection by making two key changes:

1. Updated the claude_desktop_config.json command:

I modified the command to use wsl.exe and set the environment variables directly in the bash command. This ensured the server started with the correct credentials and path.

"mcp-google-sheets-local": {
  "command": "wsl.exe",
  "args": [
    "bash",
    "-c",
    "export SERVICE_ACCOUNT_PATH='/path/to/key.json' && export DRIVE_FOLDER_ID='YOUR_ID' && /full/path/to/uv run --directory /path/to/project mcp-google-sheets"
  ],
  "env": {}
}

2. Edited server.py to redirect output:

I edited src/mcp_google_sheets/server.py to redirect all the diagnostic print() statements to sys.stderr. This kept the stdout channel clean for the client communication.

# Example Change
# Before: print("Using service account authentication")
# After:  print("Using service account authentication", file=sys.stderr)

Suggestions

It might be helpful to:

  • Add a small section to the README.md with tips for Windows + WSL users, perhaps including the working config example.
  • Consider redirecting the diagnostic print statements in server.py to stderr by default to make the server more robust out-of-the-box.

Hope this feedback is useful! Thanks again for all your work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationhelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions