Google Apps Script API MCP server

Integrates with Google Apps Script API through 17 specialized tools for project management, deployment operations, content updates, version control, process monitoring, and script execution with OAuth 2.0 authentication.
Back to servers
Provider
mohalmah
Release date
Jun 02, 2025
Language
Python
Stats
2 stars

This MCP server enables interaction with Google Apps Script through the Google Apps Script API, allowing you to manage script projects, deployments, versions, and execute scripts via MCP-compatible clients like Claude Desktop or VS Code with Cline extension.

Installation

Prerequisites

  • Node.js (v18+ required, v20+ recommended)
  • npm (included with Node.js)
  • Google Account with access to Google Cloud Console

Step 1: Clone and Install

git clone https://github.com/mohalmah/google-apps-script-mcp-server.git
cd google-apps-script-mcp-server
npm install

Step 2: Google Cloud Console Setup

Create or Select a Google Cloud Project

  1. Go to Google Cloud Console
  2. Click the project dropdown at the top and create a new project or select an existing one
  3. If creating new, enter a project name (e.g., "Google Apps Script MCP")

Enable Required APIs

  1. Navigate to APIs & ServicesLibrary
  2. Search for and enable:
    • Google Apps Script API (required)
    • Google Drive API (recommended)
    • Google Cloud Resource Manager API (for project operations)

Configure OAuth Consent Screen

  1. Go to APIs & ServicesOAuth consent screen
  2. Choose External (unless you're in a Google Workspace organization)
  3. Fill in required information (App name, email, developer contact)
  4. Add scopes (recommended):
    • https://www.googleapis.com/auth/script.projects
    • https://www.googleapis.com/auth/script.projects.readonly
    • https://www.googleapis.com/auth/script.deployments
    • https://www.googleapis.com/auth/script.deployments.readonly
    • https://www.googleapis.com/auth/script.metrics
    • https://www.googleapis.com/auth/script.processes
  5. Add your Gmail address as a test user

Create OAuth 2.0 Credentials

  1. Go to APIs & ServicesCredentials
  2. Click "+ CREATE CREDENTIALS""OAuth 2.0 Client IDs"
  3. Select "Web application" as the Application Type
  4. Name: "Google Apps Script MCP Client"
  5. Add http://localhost:3001/oauth/callback as an authorized redirect URI
  6. Click "Create" and copy your Client ID and Client Secret

Step 3: Configure Environment Variables

Create a .env file in your project root:

# Google Apps Script API OAuth Configuration
GOOGLE_APP_SCRIPT_API_CLIENT_ID=your_client_id_here
GOOGLE_APP_SCRIPT_API_CLIENT_SECRET=your_client_secret_here

# Optional: Logging level
LOG_LEVEL=info

Replace the placeholders with your actual values.

Step 4: OAuth Authentication Setup

Run the OAuth setup script:

npm run setup-oauth

This will:

  1. Open your browser to Google's authorization page
  2. Ask you to grant permissions to the application
  3. Capture the authorization code and exchange it for tokens
  4. Store the refresh token securely in your OS credential store

Step 5: Test Your Setup

npm start

You should see:

Google Apps Script MCP Server running on stdio
OAuth tokens loaded successfully
Server ready to handle MCP requests

Connecting MCP Clients

Finding Required Paths

You'll need the absolute paths to Node.js and your mcpServer.js file:

Windows

Write-Host "Node.js path: $((Get-Command node).Source)"
Write-Host "mcpServer.js path: $(Join-Path (Get-Location) 'mcpServer.js')"

macOS/Linux

echo "Node.js path: $(which node)"
echo "mcpServer.js path: $(realpath mcpServer.js)"

Claude Desktop Setup

  1. Open Claude Desktop and navigate to SettingsDevelopersEdit Config
  2. Add your MCP server configuration:
{
  "mcpServers": {
    "google-apps-script": {
      "command": "<absolute_path_to_node_executable>",
      "args": ["<absolute_path_to_mcpServer.js>"],
      "env": {
        "GOOGLE_APP_SCRIPT_API_CLIENT_ID": "your_client_id_here",
        "GOOGLE_APP_SCRIPT_API_CLIENT_SECRET": "your_client_secret_here"
      }
    }
  }
}

Replace the paths and credentials with your actual values.

VS Code Setup (with Cline Extension)

  1. Install the Cline extension
  2. Add to your VS Code settings.json:
{
  "cline.mcpServers": {
    "google-apps-script": {
      "command": "<absolute_path_to_node_executable>",
      "args": ["<absolute_path_to_mcpServer.js>"],
      "env": {
        "GOOGLE_APP_SCRIPT_API_CLIENT_ID": "your_client_id_here",
        "GOOGLE_APP_SCRIPT_API_CLIENT_SECRET": "your_client_secret_here"
      }
    }
  }
}

Available Tools

The MCP server provides 16 tools for Google Apps Script management:

Project Management

  • script-projects-create: Create a new Google Apps Script project
  • script-projects-get: Get metadata of a script project
  • script-projects-get-content: Get the content of a script project
  • script-projects-update-content: Update the content of a script project

Version Management

  • script-projects-versions-create: Create a new version of a script project
  • script-projects-versions-get: Get details of a specific script version
  • script-projects-versions-list: List all versions of a script project

Deployment Management

  • script-projects-deployments-create: Create a deployment of a script project
  • script-projects-deployments-get: Get details of a specific deployment
  • script-projects-deployments-list: List all deployments of a script project
  • script-projects-deployments-update: Update an existing deployment
  • script-projects-deployments-delete: Delete a deployment

Execution and Monitoring

  • script-scripts-run: Execute a Google Apps Script function
  • script-processes-list: List execution processes for a script project
  • script-processes-list-script-processes: List script processes with advanced filtering
  • script-projects-get-metrics: Get execution metrics and analytics

Troubleshooting

Common Issues

  1. "Command not found" errors:

    • Ensure Node.js is properly installed
    • Use absolute paths to the Node.js executable
  2. "fetch is not defined" errors:

    • Upgrade to Node.js 18+ (recommended)
    • Or install node-fetch as a dependency
  3. OAuth authentication errors:

    • Verify OAuth credentials in the .env file
    • Re-run npm run setup-oauth
    • Ensure callback URL is exactly: http://localhost:3001/oauth/callback
  4. "Authorization Error: Access blocked":

    • Ensure your app is configured for "External" users
    • Add your Gmail address as a test user
  5. MCP server not appearing in Claude Desktop:

    • Check configuration file syntax (valid JSON)
    • Ensure file paths use proper escaping (double backslashes on Windows)
    • Restart Claude Desktop after changes

Diagnostic Commands

# Start with debug logging
npm run debug

# Test OAuth authentication
npm run test-oauth

# List all available tools
npm run list-tools

Advanced Usage

Environment Variables

# Required OAuth credentials
GOOGLE_APP_SCRIPT_API_CLIENT_ID=your_client_id
GOOGLE_APP_SCRIPT_API_CLIENT_SECRET=your_client_secret

# Optional configuration
LOG_LEVEL=info                    # debug, info, warn, error
NODE_ENV=development              # development, production
PORT=3001                         # OAuth callback port

Server-Sent Events Mode

For real-time communication with web interfaces:

npm run start-sse

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later