mcpField
M
Mcp Sql Server

Mcp Sql Server

Local
github.com/ryudgDatabases9Updated 74w ago

About Mcp Sql Server

Mcp Sql Server is an MCP server for AI assistants working with MSSQL databases. It combines schema inspection, parameterized queries, batch operations, and performance monitoring; MSSQL is currently the only supported database.

Key features

  1. 01Inspect database schemas and metadata
  2. 02Run parameterized SQL queries
  3. 03Handle batch queries and transactions
  4. 04View query statistics and reports
  5. 05Monitor connection pool status

Use cases

  1. 01Explore database tables and columns
  2. 02Query active users or order data
  3. 03Check slow queries and pool status

MCP support

The server exposes database schema, query execution, batch processing, and performance-monitoring tools to MCP clients. The README names Claude Desktop, Cursor, and other MCP-compatible tools as clients.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"sql-ryudg": {
"command": "npx",
"args": [
"-y",
"@donggyunryu/mcp-sql"
],
"env": {
"DB_HOST": "<DB_HOST>",
"DB_PORT": "<DB_PORT>",
"DB_DATABASE": "<DB_DATABASE>",
"DB_USER": "<DB_USER>",
"DB_PASSWORD": "<DB_PASSWORD>",
"DB_ENCRYPT": "<DB_ENCRYPT>",
"DB_TRUST_SERVER_CERTIFICATE": "<DB_TRUST_SERVER_CERTIFICATE>"
}
}
}
}
Run commandnpx -y @donggyunryu/mcp-sql
Environment variables to set
DB_HOST
DB_PORT
DB_DATABASE
DB_USER
DB_PASSWORDSecret
DB_ENCRYPT
DB_TRUST_SERVER_CERTIFICATE

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
npm@donggyunryu/mcp-sql

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

MCP SQL Server

Version License Node TypeScript

A Model Context Protocol server that provides comprehensive access to SQL databases, starting with MSSQL support. This server enables AI assistants to inspect database schemas, execute queries, and perform database operations with enterprise-grade security and performance monitoring.

Current Status: MSSQL fully supported. MySQL and PostgreSQL support coming in future releases.

✨ Key Features

video1 video2 video3
  • Database Support: Full MSSQL support (MySQL and PostgreSQL coming soon)
  • Schema Inspection: Comprehensive database structure analysis and metadata extraction
  • Query Execution: Safe SQL execution with parameterized queries and result formatting
  • Performance Monitoring: Real-time metrics, query statistics, and performance reports
  • Security First: SQL injection prevention, connection encryption, and access controls
  • Batch Operations: Efficient bulk query execution and transaction management
  • Connection Pooling: Optimized connection management with configurable pool settings
  • MCP Integration: Native support for Claude Desktop, Cursor, and other MCP-compatible tools

📦 Installation & Setup

Prerequisites
  • Node.js 18.0.0+ - Download here
  • Database Server: Microsoft SQL Server (MSSQL)
  • AI Assistant: Claude Desktop, Cursor, or any MCP-compatible tool

Note: Currently only MSSQL is supported. MySQL and PostgreSQL support will be added in future releases.

Quick Installation
# Install globally via NPM
npm install -g @donggyunryu/mcp-sql
Basic Configuration

Refer to env.example

Create a .env file with your database settings:

# Create .env file with your database settings
# 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
# Test your database connection
npm run test:db # in local environment

#or
npx @donggyunryu/mcp-sql test:db

🚀 Quick Start

Local Environment
  1. Clone the repository:

    git clone https://github.com/ryudg/mcp-sql.git
    cd mcp-sql
    
  2. Install dependencies

    npm install
    
  3. Build the project

    npm run build
    
  4. Add to your mcp.json or setting.json, claude_desktop_config.json

    {
      "mcpServers": {
        "mcp-sql": {
          "command": "node",
          "args": ["/full/path/to/mcp-mysql/build/index.js"],
          "env": {
            // "DB_TYPE": "mssql", # Current only MSSQL supported
            "DB_SERVER": "localhost",
            "DB_PORT": "1433",
            "DB_DATABASE": "your_database",
            "DB_USER": "your_username",
            "DB_PASSWORD": "your_password",
            "DB_ENCRYPT": "false",
            "DB_TRUST_SERVER_CERTIFICATE": "true",
            "NODE_ENV": "development",
            "LOG_LEVEL": "info"
          }
        }
      }
    }
    
