Click on "Install 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-toolsshow 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.
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
Configuration
Copy .env.example to .env and configure your database connection:
Edit .env with your SQL Server credentials:
CLI Usage
After building, run commands with:
Or install globally:
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
MCP 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:
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