home / mcp / mcp database server

MCP Database Server

Provides a local MCP server to interact with a SQLite database, enabling SQL queries, CSV imports, and table schemas.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "jakubbuskiewicz-mcp-test": {
      "command": "node",
      "args": [
        "/path/to/mcp-test/dist/index.js"
      ],
      "env": {
        "DB_PATH": "REQUIRED: path to the SQLite database file"
      }
    }
  }
}

You run a lightweight MCP server that interfaces with a SQLite database, exposing practical tools to query data, import CSV files, and inspect table schemas. It’s designed to be embedded in client workflows so you can perform common data operations quickly from your app or desktop client.

How to use

Install and build the server, then connect your client to the local process. The server exposes tools you can call from an MCP client to run SQL, import CSV data, and list table schemas. For local development, you typically run the server as a stdio process and configure your client to start it with the appropriate command and environment.

Developing and running locally with a client

To run locally and connect from a client, start by building the project and then launching the server as a local process. The client will communicate with the server using standard MCP calls for the available tools.

Configuration for a Claude Desktop client

{
  "mcpServers": {
    "database": {
      "command": "node",
      "args": ["/path/to/mcp-test/dist/index.js"],
      "env": {
        "DB_PATH": "/path/to/your/database.db"
      }
    }
  }
}

Available tools and how to use them

Use the following tool interfaces to interact with the database through the MCP server.

{
  "query_database": {
    "query": "SELECT * FROM users WHERE id = ?",
    "params": ["1"]
  }
}
{
  "import_csv": {
    "file_path": "/path/to/data.csv",
    "table_name": "my_table",
    "delimiter": ","
  }
}
{
  "list_tables": {}
}

Environment variable for the database path

The server uses an environment variable to locate the SQLite database file.

Available tools

query_database

Execute SQL queries on the database. Use a prepared statement style with parameters to safely pass values.

import_csv

Import a CSV file into a database table by providing the file path, target table name, and delimiter.

list_tables

List all tables in the database along with their schemas.