AI Agent utilizing Google Calendar and Custom Function MCP Servers - n8n Workflow

Use this advanced n8n workflow to build an AI agent powered by GPT-4o that manages your Google Calendar and executes custom text processing functions via n8n MCP servers.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Automation Developers looking for advanced n8n templates.
Users who want to deploy a highly capable AI agent using n8n.
Teams needing an AI assistant to manage schedules and perform custom data transformations.
Anyone interested in learning about the n8n Microservice Computation Protocol (MCP).

Overview

This comprehensive n8n workflow demonstrates how to build scalable AI applications by separating the core AI agent from its functional tools using the n8n Microservice Computation Protocol (MCP). Instead of stuffing all logic into one massive workflow, this n8n template establishes two dedicated MCP servers (one for Google Calendar and one for utility functions) that the main AI agent consumes as external tools. This dramatically increases the agent's capability, reliability, and modularity. By using this n8n workflow, you gain an intelligent assistant capable of scheduling meetings, searching events, converting text case, and even fetching jokes, all managed through a conversational interface powered by the OpenAI 4o large language model. This approach showcases the power of the n8n node ecosystem when deployed for specialized AI tasks.

How it Works


  1. The flow starts with the When chat message received n8n trigger, initiating a conversational interaction with the user.

  2. The input message is passed to the AI Agent n8n node, which uses the OpenAI 4o LLM and Simple Memory to maintain context.

  3. The AI Agent analyzes the user's request and determines if any external tools (Calendar MCP or My Functions) need to be called.

  4. If a Google Calendar action is requested (e.g., "Schedule a meeting"), the Calendar MCP client calls the dedicated Google Calendar MCP server. This server executes the appropriate Google Calendar n8n node (SearchEvent, CreateEvent, UpdateEvent, or DeleteEvent) using AI-extracted parameters.

  5. If a utility function is requested (e.g., "Convert text"), the My Functions client calls the My Functions Server. This server identifies the specific function (e.g., converttextcase, randomuserdata, obtain_jokes) via its Tool Workflow n8n nodes.

  6. The My Functions Server routes the request to a sub-workflow (When Executed by Another Workflow) n8n trigger, which uses a Switch n8n node to execute the correct utility action (text conversion, random data generation via DebugHelper, or HTTP request for jokes).

  7. The results from the executed tools are returned to the AI Agent.

  8. The AI Agent synthesizes the final conversational response based on the tool output and delivers it back to the user via the initial chat trigger. This complete structure provides robust and scalable n8n templates for AI implementation.

Installation Guide


  1. Import: Import this n8n workflow JSON into your n8n instance.

  2. Credentials: Set up credentials for Google Calendar OAuth2 API and OpenAI API Key (using the recommended GPT-4o model).

  3. Activate: Activate the entire n8n workflow.

  4. MCP Configuration (Crucial Step): This single n8n workflow contains both the client and server components. You must connect them using their dynamic production URLs:

Obtain the production webhook URL from the Google Calendar MCP node (an n8n trigger).
Paste this URL into the sseEndpoint parameter of the Calendar MCP client node.
* Repeat this process for the My Functions Server trigger and the My Functions client node.

  1. Testing: The workflow is now ready to receive inputs via the When chat message received n8n trigger.

Node Details

When chat message received (n8n trigger): The entry point for conversational input, receiving user prompts.
AI Agent (n8n node): The core orchestrator. It uses the LLM for reasoning, maintains chat history via Simple Memory, and decides which external MCP tool to call.
OpenAI 4o (LLM Node): Provides the large language model capability, specifically chosen for its superior reliability in complex function calling within this n8n workflow.
MCP Trigger (Google Calendar MCP & My Functions Server): These are the server entry points, defining the service path (e.g., /mcp/my-calendar). They must be activated to provide their necessary production URLs for the clients.
Google Calendar Tool (n8n node): Used for Search, Create, Update, and Delete operations. Inputs (summary, start time, event ID) are dynamically injected using $fromAI() expressions extracted by the AI Agent.
Tool Workflow (n8n node): Acts as the schema definition for tools exposed by the MCP servers. It tells the AI Agent exactly what functions are available (converttextcase, randomuserdata, obtainjokes) and what inputs they require.
When Executed by Another Workflow (n8n trigger): This is the entry point for the utility sub-workflow, receiving function calls initiated by the My Functions Server MCP.
Switch (n8n node): Routes the execution path based on the input function
name provided by the MCP client.


  • HTTP Request (Joke Request): Fetches random jokes from official-joke-api.appspot.com, demonstrating seamless API integration within an n8n workflow.

Related n8n Workflows

Free

Nodes: 14 Nodes
Updated: December 26 2025
View all
Created by

Freelance consultant from Brazil, specializing in automations and data analysis. I work with select clients, addressing their toughest projects. For business inquiries, email me at [email protected] or message me on Telegram for a faster response.

Featured*