Install
$ agentstack add mcp-tanaikech-toolsformcpserver ✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
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.
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). 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.
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 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. Ref
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:
- MCPApp: Manages the MCP server lifecycle and communication protocols.
- ToolsForMCPServer: Provides a suite of pre-built tools for interacting with Google Workspace services (Gmail, Drive, Calendar, etc.).
Library Project Keys and Installation
- Open the script editor of the project you just created.
- Install MCPApp:
- Installation Guide
- Project Key:
1TlX_L9COAriBlAYvrMLiRFQ5WVf1n0jChB6zHamq2TNwuSbVlI5sBUzh - Identifier:
MCPApp - Repository: https://github.com/tanaikech/MCPApp
- Install ToolsForMCPServer:
- Installation Guide
- Project Key:
1lnE7UL1jQgPDbTB9yjhiwZM0SaS9MObhzvWUWb_t8FisO6A3bLepvM2j - Identifier:
ToolsForMCPServer - Repository: 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.
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
apiKeyline in the script and provide a valid API key for the Gemini API.
- generateroadmaptogooglesheets: Creates a roadmap in Google Sheets.
- generatedescriptionongoogledrive: Generates and sets a description for a file on Google Drive.
- generateimageongoogledrive: Generates an image from a prompt and saves it to Google Drive.
- summarizefileongoogledrive: Summarizes a file stored on Google Drive.
- descriptionwebsite: 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.
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.
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.
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.
Please follow these steps to deploy the Web App in the script editor:
- In the script editor, at the top right, click Deploy -> New deployment.
- Click Select type -> Web App.
- Enter a description for the Web App in the fields under Deployment configuration.
- Select "Me" for "Execute as". This is crucial, as it allows the script to run with your permissions to access your Google services.
- Select "Anyone" for "Who has access". This makes the URL callable from the internet. Access is controlled by the unguessable URL and the
accessKeydefined in the script. - Click Deploy.
- 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.
Preparing Gemini CLI
1. Install Gemini CLI
Follow the official documentation to install the Gemini CLI on your system. Ref
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.
- Replace
https://script.google.com/macros/s/###/execwith the Web App URL you copied earlier. - Ensure the
accessKeyquery parameter matches theaccessKeyyou defined in your Google Apps Script (samplein this example).
{
"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
{
"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, usemcp-remote.- If you use
mcp-remote, please install it. Ref - If an error like
Request timed outoccurs, please addtimeoutand useGEMINI_TIMEOUTas 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.
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. 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.
- Download
ggsrun: Get the latest release from the ggsrun releases page. The main repository is here. - Create a Google Cloud Project: Go to the Google Cloud Platform Resource Manager and click CREATE PROJECT.
- Enable Drive API: In your new project, navigate to APIs & Services > Enabled APIs & Services. Search for and enable the Drive API.
- Create Credentials: Navigate to APIs & Services > Credentials.
- Configure OAuth Client ID: Click Create credentials, select OAuth client ID, and choose Web Application.
- Set Redirect URI: Under "Authorized redirect URIs," add
http://localhost:8080. - Create and Download Credentials: Click Create, then Download JSON. Important: Rename the downloaded file to
client_secret.jsonand place it in your working directory. - 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
- 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
- Source: 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.
Reviews
No reviews yet — be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.