Skip to main content
Glama

Enhanced MCP MSSQL Server

by michaelyuwh

πŸš€ Enhanced MCP MSSQL Server

A production-ready Model Context Protocol (MCP) server for Microsoft SQL Server that provides AI agents with secure, stateless database access capabilities.

✨ New Features & Enhancements

  • πŸ”’ Advanced Security: SQL injection protection, query validation, and configurable security policies

  • πŸ“Š Health Monitoring: Real-time performance metrics and connection health checks

  • βš™οΈ Configuration Management: Environment-specific settings for development and production

  • πŸ“¦ Bulk Operations: Efficient batch processing for large-scale data operations

  • πŸ›‘οΈ Enhanced Error Handling: Structured errors with actionable information for AI agents

  • 🎯 Production Ready: Enterprise-grade monitoring and security capabilities

πŸ› οΈ Available Tools (9 Total)

Core Database Tools (Enhanced)

  1. mssql_list_databases - List all accessible databases

  2. mssql_list_tables - List tables in a specific database

  3. mssql_describe_table - Get detailed table schema information

  4. mssql_query - Execute queries with security validation and metrics

  5. mssql_sample_data - Retrieve sample rows from tables

  6. mssql_get_relationships - Discover foreign key relationships

New Advanced Tools

  1. mssql_health_check - Server health monitoring with performance metrics

  2. mssql_validate_query - Security validation without query execution

  3. mssql_bulk_insert - Efficient bulk data insertion operations

πŸš€ Quick Start

# Install dependencies npm install # Build the project npm run build # Configure your database (copy .env.example to .env) cp .env.example .env # Start the server npm start # Run tests (requires running MSSQL server) npm test

🎯 What This Does

This MCP server allows AI agents to:

  • Connect to MSSQL databases securely

  • Discover database schemas (databases, tables, columns)

  • Query data safely with read-only access

  • Explore relationships and metadata

  • Sample data for analysis without full table scans

✨ Key Features

  • βœ… Read-Only Safety: Only SELECT queries allowed

  • πŸ”’ Secure Authentication: Encrypted connections by default

  • πŸ” Schema Discovery: Automatic database structure exploration

  • πŸ“Š Smart Sampling: Get representative data without overload

  • πŸ”— Relationship Mapping: Understand foreign key connections

  • πŸ›‘οΈ SQL Injection Protection: Parameterized queries and validation

πŸ› οΈ Installation

Prerequisites:

  • Node.js 18+

  • Access to MSSQL Server (2008 R2+)

  • Database user with read permissions

Setup:

  1. Clone or download this repository

  2. Run npm install to install dependencies

  3. Run npm run build to compile TypeScript

  4. Configure your database connection (see Configuration section)

πŸ“ Configuration

No Configuration Required!

This MCP server is now stateless - you provide connection details when calling each tool. The AI agent will ask for your database credentials when needed.

For Claude Desktop, add to your configuration:

{ "mcpServers": { "mssql": { "command": "node", "args": ["path/to/mcp-mssql-connector/dist/index.js"] } } }

πŸ”§ Available Tools

Tool

Description

Key Parameters

mssql_connect

Connect to MSSQL server

server, user, password

mssql_list_databases

List available databases

-

mssql_list_tables

List tables in database

database

mssql_describe_table

Get table structure

database, table

mssql_query

Execute SELECT query

database, query, limit

mssql_sample_data

Get sample rows

database, table, limit

mssql_get_relationships

Get foreign keys

database, table

πŸ’‘ Usage Examples

List databases:

List all databases on server 'myserver.com' using username 'myuser' and password 'mypass'

Explore structure:

List all tables in the 'Northwind' database on myserver.com with my credentials

Query data:

Query "SELECT TOP 10 * FROM Customers WHERE Country = 'USA'" on Northwind database at myserver.com

Understand relationships:

Show foreign key relationships for the Orders table in Northwind database on myserver.com

πŸ”’ Security

  • Read-Only: Only SELECT statements allowed

  • Input Validation: All parameters validated with Zod schemas

  • Connection Security: TLS encryption enabled by default

  • Query Limits: Automatic row limits prevent data dumps

  • Error Handling: Safe error messages without exposing internals

πŸ“š Documentation

🀝 Contributing

  1. Fork the repository

  2. Create a feature branch

  3. Make your changes

  4. Add tests if applicable

  5. Submit a pull request

πŸ“„ License

MIT License - see LICENSE file for details

πŸ†˜ Support

If you encounter issues:

  1. Check the Usage Guide for common solutions

  2. Verify your MSSQL server configuration

  3. Ensure proper database permissions

  4. Open an issue with error details

Deploy Server
-
security - not tested
A
license - permissive license
-
quality - not tested

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Enables AI agents to securely connect to and query Microsoft SQL Server databases with read-only access, schema discovery, and relationship mapping. Features advanced security protections, health monitoring, and bulk operations for production environments.

  1. ✨ New Features & Enhancements
    1. πŸ› οΈ Available Tools (9 Total)
      1. Core Database Tools (Enhanced)
      2. New Advanced Tools
    2. πŸš€ Quick Start
      1. 🎯 What This Does
        1. ✨ Key Features
          1. πŸ› οΈ Installation
            1. πŸ“ Configuration
              1. πŸ”§ Available Tools
                1. πŸ’‘ Usage Examples
                  1. πŸ”’ Security
                    1. πŸ“š Documentation
                      1. 🀝 Contributing
                        1. πŸ“„ License
                          1. πŸ†˜ Support

                            MCP directory API

                            We provide all the information about MCP servers via our MCP API.

                            curl -X GET 'https://glama.ai/api/mcp/v1/servers/michaelyuwh/mcp-mssql-connector'

                            If you have feedback or need assistance with the MCP directory API, please join our Discord server