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

8. Security and Publishing

What must stay private, how to lock things down, and how to publish your own version of this guide without leaking anything.

Part A (Steps 1-4): protect your setup · Part B (Steps 5-11): publish safely


Where secrets live

📘 Public repo

💻 Your Mac only (never in a repo)

❌ never (copy as .example)

❌ never

❌ never

~/.config/mcp-credentials/
credentials.json · token.json

~/.claude/
CLAUDE.md · settings.json

~/.ssh/authorized_keys

docs/*.md

templates/*.example
(placeholders only)

.gitignore · LICENSE


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

bash
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-permissions except 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

No

Yes

Leak found

Step 5
Layout

Step 6
.gitignore

Step 7
Scrub

Step 8
git status clean?

Step 9
Pre-commit guard

Step 10
Push

Step 11
Review on GitHub

Rotate secrets
+ rewrite history

5Repo layout

code
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:

gitignore
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

bash
# 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 [email protected]
Names of people [Name] or remove
Org/school [Your Org] or remove

8Check what's staged

bash
git add .
git status

Only .md, .example, .sh, .gitignore, LICENSE should appear. Anything .json outside templates/ → stop.

9Pre-commit guard

bash
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

bash
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]