MCP Google Apps Script Server

by whichguy

Not rated
GitHub

About

A server for seamless integration with Google Apps Script, enabling automation and extension of Google Workspace applications.

Details

Author
whichguy
Categories
Developer Tools

Setup

Install MCP Google Apps Script Server in your MCP client (Claude Desktop, Cursor, Windsurf, and others).

Repository: https://github.com/whichguy/gas_mcp

Follow the installation instructions in the repository README, then restart your MCP client.

A server for seamless integration with Google Apps Script, enabling automation and extension of Google Workspace applications.

Let AI assistants build and manage Google Apps Script projects for you

πŸš€ Quick Startβ€’πŸ’‘ Use Casesβ€’πŸ› οΈ Featuresβ€’πŸ“š Docs

Google Apps Script is powerful for automating Google Workspace, but developing GAS projects traditionally requires:

- Switching between local development and the online editor
- Manual copy-pasting of code
- No proper module system or version control
- Limited tooling for testing and deployment

MCP GAS Server bridges AI assistants with Google Apps Script, enabling:

- AI-Driven Development: Tell Claude/Cursor what to build, and it handles the implementation
- Full CommonJS Modules:require(),module.exports, automatic dependency resolution - write GAS like Node.js
- Ad-hoc Execution: Run any JavaScript expression instantly - no deployment, no wrapper functions needed
- Production Deployment Pipeline: dev β†’ staging β†’ prod workflow with version control, promotion, and rollback
- Unix-inspired Interface: Familiar commands (cat,grep,ls,find,sed) for intuitive GAS project management
- Local Development: Write code locally with full IDE support
- Automatic Sync: Bidirectional sync between local files and Google's cloud
- Git Integration: Version control for your GAS projects with safe merging

- Developerswho want AI to handle Google Apps Script boilerplate
- Teamsautomating Google Workspace workflows
- Non-programmerswho need custom Google Sheets functions or automation
- Anyonetired of the limitations of Google's online script editor

- πŸ“Š Custom Spreadsheet Functions: Complex calculations, data processing, API integrations
- πŸ“§ Email Automation: Process Gmail, send bulk emails, manage drafts
- πŸ“… Calendar Management: Schedule events, sync calendars, automate meeting creation
- πŸ—‚οΈ Drive Automation: File organization, backup systems, document generation
- πŸ“ Document Processing: Generate reports, merge documents, extract data
- πŸ”— API Integrations: Connect Google Workspace to external services
- πŸ€– Chatbots & Add-ons: Build custom tools for Sheets, Docs, and Forms

// Tell your AI: "Create a function that fetches stock prices and updates my spreadsheet" // AI will create, deploy, and test the entire solution // Tell your AI: "Build an expense tracker that categorizes Gmail receipts" // AI handles OAuth, Gmail API, and spreadsheet integration // Tell your AI: "Make a custom menu in Sheets for data analysis tools" // AI creates the UI, functions, and deploys everything
curl -fsSL https://raw.githubusercontent.com/whichguy/mcp_gas/main/install.sh | bash -s -- --auto

This single command: downloads β†’ installs dependencies β†’ builds β†’ configures all IDEs

git clone https://github.com/whichguy/mcp_gas.git && cd mcp_gas && ./install.sh

Clone first, then run installer with more control

curl -fsSL https://raw.githubusercontent.com/whichguy/mcp_gas/main/install.sh | bash

"Create a Google Apps Script project that adds a custom menu to Google Sheets with options to highlight duplicate values and remove empty rows"

- βœ… Creates the project
- βœ… Writes the code
- βœ… Sets up the menu
- βœ… Deploys to Google
- βœ… Tests the functionality

Theinstall.shscript handles everything automatically:
- πŸ”„ Downloads Repository(if using curl)
- πŸ“¦ Installs Dependencies(npm install)
- πŸ”¨ Builds Project(npm run build)
- πŸ” Detects Your IDEs(checks for 10+ IDEs)
- βš™οΈ Configures Each IDE(updates MCP settings)
- πŸ”— Links todist/src/index.js(production build)

