SQLite MCP server

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

The SQLite MCP Server allows you to interact with SQLite databases through the Model Context Protocol, providing database operations, data analysis capabilities, and automatic business insight generation. It serves as a bridge between AI assistants and SQLite database functionality.

Installation Options

Using with Claude Desktop

You can add the SQLite MCP server to your Claude Desktop configuration using either UV or Docker.

UV Installation

Add the server to your claude_desktop_config.json file:

"mcpServers": {
  "sqlite": {
    "command": "uv",
    "args": [
      "--directory",
      "parent_of_servers_repo/servers/src/sqlite",
      "run",
      "mcp-server-sqlite",
      "--db-path",
      "~/test.db"
    ]
  }
}

Docker Installation

Add the server to your claude_desktop_config.json file:

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

Features and Capabilities

Resources

The server provides a dynamic resource:

  • memo://insights: A continuously updated business insights memo that aggregates discovered insights during analysis

Interactive Prompts

  • mcp-demo: Guides users through database operations
    • Requires a topic argument specifying the business domain to analyze
    • Automatically generates appropriate database schemas and sample data
    • Assists with analysis and insight generation
    • Integrates with the business insights memo

Available Tools

Database Query Tools

The server provides tools for common database operations:

Read Data

read_query
  • Executes SELECT queries to read data from the database
  • Input: query (string) containing a SELECT SQL statement
  • Returns: Query results as an array of objects

Write Data

write_query
  • Executes INSERT, UPDATE, or DELETE queries
  • Input: query (string) containing the SQL modification statement
  • Returns: { affected_rows: number }

Create Tables

create_table
  • Creates new tables in the database
  • Input: query (string) containing a CREATE TABLE SQL statement
  • Returns: Confirmation of table creation

Schema Management Tools

List Tables

list_tables
  • Gets a list of all tables in the database
  • No input required
  • Returns: Array of table names

Describe Table

describe-table
  • Views schema information for a specific table
  • Input: table_name (string) specifying the table to describe
  • Returns: Array of column definitions with names and types

Analysis Tools

Add Insights

append_insight
  • Adds new business insights to the memo resource
  • Input: insight (string) containing a business insight discovered from data analysis
  • Returns: Confirmation of insight addition
  • Triggers update of the memo://insights resource

Testing the Server

You can test the server using the MCP inspector:

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