SQLite Database MCP server

Provides a secure interface for executing validated SELECT queries on SQLite databases, enabling direct data analysis within conversation workflows.
Back to servers
Setup instructions
Provider
Javier Santos
Release date
Mar 08, 2025
Language
TypeScript
Stats
7 stars

This SQLite MCP server provides a Model Context Protocol implementation for interacting with SQLite databases. It allows AI models to execute SQL queries, manage database schemas, and analyze data through a standardized interface.

Features

The server currently supports these commands:

  • list_tables - List all tables in the SQLite database
  • read_query - Execute SELECT queries on the SQLite database (Example: SELECT * FROM users WHERE age > 18)

Installation

The recommended installation method uses Docker:

Build the Docker Image

git clone https://github.com/javsanmar5/mcp-server.sqlite.git
cd mcp-server.sqlite
docker build -t mcp/sqlite .

Configure Your AI Client

Add the MCP server configuration to your AI client's configuration file:

"mcpServers": {
  "sqlite": {
    "command": "docker",
    "args": [
      "run",
      "--rm",
      "-i",
      "-v",
      "mcp-test:/mcp",
      "mcp/sqlite",
      "--db-path",
      "test_db.sqlite3"
    ]
  }
}

Restart Your AI Client

After saving the configuration, restart your AI client to load the MCP server. The SQLite tools should now be available in your AI client's interface.

Note: On Windows systems, you might need to manually terminate the process for changes to take effect.

Setting Up with Claude Desktop

If you're using Claude Desktop, follow these steps to configure the MCP server:

  1. Open the Run dialog with Windows Key + R
  2. Type %appdata%\Claude and press Enter
  3. Create or edit a file named claude_desktop_config.json
  4. Add the configuration JSON shown above
  5. Save the file and restart Claude Desktop
  6. The SQLite tools should now appear in your Claude interface

Using the MCP Server

Once configured, you can use the MCP server through your AI client by:

  1. Asking the AI to list all tables in your database:

    • "List all tables in the SQLite database"
  2. Running SQL queries:

    • "Run this SQL query: SELECT * FROM users LIMIT 10"
    • "Count how many records exist in the products table"
  3. Analyzing data:

    • "Find the average age of users by location"
    • "Show me the sales trends for the last quarter"

The AI will use the MCP server to execute these operations and return the results to you.

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "sqlite" '{"command":"docker","args":["run","--rm","-i","-v","mcp-test:/mcp","mcp/sqlite","--db-path","test_db.sqlite3"]}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "sqlite": {
            "command": "docker",
            "args": [
                "run",
                "--rm",
                "-i",
                "-v",
                "mcp-test:/mcp",
                "mcp/sqlite",
                "--db-path",
                "test_db.sqlite3"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "sqlite": {
            "command": "docker",
            "args": [
                "run",
                "--rm",
                "-i",
                "-v",
                "mcp-test:/mcp",
                "mcp/sqlite",
                "--db-path",
                "test_db.sqlite3"
            ]
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later