- βœ…Idempotent- Safe to run multiple times
- πŸ’ΎCreates Backups- Before any modifications
- πŸ”Checks OAuth- Guides you through Google setup

./install.sh --dry-run # Preview changes without making them ./install.sh --interactive # Choose which IDEs to configure ./install.sh --auto # Non-interactive mode (for CI/CD) ./install.sh --force # Update existing configurations ./install.sh --help # Show detailed usage

If the installer fails or you need custom setup:

# 1. Clone repository git clone https://github.com/whichguy/mcp_gas.git cd mcp_gas # 2. Install dependencies npm install # 3. Build the project npm run build # 4. Configure your IDE manually # Point to: /absolute/path/to/mcp_gas/dist/src/index.js

Note: The server binary is atdist/src/index.jsafter building, not in the source directory.

# Remove MCP GAS from all IDEs ./uninstall.sh # With cleanup options: ./uninstall.sh --cleanup-build # Also remove dist/ and node_modules/ ./uninstall.sh --cleanup-backups # Remove all backup files ./uninstall.sh --dry-run # Preview what would be removed

- VisitGoogle Cloud Console
- Create or select a project
- Search for "Google Apps Script API" and enable it

- Navigate to APIs & Services β†’ Credentials
- Click "Create Credentials" β†’ "OAuth client ID"
- Application type:Desktop app
- Download JSON and save asoauth-config.jsonin project root

The MCP GAS Server works with any MCP-compatible client:

{ "mcpServers": { "gas": { "command": "node", "args": ["/absolute/path/to/mcp_gas/dist/src/index.js"], "env": {"NODE_ENV": "production"} } } }
{ "mcpServers": { "gas": { "command": "node", "args": ["/absolute/path/to/mcp_gas/dist/src/index.js"], "env": {"NODE_ENV": "production"} } } }
{ "context_servers": { "gas": { "command": { "path": "node", "args": ["/absolute/path/to/mcp_gas/dist/src/index.js"] } } } }
[mcp_servers.gas] command = "node" args = ["/absolute/path/to/mcp_gas/dist/src/index.js"] [[mcp_servers.gas.env]] NODE_ENV = "production"

- ls- List files
- cat- Read files
- write- Write files
- rm- Delete files
- mv- Move files
- cp- Copy files
- mkdir- Create folders

- grep- Search text
- find- Find files
- ripgrep- Fast search
- sed- Find & replace

- rsync- Stateless sync (pull/push with dryrun)
- git_feature- Feature branch management
- config- Manage sync folder

- deploy- Unified deployment management (promote/rollback/status/reset)

- project_create- New project
- project_set- Set current
- project_list- List all

- Smart tools(cat,write): Automatically handle CommonJS module wrapping
- Raw tools(raw_cat,raw_write): Preserve exact file content
- Choose based on whether you want automatic module management or full control

- Automation Projects: Gmail, Calendar, Drive, Sheets automation
- Custom Functions: Complex spreadsheet formulas and data processing
- API Integrations: Connecting Google Workspace to external services
- Rapid Prototyping: Quick proof-of-concepts and MVPs
- Learning GAS: Let AI teach by example

- Large Applications: Consider App Engine or Cloud Functions for complex apps
- Real-time Systems: GAS has execution time limits (6 minutes)
- Heavy Computing: Limited CPU/memory compared to dedicated servers
- Sensitive Data: Evaluate security requirements carefully

