AI Agent with RAG, Qdrant, and Local LLM Integration - n8n Workflow

Deploy a robust n8n workflow for a Question-Answering AI agent using RAG with Qdrant, Ollama embeddings, and local LLM execution via the MCP Server n8n trigger.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Developers and engineers seeking advanced n8n templates for building complex AI agents.
Users looking to integrate local LLMs (like Llama via Ollama) with a knowledge retrieval system (RAG).
Organizations needing a private, self-hosted knowledge base solution using Qdrant and n8n.
Technical users familiar with the LangChain architecture within n8n.

Overview

This sophisticated n8n workflow creates a full-stack Retrieval-Augmented Generation (RAG) agent architecture. It solves the problem of building highly specialized AI assistants that can access private knowledge and execute external tools, moving beyond standard API calls. The automation is split into two parts: an Ingestion Pipeline for processing PDF documents into a Qdrant vector database, and the AI Agent Pipeline which uses an n8n trigger from an MCP Client to initiate complex queries. This approach ensures your AI agent can provide accurate, up-to-date answers based on your internal documentation, significantly enhancing the capability of the core n8n node architecture.

How it Works

This n8n workflow operates in two distinct phases:

Phase 1: Knowledge Ingestion (RAG Setup)


  1. The process starts with the 'On form submission' n8n trigger, configured to accept PDF file uploads for the RAG knowledge base.

  2. The uploaded binary file is loaded by the 'Default Data Loader' n8n node.

  3. The 'Recursive Character Text Splitter' processes the text into optimized chunks (400 characters) to prepare for vectorization.

  4. The 'Embeddings Ollama1' n8n node generates embeddings using the mxbai-embed-large:latest model, connecting to a local Ollama service.

  5. The 'Qdrant Vector Store1' n8n node inserts these embeddings into the specified mcp_rag collection, establishing the RAG database within this n8n workflow.

Phase 2: AI Agent Execution


  1. The primary 'MCP Server Trigger' acts as the core n8n trigger for the agent, waiting for a prompt or query from an external MCP Client.

  2. When triggered, the underlying LangChain agent framework is initialized. This n8n workflow provides the agent with multiple tools:

The 'Qdrant Vector Store' (in retrieval mode) allows the agent to perform knowledge lookups against the specialized database. Retrieval embeddings are handled by the connected 'Embeddings Ollama' n8n node.
The 'MCP Client' n8n node instances are available as external tools (e.g., executing code or performing complex searches), extending the agent's real-time capabilities.

  1. The AI agent decides whether to use the RAG tool (Qdrant) or the external client tool based on the incoming query to formulate a final, comprehensive response.

Installation Guide


  1. Import: Import this specialized n8n workflow JSON into your self-hosted n8n instance.

  2. Credentials: You must configure the required credentials for the LangChain n8n node connections:

Ollama API: Set up connections for both Embeddings Ollama nodes pointing to your running local Ollama service.
Qdrant API: Configure credentials for the local Qdrant database instance used by both vector store n8n nodes, ensuring access to the mcp_rag collection.
* MCP Client API: Configure the connection details for the MCP Client accounts, ensuring the agent can communicate with the external environment needed by the n8n workflow.

  1. Initial RAG Setup: Execute the RAG Ingestion Pipeline (the form submission n8n trigger) once to upload and process your initial set of PDF documents into Qdrant.

  2. Deployment: Activate the n8n workflow and ensure the MCP Server Trigger is running to accept incoming queries.

Node Details

MCP Server Trigger: The core entry point for the AI Agent. This n8n trigger waits for requests from an external Multi-Client Protocol Client to initiate the question-answering process.
On form submission: The specific n8n trigger used for the RAG ingestion pipeline, designed to accept PDF file uploads easily.
Qdrant Vector Store (Retrieve): Configured as an AI tool within the n8n node structure to allow the agent to perform RAG knowledge retrieval from the mcprag collection.
Qdrant Vector Store1 (Insert): Handles the insertion of vectorized document chunks into the mcp
rag collection during the ingestion phase of the n8n workflow.
Embeddings Ollama / Embeddings Ollama1: These critical n8n nodes utilize the mxbai-embed-large:latest model to generate document embeddings, connecting to a local Ollama service. Essential for all RAG functionality in this n8n template.
Recursive Character Text Splitter: An n8n node that configures text segmentation before vectorization (Chunk Size 400, Overlap 100), ensuring efficient RAG query performance.
MCP Client / MCP Client1: These n8n node instances define callable tools available to the AI agent, providing capabilities beyond the static RAG database, such as complex search or execution (e.g., the execute_tool).
Default Data Loader: The n8n node responsible for loading binary input (like PDFs) received from the form trigger for processing and splitting.

Related n8n Workflows

Free

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

Featured*