Skip to main content

keep-mcp

MCP server for Google Keep

See CONTRIBUTING.md for contribution guidelines and required visual evidence.

keep-mcp

How to use

  1. Add the MCP server to your MCP servers:
  "mcpServers": {
    "keep-mcp-pipx": {
      "command": "pipx",
      "args": [
        "run",
        "keep-mcp"
      ],
      "env": {
        "GOOGLE_EMAIL": "Your Google Email",
        "GOOGLE_MASTER_TOKEN": "Your Google Master Token - see README.md"
      }
    }
  }

Or with uvx:

  "mcpServers": {
    "keep-mcp": {
      "command": "uvx",
      "args": [
        "keep-mcp"
      ],
      "env": {
        "GOOGLE_EMAIL": "Your Google Email",
        "GOOGLE_MASTER_TOKEN": "Your Google Master Token - see README.md"
      }
    }
  }
  1. Add your credentials:
  • GOOGLE_EMAIL: Your Google account email address
  • GOOGLE_MASTER_TOKEN: Your Google account master token

Obtain a Google master token

keep-mcp uses gkeepapi, which connects to Google Keep through an unofficial private API. A Google master token has full access to your account. Treat it like a password and never commit or share it.

You need Docker and a desktop browser.

  1. Open https://accounts.google.com/EmbeddedSetup and sign in with the Google account you use for Keep.

  2. Click I agree. The page may keep loading forever. Leave it open and continue.

  3. Copy the oauth_token cookie:

    • Chrome or Edge: Press F12, open the Application tab, then Cookies → https://accounts.google.com.
    • Firefox: Press F12, open the Storage tab, then Cookies → https://accounts.google.com.

    Find the row named oauth_token and copy its value. It starts with oauth2_4/.

  4. Right away, run this in a terminal and paste your email and the cookie value when asked:

    docker run --rm -it ghcr.io/astral-sh/uv:python3.13-bookworm-slim uv run --no-project --with gpsoauth python -c "import gpsoauth; r = gpsoauth.exchange_token(input('Email: '), input('oauth_token: '), '0123456789abcdef'); print(r.get('Token', r))"
    

    Without Docker, install uv and run the same command without the docker run --rm -it ghcr.io/astral-sh/uv:python3.13-bookworm-slim part.

  5. The command prints your master token. It starts with aas_et/. Use it as GOOGLE_MASTER_TOKEN.

If it prints an error such as BadAuthentication instead, the cookie has expired. Repeat steps 1 to 4 to get a fresh one.

More details

Older instructions may ask for your Google password or an app password and call perform_master_login(). That flow is unreliable and can return BadAuthentication. Use the browser-assisted flow above instead.

Features

Query and read tools

  • find: Search notes (case-insensitive by default) with optional filters for labels, colors, pinned, archived, trashed, creation/update date ranges (ISO 8601, UTC), and a result limit (default 50)
  • get_note: Get a single note by ID

Creation and update tools

  • create_note: Create a new note with title and text (automatically adds keep-mcp label)
  • create_list: Create a checklist note
  • update_note: Update a note's title and text
  • add_list_item: Add an item to a checklist note
  • update_list_item: Update checklist item text and checked state
  • delete_list_item: Delete a checklist item
  • move_list_item: Move an item to a zero-based final position
  • reorder_list_items: Bulk reorder a checklist using all its item IDs
  • replace_list_items: Replace the entire checklist, creating new item IDs

Checklist ordering and replacement

Get the current item IDs and order with get_note. move_list_item takes note_id, item_id, and position: 0 means first, and the last valid position is the item count minus one. The position is the item's final index after moving.

For bulk ordering, call reorder_list_items with note_id and item_ids in the desired first-to-last order. Supply every current item ID exactly once, including checked items. Missing, duplicate, unknown, foreign, or deleted IDs are rejected before mutation. Ordering preserves item IDs, text and checked states. Positions refer to the combined order returned by get_note; Keep may display checked items in a separate section according to its settings.

Example tool arguments (substitute IDs returned by get_note):

{"note_id":"NOTE_ID","item_id":"THIRD_ITEM_ID","position":0}
{"note_id":"NOTE_ID","item_ids":["THIRD_ITEM_ID","FIRST_ITEM_ID","SECOND_ITEM_ID"]}

replace_list_items takes note_id and an items array. Each item requires text; checked is optional and defaults to false. Only these two item fields are accepted. The full payload is validated before any item is changed. All old items are marked for deletion and new items are created in input order with new IDs. The note itself, title, labels, collaborators and other note metadata remain. Passing items: [] clears the checklist; an empty bulk order is valid only for an already empty checklist.

