by tanaikech
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.
# Add to your Claude Code skills
git clone https://github.com/tanaikech/ToolsForMCPServerThe 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.

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.
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 .
No comments yet. Be the first to share your thoughts!
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.
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.
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
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:
1TlX_L9COAriBlAYvrMLiRFQ5WVf1n0jChB6zHamq2TNwuSbVlI5sBUzhMCPApp1lnE7UL1jQgPDbTB9yjhiwZM0SaS9MObhzvWUWb_t8FisO6A3bLepvM2jToolsForMCPServerPlease 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 apiKey line in the script and provide a valid API key for the Gemini API.
If you want to use the specific Google Calendar, please set defaultCalendarId.
APIs
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);
}
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);
}
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:
accessKey defined in the script.