Labsco
MCP SERVER

Unified MCP & A2A Server

by tanaikech

One Google Apps Script Web App that serves both an MCP server and an A2A agent, sharing the same functions.

Summary
Worth reading for the pattern more than for the code.

This is published as a report with a working demo attached, and the idea it demonstrates is genuinely useful: MCP and A2A are different protocols over the same HTTP surface, so one Apps Script deployment can answer both and share its functions between them. It is also honest about the sharp edges — the client-side patch A2A needs, and the redeploy-as-new-version rule that silently serves stale code if you skip it.

What it is

A unified Google Apps Script that deploys an MCP server and an Agent2Agent (A2A) server as a single Web App. Both clients hit the same URL over HTTP GET and POST, and both protocols share the same underlying functions — which is the point: one project instead of two, with the common logic written once.

What you get
  • A single Web App URL acting as both servers, so an MCP client such as Claude Desktop and an A2A client such as `@a2a-js/sdk` reach the same functions
  • Direct access to Google Workspace and Google APIs from inside the server, since Apps Script runs with your own authorization rather than needing separate credentials per service
  • A copyable demo project — running one function copies the sample Apps Script into the root of your Google Drive, ready to deploy
  • A helper, `getRegisteringAgentCardURL()`, that prints the URL the A2A client needs for the agent card
  • Shared functions between the MCP and A2A sides, which is what removes the duplicated development cost of maintaining two servers
Requirements

A Google account and a Gemini API key, set as `apiKey` in the copied script. Deploy the script as a Web App with **Execute as: Me** and **Who has access: Anyone**, then copy the deployment URL and add an `accessKey` query parameter to it. Claude Desktop connects through `npx mcp-remote` pointed at that URL. Two things to plan around: modifying the script requires redeploying as a **new version** or the Web App keeps serving the old code, and the A2A side needs a small patch to `@a2a-js/sdk` — Apps Script Web Apps require an access token as a query parameter on the well-known agent-card path, which most current A2A clients do not support, and they also require following a redirect, which the public Python A2A client does not do. MIT licensed.

Setup effort

One command plus a key — npx mcp-remote https://script.google.com/macros/s/###/exec?accessKey=sample, then supply credentials