Configure AI Assistant

For Claude Desktop:

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "mcp-sql": {
      "command": "npx",
      "args": ["-y", "@donggyunryu/mcp-sql"],
      "env": {
        // "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"
      }
    }
  }
}

For Cursor(VSCode, Windsurf... etc IDE):

Add to your MCP settings:

{
  "mcpServers": {
    "mcp-sql": {
      "command": "npx",
      "args": ["-y", "@donggyunryu/mcp-sql"],
      "env": {
        // "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"
      }
    }
  }
}
Start Using

Restart your AI assistant and try:

"Show me all tables in my database"
"What's the structure of the users table?"
"Find all active users from the last 30 days"

💬 Usage Examples

Schema Exploration
"Show me all tables in the database"
"What's the structure of the users table?"
"List all columns in the orders table with their data types"
Data Queries
"Find all active users registered in the last 30 days"
"Show me the top 10 customers by total order value"
"Get all pending orders from this month"
Performance Monitoring
"Show me current connection pool status"
"What are the slowest queries in the last hour?"
"Generate a performance report for today"

🛠️ Available Tools

The MCP SQL server provides the following tools for database interaction:

Schema & Discovery Tools
ToolDescriptionParameters
list_tablesList all tables in databasepattern (optional): Filter pattern
describe_tableGet detailed table structuretable_name: Name of table to describe
get_schemaGet complete database schemainclude_system_tables: Include system tables
get_schema_statisticsGet schema statistics informationNone
Query Execution Tools
ToolDescriptionParameters
execute_queryExecute SQL queries safelyquery: SQL statement
parameters: Bind parameters
start_batch_processingProcess multiple queries in batchqueries: Array of SQL statements
Performance & Monitoring Tools
ToolDescriptionParameters
get_connection_pool_statusGet database connection pool statusNone
get_query_statsGet query execution statisticsperiod: Time period (optional)
start_performance_monitoringStart performance monitoringinterval: Monitoring interval (ms)
generate_performance_reportGenerate performance analysis reporttimeRange: Report period
clear_cachesInitialize cache dataNone

🛡️ Security

  • Connection Encryption: TLS/SSL connection support
  • Parameter Binding: SQL injection prevention
  • Access Control: Database user permission-based control
  • Logging: Complete query execution logging
  • Input Validation: Comprehensive input sanitization
Security Best Practices
  • Use dedicated database users with minimal required permissions
  • Enable SSL/TLS encryption for database connections when possible
  • Use connection pooling with appropriate limits
  • Never commit credentials to version control
  • Use environment variables for all sensitive configuration

🗺️ Roadmap

Upcoming Features
  • 🔮 Multi-Database Support

    • MySQL adapter implementation
    • PostgreSQL adapter implementation
    • Unified database interface
  • ⚡ Performance & Caching

    • Query result caching system
    • Advanced performance optimization
    • Connection pool enhancements
  • 🧪 Testing & Quality

    • Comprehensive test coverage (100%)
    • Automated CI/CD pipeline
    • Performance benchmarking
  • 🚀 Advanced Features

    • GraphQL integration support
    • Enhanced monitoring dashboard
    • Plugin architecture for extensibility
  • 📊 Analytics & Insights

    • Advanced query analytics
    • Database performance insights
    • Usage statistics and reporting

View CHANGELOG

Support & Community

📝 License

This project is licensed under the MIT License. See the LICENSE file for details.


Made with for the AI-powered development community

MCP SQL Server v1.0.0 - Bridging AI and databases

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.