Build an MCP Server in n8n: Google Calendar + Custom Functions Dual-Service Example
Import template → Configure two MCP servers (Google Calendar tools + custom function sub-workflows) → Connect via MCP Clients to an AI Agent → Interact through chat trigger
- Who
- Operators already running n8n 1.88.0+ who want to extend their AI Agent's tool set using the MCP protocol
- You get
- A working setup that exposes both Google Calendar operations (search/create/update/delete events) and custom functions (text case conversion, random user data, fetch jokes) as MCP servers, with an AI Agent auto-discovering and calling them through MCP Clients
- You need
- n8n · MCP Trigger · MCP Client · Google Calendar · Sub-workflow
Constraints
Prerequisites: n8n 1.88.0 or later; an n8n instance reachable enough to generate MCP Production URLs. Google Calendar OAuth credentials required (n8n Cloud users can configure directly in the UI). No extra credentials needed for the custom function side. After importing the template, activate the workflow and copy each MCP Trigger's Production URL into its corresponding MCP Client per the in-workflow sticky notes.
What they did
Author Solomon published an official n8n template demonstrating how to build two MCP Servers (Google Calendar tool set + custom function set) using native n8n nodes, and connect them to an AI Agent via MCP Clients. The template contains 33 nodes; the core flow is: AI Agent (gpt-4o) ← two MCP Clients ← two MCP Triggers ← respective tool sets. The Google Calendar side provides search/create/update/delete operations; the custom function side implements text case conversion, random user data generation, and random joke fetching through a sub-workflow.
How it went
The author reports the template runs on n8n 1.88.0+ and that gpt-4o reliably handles calendar requests, while 4o-mini struggled in their tests (author_report). The template has been viewed over 73,000 times.
Worth knowing
1. The MCP Client sseEndpoint fields use placeholder domain n8n.yourdomain and must be replaced with your actual reachable address, or the Agent cannot connect to tools. 2. Google Calendar tools require valid OAuth credentials; n8n Cloud users can configure this more easily, while self-hosted users should follow the official video tutorial. 3. The custom function sub-workflow shares the same workflow ID ({{ $workflow.id }}) with the main workflow and is triggered by 'When Executed by Another Workflow'; if copied as a standalone workflow, the workflowId must be adjusted. 4. The author only tested with gpt-4o; 4o-mini compatibility has not been fully verified. 5. This site has not imported or run the workflow (reproduction=not_tested); validate credentials and URL connectivity in an isolated environment before production use.
n8n workflow template
Structure checked · Not run-testedUse “Import from File” in n8n, or copy the JSON and paste it into the editor. Connect your own accounts, then try test data. The template is inactive by default.
Setup and test checklist
Credentials to connect
- After import, connect your own credentials on auth-required nodes; author secrets are not included.
Configuration to replace
- Source template is n8n public workflow #3514 (~33 nodes). Keep inactive after import; verify triggers, expressions and external API endpoints.
- Sticky-note guidance is informational; replace placeholders with your own accounts, sheet schemas or channel IDs.
Test input and expected output
- Manually run the main path once in a test workspace and confirm credentialed nodes authenticate without errors.
- Drive one synthetic/redacted sample through and check output fields and downstream writes before enabling in production.
Template changes
- Author credential bindings, webhookId and execution data are removed; the workflow is inactive. Nodes, connections and original prompts are preserved. Not run-tested in n8n.
- No business-logic edits; verify keys, quotas and privacy compliance before use.
Template retrieved: 2026-10-25
Steps
Import template and understand the architecture
Import 'Build an MCP server with Google Calendar and custom functions' from the n8n template library. Architecture overview: left side is the AI Agent conversation entry (Chat Trigger + AI Agent + OpenAI 4o + Simple Memory); middle layer has two MCP Clients (Calendar MCP / My Functions); right side hosts two MCP Trigger servers (Google Calendar MCP / My Functions Server) with their respective tool nodes underneath.
Activate the workflow and obtain MCP server URLs
Activate the workflow. Open the two MCP Trigger nodes (Google Calendar MCP, My Functions Server) and copy their Production URLs (typically https://your-n8n-domain/mcp/{path}/sse). These URLs will be used in the next step to configure the MCP Clients.
Setup guidance · Source text。Sticky Note next to MCP Trigger nodes; operational instruction
## Activate the workflow to make the MCP Trigger work In order to make the MCP server available, you need to activate the workflow. Then copy the Production URL of the MCP Trigger and paste it in the corresponding MCP Client tool.
Configure MCP Client endpoints
Open the Calendar MCP and My Functions MCP Client nodes. Paste the corresponding Production URLs from the previous step into the sseEndpoint field. The template uses placeholder addresses https://n8n.yourdomain/mcp/my-calendar/sse and https://n8n.yourdomain/mcp/my-functions/sse; replace these with your actual domain and path.
Setup guidance · Source text。Sticky Note next to MCP Client nodes; configuration instruction
## MCP Clients For every tool here you need to obtain he corresponding Production URL from the MCP Triggers on the right 👉
Configure Google Calendar credentials and tool parameters
The Google Calendar MCP server hosts four Google Calendar Tool nodes: SearchEvent, CreateEvent, UpdateEvent, and DeleteEvent. Each requires Google Calendar OAuth credentials. The calendar field defaults to [email protected]; replace it with your actual calendar ID. Tool parameters use $fromAI() and are auto-filled by the AI Agent; no manual fixing needed.
Setup guidance · Source text。Sticky Note in Google Calendar tools area; credential guidance
## Google Calendar tools require credentials If you don't have your Google Credentials set up in n8n yet, watch [this](https://www.youtube.com/watch?v=3Ai1EPznlAc) video to learn how to do it. If you are using n8n Cloud plans, it's very intuitive to setup and you may not even need the tutorial.
Review the custom function sub-workflow
The My Functions Server exposes three toolWorkflow nodes through its MCP Trigger: Convert Text (case conversion), Generate random user data, and Random Jokes. These tools call an internal sub-workflow segment within the same workflow: triggered by 'When Executed by Another Workflow', routed by a Switch node based on function_name to the appropriate branch (uppercase / lowercase / random_user_data / joke). The sub-workflow receives a payload parameter and returns results. No changes are required for basic use.
Setup guidance · Source text。Sticky Note in sub-workflow area; architecture explanation
## The My Functions MCP calls this sub-workflow every time. A subworkflow is a separate workflow that can be called by other workflows and is able to receive parameters. Learn more about sub-workflows **[here](https://docs.n8n.io/flow-logic/subworkflows/)**
Configure the AI Agent and model
The AI Agent node uses OpenAI 4o (gpt-4o) as the language model. Its System Message is: '=You are a helpful assistant.\nCurrent datetime is {{ $now.toString() }}'. Simple Memory provides conversational context. Chat Trigger is the default chat entry. Author note: 4o-mini struggled with calendar requests in testing, while 4o handled them smoothly; 4o-mini may work but requires further validation.
Execution prompt · Source text。AI Agent node systemMessage field
=You are a helpful assistant. Current datetime is {{ $now.toString() }}Setup guidance · Source text。Sticky Note next to OpenAI 4o node; model selection note
## Why model 4o? 👆 After testing 4o-mini it had some difficulties handling the calendar requests, while the 4o model handled it with ease. Depending on your prompt and tools, 4o-mini might be able to work well too, but it requires further testing.
Test the setup
[First-test safety] Before sending the examples below, use a dedicated test calendar (change the calendar field), or disconnect CreateEvent / UpdateEvent / DeleteEvent first; only reconnect a real calendar after tool calls look correct. Send example requests through the Chat Trigger to verify both MCP services. Custom function examples: 'Use your tools to convert this text to lower case: EXAMPLE TeXt', 'Generate 5 random user data', 'Please obtain 3 jokes'. Calendar examples: 'What is my schedule for next week?', 'I have a meeting with John tomorrow at 2pm. Please add it to my Calendar.', 'Cancel my meeting with John, tomorrow.' Observe whether the AI Agent correctly invokes the corresponding tools and returns results.
Execution prompt · Source text。Sticky Note in Chat Trigger area; test examples list
# Try these example requests with the AI Agent ### My Functions MCP 1. Use your tools to convert this text to lower case: `EXAMPLE TeXt` 2. Use your tools to convert this text to upper case: `example TeXt` 3. Generate 5 random user data, please. 4. Please obtain 3 jokes. ### Calendar MCP 5. What is my schedule for next week? 6. I have a meeting with John tomorrow at 2pm. Please add it to my Calendar. 7. Adjust the time of my meeting with John tomorrow from 2pm to 4pm, please. 8. Cancel my meeting with John, tomorrow.
Prompt you can copy
Setup guidance · Editorial suggestion。Hand to setup assistant; confirm inputs and permissions first
This block is the prompt. Ads are never placed here.
You are an n8n workflow setup assistant. The user wants to reproduce the 'Build an MCP server with Google Calendar and custom functions' template. Assist in this order: 1. Confirm the user's n8n version is ≥ 1.88.0 and their instance is reachable to generate Production URLs. 2. Guide them to import the template and identify the three areas: AI Agent (left), MCP Clients (middle), MCP Servers (right). 3. Help activate the workflow, obtain the two MCP Trigger Production URLs, and paste them into the corresponding MCP Client sseEndpoint fields. 4. Remind them to configure Google Calendar OAuth credentials and replace the calendar field with a real calendar ID. 5. Explain the custom function sub-workflow Switch routing logic and confirm no changes are needed. 6. Provide the 8 test examples for verification. If invocations fail, check URL reachability, credential validity, and model quota.
Paste this prompt into an AI chat to get step-by-step setup guidance. You will need: n8n 1.88.0+ instance, Google Calendar OAuth credentials, and a reachable n8n domain.
Source
Build an MCP server with Google Calendar and custom functions · solomon · n8n.io · 2025-04-10
Comments & feedback
Tried this method? Share results, problems or improvements. Comments appear after moderation. Please avoid sensitive information.
Loading…
Agent feedback
Reports are submitted by Agents and shared after user confirmation and moderation. They are not platform-verified.