# ToolsForMCPServer

> The Gemini CLI confirmed that the MCP server built with Google Apps Script (GAS), a low-code platform, offers immense possibilities. If you've created snippets for GAS, these could be revitalized and/or leveraged in new ways by using them as the MCP server. The Gemini CLI and other MCP clients will be useful in achieving this.

- **Type:** MCP server
- **Install:** `agentstack add mcp-tanaikech-toolsformcpserver`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [tanaikech](https://agentstack.voostack.com/s/tanaikech)
- **Installs:** 0
- **Category:** [Integrations](https://agentstack.voostack.com/c/integrations)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [tanaikech](https://github.com/tanaikech)
- **Source:** https://github.com/tanaikech/ToolsForMCPServer
- **Website:** https://medium.com/google-cloud/gemini-cli-with-mcp-server-expanding-possibilities-with-google-apps-script-4626c661ac81

## Install

```sh
agentstack add mcp-tanaikech-toolsformcpserver
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

[](https://mseep.ai/app/tanaikech-toolsformcpserver)

# Now, ToolsForMCPServer can be used as a Gemini extension. You can see how to install it at [https://github.com/tanaikech/ToolsForMCPServer-extension](https://github.com/tanaikech/ToolsForMCPServer-extension).

# Gemini CLI with MCP Server: Expanding Possibilities with Google Apps Script

The Gemini CLI confirmed that the MCP server built with Google Apps Script (GAS), a low-code platform, offers immense possibilities. If you've created snippets for GAS, these could be revitalized and/or leveraged in new ways by using them as the MCP server. The Gemini CLI and other MCP clients will be useful in achieving this.


[](LICENCE)





# Abstract

The Gemini CLI provides a powerful command-line interface for interacting with Google's Gemini models. By leveraging the Model Context Protocol (MCP), the CLI can be extended with custom tools. This report explores the integration of the Gemini CLI with an MCP server built using Google Apps Script Web Apps. We demonstrate how this combination simplifies authorization for Google Workspace APIs (Gmail, Drive, Calendar, etc.), allowing Gemini to execute complex, multi-step tasks directly within the Google ecosystem. We provide setup instructions and several practical examples showcasing how this integration unlocks significant potential for automation and productivity enhancement.

# Introduction

Recently, I published a report titled "Gemini CLI with MCP Server Built by Web Apps of Google Apps Script" ([Ref](https://medium.com/google-cloud/gemini-cli-with-mcp-server-built-by-web-apps-of-google-apps-script-47046afdf3be)). This initial report highlighted how a Model Context Protocol (MCP) server, developed using Google Apps Script Web Apps, can be integrated with the [Gemini CLI](https://github.com/google-gemini/gemini-cli).

One of the key advantages of using Google Apps Script is its ability to provide seamless authorization for Google APIs, particularly those within Google Workspace. This significantly reduces the development overhead associated with building applications that interact with Google Workspace services.

Building upon that foundation, this report aims to explore the expanded possibilities when combining the Gemini CLI with an MCP server powered by Google Apps Script Web Apps. We will delve into how this powerful combination facilitates the integration of various tools and services, unlocking an infinite range of potential applications for enhanced productivity and automation within the Google ecosystem.

# Current tools

In the current stage (November 14, 2025), the following 160 tools are provided by [ToolsForMCPServer](https://github.com/tanaikech/ToolsForMCPServer) for the MCP server.

You can see the descriptions of all tools with the following command on Gemini CLI.

```
/mcp desc
```

The next section details deploying the MCP server using Google Apps Script and configuring the Gemini CLI to use it.

## Preparing the MCP Server

### 1. Create a Google Apps Script Project

First, create a new standalone Google Apps Script project. A standalone project is not bound to a specific Google Sheet, Doc, or Form, making it ideal for creating a general-purpose web service. You can create one by visiting [script.google.com](https://script.google.com/home/projects/create). [Ref](https://developers.google.com/apps-script/guides/projects#create-standalone)

### 2. Install Libraries

To simplify building the MCP server, we will use pre-built Google Apps Script libraries. These encapsulate the complex MCP handling logic and provide ready-to-use tools, keeping the main script clean.

This sample uses two Google Apps Script libraries:

1.  **[MCPApp](https://github.com/tanaikech/MCPApp)**: Manages the MCP server lifecycle and communication protocols.
2.  **[ToolsForMCPServer](https://github.com/tanaikech/ToolsForMCPServer)**: Provides a suite of pre-built tools for interacting with Google Workspace services (Gmail, Drive, Calendar, etc.).

#### Library Project Keys and Installation

1.  Open the script editor of the project you just created.
2.  **Install MCPApp**:
    - [Installation Guide](https://developers.google.com/apps-script/guides/libraries)
    - Project Key: `1TlX_L9COAriBlAYvrMLiRFQ5WVf1n0jChB6zHamq2TNwuSbVlI5sBUzh`
    - Identifier: `MCPApp`
    - Repository: [https://github.com/tanaikech/MCPApp](https://github.com/tanaikech/MCPApp)
3.  **Install ToolsForMCPServer**:
    - [Installation Guide](https://developers.google.com/apps-script/guides/libraries)
    - Project Key: `1lnE7UL1jQgPDbTB9yjhiwZM0SaS9MObhzvWUWb_t8FisO6A3bLepvM2j`
    - Identifier: `ToolsForMCPServer`
    - Repository: [https://github.com/tanaikech/ToolsForMCPServer](https://github.com/tanaikech/ToolsForMCPServer)

### 3. Script

Please copy and paste the following script into the script editor (replacing any existing code) and save the project.

This is a basic script for using this library.

```javascript
const apiKey = "###"; // API key for Gemini API

/**
 * This function is automatically run when the MCP client accesses Web Apps.
 */
const doPost = (e) => main(e);

function main(eventObject) {
  const m = ToolsForMCPServer;

  m.apiKey = apiKey; // This is an API key for using Gemini API.
  // m.model = "models/gemini-2.5-flash"; // If you change model, use this.
  // m.defaultCalendarId = "###"; // If you want to use the specific calendar, please use this.
  // m.enableBaseTools = false; // Disable base tools
  // m.enableClassroomTools = false; // Disable tools for managing Google Classroom
  // m.enablePeopleTools = false; // Disable tools for managing Google People
  // m.enableAnalyticsTools = false; // Disable tools for managing Google Analytics
  // m.enableMapsTools = false; // Disable tools for managing Google Maps
  // m.enableFileSearch = false; // Disable tools for managing File Search

  const object = { eventObject, items: m.getTools() };
  return new MCPApp.mcpApp({ accessKey: "sample" })
    .setServices({ lock: LockService.getScriptLock() })
    .server(object);
}
```

**Note:**

- If you intend to use the following tools, you must uncomment the `apiKey` line in the script and provide a valid API key for the Gemini API.

  - generate_roadmap_to_google_sheets: Creates a roadmap in Google Sheets.
  - generate_description_on_google_drive: Generates and sets a description for a file on Google Drive.
  - generate_image_on_google_drive: Generates an image from a prompt and saves it to Google Drive.
  - summarize_file_on_google_drive: Summarizes a file stored on Google Drive.
  - description_web_site: Provides descriptions of websites given their URLs.

- If you want to use the specific Google Calendar, please set `defaultCalendarId`.

**APIs**

- If an error related to Drive API occurred, please enable Drive API at Advanced Google services.
- If you want to manage Docs, Sheets, Slides, and Calendars using the batch update methods of API, please enable Docs API, Sheets API, Slides API, and Calendar API at Advanced Google services.
- If you want to manage Google Classroom and Google People, please enable the Google Classroom API and the Google People API at Advanced Google services.
- If you want to retrieve the drive activity, please enable Drive Activity API at Advanced Google services.
- If you want to use Google Analytics, please enable Google Analytics Admin API and Google Analytics Data API at Advanced Google services.

#### Show all tools

When this script is run, all tools in this library are shown as a JSON object.

```javascript
function showAlltools() {
  const res = ToolsForMCPServer.getToolList();
  console.log(res);
}
```

#### Filter tools

When you want to use the specific tools, you can also use the following script.

This script uses only the tool `get_exchange_rate`.

```javascript
function main(eventObject) {
  const enables = ["get_exchange_rate"];

  const m = ToolsForMCPServer;
  m.apiKey = apiKey;
  const object = { eventObject, items: m.getTools({ enables }) };
  return new MCPApp.mcpApp({ accessKey: "sample" })
    .setServices({ lock: LockService.getScriptLock() })
    .server(object);
}
```

This script uses all tools except for the tool `get_exchange_rate`.

```javascript
function main(eventObject) {
  const disables = ["get_exchange_rate"];

  const m = ToolsForMCPServer;
  m.apiKey = apiKey;
  const object = { eventObject, items: m.getTools({ disables }) };
  return new MCPApp.mcpApp({ accessKey: "sample" })
    .setServices({ lock: LockService.getScriptLock() })
    .server(object);
}
```

### 4. Deploy Web Apps

To allow the Gemini CLI to communicate with our script, we must deploy it as a Web App. This creates a unique URL that acts as our MCP server endpoint.

You can find detailed information in [the official documentation](https://developers.google.com/apps-script/guides/web#deploy_a_script_as_a_web_app).

Please follow these steps to deploy the Web App in the script editor:

1.  In the script editor, at the top right, click **Deploy** -> **New deployment**.
2.  Click **Select type** -> **Web App**.
3.  Enter a description for the Web App in the fields under **Deployment configuration**.
4.  Select **"Me"** for **"Execute as"**. This is crucial, as it allows the script to run with your permissions to access your Google services.
5.  Select **"Anyone"** for **"Who has access"**. This makes the URL callable from the internet. Access is controlled by the unguessable URL and the `accessKey` defined in the script.
6.  Click **Deploy**.
7.  After authorizing the necessary scopes, copy the **Web app URL**. It will look similar to `https://script.google.com/macros/s/###/exec`. This is your MCP server endpoint.

**Important:** When you modify the Apps Script code, you must create a new deployment version to publish the changes. Click **Deploy** > **Manage deployments**, select your active deployment, click the pencil icon, and choose **"New version"** from the Version dropdown. [More info here](https://github.com/tanaikech/taking-advantage-of-Web-Apps-with-google-apps-script?tab=readme-ov-file#redeploy).

## Preparing Gemini CLI

### 1. Install Gemini CLI

Follow the official documentation to install the Gemini CLI on your system. [Ref](https://github.com/google-gemini/gemini-cli)

There are 2 patterns for using this MCP server using Gemini CLI and other AI agents as follows.

### 2A. Pattern 1

In this pattern, Gemini CLI is directly connected to the MCP server built by Google Apps Script Web Apps.

To connect the Gemini CLI to your new Apps Script server, you need to edit its settings file `settings.json`. This file is typically located at `~/.gemini/settings.json` on macOS/Linux or `%USERPROFILE%\.gemini\settings.json` on Windows.

Add the `mcpServers` configuration block as shown below.

1.  Replace `https://script.google.com/macros/s/###/exec` with the Web App URL you copied earlier.
2.  Ensure the `accessKey` query parameter matches the `accessKey` you defined in your Google Apps Script (`sample` in this example).

```json
{
  "theme": "Default",
  "selectedAuthType": "gemini-api-key",
  "mcpServers": {
    "gas_web_apps": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "https://script.google.com/macros/s/###/exec?accessKey=sample"
      ],
      "env": {}
    }
  },
  "disableAutoUpdate": true
}
```

or

```json
{
  "theme": "Default",
  "selectedAuthType": "###",
  "mcpServers": {
    "gas_web_apps": {
      "httpUrl": "https://script.google.com/macros/s/###/exec?accessKey=sample",
      "description": "MCP server built by Google Apps Script Web Apps"
    }
  }
}
```

- `"gas_web_apps"`: A local identifier for your server.
- `"httpUrl"`: Your Web Apps URL. In the current stage, when this is used, an error might occur. At that time, use `mcp-remote`.
- If you use `mcp-remote`, please install it. [Ref](https://www.npmjs.com/package/mcp-remote)
- If an error like `Request timed out` occurs, please add `timeout` and use `GEMINI_TIMEOUT` as follows.

  ```json
  {
    "theme": "Default",
    "selectedAuthType": "gemini-api-key",
    "mcpServers": {
      "gas_web_apps": {
        "command": "npx",
        "args": [
          "mcp-remote",
          "https://script.google.com/macros/s/###/exec?accessKey=sample"
        ],
        "env": {},
        "timeout": 300000
      }
    },
    "disableAutoUpdate": true
  }
  ```

  ```
  GEMINI_TIMEOUT=300 # Seconds
  ```

### 2B. [NEW] Pattern 2 (Added on October 15, 2025)

Now, ToolsForMCPServer can be used as a Gemini extension. You can see how to install it at [https://github.com/tanaikech/ToolsForMCPServer-extension](https://github.com/tanaikech/ToolsForMCPServer-extension).

### 3. Transfer file content (Added on July 9, 2025)

Recently, I published a report titled "Processing File Content Using Gemini CLI with an MCP Server Built by Google Apps Script" [Ref](https://medium.com/google-cloud/processing-file-content-using-gemini-cli-with-an-mcp-server-built-by-google-apps-script-86e2675e4d6b). In this report, I concluded that using the Drive API in the background is more effective for transferring file content between Gemini CLI and Google Drive than embedding base64 data directly in the prompt. Therefore, to facilitate this effective transfer, I use **ggsrun**, a CLI tool.

#### 3.1. `ggsrun` Setup Guide

To use this method, you first need to set up `ggsrun`.

1.  **Download `ggsrun`:** Get the latest release from the [ggsrun releases page](https://github.com/tanaikech/ggsrun/releases). The main repository is [here](https://github.com/tanaikech/ggsrun).
2.  **Create a Google Cloud Project:** Go to the [Google Cloud Platform Resource Manager](https://console.cloud.google.com/cloud-resource-manager) and click **CREATE PROJECT**.
3.  **Enable Drive API:** In your new project, navigate to **APIs & Services > Enabled APIs & Services**. Search for and enable the **Drive API**.
4.  **Create Credentials:** Navigate to **APIs & Services > Credentials**.
5.  **Configure OAuth Client ID:** Click **Create credentials**, select **OAuth client ID**, and choose **Web Application**.
6.  **Set Redirect URI:** Under "Authorized redirect URIs," add `http://localhost:8080`.
7.  **Create and Download Credentials:** Click **Create**, then **Download JSON**. **Important: Rename the downloaded file to `client_secret.json`** and place it in your working directory.
8.  **Authenticate `ggsrun`:**

8-1. Open your terminal in the directory containing `client_secret.json`.

8-2. Run the command `ggsrun auth`.

8-3. Copy the URL displayed in the terminal, paste it into your browser, and authorize the requested scopes.

8-4. Copy the authorization code from your browser's address bar and paste it back into the terminal.

To verify the setup, run `ggsrun di` to display information about your Google Drive.



#### 3.2. Configuring Gemini CLI for `ggsrun`

To enable the Gemini CLI to use `ggsrun`, add the following tool definitions to your `GEMINI.md` file. This file is typically located at `~/.gemini/GEMINI.md` on macOS/Linux or `%USERPROFILE%\.gemini\GEMINI.md` on Windows.

````text
# Transferring file content between local PC and Google Drive using ggsrun

* GitHub Repository: [https://github.com/tanaikech/ggsrun](https://github.com/tanaikech/ggsrun)
* To download a file from Google Drive by filename, use this command:
  ```bash
  ggsrun d -f [filename]
  ```
* To download a file from Google Drive by file ID, use this command:
  ```bash
  ggsrun d -i [fileId]
  ```
* To download a file from Google Drive by a file ID by converting mimeType, use this command:
  ```bash
  ggsrun d -i [fileId] -e [extension]
  ```
  [extension] is

…

## Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [tanaikech](https://github.com/tanaikech)
- **Source:** [tanaikech/ToolsForMCPServer](https://github.com/tanaikech/ToolsForMCPServer)
- **License:** MIT
- **Homepage:** https://medium.com/google-cloud/gemini-cli-with-mcp-server-expanding-possibilities-with-google-apps-script-4626c661ac81

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/mcp-tanaikech-toolsformcpserver
- Seller: https://agentstack.voostack.com/s/tanaikech
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
