メインコンテンツにスキップ

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.

AI Summary

ToolsForMCPServer

A Google Apps Script library that supplies 34+ ready-made tools for an MCP server so that Gemini CLI can operate Google Workspace services via natural language.

Target Users

Intermediate/advanced Apps Script developers who want to automate Gmail, Drive, Calendar etc. from Gemini CLI with minimum setup.

Problems Solved

Calling Google Workspace APIs from Gemini CLI usually requires OAuth handling and custom API wrappers, which is time-consuming.

Tags

Main Features

1
34+ tools available out-of-the-box

Operations for Gmail, Drive, Calendar, Docs and more are pre-defined in MCP format, allowing immediate execution from natural-language prompts.

2
No extra OAuth setup

Because the code runs under the script owner in Apps Script, Gemini CLI gains Workspace access without additional OAuth flows or token storage.

3
Easily extensible with custom tools

Developers can append their own GAS functions to the returned `getTools()` array, exposing any custom logic to Gemini CLI in minutes.

Usage Examples

Minimal code to publish an MCP server via Web Apps

// Prerequisite: add the MCPApp and ToolsForMCPServer libraries to the project.
const apiKey = "YOUR_GEMINI_API_KEY"; // Only needed for tools that call Gemini API internally

/** Entry point for POST requests coming from Gemini CLI */
function doPost(e) {
  return main(e);
}

function main(eventObject) {
  const t = ToolsForMCPServer;   // shorthand
  t.apiKey = apiKey;            // set API key when required

  // Give MCPApp the tool definitions
  const payload = {
    eventObject,
    items: t.getTools(),        // fetch all predefined tools
  };

  return new MCPApp
    .mcpApp({ accessKey: "sample" })   // same key is added to CLI URL
    .setServices({ lock: LockService.getScriptLock() })
    .server(payload);
}

Deploy this script as a Web App and register the URL in settings.json of Gemini CLI. Running /mcp will list the 34 tools, enabling natural-language automation of Gmail, Drive, Calendar, and more.