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

Consolidating-Generative-AI-Protocols-A-Single-Server-Solution-for-MCP-and-A2A

A new unified Google Apps Script now deploys both Model Context Protocol (MCP) and Agent2Agent (A2A) networks as a single server, streamlining AI model integration for Google Workspace users.

AI Summary

Unified GAS Server for MCP & A2A Protocols

Deploy both Model Context Protocol and Agent2Agent servers with a single Google Apps Script project.

Target Users

Intermediate-to-advanced GAS developers who build Workspace AI services that need to interact with MCP or A2A clients.

Problems Solved

Without this script, developers had to maintain separate MCP and A2A server projects, complicating deployment and maintenance.

Tags

Main Features

1
Single deployment for both MCP and A2A

One GAS Web App handles HTTP requests from both MCP and A2A clients via the same endpoint.

2
Leverages existing Workspace auth

Because it runs on GAS, the script inherits Workspace OAuth scopes, letting the server call Google APIs without extra setup.

3
Shared utility functions

Reusable functions live in a single codebase, reducing duplication and version-tracking overhead for both protocols.

Usage Examples

Copy the demo project to your Drive

Paste the snippet below into an empty Google Apps Script project and run myFunction(). The demo project referenced in the repository will be copied to the root of your Drive.

/**
 * Copies the public demo GAS project to the user's Drive.
 * 1. Holds the File ID published in the README
 * 2. Uses DriveApp to create a duplicate under the same name
 */
function myFunction() {
  const fileId = "1N1eg3vEgi_eVAiPB1SrPG9NIfEEQ5qohZED9haQQ7VbOKnMfLkPkYkUe"; // Template project ID
  const file = DriveApp.getFileById(fileId);          // Fetch source file
  file.makeCopy(file.getName());                      // Duplicate in root folder
  Logger.log(`Project copied: ${file.getName()}`);
}

After copying, open the script editor, set your apiKey and the Web App URL that ends with ?accessKey=sample, then choose "Deploy → New deployment" to publish it. The resulting Web App acts as a unified MCP and A2A server.