{"note_id":"NOTE_ID","items":[{"text":"Milk","checked":false},{"text":"Bread","checked":true}]}

All three tools currently require flat checklists: an existing checklist with indented items is rejected without changes, so hierarchy cannot be silently lost. They are annotated as destructive because ordering overwrites the existing order and replacement deletes the old items. They use the same keep-mcp label / UNSAFE_MODE restriction as other modification tools. They refresh through the shared client, then sync once after mutation. Moving an item to its current position or supplying the current bulk order leaves the items untouched and skips the post-mutation sync. This is not a server-side atomic transaction: a network failure can leave the remote outcome uncertain. Read the note again before retrying, particularly after replacement. Concurrent external edits can also affect the final order.

Note state tools

  • set_note_color: Set a note color (valid values: DEFAULT, RED, ORANGE, YELLOW, GREEN, TEAL, BLUE, CERULEAN, PURPLE, PINK, BROWN, GRAY)
  • pin_note: Pin or unpin a note
  • archive_note: Archive or unarchive a note
  • trash_note: Move a note to trash
  • restore_note: Restore a trashed/deleted note
  • delete_note: Mark a note for deletion

Labels, collaborators, and media tools

  • list_labels: List labels
  • create_label: Create a label
  • delete_label: Delete a label
  • add_label_to_note: Add a label to a note
  • remove_label_from_note: Remove a label from a note
  • list_note_collaborators: List collaborator emails for a note
  • add_note_collaborator: Add a collaborator email to a note
  • remove_note_collaborator: Remove a collaborator email from a note
  • list_note_media: List media blobs for a note (with media links)
  • download_media: Download a note's media (images, drawings, audio) to a local directory through the authenticated session (the raw media links answer 403 to plain HTTP clients). Not available over Streamable HTTP, where the files would land on the server

By default, all destructive and modification operations are restricted to notes that have were created by the MCP server (i.e. have the keep-mcp label). Set UNSAFE_MODE to true to bypass this restriction.

"env": {
  ...
  "UNSAFE_MODE": "true"
}

Local development (uv + make)

If you prefer a JS-style workflow (npm i, npm start), use the included Makefile:

make install   # like npm i
make start     # like npm start
make test
make lint

Run the real-account smoke test with credentials:

GOOGLE_EMAIL="you@example.com" \
GOOGLE_MASTER_TOKEN="..." \
make smoke

Equivalent direct uv commands (without make):

UV_CACHE_DIR=/tmp/uv-cache uv venv --python 3.11 .venv
UV_CACHE_DIR=/tmp/uv-cache uv pip install --python .venv/bin/python -e .
UV_CACHE_DIR=/tmp/uv-cache uv run --no-sync --python .venv/bin/python -m server

Testing

Unit tests (default)

The project includes a lightweight unit test suite under tests/.

It validates:

  • note serialization shape for note and list objects (including labels, collaborators, media, and list items)
  • modification safety behavior (keep-mcp label requirement and UNSAFE_MODE=true override)
  • MCP tool behavior in src/server/cli.py using mocked Keep client objects (tool happy paths and key error paths)

Run locally:

make test

Smoke test against a real Keep account

For additional confidence, run a basic lifecycle smoke test against a dedicated test account:

GOOGLE_EMAIL="you@example.com" \
GOOGLE_MASTER_TOKEN="..." \
make smoke

What it does:

  • create note
  • update note
  • pin/unpin
  • archive/unarchive
  • trash/restore
  • delete

This script is intended for manual verification and is not run in CI.

CI checks

GitHub Actions runs on every pull request and executes:

  • lint (ruff check .)
  • unit tests with coverage (pytest -q --cov=src/server --cov-report=term-missing --cov-fail-under=70)
  • bytecode sanity (python -m compileall src)

Publishing

Automatic publish on merge to main (GitHub Actions)

This repo includes a release workflow at .github/workflows/release.yml that runs on every push to main (including merged PRs).

