Table of contents

Thousands of companies trust Merge to accelerate AI from PoC to production.
Get a demo

How to connect a Google Calendar MCP with Codex (4 steps)

Jon Gitlin
Senior Content Marketing Manager
at Merge

When you hand Codex a task to build a scheduling feature or a calendar sync, you usually describe the event data in the prompt.

That description glosses over the parts of Google Calendar's model that actually break code.

All-day events use start.date while timed events use start.dateTime, recurring events carry RRULE strings that have to be expanded, and every timestamp depends on a time zone field.

So Codex generates a parser that throws on the first all-day event, recurrence logic that drops repeated instances, or scheduling code that lands an hour off.

To give Codex direct access to Google Calendar as it works through your coding tasks, we'll show you how to connect Google Calendar with Merge Agent Handler's Google Calendar MCP server.

How it works

Merge Agent Handler connects Codex to the Google Calendar API through the Merge CLI. You install the CLI, authenticate once, and run a single setup command from your project root.

That command writes a Merge CLI section to your project's AGENTS.md file, which tells Codex when to call merge search-tools and merge execute-tool to reach Google Calendar.

Once connected, Merge handles OAuth token storage and refresh on your behalf, so you never embed Google credentials in your repo or manage per-user authorization state yourself.

Related: How to use the Google Calendar MCP in Claude Code

Prerequisites

Before getting started, you'll need the following:

  • A Merge Agent Handler account
  • Codex access (available via the OpenAI platform)
  • pipx installed (run pipx --version to confirm, or install via pip install pipx)
  • A Google account with access to the calendars your tasks need

If you want to connect Merge Agent Handler's Google Calendar MCP with internal or customer-facing agentic products, you can follow the steps in our docs.

1. Install the Merge CLI

Install the Merge CLI with pipx: pipx install merge-api

Verify the install: merge --version

2. Log in to Merge

Run the following to authenticate the CLI with your Merge Agent Handler account: merge login

This links the CLI to your Merge account and stores your session credentials locally.

3. Add Agent Handler to Codex

From the root of the project where you want Codex to reach Google Calendar, run:

merge setup agents-md

This writes a Merge CLI section to your project's AGENTS.md file so Codex knows to use the CLI when a task needs Google Calendar data. The command is idempotent, safe to re-run if you need to reset the configuration.

Commit the updated AGENTS.md so the configuration travels with the repo.

Related: A guide to integrating the Google Calendar MCP with Cursor

4. Authenticate Google Calendar

Create a Codex task that needs live Google Calendar data. For example: "Read a week of events from this calendar, including a recurring event and an all-day event, then scaffold a booking service that finds open 30-minute slots."

The first time Codex invokes a Google Calendar tool, a Magic Link will appear to complete connector authentication.

Authenticating the Google Calendar connector

Once authenticated, Codex can reach your Google Calendar account through Merge for every later task in this project.

{{this-blog-only-cta}}

Google Calendar MCP FAQ

In case you have more questions on setting up and using the Google Calendar MCP with Codex, we've addressed several more commonly-asked questions below.

What can you do once the Google Calendar MCP is connected to Codex?

With Google Calendar connected, Codex can:

  • Read a real event, including its time zone and all-day handling, before scaffolding event-creation code: pull a live event so the create and update payloads it generates use the right fields, start.date for all-day and start.dateTime with a time zone for timed events
  • Pull free/busy data across calendars before generating a booking algorithm: fetch real availability so the slot-finding logic it writes is calibrated to how densely the calendars are actually booked, not an idealized empty week
  • Read recurring events before generating test fixtures for a sync job: fetch live RRULE-based events so the fixtures and assertions it produces cover the recurrence cases the sync will hit in production
  • Pull calendar time zone settings before generating conversion logic: retrieve the real time zone configuration of the calendars so the conversion and display code it writes handles cross-zone events correctly
  • Read attendee data before scaffolding a notification service: fetch an event with multiple attendees so the routing and reminder code it generates reflects the real responseStatus values it needs to branch on

