-
Notifications
You must be signed in to change notification settings - Fork 157
Description
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:
uv: command not found: Initially, it seems Claude Desktop was trying to runuvfrom the Windows side and couldn't find it. The first step was realizing the command needed to be executed inside WSL.- Authentication Failure: My next configuration using
wsl.exestill failed. The server log showed anAll authentication methods failedexception. It looked like the environment variables (SERVICE_ACCOUNT_PATH, etc.) set in theenvblock of the config weren't making it into the WSL session. - 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 JSONerror. It turned out the server's helpful startup messages (like "Using service account authentication") were being sent tostdoutand 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.mdwith tips for Windows + WSL users, perhaps including the working config example. - Consider redirecting the diagnostic
printstatements inserver.pytostderrby default to make the server more robust out-of-the-box.
Hope this feedback is useful! Thanks again for all your work.