Skip to main content

Build your own SQLite MCP server

Workflow preview

Workflow preview
100%
Build your own SQLite MCP server preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

This template is for Self Hosted N8N Instances only. This n8n demonstrates how to build a simple SQLite MCP server to perform local database operations as well as use it for Business Intelligence. ...

Best for

  • Engineering automation workflows
  • AI RAG automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.executeworkflowtrigger, n8n-nodes-base.switch, n8n-nodes-base.stickynote, @n8n/n8n-nodes-langchain.mcptrigger, n8n-nodes-base.code, @n8n/n8n-nodes-langchain.toolcode, @n8n/n8n-nodes-langchain.toolworkflow

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Jimleuk.

Original n8n.io source

1.1 Workflow description

Title
Build your own SQLite MCP server
Workflow name
Build your own SQLite MCP server

This template is for Self-Hosted N8N Instances only.

This n8n demonstrates how to build a simple SQLite MCP server to perform local database operations as well as use it for Business Intelligence.

This MCP example is based off an official MCP reference implementation which can be found here -https://github.com/modelcontextprotocol/servers/tree/main/src/sqlite

How it works

  • A MCP server trigger is used and connected to 5 tools: 2 Code Node and 3 Custom Workflow.
  • The 2 Code Node tools use the SQLLite3 library and are simple read-only queries and as such, the Code Node tool can be simply used.
  • The 3 custom workflow tools are used for select, insert and update queries as these are operations which require a bit more discretion.
  • Whilst it may be easier to allow the agent to use raw SQL queries, we may find it a little safer to just allow for the parameters instead. The custom workflow tool allows us to define this restricted schema for tool input which we'll use to construct the SQL statement ourselves.
  • All 3 custom workflow tools trigger the same "Execute workflow" trigger in this very template which has a switch to route the operation to the correct handler.
  • Finally, we use our Code nodes to handle select, insert and update operations. The responses are then sent back to the the MCP client.

How to use

  • This SQLite MCP server allows any compatible MCP client to manage a SQLite database by supporting select, create and update operations. You will need to have a SQLite database available before you can use this server.
  • Connect your MCP client by following the n8n guidelines here - https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-langchain.mcptrigger/#integrating-with-claude-desktop
  • Try the following queries in your MCP client:
    • "Please create a table to store business insights and add the following..."
    • "what business insights do we have on current retail trends?"
    • "Who has contributed the most business insights in the past week?"

Requirements

Customising this workflow

  • If the scope of schemas or tables is too open, try restrict it so the MCP serves a specific purpose for business operations. eg. Confine the querying and editing to HR only tables before providing access to people in that department.
  • Remember to set the MCP server to require credentials before going to production and sharing this MCP server with others!

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - When Executed by Another Workflow

Type / Role
n8n-nodes-base.executeWorkflowTrigger - executeWorkflowTrigger
Config choices
Version 1.1

Block 2 - Operation

Type / Role
n8n-nodes-base.switch - switch
Config choices
Version 3.2

Block 3 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 4 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 5 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 6 - SQLite MCP Server

Type / Role
@n8n/n8n-nodes-langchain.mcpTrigger - mcpTrigger
Config choices
Version 1

Block 7 - CreateRecord

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 8 - UpdateRecord

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 9 - ReadRecords

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 10 - DescribeTables

Type / Role
@n8n/n8n-nodes-langchain.toolCode - toolCode
Config choices
Version 1.1

Block 11 - ListTables

Type / Role
@n8n/n8n-nodes-langchain.toolCode - toolCode
Config choices
Version 1.1

Block 12 - CreateRecords

Type / Role
@n8n/n8n-nodes-langchain.toolWorkflow - toolWorkflow
Config choices
Version 2.1

Block 13 - UpdateRows

Type / Role
@n8n/n8n-nodes-langchain.toolWorkflow - toolWorkflow
Config choices
Version 2.1

Block 14 - ReadRows

Type / Role
@n8n/n8n-nodes-langchain.toolWorkflow - toolWorkflow
Config choices
Version 2.1

Block 15 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 16 - Sticky Note4

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

3. Summary Table

Workflow Build your own SQLite MCP server
Complexity advanced
Nodes 16
Categories Engineering, AI RAG
Author Jimleuk
Published 21 Apr 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/3632/3632.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Build your own SQLite MCP server do?

This template is for Self Hosted N8N Instances only. This n8n demonstrates how to build a simple SQLite MCP server to perform local database operations as well as use it for Business Intelligence. ...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Engineering, AI RAG use case.