# Google Docs MCP for AI agents. AI Agent Connect

> Google Docs MCP connects your AI client to your Google Workspace via the official API. Your agent can now read document structures, draft new files, perform regex find-and-replace, and export finished work as PDFs or Word docs. It handles the heavy lifting of document manipulation so you can focus on the content.

## Overview
- **Category:** productivity
- **Price:** Free
- **Endpoint:** https://edge.vinkius.com/vk_preview_mAxS5JN1dGWGR2njiGhZGnTCMlzA5y8ce250qBs6/ai-agent-connect
- **Tags:** google-docs, documents, text-editing, find-and-replace, google-workspace

## Description

This MCP gives your AI client a direct line to your Google Docs. Instead of just copying and pasting text back and forth, you can let your agent interact with your files directly. It can pull the full structural layout of a document to understand how it is organized, or just grab the plain text for a quick summary. If you need to build something new, your agent can create a fresh document and populate it with your ideas. You can also use it to clean up existing files by inserting specific text or running complex find-and-replace operations using regex. When the work is done, your agent can export the file into formats like PDF, DOCX, or HTML. It works within the permissions of your connected Google account, so it only touches what you allow it to see.

## Tools

### get_document_text
Reads the plain text of a Google Doc. Use this when you need your agent to summarize or search content without worrying about layout.

### export_document
Converts a Google Doc into a file like PDF, DOCX, or HTML. Use this to download your finished work in a specific format.

### get_document
Retrieves the full structural layout of a Google Doc. Use this when your agent needs to understand sections and formatting before making edits.

### create_document
Starts a brand new Google Doc. You can provide a title and initial text to get a document started immediately.

### insert_text
Adds new content or notes to a specific spot in a document. It uses character indices to place text exactly where you want it.

### replace_text
Performs find-and-replace operations using regex. This is how you rename terms or bulk-edit text across the whole document.

## Prompt Examples

**Prompt:** 
```
Turn these meeting notes into a formatted Google Doc.
```

**Response:** 
```
Created 'Board sync — Sep 2026' and inserted the notes as sections: Decisions, Open items, Risks, and Next steps, with the action items listed under each.
```

**Prompt:** 
```
Read my 'Investor update' doc and summarize it.
```

**Response:** 
```
The doc covers the quarter in four parts: KPIs, a product roadmap, the enterprise pipeline, and a request for board approval.
```

**Prompt:** 
```
Replace every 'ACME Inc' in the doc with 'Acme Corp' and export it as PDF.
```

**Response:** 
```
Replaced 6 occurrences of 'ACME Inc' with 'Acme Corp' in one pass, then exported the document as PDF.
```

## Capabilities

### Structural Reading
Your agent can see the difference between paragraphs and sections to maintain document integrity.

### Automated Drafting
The agent creates new files from scratch based on your conversation.

### Regex Editing
Your agent can perform complex find-and-replace tasks using regular expressions.

### Multi-format Export
The agent converts documents into PDF, DOCX, HTML, and other common formats.

### Targeted Insertion
Your agent can place text at specific character positions within an existing file.

## Use Cases

### Meeting Note Conversion
Turn messy, unformatted meeting notes into structured Google Docs with headers and lists.

### Bulk Renaming
Use regex to replace outdated company names or terms throughout a massive document in one go.

### Content Summarization
Have your agent read a long report and provide a concise summary of the key findings.

### Document Exporting
Directly convert a collaborative Google Doc into a PDF for distribution.

## Benefits

- Eliminates manual copy-pasting between your AI client and Google Docs.
- Enables bulk text updates using regex patterns.
- Allows for direct document creation from chat prompts.
- Provides instant file conversion to PDF and other formats.

## How It Works

Setting up the connection takes a few minutes through Google Cloud.

1. Create a Google Cloud project and enable the Docs API.
2. Generate OAuth 2.0 client credentials.
3. Enter your Client ID and Client Secret into the Vinkius credential fields.
4. Connect your Google account via OAuth to grant the agent access.
5. Start using the tools in your preferred AI client.

## Frequently Asked Questions

**How does the agent access my files?**
The agent uses the official Google Docs API and acts only on the documents your specific Google account has permission to access.

**Can I export files to Word?**
Yes, you can export documents as DOCX using the export tool.

**What happens if I want to keep the document formatting?**
Use the get_document tool instead of get_document_text to ensure the agent understands the document structure and layout.

**Is it safe to use my Client Secret here?**
Vinkius hosts the MCP and manages your credentials securely so you don't have to run the connection locally.

**Can the agent use regex for find and replace?**
Yes, the replace_text tool supports standard regex with capture groups for advanced editing.

**Which Google Cloud permissions are required?**
The OAuth flow requests only the Google Docs API scope. The agent can therefore read and modify documents that your connected Google account can access, and nothing beyond that scope.

**How do replace_text regex and capture groups work?**
replace_text takes a regex pattern and a replacement string. Use $1, $2… in the replacement to insert captured groups. To rename a product across a whole doc, match the old name and replace with the new one in a single pass — every occurrence is updated.

**What does export_document return?**
It returns the document converted to the requested format (pdf, docx, html, txt, csv, epub, rtf or odt) as a base64 string. Save the decoded bytes to a file to get a real downloadable document.
