Get the FREE Ultimate OpenClaw Setup Guide →

mcp-sql

MCP server from ryudg/mcp-sql

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio ryudg-mcp-sql npx -y @donggyunryu/mcp-sql \
  --env DB_HOST="localhost" \
  --env DB_PORT="1433" \
  --env DB_TYPE="mssql" \
  --env DB_USER="your_username" \
  --env NODE_ENV="development" \
  --env LOG_LEVEL="info" \
  --env DB_ENCRYPT="false" \
  --env DB_DATABASE="your_database" \
  --env DB_PASSWORD="your_password" \
  --env DB_TRUST_SERVER_CERTIFICATE="true"

How to use

The MCP SQL server provides a dedicated MCP server for interacting with MSSQL databases. It exposes a set of tools that let an AI assistant inspect database schemas, run parameterized queries, and monitor performance, all with security protections such as parameter binding and encrypted connections. You can connect to the server using MCP-compatible clients like Claude Desktop or Cursor by pointing them at the mcp-sql server and supplying the required environment variables for your database. Tools include schema discovery (list_tables, describe_table, get_schema) and query execution (execute_query, start_batch_processing), as well as performance monitoring (get_connection_pool_status, get_query_stats, start_performance_monitoring, generate_performance_report, clear_caches). The server is currently focused on MSSQL, with MySQL/PostgreSQL support planned for future releases.

How to install

Prerequisites:

  • Node.js 18.0.0 or newer
  • Microsoft SQL Server (MSSQL) available to connect to
  • A supported MCP client (e.g., Claude Desktop, Cursor) for integration

Quick installation:

# Install globally via NPM
npm install -g @donggyunryu/mcp-sql

Basic configuration (environment file):

# Create a .env file with your database settings (optional if using env variables directly in MCP config)
# DB_TYPE=mssql  # Current only MSSQL supported
DB_HOST=localhost
DB_PORT=1433
DB_DATABASE=your_database
DB_USER=your_username
DB_PASSWORD=your_password
DB_ENCRYPT=false
DB_TRUST_SERVER_CERTIFICATE=true

Test connection (when applicable):

# If there are test commands defined in the package
npm run test:db
# or with npx as shown in MCP configuration
npx @donggyunryu/mcp-sql test:db

Local development (optional):

# Clone and install from source (if you prefer to build locally)
git clone https://github.com/ryudg/mcp-sql.git
cd mcp-sql
npm install
npm run build

Additional notes

Environment variables can be set either in the mcp.json/claude_desktop_config.json environment maps or in a local .env file, depending on your deployment method. Ensure DB_PASSWORD is secured and not committed to version control. If you encounter connection issues, check TLS settings and trust certificates (DB_ENCRYPT and DB_TRUST_SERVER_CERTIFICATE). The provided tools require proper permissions on your MSSQL database; use parameterized queries to avoid SQL injection risks. For performance, you can enable connection pooling and monitoring via the available tools; consult the MCP client documentation for wiring up real-time metrics.

Related MCP Servers

Sponsor this space

Reach thousands of developers