Why use Merge Agent Handler vs. a self-hosted Google Calendar MCP server?

You can build your own MCP server on top of the Google Calendar API. For one developer on one account, it's workable: set up a Google Cloud project, run the OAuth consent flow, and write tool schemas for the endpoints your tasks touch.

It gets harder once more than one person uses it or tasks run in CI.

Google issues short-lived access tokens with refresh tokens, and every connected user needs their own token pair, refresh cycle, and handling for revoked access. A silent refresh failure means a Codex task quietly runs against stale or missing calendar data, with no central view of which connections are live.

A self-hosted server doesn't change that. You still own the OAuth plumbing and the Google Cloud project, and now you maintain the server too. Community Google Calendar MCP builds vary in endpoint coverage and upkeep, so you're betting on someone else's maintenance.

Merge Agent Handler handles credential storage and token refresh across every connected user. You can scope exactly which Google Calendar operations a Codex task can call, and every call is logged with identity, timestamp, and inputs.

For an agent reading calendars that contain meeting details and attendee information, scoped access plus full audit logging is the foundation you want in place first.

Why connect Google Calendar to Codex?

Google Calendar holds the event objects, recurrence rules, time zone settings, and attendee data that scheduling code has to handle exactly.

Codex tasks that build booking features, calendar syncs, or notification services need that ground truth to produce code that works against real calendars.

The alternative is describing the data in the prompt, and those descriptions skip the hard parts. A summary rarely mentions that all-day events use a different field than timed ones, that recurring events arrive as RRULE strings, or that every timestamp is time-zone dependent. This leads Codex to generate code that breaks on the first real event that hits one of those cases.

Connecting Google Calendar lets Codex read the actual events when a task needs them. The real event object before event-creation code, real availability before a booking algorithm, real recurring events before a sync: Codex works from the calendar itself, not a paraphrase of it.

Can I use Merge Agent Handler's Google Calendar MCP with my employees?

Yes, Agent Handler for Employees is built to help organizations provision, secure, and govern how employees connect AI tools like Codex to systems like Google Calendar.

Common patterns include:

  • Provisioning and access control via SCIM with identity providers like Okta and Microsoft Entra ID, so IT can manage which calendars an employee's agent can reach by role or team
  • DLP and policy enforcement on tool calls, so admins can block queries that would return sensitive meeting details or attendee data before results reach a Codex task's context
  • User-level audit logging so security and IT teams can review which calendars and events were accessed, by which employee identity, and when

Taken together, employees can use the Google Calendar MCP to scaffold booking features against real event objects, generate sync jobs that handle real recurrence rules, and build notification services grounded in actual attendee data, and more, while IT keeps centralized control over which calendars each agent can reach.

Jon Gitlin
Senior Content Marketing Manager
@Merge

Jon Gitlin is the Managing Editor of Merge's blog. He has several years of experience in the integration and automation space; before Merge, he worked at Workato, an integration platform as a service (iPaaS) solution, where he also managed the company's blog. In his free time he loves to watch soccer matches, go on long runs in parks, and explore local restaurants.

Read more

How our product designer uses AI to move at engineering speed

AI

Agent Handler’s Quartr connector is live! Here's how your AI can securely use it 

Company

How Merge activates institutional knowledge with Agent Handler’s Notion connector 

AI

Subscribe to the Merge Blog

Get stories from Merge straight to your inbox

Subscribe

Connect Codex to thousands of tools with Merge Agent Handler

Use Merge Agent Handler’s 150+ connectors (including Google Calendar) to power reliable, secure, and powerful agents.

Get started for free
But Merge isn’t just a Unified 
API product. Merge is an integration platform to also manage customer integrations.  gradient text
But Merge isn’t just a Unified 
API product. Merge is an integration platform to also manage customer integrations.  gradient text
But Merge isn’t just a Unified 
API product. Merge is an integration platform to also manage customer integrations.  gradient text
But Merge isn’t just a Unified 
API product. Merge is an integration platform to also manage customer integrations.  gradient text