// Set up .git/config breadcrumb file first mcp__gas__write({ scriptId: "...", path: ".git/config", content: JSON.stringify({ repository: "https://github.com/...", localPath: "~/my-project" }) }) // Stateless sync: preview then apply mcp__gas__rsync({ operation: "pull", scriptId: "...", dryrun: true }) mcp__gas__rsync({ operation: "pull", scriptId: "..." }) // Standard git workflow works in sync folder cd ~/gas-repos/project-xxx git add . && git commit -m "Update" && git push
// Write modular code with CommonJS const utils = require('./utils'); const api = require('./api/client'); function processData() { const data = api.fetchData(); return utils.transform(data); } module.exports = { processData };
// Tell your AI assistant: "Create a Google Apps Script project that calculates Fibonacci numbers" // The AI will execute: // 1. Authenticate await mcp__gas__auth({ mode: "start" }); // 2. Create project const project = await mcp__gas__project_create({ title: "Fibonacci Calculator" }); // 3. Add code await mcp__gas__write({ scriptId: project.scriptId, path: "fibonacci", content:  function fibonacci(n) { if (n <= 1) return n; return fibonacci(n - 1) + fibonacci(n - 2); } function test() { Logger.log(fibonacci(10)); // 55 } module.exports = { fibonacci };  }); // 4. Execute const result = await mcp__gas__run({ scriptId: project.scriptId, js_statement: "require('fibonacci').fibonacci(10)" }); // Returns: 55
// Read file contents (auto-unwraps CommonJS) mcp__gas__cat({ scriptId: "...", path: "utils/helper" }) // List files matching pattern mcp__gas__ls({ scriptId: "...", path: "utils/" }) // ⚑ RECOMMENDED: High-performance multi-pattern search with ripgrep mcp__gas__ripgrep({ scriptId: "...", pattern: "function.test", ignoreCase: true, context: 2 }) // Simple grep (use ripgrep for advanced searches) mcp__gas__grep({ scriptId: "...", pattern: "function.test", outputMode: "content" }) // Find files by name pattern mcp__gas__find({ scriptId: "...", name: ".test" }) // Find/replace with regex mcp__gas__sed({ scriptId: "...", pattern: "console\\.log", replacement: "Logger.log" }) // ⚑ Advanced ripgrep features (STRONGLY RECOMMENDED over grep) mcp__gas__ripgrep({ scriptId: "...", pattern: "TODO|FIXME|HACK", // Multi-pattern OR search ignoreCase: true, // Case-insensitive sort: "path", // Alphabetical sorting trim: true, // Clean whitespace context: 2, // Show 2 lines of context showStats: true // Performance statistics })
// Execute mathematical expressions mcp__gas__run({ scriptId: "...", js_statement: "Math.PI  2" }) // Call Google Apps Script services mcp__gas__run({ scriptId: "...", js_statement: "DriveApp.getRootFolder().getName()" }) // Execute project functions with CommonJS mcp__gas__run({ scriptId: "...", js_statement: "require('Calculator').fibonacci(10)" }) // Complex data operations mcp__gas__run({ scriptId: "...", js_statement:  const data = require('API').fetchData(); const sheet = SpreadsheetApp.create('Report'); sheet.getActiveSheet().getRange(1,1,data.length,3).setValues(data); return sheet.getId();  })
// Write module with automatic CommonJS wrapping mcp__gas__write({ scriptId: "...", path: "Calculator", content:  function add(a, b) { return a + b; } function multiply(a, b) { return a  b; } module.exports = { add, multiply };  }) // Use require() in other modules - automatic dependency resolution mcp__gas__write({ scriptId: "...", path: "Main", content:  const calc = require('Calculator'); const result = calc.add(5, calc.multiply(2, 3)); Logger.log(result); // Logs: 11  }) // Read shows clean user code (CommonJS wrapper removed) mcp__gas__cat({ scriptId: "...", path: "Calculator" }) // Returns user code without _main() wrapper
// Create .git/config breadcrumb file mcp__gas__write({ scriptId: "...", path: ".git/config", content: JSON.stringify({ repository: "https://github.com/owner/repo.git", localPath: "~/my-projects/gas-app" }) }) // Stateless sync: preview then apply mcp__gas__rsync({ operation: "pull", scriptId: "...", dryrun: true }) mcp__gas__rsync({ operation: "pull", scriptId: "..." }) // Manage sync folder configuration mcp__gas__config({ operation: "set", setting: "sync_folder", scriptId: "...", value: "~/my-projects/gas-app" })
# Enable debug logging DEBUG=mcp:* npm start # Test installation without changes ./install.sh --dry-run # Check configuration cat ~/.claude/claude_desktop_config.json | jq '.mcpServers.gas'
mcp_gas/ β”œβ”€β”€ src/ # TypeScript source code β”‚ β”œβ”€β”€ tools/ # ~50 MCP tools β”‚ β”œβ”€β”€ auth/ # OAuth authentication β”‚ β”œβ”€β”€ api/ # Google Apps Script API client β”‚ └── server/ # MCP server implementation β”œβ”€β”€ dist/ # Compiled JavaScript (after build) β”œβ”€β”€ test/ # Test suites β”œβ”€β”€ docs/ # Documentation β”œβ”€β”€ install.sh # Automated installer β”œβ”€β”€ uninstall.sh # Clean uninstaller β”œβ”€β”€ gas-config.json # Project configuration └── oauth-config.json # OAuth credentials (create this)
# Clone and install git clone https://github.com/whichguy/mcp_gas.git cd mcp_gas npm install # Development mode with watch npm run dev # Build for production npm run build
npm test # Run all tests npm run test:unit # Unit tests only npm run test:integration # Integration tests (requires auth) npm run test:system # System-level tests npm run test:security # Security validation

