Skip to main content
Glama

MCP Database Server

by JuanYin1
MIT License
228
  • Apple
  • Linux

MCP Database Server

This MCP (Model Context Protocol) server provides database access capabilities to Claude, supporting SQLite, SQL Server, PostgreSQL, and MySQL databases.

Installation

  1. Clone the repository:
git clone https://github.com/executeautomation/database-server.git cd database-server
  1. Install dependencies:
npm install
  1. Build the project:
npm run build

Usage Options

There are two ways to use this MCP server with Claude:

  1. Direct usage: Install the package globally and use it directly
  2. Local development: Run from your local development environment

Direct Usage with NPM Package

The easiest way to use this MCP server is by installing it globally:

npm install -g @executeautomation/database-server

This allows you to use the server directly without building it locally.

Local Development Setup

If you want to modify the code or run from your local environment:

  1. Clone and build the repository as shown in the Installation section
  2. Run the server using the commands in the Usage section below

Usage

SQLite Database

To use with an SQLite database:

node dist/src/index.js /path/to/your/database.db

SQL Server Database

To use with a SQL Server database:

node dist/src/index.js --sqlserver --server <server-name> --database <database-name> [--user <username> --password <password>]

Required parameters:

  • --server: SQL Server host name or IP address
  • --database: Name of the database

Optional parameters:

  • --user: Username for SQL Server authentication (if not provided, Windows Authentication will be used)
  • --password: Password for SQL Server authentication
  • --port: Port number (default: 1433)

PostgreSQL Database

To use with a PostgreSQL database:

node dist/src/index.js --postgresql --host <host-name> --database <database-name> [--user <username> --password <password>]

Required parameters:

  • --host: PostgreSQL host name or IP address
  • --database: Name of the database

Optional parameters:

  • --user: Username for PostgreSQL authentication
  • --password: Password for PostgreSQL authentication
  • --port: Port number (default: 5432)
  • --ssl: Enable SSL connection (true/false)
  • --connection-timeout: Connection timeout in milliseconds (default: 30000)

MySQL Database

To use with a MySQL database:

node dist/src/index.js --mysql --host <host-name> --database <database-name> --port <port> [--user <username> --password <password>]

Required parameters:

  • --host: MySQL host name or IP address
  • --database: Name of the database
  • --port: Port number (default: 3306)

Optional parameters:

  • --user: Username for MySQL authentication
  • --password: Password for MySQL authentication
  • --ssl: Enable SSL connection (true/false or object)
  • --connection-timeout: Connection timeout in milliseconds (default: 30000)

Configuring Claude Desktop

Direct Usage Configuration

If you installed the package globally, configure Claude Desktop with:

{ "mcpServers": { "sqlite": { "command": "npx", "args": [ "-y", "@executeautomation/database-server", "/path/to/your/database.db" ] }, "sqlserver": { "command": "npx", "args": [ "-y", "@executeautomation/database-server", "--sqlserver", "--server", "your-server-name", "--database", "your-database-name", "--user", "your-username", "--password", "your-password" ] }, "postgresql": { "command": "npx", "args": [ "-y", "@executeautomation/database-server", "--postgresql", "--host", "your-host-name", "--database", "your-database-name", "--user", "your-username", "--password", "your-password" ] }, "mysql": { "command": "npx", "args": [ "-y", "@executeautomation/database-server", "--mysql", "--host", "your-host-name", "--database", "your-database-name", "--port", "3306", "--user", "your-username", "--password", "your-password" ] } } }

Local Development Configuration

For local development, configure Claude Desktop to use your locally built version:

{ "mcpServers": { "sqlite": { "command": "node", "args": [ "/absolute/path/to/mcp-database-server/dist/src/index.js", "/path/to/your/database.db" ] }, "sqlserver": { "command": "node", "args": [ "/absolute/path/to/mcp-database-server/dist/src/index.js", "--sqlserver", "--server", "your-server-name", "--database", "your-database-name", "--user", "your-username", "--password", "your-password" ] }, "postgresql": { "command": "node", "args": [ "/absolute/path/to/mcp-database-server/dist/src/index.js", "--postgresql", "--host", "your-host-name", "--database", "your-database-name", "--user", "your-username", "--password", "your-password" ] }, "mysql": { "command": "node", "args": [ "/absolute/path/to/mcp-database-server/dist/src/index.js", "--mysql", "--host", "your-host-name", "--database", "your-database-name", "--port", "3306", "--user", "your-username", "--password", "your-password" ] } } }

The Claude Desktop configuration file is typically located at:

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

Available Database Tools

The MCP Database Server provides the following tools that Claude can use:

ToolDescriptionRequired Parameters
read_queryExecute SELECT queries to read dataquery: SQL SELECT statement
write_queryExecute INSERT, UPDATE, or DELETE queriesquery: SQL modification statement
create_tableCreate new tables in the databasequery: CREATE TABLE statement
alter_tableModify existing table schemaquery: ALTER TABLE statement
drop_tableRemove a table from the databasetable_name: Name of tableconfirm: Safety flag (must be true)
list_tablesGet a list of all tablesNone
describe_tableView schema information for a tabletable_name: Name of table
export_queryExport query results as CSV/JSONquery: SQL SELECT statementformat: "csv" or "json"
append_insightAdd a business insight to memoinsight: Text of insight
list_insightsList all business insightsNone

For practical examples of how to use these tools with Claude, see Usage Examples.

Additional Documentation

Development

To run the server in development mode:

npm run dev

To watch for changes during development:

npm run watch

Requirements

  • Node.js 18+
  • For SQL Server connectivity: SQL Server 2012 or later
  • For PostgreSQL connectivity: PostgreSQL 9.5 or later

License

MIT

-
security - not tested
A
license - permissive license
-
quality - not tested

Provides Claude with direct access to databases including SQLite, SQL Server, PostgreSQL, and MySQL, enabling execution of SQL queries and table management through natural language.

  1. Installation
    1. Usage Options
      1. Direct Usage with NPM Package
      2. Local Development Setup
    2. Usage
      1. SQLite Database
      2. SQL Server Database
      3. PostgreSQL Database
      4. MySQL Database
    3. Configuring Claude Desktop
      1. Direct Usage Configuration
      2. Local Development Configuration
    4. Available Database Tools
      1. Additional Documentation
        1. Development
          1. Requirements
            1. License

              Related MCP Servers

              • A
                security
                A
                license
                A
                quality
                A Claude integration that enables updating various database types (PostgreSQL, MySQL, MongoDB, SQLite) from CSV and Excel files through natural language commands.
                Last updated -
                2
                JavaScript
                Apache 2.0
                • Apple
              • -
                security
                A
                license
                -
                quality
                Connects Claude Desktop directly to databases, allowing it to explore database structures, write SQL queries, analyze datasets, and create reports through an API layer with tools for table exploration and query execution.
                Last updated -
                210
                Python
                Mozilla Public License 2.0
                • Apple
              • -
                security
                F
                license
                -
                quality
                A server that enables interaction with PostgreSQL, MySQL, MariaDB, or SQLite databases through Claude Desktop using natural language queries.
                Last updated -
                Python
              • -
                security
                F
                license
                -
                quality
                A natural language interface that allows Claude to execute SQL queries on your local MySQL databases, enabling database interaction using natural language.
                Last updated -
                2
                Python
                • Linux
                • Apple

              View all related MCP servers

              MCP directory API

              We provide all the information about MCP servers via our MCP API.

              curl -X GET 'https://glama.ai/api/mcp/v1/servers/JuanYin1/mcp-database-server-with-database'

              If you have feedback or need assistance with the MCP directory API, please join our Discord server