claude-database-tools
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@claude-database-tools show me the schema for the dbo.Users table"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
claude-database-tools
SQL Server CLI and MCP server for Claude Code.
Why This Tool?
This project is an alternative to Microsoft's official mssql MCP server with some key advantages:
SQL Server Authentication: Supports SQL Server authentication (username/password), not just Windows/Entra authentication. Ideal for development environments, Docker containers, or scenarios where integrated auth isn't available.
CLI-First Design: The CLI tools can be used directly from a Claude Code skill, giving you database access without requiring MCP server setup. This is useful when you want simpler configuration or need to work in environments where MCP servers are problematic.
MCP Server Included: Also provides an MCP server if you prefer that integration approach.
Related MCP server: SQL Server MCP
Features
CLI Tool: Command-line interface for SQL Server operations
MCP Server: Model Context Protocol server for Claude integration (experimental)
Security: Built-in SQL injection prevention and query validation
Operations: List tables, describe schemas, query data, insert/update/delete records, DDL generation
Installation
git clone https://github.com/cyronius/claude-database-tools.git
cd claude-database-tools
npm install
npm run buildConfiguration
Copy .env.example to .env and configure your database connection:
cp .env.example .envEdit .env with your SQL Server credentials:
SQL_SERVER=localhost
SQL_DATABASE=your_database
SQL_USER=your_username
SQL_PASSWORD=your_password
SQL_PORT=1433
SQL_ENCRYPT=false
SQL_TRUST_SERVER_CERTIFICATE=trueCLI Usage
After building, run commands with:
node dist/cli/index.js <command> [options]Or install globally:
npm install -g .
sql-cli <command> [options]Commands
Command | Description |
| List tables, optionally filtered by schema |
| Get table schema (columns, indexes, foreign keys) |
| Execute a SELECT query |
| Insert records |
| Update records |
| Delete records |
| Execute stored procedure |
| Create a new table |
| Drop a table |
| Create an index |
| Generate CREATE TABLE DDL |
| Generate ALTER TABLE DDL |
Examples
# List all tables
sql-cli list-tables
# List tables in specific schemas
sql-cli list-tables dbo sales
# Describe a table
sql-cli describe-table dbo.Users
# Query data
sql-cli read-data "SELECT TOP 10 * FROM dbo.Users"
# Insert data
sql-cli insert-data dbo.Users '{"name": "John", "email": "john@example.com"}'
# Update data
sql-cli update-data dbo.Users '{"name": "Jane"}' "id = 1"
# Delete data (requires --confirm flag)
sql-cli delete-data dbo.Users "id = 1" --confirm
# Get table DDL
sql-cli get-ddl dbo.UsersMCP Server (Experimental)
Note: The MCP server integration has not been fully tested. Use at your own risk.
The MCP server allows Claude Code to interact with your SQL Server database directly.
Setup
Add to your ~/.claude/mcp.json:
{
"mcpServers": {
"mssql": {
"command": "node",
"args": ["/path/to/claude-database-tools/dist/index.js"],
"env": {
"SQL_SERVER": "your-server",
"SQL_DATABASE": "your-database",
"SQL_USER": "your-username",
"SQL_PASSWORD": "your-password",
"SQL_ENCRYPT": "true",
"READONLY": "true"
}
}
}
}Restart Claude Code to load the MCP server.
Available MCP Tools
Read-Only (available when READONLY=true):
list_tables- List tablesdescribe_table- Get table schemaread_data- Execute SELECT queriesget_table_ddl- Generate CREATE TABLE DDLget_table_alter_ddl- Generate ALTER TABLE DDL
Write (requires READONLY=false):
insert_data- Insert recordsupdate_data- Update recordsdelete_data- Delete recordscreate_table- Create tablescreate_index- Create indexesdrop_table- Drop tablesexecute_stored_proc- Execute stored procedures
Security
SQL Injection Prevention: SELECT queries are validated against dangerous keywords and patterns
Parameterized Queries: All INSERT/UPDATE/DELETE operations use parameterized queries
WHERE Clause Required: UPDATE and DELETE operations require WHERE clauses
Query Limits: Maximum query length of 10,000 characters, result sets limited to 10,000 records
Read-Only Mode: Set
READONLY=trueto disable write operations
License
MIT
Available Tools
12 toolscreate_indexC
Creates an index on a specified column or columns in an MSSQL Database table
Inputs: tableName (required), indexName (required), columns (required), isUnique, +1 more.
create_tableC
Creates a new table in the MSSQL Database with the specified columns.
Inputs: tableName (required), columns (required).
delete_dataA
Executes a physical DELETE operation on table records. WARNING: This database uses soft delete patterns (__deleted flag). Consider using update_data to set __deleted = 1 instead for most use cases.
Inputs: tableName (required), whereClause (required), confirmDelete (required).
describe_tableA
Describes the complete schema of a specified MSSQL Database table, including columns, types, constraints, indexes, and foreign keys.
Inputs: tableName (required).
drop_tableC
Drops a table from the MSSQL Database.
Inputs: tableName (required).
execute_stored_procC
Executes a stored procedure with optional parameters. Supports input parameters and returns result sets, output parameters, and return values.
Inputs: procedureName (required), parameters.
get_table_alter_ddlB
Generates ALTER TABLE DDL statements to add columns and constraints from an existing table.
Inputs: tableName (required).
get_table_ddlB
Generates CREATE TABLE DDL script for an existing table, including columns, constraints, and optionally indexes.
Inputs: tableName (required), includeIndexes, includeConstraints.
insert_dataA
Inserts data into an MSSQL Database table. Supports both single record insertion and multiple record insertion using standard SQL INSERT with VALUES clause. FORMAT EXAMPLES: Single Record Insert: { "tableName": "Users", "data": { "name": "John Doe", "email": "john@example.com", "age": 30, "isActive": true, "createdDate": "2023-01-15" } } Multiple Records Insert: { "tableName": "Users", "data": [ { "name": "John Doe", "email": "john@example.com", "age": 30, "isActive": true, "createdDate": "2023-01-15" }, { "name": "Jane Smith", "email": "jane@example.com", "age": 25, "isActive": false, "createdDate": "2023-01-16" } ] } GENERATED SQL FORMAT:
Single: INSERT INTO table (col1, col2) VALUES (@param1, @param2)
Multiple: INSERT INTO table (col1, col2) VALUES (@param1, @param2), (@param3, @param4), ... IMPORTANT RULES:
For single record: Use a single object for the 'data' field
For multiple records: Use an array of objects for the 'data' field
All objects in array must have identical column names
Column names must match the actual database table columns exactly
Values should match the expected data types (string, number, boolean, date)
Use proper date format for date columns (YYYY-MM-DD or ISO format)
Inputs: tableName (required), data (required).
list_tablesC
Lists tables in an MSSQL Database, or list tables in specific schemas
Inputs: schemas.
read_dataA
Executes a SELECT query on an MSSQL Database table. The query must start with SELECT and cannot contain any destructive SQL operations for security reasons.
Inputs: query (required).
update_dataB
Updates data in an MSSQL Database table using a WHERE clause. The WHERE clause must be provided for security.
Inputs: tableName (required), updates (required), whereClause (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 12 tools
Each tool has a clearly distinct purpose with no ambiguity. Tools like create_table, describe_table, and drop_table target different table operations, while insert_data, update_data, delete_data, and read_data cover distinct CRUD actions. The descriptions reinforce these boundaries, such as the warning in delete_data about soft deletes versus update_data.
All tool names follow a consistent verb_noun pattern using snake_case, such as create_table, describe_table, and execute_stored_proc. There are no deviations in naming conventions, making the set predictable and easy to understand at a glance.
With 12 tools, this server is well-scoped for MSSQL database operations. The count covers essential tasks like table management, data manipulation, and schema inspection without being overwhelming. Each tool serves a clear purpose, such as get_table_ddl for DDL generation and list_tables for discovery.
The tool set provides comprehensive coverage for core database operations, including table creation, schema description, data CRUD, and stored procedure execution. Minor gaps exist, such as no explicit tools for managing indexes beyond create_index (e.g., drop_index) or handling transactions, but agents can work around these with existing tools like execute_stored_proc.
Maintenance
Related MCP Connectors
Hosted SQL Server MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Text-to-SQL MCP server: read-only queries on PostgreSQL, MySQL and SQL Server with your real schema
Draxlr's remote MCP server connects AI assistants to your SQL databases and dashboards. Explore schemas, run read-only queries, manage saved queries and dashboards, and export results, all with row-level security so each user sees only their own data.
Hosted MySQL MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceAn MCP server for Microsoft SQL Server integration that enables users to query, monitor, and analyze databases directly through Claude. It supports schema exploration, performance analysis, and optional write operations via natural language commands.8 npm1MIT
- AlicenseAqualityDmaintenanceA read-only MCP server for SQL Server database introspection that enables Claude to explore and query databases via tools like listing objects and executing SELECT queries.20MIT
- AlicenseNot gradedqualityDmaintenanceEnables Claude Code and other MCP clients to interact with Microsoft SQL Server databases through standardized tools for query execution, schema exploration, table management, and stored procedure execution.95 npm1MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that enables Claude to query, monitor, and analyze SQL Server databases, with support for schema exploration, performance analysis, and optional write operations.25 npm1MIT