⏱️ 10 minutes · Output: claude mcp list shows ✔ Connected, and short questions like "whats due this week" just work.
Claude Code vs Claude Desktop: these are different apps with different config files. This guide is for Claude Code (the claude CLI and its app). Don't edit claude_desktop_config.json for this setup.
1Install and log in
npm install -g @anthropic-ai/claude-code
claude --version
Log in once. /login works inside an interactive session, not as a shell argument:
claude # opens the interactive session
/login # type this at the Claude prompt, finish in the browser
/exit # back to your shell
Test:
claude -p "say hi"; echo "exit code: $?"
✅ A greeting and exit code: 0. If you see Not logged in, repeat the three steps above.
2Register the MCP server
Use full paths for everything. Claude may be launched from contexts (like SSH) with a different PATH.
claude mcp add google-sheets \
--scope user \
--env CREDENTIALS_PATH=$HOME/.config/mcp-credentials/credentials.json \
--env TOKEN_PATH=$HOME/.config/mcp-credentials/token.json \
-- $HOME/.local/bin/uvx --with 'mcp<2' mcp-google-sheets
--scope user: available in every folder and project.- Everything after
--is the command that starts the server.
Check the confirmation line ends exactly in mcp-google-sheets to user config. Anything extra after the package name (a stray ¬, a space) breaks it.
claude mcp list | grep google-sheets
✅ google-sheets: ... - ✔ Connected
Useful commands:
claude mcp get google-sheets # show config
claude mcp remove google-sheets -s user # remove (then re-add)
3Permissions (required for claude -p)
claude -p runs non-interactively, so it can't ask you to approve a tool call. Unapproved tools are simply refused. Pre-approve the Sheets server in ~/.claude/settings.json.
If the file already exists, merge. Don't overwrite it. It may hold your model, theme and hooks.
cp ~/.claude/settings.json ~/.claude/settings.json.bak 2>/dev/null
nano ~/.claude/settings.json
Add (or replace) the permissions key:
"permissions": {
"allow": [
"mcp__google-sheets"
],
"deny": [
"mcp__google-sheets__delete_sheet",
"mcp__google-sheets__clear_sheet"
]
}
mcp__google-sheetsapproves every tool from that server (read and write).denyblocks destructive tools even if something else would allow them.
Validate:
python3 -m json.tool ~/.claude/settings.json > /dev/null && echo "JSON OK"
grep -A10 '"permissions"' ~/.claude/settings.json
Use grep or tail to check. head only shows the top of the file and makes it look like your block is missing.
Prefer read-only? Allow only read tools and do edits in interactive claude, where you approve each write:
"allow": ["mcp__google-sheets__get_sheet_data", "mcp__google-sheets__list_sheets"]
To see exact tool names: run claude, type /mcp, select google-sheets.
Full example: templates/settings.json.example
4Sheet context (~/.claude/CLAUDE.md)
Claude Code loads ~/.claude/CLAUDE.md into every session, in every folder, including claude -p. Put your sheet's details here once and questions like "how many subjects" or "whats due this week" work without naming the sheet.
Get your sheet ID from its URL:
https://docs.google.com/spreadsheets/d/<THIS_PART_IS_THE_ID>/edit
Create the file (edit the placeholders):
mkdir -p ~/.claude
cp templates/CLAUDE.md.example ~/.claude/CLAUDE.md
nano ~/.claude/CLAUDE.md
What to fill in:
| Section | Put |
|---|---|
| Trigger words | Words that mean "use my sheet": tracker, deadline, quiz, due, subject... |
| Sheet | Spreadsheet ID and exact tab names (copy emojis too, e.g. 🎨 Color Legend) |
| Categories | Your subjects/projects, spelled exactly like the sheet |
| Layout | Header row number, first data row, what each column holds |
| Rules | Time zone, defaults for new rows, never-touch columns, answer style |
Template: templates/CLAUDE.md.example
Tips: - Keep it short and specific. Concise rules are followed more reliably than long essays. - Add "Never mention unconnected connectors" if Claude keeps listing Slack/Notion/etc. - Tell it "If this file and the sheet disagree, trust the sheet" so updates in the sheet win. - When your term or project changes, you only edit this one file.
Check it's loaded: run claude, type /memory.
5Verify end to end
claude -p --output-format json "how many rows are in my tracker" | python3 -m json.tool
Check these fields:
| Field | Healthy value |
|---|---|
is_error |
false |
num_turns |
2 or more (it called a Sheets tool) |
permission_denials |
[] |
result |
Your answer |
num_turns: 1 means no tool was called. Check context (Step 4) and permissions (Step 3).
Step 6 (optional): Tidy up
Hide unused plugin connectors (Slack, Notion, Asana, ...) that clutter answers and slow startup:
claude plugin disable productivity # or: claude → /plugin → disable
Faster answers for quick lookups: use a lighter model in your shortcut (Guide 4):
claude -p --model sonnet "..."
➡️ Next: 4. Daily commands
Questions or corrections: [email protected]