DEV Community

Time Pass
Time Pass

Posted on

Build Your Own AI Personal Assistant: Automating Calendars with n8n and MCP

Build Your Own AI Personal Assistant: Automating Calendars with n8n and MCP

Ever wish you had an AI that could check your schedule, find gaps, and book meetings without you clicking through endless UI menus? By combining n8n (for workflow orchestration) and the Model Context Protocol (MCP), you can create a private, self-hosted calendar agent that actually does the work for you.

The Architecture

  1. n8n: The heavy lifter that handles API connectivity (Google Calendar, Outlook, Slack).
  2. MCP Server: A bridge that exposes your calendar data as "tools" to any AI agent.
  3. AI Agent (e.g., Goose or Claude): The brain that understands your natural language request and calls the tools provided by n8n.

Step-by-Step Setup

1. Build the n8n Workflow

Create an n8n workflow that performs specific actions, such as listEvents or createEvent.

  • Use the Webhook Node as the entry point.
  • Set the HTTP method to POST.
  • Configure it to return JSON data so your AI agent can parse the results easily.

2. Create the MCP Wrapper

Since n8n provides a webhook, you can create a simple MCP server that acts as a proxy, sending requests to your n8n webhook URL.

// A snippet of an MCP tool definition for your server
{
  name: "n8n_calendar_query",
  description: "Query the calendar via n8n",
  inputSchema: {
    type: "object",
    properties: {
      action: { type: "string", enum: ["list", "book"] },
      details: { type: "string" }
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

3. Connect the Agent

Configure your AI desktop client (like Goose or Claude Desktop) to point to your new MCP server.

{
  "mcpServers": {
    "calendar-agent": {
      "command": "node",
      "args": ["/path/to/mcp-n8n-proxy.js"]
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Practical Automation Workflow

Once connected, your interaction loop looks like this:

  1. You: "Check if I'm free on Friday and book a 1-hour focus session."
  2. AI Agent: Calls your n8n_calendar_query tool with action: "list".
  3. n8n: Executes the Google Calendar node, returns the free slots.
  4. AI Agent: Sees the open slots, chooses one, and calls action: "book".
  5. n8n: Updates the calendar via the Google Calendar API.

Why This Workflow Rocks

  • Security: Your calendar credentials live inside your self-hosted n8n instance, not in an AI vendor's cloud.
  • Extensibility: Want to add Slack notifications? Just add a Slack node to your n8n workflow. The AI agent doesn't even need to know the implementation changed.
  • Debuggability: Use n8n's visual execution history to see exactly why an agent failed to book a meeting.

Best Practices

  • Rate Limiting: Ensure your n8n webhook has basic authentication (Header Auth) to prevent unauthorized triggers.
  • Confirmations: For critical actions (like deleting events), configure your agent to always ask for human approval before triggering the n8n webhook.
  • Schema Precision: The more descriptive your inputSchema is, the better the LLM will be at filling in parameters like start_time or attendees.

Top comments (0)