samayly.com is live. Hosted plans open soon. Join the waitlist →
Guide 025 min5 min read

2. Local MCP Server

Install uv, store your credentials where every session (including SSH) can read them, and complete the one-time Google login.

⏱️ 5 minutes · Output: credentials.json + token.json in ~/.config/mcp-credentials/


1Install uv

uv runs Python packages in throwaway environments, like npx for Python.

bash
curl -LsSf https://astral.sh/uv/install.sh | sh
source ~/.zshrc
uv --version
which uvx          # note this path, usually ~/.local/bin/uvx

If uv: command not found:

bash
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

2Store credentials in ~/.config, not Desktop

⚠️ Do not keep credentials on ~/Desktop or ~/Documents. macOS privacy protection blocks SSH sessions from reading those folders. Everything works on the Mac, then fails from your iPhone with Connection closed. ~/.config is not protected.

bash
mkdir -p ~/.config/mcp-credentials
mv ~/Downloads/client_secret_*.json ~/.config/mcp-credentials/credentials.json
chmod 700 ~/.config/mcp-credentials
chmod 600 ~/.config/mcp-credentials/credentials.json
ls -la ~/.config/mcp-credentials/

✅ You see credentials.json, owned by you, mode -rw-------.


3First OAuth login

Use Chrome or Firefox as your default browser for this step. Safari's HTTPS-Only mode blocks the http://localhost callback. (System Settings → Desktop & Dock → Default web browser.)

Run as one command:

bash
CREDENTIALS_PATH=$HOME/.config/mcp-credentials/credentials.json \
TOKEN_PATH=$HOME/.config/mcp-credentials/token.json \
$HOME/.local/bin/uvx --with 'mcp<2' mcp-google-sheets

Why --with 'mcp<2'? mcp-google-sheets was written for the mcp 1.x library. The 2.x release renamed FastMCP, which crashes the server with ModuleNotFoundError. Pinning below 2 fixes it.

What happens:

GoogleBrowserMCP serverTerminalGoogleBrowserMCP serverTerminalAdvanced → Go to Sheets MCP → Allowstart (reads CREDENTIALS_PATH)1open consent URL2sign in3"Google hasn't verified this app"4redirect to http://localhost:PORT/?code=...5deliver code6exchange code for tokens7save token.json8"Successfully authenticated"9
  1. The browser opens. Sign in with the account from Guide 1.
  2. "Google hasn't verified this app" is expected: you are the developer. Click Advanced → Go to Sheets MCP (unsafe) → Allow.
  3. Browser: "The authentication flow has completed."
  4. Terminal: Successfully authenticated using OAuth flow, then it waits. That's correct (it's waiting for an MCP client).
  5. Press Ctrl+C.

Verify:

bash
ls -la ~/.config/mcp-credentials/
chmod 600 ~/.config/mcp-credentials/token.json

✅ Both credentials.json and token.json exist.


Common mistakes in this step

Mistake Symptom Fix
Split env vars over separate lines without \ No such file or directory: 'credentials.json' Run as one command, or export the vars first
Safari as default browser "Safari Can't Open the Page" at localhost:xxxxx Switch default to Chrome, rm token.json, rerun
Missing --with 'mcp<2' No module named 'mcp.server.fastmcp' Add the pin
Stray character after the package name Server exits instantly Retype; check with cat -v (see Troubleshooting)

➡️ Next: 3. Claude Code setup

Questions or corrections: [email protected]