The MCP GAS Server uses a layered architecture:
- MCP Protocol Layer: Handles communication with AI assistants
- Tool Layer: ~50 specialized tools for GAS operations
- Authentication Layer: OAuth 2.0 PKCE flow with token management
- API Client Layer: Google Apps Script API v1 client with rate limiting
- File System Layer: Local caching and synchronization

- docs/REFERENCE.md- Complete reference for all 63 tools with capabilities, limitations, and compatibility matrix

- docs/CROSS_TOOL_REFERENCES.md- Strategy for cross-tool references and workflow chaining
-
docs/SCHEMA_ENHANCEMENTS_SUMMARY.md- Progress tracking for schema improvements
-
Architecture Guide- System design and internals
-
Git Integration- Version control workflows
-
API Documentation- TypeScript API reference
-
Examples- Sample projects and use cases

- Script Type Compatibility- Clear indication of standalone vs container-bound support
- Limitations- Specific constraints, quotas, and API restrictions
- Cross-Tool References- Prerequisites, next steps, alternatives, and error recovery guidance
- ⚑ Search Tool Preference-ripgrep is STRONGLY RECOMMENDEDover grep for all searches (multi-pattern, smart case, context control, better performance)

We welcome contributions! SeeCONTRIBUTING.mdfor guidelines.

- πŸ›Report bugs
- πŸ’‘
Request features
- πŸ“–
Improve documentation
- πŸ”§
Submit pull requests

- Model Context Protocolby Anthropic
-
Google Apps Script API
- TypeScript, Node.js, and the amazing open-source community

🌟 Ready to supercharge your Google Apps Script development?

This is a web browser that enables your coding agent, such as Claude Code, to visit websites on your behalf and assist you in identifying bugs or creating UI test cases.

Create crafted UI components inspired by the best 21st.dev design engineers.

Bring agent evaluations, observability, and synthetic test set generation directly into your IDE for free with Galileo's new MCP server

An MCP server to help AI assistants to answer questions and generate AccelByte Extend SDK code more effectively .

MCP server for AI Diagram Maker β€” generate beautiful software engineering diagrams directly inside Cursor, Claude Desktop, Claude Code, or any MCP-compatible AI agent

ALAPI MCP Tools,Call hundreds of API interfaces via MCP

AI-powered SVG animation generator that transforms static files into animated SVG components using the Allyson platform

MCP server that gives AI assistants on-demand access to 1,500+ amCharts docs, ~300 code examples, and 1000+ class API references.

APIMatic MCP Server is used to validate OpenAPI specifications using APIMatic. The server processes OpenAPI files and returns validation summaries by leveraging APIMatic’s API.

One shared context layer for AI agents and humans β€” live API specs, DB schemas, and versioned contracts across repos so every agent and teammate works from the same source of truth.

Build and deploy full-stack Next.js apps with 98 tools for React, AWS, and MongoDB

No reviews yet β€” be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.