GitHub - executeautomation/mcp-database-server: MCP Database Server is a new MCP Server which helps connect with Sqlite, SqlServer and Posgresql Databases (original) (raw)

MseeP.ai Security Assessment Badge

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:
  2. Build the project:

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:

Optional parameters:

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:

Optional parameters:

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:

Optional parameters:

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:

Available Database Tools

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

Tool Description Required Parameters
read_query Execute SELECT queries to read data query: SQL SELECT statement
write_query Execute INSERT, UPDATE, or DELETE queries query: SQL modification statement
create_table Create new tables in the database query: CREATE TABLE statement
alter_table Modify existing table schema query: ALTER TABLE statement
drop_table Remove a table from the database table_name: Name of tableconfirm: Safety flag (must be true)
list_tables Get a list of all tables None
describe_table View schema information for a table table_name: Name of table
export_query Export query results as CSV/JSON query: SQL SELECT statementformat: "csv" or "json"
append_insight Add a business insight to memo insight: Text of insight
list_insights List all business insights None

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

Additional Documentation

Development

To run the server in development mode:

To watch for changes during development:

Requirements

License

MIT