SQL Database Bridge MCP server

Provides a bridge to SQL databases (MSSQL, MySQL, PostgreSQL) for executing queries, exploring schemas, monitoring performance, and generating reports with features like connection pooling and transaction management.
Back to servers
Provider
Donggyun Ryu
Release date
May 26, 2025
Language
Python
Stats
1 star

The MCP SQL Server provides comprehensive access to SQL databases (starting with MSSQL support), enabling AI assistants to inspect database schemas, execute queries, and perform database operations with enterprise-grade security and performance monitoring.

Installation & Setup

Prerequisites

  • Node.js 18.0.0+
  • Microsoft SQL Server (MSSQL)
  • Claude Desktop, Cursor, or any MCP-compatible tool

Quick Installation

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

Basic Configuration

Create a .env file with your database settings:

# DB_TYPE=mssql # Currently 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

Configuring Your AI Assistant

For Claude Desktop

Add to your claude_desktop_config.json:

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

Add to your MCP settings:

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

Usage Examples

After configuring your AI assistant, restart it and try the following prompts:

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

Schema & Discovery Tools

Tool Description Parameters
list_tables List all tables in database pattern (optional): Filter pattern
describe_table Get detailed table structure table_name: Name of table to describe
get_schema Get complete database schema include_system_tables: Include system tables
get_schema_statistics Get schema statistics information None

Query Execution Tools

Tool Description Parameters
execute_query Execute SQL queries safely query: SQL statement
parameters: Bind parameters
start_batch_processing Process multiple queries in batch queries: Array of SQL statements

Performance & Monitoring Tools

Tool Description Parameters
get_connection_pool_status Get database connection pool status None
get_query_stats Get query execution statistics period: Time period (optional)
start_performance_monitoring Start performance monitoring interval: Monitoring interval (ms)
generate_performance_report Generate performance analysis report timeRange: Report period
clear_caches Initialize cache data None

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

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later