It will:

  • inspect commits since the last release tag (vX.Y.Z)
  • compute the next semantic version from Conventional Commit types
  • skip publishing when there are no releasable commit types
  • run lint and unit tests
  • build dist/*
  • publish to PyPI
  • create a GitHub release/tag v<computed-version> with generated notes

Version bump rules:

  • major: commit subject with ! (example: feat!: or fix(api)!:) or commit body containing BREAKING CHANGE
  • minor: feat:
  • patch: fix:, perf:, revert:
  • no release: docs:, chore:, ci:, test:, refactor: (unless the commit is marked as breaking)

Required repository secret:

  • PYPI_API_TOKEN: a PyPI API token (recommended scope: this project only)

Manual publish

To publish manually to PyPI:

  1. Update the version in pyproject.toml
  2. Build the package:
    pipx run build
    
  3. Upload to PyPI:
    pipx run twine upload --repository pypi dist/*
    

Run locally with MCP clients

This is useful when you want a client to run this server from your local checkout instead of PyPI.

  1. Create a local virtualenv and install in editable mode:
cd /ABSOLUTE/PATH/TO/keep-mcp
make install
  1. Add the server to your MCP client config.

config.toml clients (Codex, Goose, etc.)

[mcp_servers.keep_mcp]
command = "make"
args = ["-C", "/ABSOLUTE/PATH/TO/keep-mcp", "start"]

[mcp_servers.keep_mcp.env]
GOOGLE_EMAIL = "you@example.com"
GOOGLE_MASTER_TOKEN = "your-master-token"
UNSAFE_MODE = "false"

JSON mcpServers clients (Claude Desktop, Cursor, Cline, etc.)

{
  "mcpServers": {
    "keep-mcp-local": {
      "command": "make",
      "args": ["-C", "/ABSOLUTE/PATH/TO/keep-mcp", "start"],
      "env": {
        "GOOGLE_EMAIL": "you@example.com",
        "GOOGLE_MASTER_TOKEN": "your-master-token",
        "UNSAFE_MODE": "false"
      }
    }
  }
}

Alternative (without make):

[mcp_servers.keep_mcp]
command = "uv"
args = [
  "--directory", "/ABSOLUTE/PATH/TO/keep-mcp",
  "run", "--no-sync", "--python", ".venv/bin/python",
  "-m", "server"
]

Notes:

  • Run make install once before starting from an MCP client.
  • Only the repo root path is required (no absolute /.venv/bin/python path).
  • Ensure make and uv are in your PATH.
  • Restart your MCP client after updating config files.
  • UNSAFE_MODE is optional; keep it "false" unless you explicitly want to modify non-keep-mcp notes.

Running over Streamable HTTP

keep-mcp supports the MCP Streamable HTTP transport (/mcp endpoint) in addition to the default stdio transport:

# Start Streamable HTTP server on localhost (default: 127.0.0.1:8000)
keep-mcp --transport streamable-http

# Customize host or port
keep-mcp --transport streamable-http --host 127.0.0.1 --port 8000

Running in Docker

A Dockerfile is provided for running keep-mcp as a containerized Streamable HTTP server listening on port 8000.

  1. Build the container image:

    docker build -t keep-mcp .
    
  2. Run the container:

    docker run -d \
      -e GOOGLE_EMAIL="you@example.com" \
      -e GOOGLE_MASTER_TOKEN="aas_et/..." \
      -p 127.0.0.1:8000:8000 \
      keep-mcp
    

Troubleshooting

Metadata

Release files for keep-mcp 2.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for keep-mcp 2.7.0
File Size Uploaded Provenance Actions
keep_mcp-2.7.0.tar.gz 33.8 kB Without provenance Details for keep_mcp-2.7.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for keep-mcp 2.7.0
File Interpreter ABI Platform Actions
keep_mcp-2.7.0-py3-none-any.whl Python 3 none any Details for keep_mcp-2.7.0-py3-none-any.whl

Total release size: 50.1 kB

Release files / keep_mcp-2.7.0.tar.gz

Download URL keep_mcp-2.7.0.tar.gz
Size 33.8 kB
Tags Source
SHA-256 checksum
How to use checksums
1de8b19a0a6b358eaa30c0912b9176979c5ef6c131d79ec5099be0fac3b54c3e
BLAKE2b-256 checksum
How to use checksums
3d5204a810ae465e29c0cc8b70b79dfa41e2159f2131ff335698cb5d49746be8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / keep_mcp-2.7.0-py3-none-any.whl

Download URL keep_mcp-2.7.0-py3-none-any.whl
Size 16.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d638c1513e9a1c29325eabd31ee92088441afe1312e416919d7b486930ceb566
BLAKE2b-256 checksum
How to use checksums
c128f50c334262deffe9c702bff22c3a655595a6a0e6c79deb11722efe5b728b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for keep-mcp 2.7.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page