Part A (Steps 1-4): protect your setup · Part B (Steps 5-11): publish safely
Where secrets live
Part A · Protect your setup
1Know what each secret is
| File / value | Contains | If leaked |
|---|---|---|
credentials.json |
OAuth client ID + secret | Low alone, but rotate it |
token.json |
Access + refresh token for your Google account | High: read/write to your Drive and Sheets until revoked |
| Sheet ID | Identifies your sheet | Low if the sheet is private, exposes data if link-shared |
~/.claude/settings.json |
Permissions, hooks, local paths | Reveals username and setup |
~/.claude/CLAUDE.md |
Sheet ID, tab names, categories, names of people | Personal/organizational details |
~/.ssh/authorized_keys |
Public keys allowed into your Mac | Low, but don't publish |
Anthropic API keys (sk-ant-...) |
Billing access | High: revoke immediately |
Rule: none of these ever go into a repository, screenshot, or chat.
2Lock down local files
chmod 700 ~/.config/mcp-credentials ~/.ssh
chmod 600 ~/.config/mcp-credentials/*.json ~/.ssh/authorized_keys
3Least privilege for Claude
- Allow the Sheets server, but deny destructive tools:
json "deny": ["mcp__google-sheets__delete_sheet", "mcp__google-sheets__clear_sheet"] - Put hard rules in
CLAUDE.md: never write to formula columns, never delete rows unless you say "delete", never touch archive tabs. - For risky edits, use interactive
claude(you approve each call) instead of-p. - Avoid
--dangerously-skip-permissionsexcept in throwaway sandboxes.
4Know how to revoke access
- Google token: https://myaccount.google.com/permissions → remove the app → delete
token.json. - OAuth client: Google Cloud → Credentials → delete the client, create a new one, redo Guide 2.
- Lost phone: remove its key line from
~/.ssh/authorized_keys; remove the device in Tailscale admin.
Note: data sent to Anthropic
When Claude reads your sheet, the returned cell data is sent to Anthropic's API to produce the answer. Your Google credentials are not. Don't use this setup on sheets holding data you're not allowed to share with a third-party service. See https://www.anthropic.com/privacy.
Part B · Publish safely
5Repo layout
google-sheets-mcp-guide/
├── README.md
├── LICENSE
├── .gitignore
├── docs/
├── templates/
└── iphone-integrations/
Keep real configs out of the repo. The repo holds templates/*.example with placeholders only.
6.gitignore
The repo ships one. Core lines:
mcp-credentials/
credentials.json
token.json
*client_secret*.json
*.env
.claude/
.claude.json
CLAUDE.md
!templates/CLAUDE.md.example
claude_desktop_config.json
.DS_Store
*.bak
*.backup
7Scrub before every push
# Your username in paths
grep -rnE "/Users/[a-z0-9._-]+" --include=*.md . | grep -v YOUR_USERNAME
# Real Google Sheet IDs (long IDs starting with 1)
grep -rnE "\b1[A-Za-z0-9_-]{40,}\b" .
# Emails
grep -rnE "[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[a-z]{2,}" . | grep -v example.com
# OAuth client IDs, secrets, API keys, tokens
grep -rnE "apps\.googleusercontent\.com|GOCSPX-|sk-ant-|ghp_|ya29\." . | grep -v XXXX
# Your own names, IDs, org/school names (edit this list)
grep -rniE "yourname|your-student-id|your-org" .
Every hit should be a placeholder. If not, replace it:
| Real value | Placeholder |
|---|---|
/Users/<you> |
/Users/YOUR_USERNAME or $HOME |
| Sheet ID | your_sheet_id_here |
[email protected] |
|
| Names of people | [Name] or remove |
| Org/school | [Your Org] or remove |
8Check what's staged
git add .
git status
Only .md, .example, .sh, .gitignore, LICENSE should appear. Anything .json outside templates/ → stop.
9Pre-commit guard
cat > .git/hooks/pre-commit << 'EOF'
#!/bin/bash
patterns='client_secret|GOCSPX-|sk-ant-|ghp_|ya29\.|"refresh_token"'
if git diff --cached | grep -iE "$patterns" >/dev/null; then
echo "❌ Blocked: possible secret in staged changes. Review: git diff --cached"
exit 1
fi
EOF
chmod +x .git/hooks/pre-commit
Add your own name, username and sheet ID to patterns too.
10Push
gh repo create google-sheets-mcp-guide --public \
--description "Talk to Google Sheets in plain English with Claude Code + MCP, from Mac or iPhone" \
--source=. --remote=origin --push
Topics: mcp model-context-protocol claude-code anthropic google-sheets oauth macos ios termius tailscale automation
11Review on GitHub, and if something leaked
Open the repo in a private browser window and read every file. If anything private is there, a new commit doesn't remove it from history:
1. Rotate first: revoke tokens/keys, delete the OAuth client.
2. Rewrite history:
bash
brew install git-filter-repo
git filter-repo --path path/to/file --invert-paths
git push --force
3. Assume anything public was copied. Rotation is what actually protects you.
Screenshots
Crop out: terminal prompts with your username/hostname, sheet URLs, names of people, email addresses, status bars. Terminal history in screenshots is the most common leak.
Questions or corrections: [email protected]