AI Agent for Team Knowledge Management with Google Docs and Discord - n8n Workflow

Deploy an advanced n8n workflow utilizing an AI Agent, Google Docs for long-term memory, and Discord tools. This n8n templates streamlines team knowledge retrieval and response.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Teams requiring persistent, searchable knowledge bases.
Developers implementing custom AI tool orchestration within n8n.
Users looking for complex, multi-stage n8n templates integrating LangChain and storage services.
n8n specialists needing examples of sophisticated agent-based communication flows.

Overview

This sophisticated n8n workflow, dubbed the 'Zero Cost Memories MCP Server,' is designed to provide an intelligent long-term memory system for a team operating primarily through chat platforms like Discord. The core problem solved is the ephemeral nature of chat data—critical decisions and knowledge are often lost. This n8n solution uses a robust AI Agent powered by a large language model (LLM) to interface with Google Docs, treating it as a dynamic knowledge repository.

When the system receives an input (likely from a Discord channel via a specialized n8n trigger), the AI Agent determines whether the request is to save a new piece of knowledge or retrieve an existing one. The subsequent steps use Google Docs to perform the necessary file operations. This n8n workflow demonstrates how to build modular, tool-using AI systems directly within n8n, leveraging custom LangChain n8n node components for highly specific automation tasks. This setup allows for continuous learning and retrieval capabilities within your team's existing communication channels, making this one of the most powerful n8n templates for knowledge management.

How it Works

This n8n workflow operates using two primary initiation methods: an external trigger for tool definition and an internal trigger for execution.


  1. Tool Definition: The workflow is primarily defined by the MCP Server Trigger, which utilizes several Tool Workflow n8n node components (Save Memories, Retrieve Memories, Send Memories to Discord). These tools are registered by a higher-level AI Agent (not visible in this specific JSON, or the internal AI Agent node itself).

  2. Internal Execution: The process is triggered when called by another parent n8n workflow via the When Executed by Another Workflow n8n trigger. This initiates the core logic.

  3. Field Preparation: The Edit Fields n8n node prepares and standardizes the incoming data before routing.

  4. Routing: The Memory Tool Router (a Switch n8n node) analyzes the incoming request (likely determining which specific memory operation the AI Agent requested) and routes the execution path accordingly: either to save memory, retrieve a general memory, or retrieve a memory specifically for a Discord response.

  5. Memory Operations (Saving): If saving, the Save Long Term Memories n8n node uses Google Docs to append or update the team knowledge document. The successful response is captured by the Saved response Set n8n node.

  6. Memory Operations (Retrieving): If retrieving, the Retrieve Long Term Memories or Retrieve Long Term Memories Discord n8n node queries the Google Docs knowledge base.

  7. AI Agent Response Generation: In the case of Discord retrieval, the result feeds into the main AI Agent n8n node, which uses the 4o-mini LangChain n8n node (the LLM) and the Discord tools (DM User, Send to Channel) to formulate and deliver a coherent response back to the user or channel. This integrated process ensures a dynamic and intelligent output, leveraging the power of this specific n8n workflow.

Installation Guide

To utilize this complex n8n workflow, follow these steps:


  1. Import the JSON: Copy the provided n8n workflow JSON and paste it directly into your n8n instance via the 'New' menu -> 'Import from JSON'.

  2. Google Docs Credentials: You must set up Google Docs credentials. This requires a Google Service Account or OAuth 2.0 configuration with access to the target knowledge document used by the Save Long Term Memories and Retrieve Long Term Memories n8n node components.

  3. Discord Credentials: Set up Discord credentials (Bot Token and required permissions) for the DM User and Send to Channel n8n node actions. The webhook IDs must correspond to your active application.

  4. OpenAI/LLM Credential Setup: Ensure your 4o-mini (or equivalent OpenAI) credentials are configured for the lmChatOpenAi n8n node, providing the API key necessary for the AI Agent to function.

  5. MCP Trigger Setup: The MCP Server Trigger n8n trigger is crucial. Note the webhook ID provided (14877796-8d49-4bde-98cb-2b035d9e9f76) and configure the parent AI Agent or external system to call this endpoint. This n8n workflow is designed to be an internal service for a larger AI Agent system.

Node Details

This n8n workflow relies heavily on specialized AI and data persistence n8n node components:

MCP Server Trigger (LangChain): This specialized n8n trigger is used to define and expose the core functionalities of this server to a centralized AI Agent. It acts as the entry point for tool execution requests.
When Executed by Another Workflow (n8n trigger): The standard way the internal logic of this service is executed, triggered by the parent LangChain Agent or another n8n workflow.
Google Docs (n8n node): Used by Save Long Term Memories and Retrieve Long Term Memories to interact with the persistent knowledge store. It handles text appending and document reading.
Memory Tool Router (Switch n8n node): Essential for corelogicflow_control. It directs the execution path based on the input command (save vs. retrieve).
AI Agent (LangChain n8n node): The central decision-making component. It utilizes available tools (Discord, memory tools) and the LLM (4o-mini) to process the request and generate a relevant response.
4o-mini (LLM Chat OpenAI n8n node): Provides the necessary intelligence for the AI Agent to reason, access memory, and construct natural language responses.


  • Discord Tool (n8n node): Configured as DM User and Send to Channel, these nodes allow the AI Agent to communicate the results of its memory search back to the requesting user or team channel, finalizing the end-to-end n8n workflow.

Related n8n Workflows

Paid

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

A hacker by nature, programmer by trade ⚒️ I'm looking to collaborate on things that save human labor 📫 How to reach me Github👇 -> Discord

Featured*