Add inline, range-anchored comments to Google Docs - the one comment op the Google APIs can't do.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
π‘ Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
Inline, range-anchored comments for Google Docs β the one comment operation the Google APIs can't do.
Quickstart Β Β·Β Scope Β Β·Β Tools Β Β·Β Configuration Β Β·Β How it works Β Β·Β Troubleshooting Β Β·Β Server deployment Β Β·Β FAQ
You're building an AI process around Google Docs β an agent that reviews drafts, audits contracts, gives editorial feedback. The natural way to deliver that feedback is how humans do it: a comment pinned to the exact sentence it's about, not a wall of text dumped at the end of the doc or into chat.
Then you hit the wall: the Google APIs can't create anchored comments. The Docs API has no comment endpoints at all, and the Drive API accepts an anchor field only to have the Docs editor ignore it β the comment shows up as a general, whole-document comment.
This MCP server closes that gap. Your agent calls add_comment with a text fragment and a comment; the server posts it through a real, logged-in Google Docs session, so it lands anchored to that exact text β just as if a human had selected it and pressed Ctrl+Alt+M:
This server does one thing: add a comment to a Google Doc. The interesting case is the anchored one β a comment pinned to a specific text range β which no Google API can do.
| Add a comment⦠| Google Docs API | Google Drive API | this server |
|---|---|---|---|
| unanchored (whole document) | β | β | β |
| anchored to a text range | β | β | β |
The Docs API has no comment endpoints at all. The Drive API's comments.create accepts an anchor field, but the Docs editor ignores it β the comment renders as an unanchored, whole-document comment. The editor's own anchor format (kix.*) is undocumented and can't be produced externally (Drive API docs, issuetracker #292610078, open since 2016). Driving the editor UI is the only way β so this server does exactly that, and nothing else. (Listing, replying, resolving, and deleting comments already work over the Drive API β use a Drive-based tool for those.)
This server is deliberately one narrow thing. Read this before wiring it in.
β It does: add comments to a Google Doc β anchored to a specific text range (the part no API can do), or unanchored on the whole document.
β It does NOT:
| You want to⦠| Use instead |
|---|---|
| Read the document's content (so an agent can decide what to comment on, or get the exact text to anchor to) | Google Docs API (documents.get) or a Docs-reading MCP |
| Export the doc (text / markdown / PDF) | Google Drive API (files.export) |
| List / reply to / resolve / delete comments | Google Drive API (comments.*) β faster, no browser |
Important: this tool never returns document content β its output is structured-only (
{ ok, anchored, occurrence_used, verified }), by design, so a malicious doc can't inject instructions into your agent. That means the agent is writing blind: to review a doc intelligently, pair this with a read capability (Docs APIdocuments.get) and feed the exact quoted text back in asfind_text. The two use different auth β this server drives a logged-in browser session (no OAuth), while the Docs/Drive APIs need an OAuth token or service account β but they can run against the same Google account.
One command β signs you in (opens a browser once), then registers the server with Claude Code:
That's it β skip to Use it below. Prefer to do it by hand, or use another client? The manual steps are below.
1. Log in once β opens a browser window; the Google session is saved to a local profile (~/.gdocs-comments-mcp/profile):
2. Add the server to your MCP client:
Other MCP clients β after login, add the config for your client:
Add to claude_desktop_config.json (Settings β Developer β Edit Config):
.mcp.json (shared with your team via git)Create .mcp.json in the project root β Claude Code, Cowork, and most MCP clients pick it up:
Note: every user of the project still runs npx gdocs-comments-mcp login once on their own machine β sessions are personal and never shared through git.
Add to .cursor/mcp.json (project) or ~/.cursor/mcp.json (global):
Add to .vscode/mcp.json:
3. Use it β ask your agent:
Add a comment to https://docs.google.com/document/d/1AbCβ¦/edit β anchor it to "quarterly numbers" and say "Update this before Friday".
The agent calls add_comment and gets back:
β¦and the comment is sitting on the highlighted phrase in the doc, from the account you logged in with.
No Playwright browser download is needed β by default the server drives your installed Google Chrome via playwright-core.
add_comment| Param | Required | Description |
|---|---|---|
doc | β | Document id or full docs.google.com/document/d/<id>/edit URL |
comment_text | β | Comment body (plain text, newlines OK) |
find_text | β | Exact, single-line text fragment to anchor to (must match the doc text). Omit to add a general, unanchored comment on the whole document. |
occurrence | β | Anchor to the N-th match when find_text appears multiple times (default 1) |
Returns { ok, anchored, occurrence_used, verified } β verified: true means the posted comment was observed in the page after submitting. If find_text is given but not found, the call fails with TEXT_NOT_FOUND and nothing is posted.
The tool never returns document content, so a malicious doc can't inject instructions into your agent through it.
check_connectionProbes the Google session; returns { connected, mode }. If connected: false, run npx gdocs-comments-mcp login again.
Scope note: this server does one thing β creating anchored comments. Listing, replying, resolving, and deleting comments all work fine through the Drive API (
comments.*), which is faster and needs no browser β use a Drive-based MCP for those.
All optional, via environment variables:
| Env var | Default | Purpose |
|---|---|---|
GDOCS_COMMENTS_PROFILE_DIR | ~/.gdocs-comments-mcp/profile | Where the logged-in browser profile lives (set a different dir per Google account) |
GDOCS_COMMENTS_BROWSER_CHANNEL | chrome | chrome | msedge | chromium (bundled; needs npx playwright install chromium) |
GDOCS_COMMENTS_HEADLESS | true | Set false to watch the automation work |
GDOCS_COMMENTS_IDLE_CLOSE_MIN | 10 | Close the managed browser after N idle minutes (0 = keep open) |
GDOCS_COMMENTS_CDP_URL | β | Attach to an existing browser over CDP instead of managing a profile (see below) |
GDOCS_COMMENTS_AUDIT_LOG | off | JSONL audit log (hashes only, no content) |
No reviews yet β be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/gdocs-comments-mcp)<a href="https://allmcps.com/mcp/gdocs-comments-mcp"><img src="https://allmcps.com/api/badge/gdocs-comments-mcp?style=directory" alt="Gdocs Comments MCP on AllMCPs" /></a>