SQLite MCP server

Query and analyze SQLite databases directly.
Back to servers
Provider
Anthropic
Release date
Nov 19, 2024
Language
Python
Package
Stats
79.9K downloads
42.3K stars

The SQLite MCP Server provides database interaction and business intelligence capabilities through SQLite, allowing you to run SQL queries, analyze business data, and automatically generate business insight memos.

Installation Options

Installing with Claude Desktop

Using UV

# Add the server to your claude_desktop_config.json
"mcpServers": {
  "sqlite": {
    "command": "uv",
    "args": [
      "--directory",
      "parent_of_servers_repo/servers/src/sqlite",
      "run",
      "mcp-server-sqlite",
      "--db-path",
      "~/test.db"
    ]
  }
}

Using Docker

# Add the server to your claude_desktop_config.json
"mcpServers": {
  "sqlite": {
    "command": "docker",
    "args": [
      "run",
      "--rm",
      "-i",
      "-v",
      "mcp-test:/mcp",
      "mcp/sqlite",
      "--db-path",
      "/mcp/test.db"
    ]
  }
}

Installing with VS Code

Manual Installation with UV

Add the following JSON block to your User Settings (JSON) file in VS Code (press Ctrl + Shift + P and type Preferences: Open Settings (JSON)):

{
  "mcp": {
    "inputs": [
      {
        "type": "promptString",
        "id": "db_path",
        "description": "SQLite Database Path",
        "default": "${workspaceFolder}/db.sqlite"
      }
    ],
    "servers": {
      "sqlite": {
        "command": "uvx",
        "args": [
          "mcp-server-sqlite",
          "--db-path",
          "${input:db_path}"
        ]
      }
    }
  }
}

Manual Installation with Docker

{
  "mcp": {
    "inputs": [
      {
        "type": "promptString",
        "id": "db_path",
        "description": "SQLite Database Path (within container)",
        "default": "/mcp/db.sqlite"
      }
    ],
    "servers": {
      "sqlite": {
        "command": "docker",
        "args": [
          "run",
          "-i",
          "--rm",
          "-v",
          "mcp-sqlite:/mcp",
          "mcp/sqlite",
          "--db-path",
          "${input:db_path}"
        ]
      }
    }
  }
}

Alternatively, you can add either configuration to a file called .vscode/mcp.json in your workspace to share the configuration with others.

Using the MCP Server

Available Resources

The server exposes a dynamic resource called memo://insights, which maintains a continuously updated business insights memo that aggregates discovered insights during analysis.

Using the Demonstration Prompt

The server provides an interactive demonstration prompt called mcp-demo:

# Example usage of the demo prompt
# You would use this in a conversation with Claude
Use the mcp-demo prompt to analyze retail sales data

The prompt requires a topic argument specifying the business domain to analyze. It will:

  • Generate appropriate database schemas and sample data
  • Guide you through analysis and insight generation
  • Integrate with the business insights memo

Using the Core Tools

Query Tools

Reading Data

# Use read_query to execute SELECT queries
read_query('SELECT * FROM customers LIMIT 10')

Writing Data

# Use write_query for INSERT, UPDATE, DELETE operations
write_query('INSERT INTO customers (name, email) VALUES ("John Doe", "[email protected]")')

# Update existing records
write_query('UPDATE customers SET email = "[email protected]" WHERE name = "John Doe"')

Creating Tables

# Create a new table in the database
create_table('CREATE TABLE products (id INTEGER PRIMARY KEY, name TEXT, price REAL)')

Schema Tools

Listing Tables

# Get a list of all tables in the database
list_tables()

Describing Tables

# View schema information for a specific table
describe_table('customers')

Analysis Tools

Adding Business Insights

# Add a new insight to the memo resource
append_insight('Sales of premium products increased by 15% in Q4 compared to Q3')

This will update the memo://insights resource with the new insight.

Testing with MCP Inspector

If you need to test the server locally:

uv add "mcp[cli]"
mcp dev src/mcp_server_sqlite/server.py:wrapper

How to add this MCP server to 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 > MCP and click "Add new global MCP server".

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

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

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 explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

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