← Back to Work

Project note · SYSTEM

LLM Agent Workflow MCP Server (Google Workspace · Microsoft 365)

An MCP server that unifies 13 services into ~100 AI tools so an AI agent can run cross-ecosystem work from natural language alone

Role
Backend · AI/Agent
Period
2025.03 ~ 2025.07
Stack
Python · FastMCP / MCP · OAuth 2.0 / 2.1 · Google Workspace API · Microsoft Graph API · Docker

01 / Project note

I built an MCP (Model Context Protocol) server that lets an AI agent perform Google Workspace and Microsoft 365 tasks from natural-language commands alone, without any API knowledge. It integrates 13 services across both ecosystems — Gmail, Drive, Calendar, Teams, Outlook, OneDrive, SharePoint, and more — into ~100 AI tools, with the server absorbing everything from user identification to token lookup/refresh, permission checks, and the actual API calls. Cross-cutting concerns such as auth, session, and token refresh are separated via decorators, so a new tool only needs its business logic.

For an AI agent to do real work, every service brings a different API, OAuth flow, token refresh, and multi-user permissions — and exposing that complexity to the agent makes maintenance harder as tools grow. So I separated cross-cutting concerns (auth, session, token refresh, caching) into a decorator layer, letting feature tools stay unaware of auth and use only an injected, authenticated client. On failure, the server returns an auth URL instead of a plain error so the agent can self-recover, and immutable mcp_session_id–user binding plus dynamic per-active-tool scopes block cross-account access and over-broad permissions in multi-user settings. The result integrates 13 services into ~100 tools while keeping an extensible structure where new tools inherit the same auth and security guarantees by writing business logic alone.

  • Integrated 13 services across two ecosystems into ~100 AI tools (~60 Google, ~40 Microsoft)
  • Designed multi-user isolation on immutable session–user binding, blocking session hijacking and cross-account access
  • Separated auth/session/token-refresh via decorators so new tools are added with business logic only