n8n MCP Integration for Agent5ive
Create a calendar integration using n8n's MCP Server Trigger node
Overview
This tutorial will guide you through creating a calendar integration for your Agent5ive agent using n8n's MCP Server Trigger node. You'll learn how to set up a publicly accessible MCP URL that your agent can use to access calendar functionality.
Prerequisites
- An Agent5ive account
- Access to n8n (self-hosted with public access or n8n Cloud)
- A Google account for calendar access (optional, for the example workflow)
Step-by-Step Guide
Set Up n8n
First, you need an n8n instance that's publicly accessible on the internet. You have two options:
- n8n Cloud (Recommended): Sign up for n8n Cloud , which provides a hosted solution with public access.
- Self-hosted with public access: If you self-host n8n, ensure it's accessible from the public internet with a domain name and HTTPS.
Create a New Workflow
Log in to your n8n account and create a new workflow:
- Click the "Create Workflow" button in the n8n dashboard
- Name your workflow with something descriptive like "Calendar MCP Integration"
Add the MCP Server Trigger Node
Now, add the MCP Server Trigger node as the starting point of your workflow:
- Click the "+" button in the workflow editor to add a node
- Search for "MCP Server Trigger" in the node search box
- Select the MCP Server Trigger node from the results
Configure the MCP Server Trigger node with authentication set to "None" (Agent5ive currently doesn't support authenticated MCP URLs).
Add Google Calendar Tools
Now, let's add Google Calendar tools to your workflow. Each tool will be exposed as a function that your agent can call.
1. Create Event Tool
- Click the "+" button to add a node after the MCP Server Trigger
- Search for "Google Calendar Tool" and select it
- Give the node a meaningful name like "googleCalendar_createEvent" (this will be the function name exposed to your agent)
- Select "Resource: Event" and "Operation: Create"
- Connect your Google Calendar account (you'll need to authorize n8n)
- For input fields like summary, description, start time, etc., click the "Magic" button to allow the AI to fulfill these values at runtime
- Connect this node to the MCP Server Trigger node
2. Check Availability Tool
- Add another Google Calendar Tool node
- Name it "googleCalendar_checkAvailability"
- Select "Resource: Calendar" and "Operation: Availability"
- Configure the relevant fields and use the "Magic" button for input parameters
- Connect this node to the MCP Server Trigger node
3. Get Event Details Tool (Optional)
- Add another Google Calendar Tool node
- Name it "googleCalendar_getEventDetails"
- Select "Resource: Event" and "Operation: Get"
- Configure it to retrieve event details and use the "Magic" button for the event ID parameter
- Connect this node to the MCP Server Trigger node
For each tool, make sure to specify all relevant fields and mark the inputs to use the "Magic" button. This allows the AI to dynamically provide values at runtime based on the user's request.
Unlike conventional trigger nodes, the MCP Server Trigger node only connects to and executes tool nodes. Each Google Calendar Tool node you've added will be exposed as a separate function that your Agent5ive agent can call.
Activate and Get the MCP URL
Now that your workflow is complete, you need to activate it and get the MCP URL:
- Click the "Save" button to save your workflow
- Toggle the "Active" switch in the top-right corner to activate your workflow
- Go back to the MCP Server Trigger node and look for the "Production URL" at the top
- Copy this URL - this is what you'll use in Agent5ive
The Production URL is generated when you activate the workflow. This URL is what you'll provide to Agent5ive in the next step.
Configure Your Agent5ive Agent
Now, let's connect your n8n MCP URL to your Agent5ive agent:
- Log in to your Agent5ive account
- Create a new agent or edit an existing one
- Navigate to the "Tools" section during agent creation/editing
- Expand the "Advanced Tools (MCP - Experimental)" section
- Toggle on "Enable Advanced Tools (via MCP Server)"
- Paste the MCP Production URL you copied from n8n
- If you enabled authentication in your n8n MCP Server Trigger node, add the corresponding headers
- Click the "Validate" button to verify the connection
If the validation is successful, you'll see a list of the calendar operations you defined in your n8n workflow that are now available to your agent.
Update Your Agent's System Prompt
To ensure your agent knows how to use the calendar integration, update your agent's system prompt with instructions:
Example System Prompt Addition:
You have access to the following calendar tools:
- googleCalendar_checkAvailability: Checks calendar availability within a specified date range. Parameters: calendarId (string), timeMin (string, ISO date), timeMax (string, ISO date)
- googleCalendar_createEvent: Creates a new calendar event. Parameters: calendarId (string), summary (string), description (string), start (string, ISO date), end (string, ISO date), location (string, optional)
- googleCalendar_getEventDetails: Gets details of a specific event. Parameters: calendarId (string), eventId (string)
Use these tools when a user asks about their calendar, wants to schedule events, or needs information about specific appointments. Always format dates in ISO format (YYYY-MM-DDTHH:MM:SS).
Test Your Integration
After deploying your agent, test the calendar integration with these example prompts:
Example Prompts to Test:
- "What times am I available tomorrow between 9 AM and 5 PM?"
- "Schedule a team meeting for next Monday at 10 AM for 1 hour"
- "Can you tell me the details of my upcoming doctor's appointment?"
Your agent should now be able to interact with Google Calendar through your n8n workflow, checking availability and creating events as requested.
Troubleshooting
MCP URL Validation Fails
If Agent5ive cannot validate your MCP URL, check these common issues:
- URL Accessibility: Ensure your n8n instance is publicly accessible from the internet
- HTTPS Required: The URL must use HTTPS, not HTTP
- Workflow Activation: Make sure your workflow is activated in n8n
- Authentication: If you enabled authentication on the MCP Server Trigger node, ensure you've added the same authentication headers in Agent5ive
- Correct URL: Verify you're using the Production URL, not the Test URL
Calendar Operations Not Working
If your agent can't perform calendar operations:
- Google Authentication: Check if your Google Calendar authentication in n8n is still valid
- Node Names: Verify that node names don't contain spaces or special characters
- Magic Button: Ensure you've used the Magic button for input fields that should be filled by the AI
- Calendar Permissions: Verify that n8n has the necessary permissions to access and modify your calendar
- Execution Logs: Check the execution logs in n8n to see if there are any errors
Extending Your Integration
Once you have the basic calendar integration working, you can extend it with additional functionality:
Additional Calendar Operations
Add more operations like deleting events, updating events, or listing calendars.
Multiple Calendars
Configure your workflow to work with multiple calendars, such as personal and work calendars.
Calendar Notifications
Add functionality to send reminders or notifications about upcoming events.
Integration with Other Services
Connect your calendar with other services like Slack, email, or task management tools.
Technical Details
Understanding how the MCP Server Trigger node works:
- Server-Sent Events (SSE): The MCP Server Trigger node supports SSE, a long-lived transport built on top of HTTP for connections between clients and the server.
- Tool Nodes Only: Unlike conventional trigger nodes which respond to events and pass their output to the next connected node, the MCP Server Trigger node only connects to and executes tool nodes. Clients can list the available tools and call individual tools to perform work.
- MCP URLs: The node has two MCP URLs: test and production. n8n displays these URLs at the top of the node panel. The production URL is generated when you activate the workflow.
- URL Path: By default, the MCP URL contains a randomly generated path to avoid conflicts with other MCP Server Trigger nodes. You can manually specify a URL path if needed.
For more information about n8n and MCP, visit the n8n documentation or contact support@agent5ive.com for assistance with Agent5ive integration.