docugen-mcp
v5.0.0
Published
DocGen - 100% COMPLETE Google Docs API - All 3 primary methods + 33 batch operations + helpers
Downloads
20
Maintainers
Readme
DocuGen MCP Server
Complete Google Docs automation for AI assistants. All 33 batch operations + tabs, suggestions, and analysis tools. 43+ operations total.
Features
Complete implementation with clean architecture:
- ✅ All 33 Batch Operations - Every single Google Docs API batch operation
- ✅ Tab Management - Full support for document tabs and nested tabs
- ✅ Suggestions API - Create and manage suggested changes
- ✅ Document Analysis - Extract structure, metrics, and content
- ✅ Complete Table Operations - Insert/delete rows/columns, merge/unmerge cells
- ✅ Style Management - Document, section, and custom styles
- ✅ Error Handling - Exponential backoff retry logic
- ✅ Performance Optimization - Document caching and batch queuing
- ✅ UTF-16 Support - Accurate index calculations for all Unicode
Quick Start
Installation
# Run directly with npx
npx docugen-mcp
# Or install globally
npm install -g docugen-mcpSetup (5 minutes)
Get Google Cloud Credentials:
- Go to Google Cloud Console
- Create project, enable Docs & Drive APIs
- Create OAuth 2.0 credentials (Desktop app)
- Download credentials JSON
Configure Your AI Assistant:
Claude Desktop:
{
"mcpServers": {
"docugen": {
"command": "npx",
"args": ["docugen-mcp"],
"env": {
"GOOGLE_OAUTH_PATH": "/path/to/credentials.json"
}
}
}
}- Start Using:
- Restart your AI assistant
- Test: "Create a new Google Doc"
- Authenticate once when browser opens
Complete Tool List (70+ Operations)
Core Document Operations
create-document- Create with initial contentget-document- Retrieve with field masksdelete-document- Move to trashanalyze-document- Extract structure and metrics
Text Operations (Complete)
insert-text- Insert at multiple positionsdelete-text- Delete content rangesreplace-all-text- Find and replacemove-text- Move between positions
Formatting (Complete)
update-text-style- Bold, italic, colors, fonts, linksupdate-paragraph-style- Headings, alignment, spacing, indentationupdate-document-style- Document-wide stylesupdate-section-style- Section-specific styles
Tables (Complete)
insert-table- Create with contentinsert-table-row- Add rowsinsert-table-column- Add columnsdelete-table-row- Remove rowsdelete-table-column- Remove columnsupdate-table-cell-style- Style cellsupdate-table-row-style- Style rowsupdate-table-column-properties- Set widthsmerge-table-cells- Merge cellsunmerge-table-cells- Split cellspin-table-header-rows- Fix headers
Lists
create-paragraph-bullets- Bullet/numbered/checkbox listsdelete-paragraph-bullets- Remove list formatting
Images & Objects
insert-inline-image- Add from URLsreplace-image- Replace existingdelete-positioned-object- Remove images
Document Structure
insert-page-break- Page breaksinsert-section-break- Section breakscreate-header- Add headerscreate-footer- Add footersdelete-header- Remove headersdelete-footer- Remove footerscreate-footnote- Add footnotes
Named Ranges
create-named-range- Create rangesdelete-named-range- Remove rangesreplace-named-range-content- Replace content
Tab Management (New)
get-tabs- List all tabscreate-tab- Create new tabdelete-tab- Remove tabrename-tab- Change titlemove-tab- Reorder tabsget-tab-content- Get specific tab
Suggestions API (New)
create-suggestion- Create suggested editslist-suggestions- Get all suggestionsaccept-suggestion- Accept changesreject-suggestion- Reject changesget-document-with-suggestions- View inline
Document Analysis (New)
extract-outline- Get structureget-word-count- Statisticsfind-all-links- Extract linksfind-all-images- List imagesfind-all-tables- List tablescalculate-reading-time- Reading estimate
High-Level Workflows
create-report- Generate reportscreate-resume- Build resumesmail-merge- Bulk generationconvert-markdown- Import markdownexport-markdown- Export markdown
Batch Operations
batch-update- Execute any of 33 operations
Usage Examples
Complete Document Creation
// Create document
await createDocument({
title: "Q4 2024 Report",
content: "Executive Summary"
});
// Add sections (auto-sorted descending)
await insertText({
documentId: "doc123",
insertions: [
{ index: 100, text: "Results" },
{ index: 50, text: "Achievements" },
{ index: 150, text: "Outlook" }
]
});
// Create data table
await insertTable({
documentId: "doc123",
index: 200,
rows: 4,
columns: 3,
content: [
["Metric", "Q3", "Q4"],
["Revenue", "$1.2M", "$1.5M"],
["Users", "10K", "15K"],
["Growth", "20%", "25%"]
]
});
// Style header row
await updateTableRowStyle({
documentId: "doc123",
tableStartIndex: 200,
rowIndices: [0],
backgroundColor: "#4285f4",
foregroundColor: "#ffffff",
bold: true
});
// Merge cells
await mergeTableCells({
documentId: "doc123",
tableStartIndex: 200,
rowIndex: 3,
columnIndex: 0,
rowSpan: 1,
columnSpan: 2
});Tab Management
// Create tabs
await createTab({
documentId: "doc123",
title: "Technical Specs"
});
// Add content to specific tab
await insertText({
documentId: "doc123",
tabId: "tab-2",
insertions: [
{ index: 1, text: "API Endpoints" }
]
});Suggestions
// Create suggestion
await createSuggestion({
documentId: "doc123",
suggestionId: "sug-001",
insertText: {
index: 50,
text: "Needs review"
}
});
// Accept suggestion
await acceptSuggestion({
documentId: "doc123",
suggestionId: "sug-001"
});Critical Implementation Details
1. Backward Ordering
Operations automatically sorted descending:
// Input: [10, 50, 100]
// Executed: 100 → 50 → 102. Table Cell Addressing
Zero-based indices with table start:
{
tableCellLocation: {
tableStartLocation: { index: 200 },
rowIndex: 0,
columnIndex: 1
}
}3. UTF-16 Encoding
Accurate character counting:
"Hello 😀" // 8 UTF-16 units, not 74. Error Handling
Automatic retry with exponential backoff for rate limits.
5. Performance
- Document caching
- Batch queuing (up to 100)
- Field masks for efficiency
Architecture
DocuGen MCP Server v4.0
├── Core Systems
│ ├── Authentication (OAuth 2.0)
│ ├── Error Handling (Exponential Backoff)
│ ├── Document Cache
│ └── Batch Queue
├── Managers
│ ├── Document Manager
│ ├── Tab Manager
│ ├── Table Manager
│ ├── Style Manager
│ ├── Suggestion Manager
│ └── Named Range Manager
├── Utilities
│ ├── UTF-16 Calculator
│ ├── Index Validator
│ ├── Field Mask Builder
│ └── Batch Optimizer
└── MCP Interface
├── 33 Batch Operations
├── Tab Operations (10+)
├── Suggestion Operations (8+)
├── Analysis Operations (10+)
└── High-Level Workflows (5+)Why DocuGen is Production Ready
- Complete API Coverage - Every Google Docs API endpoint
- Clean Architecture - Single implementation, modular utilities
- Nothing Missing - All 33 operations + advanced features
- Production Ready - Error handling, caching, and retries
- Well Tested - All operations verified and working
For Organizations
Deploy for your entire team with one setup. Each employee maintains private access.
IT Setup (15 minutes)
- Create Google Cloud project
- Enable Docs & Drive APIs
- Create OAuth credentials
- Share configuration with team
Employee Setup (2 minutes)
- Add configuration to AI assistant
- Restart assistant
- Authenticate once
- Start creating documents
Support
- GitHub Issues: github.com/eagleisbatman/docugen/issues
- Documentation: Google Docs API
Author
Created by Gautam Mandewalker
📍 Cumming, Forsyth County, Georgia, USA
License
Apache-2.0
