mssql-mcp-server

v1.3.0
mssql-mcp-server Checked 20 hours ago Published 5 months ago

MCP server for Microsoft SQL Server database access and comprehensive schema exploration using tedious.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

list_connections List Available Connections

List all available named database connections configured in the server

test_connection Test Connection

Test the database connection and return basic server information

ParameterTypeDescription
connectionNamestringNamed connection to use (e.g., 'production', 'staging')

list_databases List Databases

List all databases available on the SQL Server instance

ParameterTypeDescription
connectionNamestringNamed connection to use (e.g., 'production', 'staging')

list_tables List Tables

List all tables in the connected database

ParameterTypeDescription
connectionNamestringNamed connection to use (e.g., 'production', 'staging')
schemastringSchema name (default: dbo)

describe_table Describe Table

Get detailed schema information for a specific table including columns, data types, and constraints

ParameterTypeDescription
tableName *stringName of the table to describe
connectionNamestringNamed connection to use (e.g., 'production', 'staging')
schemastringSchema name (default: dbo)

sample_data Sample Table Data

Retrieve sample data from a table (top 10 rows by default)

ParameterTypeDescription
tableName *stringName of the table to sample
connectionNamestringNamed connection to use (e.g., 'production', 'staging')
limitnumberNumber of rows to return (default: 10, max: 100)
schemastringSchema name (default: dbo)

execute_query Execute SQL Query

Execute a custom SQL SELECT query with automatic limit (top 20 rows). Disabled unless MSSQL_ENABLE_EXECUTE_QUERY=true.

ParameterTypeDescription
query *stringSQL SELECT query to execute
connectionNamestringNamed connection to use (e.g., 'production', 'staging')

get_relationships Get Table Relationships

Get foreign key relationships between tables in the database

ParameterTypeDescription
connectionNamestringNamed connection to use (e.g., 'production', 'staging')
schemastringSchema name (default: dbo)

list_stored_procedures List Stored Procedures

List all stored procedures, functions, and their basic information

ParameterTypeDescription
connectionNamestringNamed connection to use (e.g., 'production', 'staging')
includeSystemObjectsbooleanInclude system stored procedures (default: false)
schemastringSchema name (default: dbo)

describe_stored_procedure Describe Stored Procedure

Get detailed information about a specific stored procedure including parameters and definition

ParameterTypeDescription
procedureName *stringName of the stored procedure to describe
connectionNamestringNamed connection to use (e.g., 'production', 'staging')
includeDefinitionbooleanInclude the procedure definition/body (default: true)
schemastringSchema name (default: dbo)

list_views List Views

List all views in the database with their basic information

ParameterTypeDescription
connectionNamestringNamed connection to use (e.g., 'production', 'staging')
includeSystemViewsbooleanInclude system views (default: false)
schemastringSchema name (default: dbo)

describe_view Describe View

Get detailed information about a specific view including its definition and dependencies

ParameterTypeDescription
viewName *stringName of the view to describe
connectionNamestringNamed connection to use (e.g., 'production', 'staging')
includeDefinitionbooleanInclude the view definition (default: true)
schemastringSchema name (default: dbo)

list_triggers List Triggers

List all triggers in the database with their associated tables

ParameterTypeDescription
connectionNamestringNamed connection to use (e.g., 'production', 'staging')
schemastringSchema name (default: dbo)
tableNamestringFilter by specific table name

describe_trigger Describe Trigger

Get detailed information about a specific trigger including its definition and events

ParameterTypeDescription
triggerName *stringName of the trigger to describe
connectionNamestringNamed connection to use (e.g., 'production', 'staging')
includeDefinitionbooleanInclude the trigger definition (default: true)

list_functions List User-Defined Functions

List all user-defined functions (scalar, table-valued, etc.)

ParameterTypeDescription
connectionNamestringNamed connection to use (e.g., 'production', 'staging')
functionTypestringFilter by function type (default: ALL)
schemastringSchema name (default: dbo)

list_indexes List Table Indexes

List all indexes on tables with usage statistics and detailed information

ParameterTypeDescription
connectionNamestringNamed connection to use (e.g., 'production', 'staging')
includeUsageStatsbooleanInclude index usage statistics (default: true)
schemastringSchema name (default: dbo)
tableNamestringFilter by specific table name

analyze_table_stats Analyze Table Statistics

Get table row counts, size information, and last update statistics

ParameterTypeDescription
connectionNamestringNamed connection to use (e.g., 'production', 'staging')
schemastringSchema name (default: dbo)
tableNamestringFilter by specific table name

find_missing_indexes Find Missing Indexes

Identify potentially missing indexes based on query execution patterns

ParameterTypeDescription
connectionNamestringNamed connection to use (e.g., 'production', 'staging')
minImpactnumberMinimum impact score to include (default: 1000)
schemastringSchema name (default: dbo)

analyze_index_usage Analyze Index Usage

Show detailed index usage statistics to identify unused or underutilized indexes

ParameterTypeDescription
connectionNamestringNamed connection to use (e.g., 'production', 'staging')
schemastringSchema name (default: dbo)
showUnusedOnlybooleanShow only unused indexes (default: false)
tableNamestringFilter by specific table name

analyze_database_size Analyze Database Size

Get comprehensive database size information including data and log file sizes

ParameterTypeDescription
connectionNamestringNamed connection to use (e.g., 'production', 'staging')

list_constraints List All Constraints

List all constraints (check, unique, foreign key, etc.) across tables in the database

ParameterTypeDescription
connectionNamestringNamed connection to use (e.g., 'production', 'staging')
constraintTypestringFilter by constraint type (default: ALL)
schemastringSchema name (default: dbo)

analyze_check_constraints Analyze Check Constraints

Extract and analyze business rules from check constraints

ParameterTypeDescription
connectionNamestringNamed connection to use (e.g., 'production', 'staging')
schemastringSchema name (default: dbo)
tableNamestringFilter by specific table name

list_user_defined_types List User-Defined Data Types

List all user-defined data types and their definitions

ParameterTypeDescription
connectionNamestringNamed connection to use (e.g., 'production', 'staging')
schemastringSchema name (default: dbo)

find_computed_columns Find Computed Columns

List computed columns and their formulas to understand derived business logic

ParameterTypeDescription
connectionNamestringNamed connection to use (e.g., 'production', 'staging')
schemastringSchema name (default: dbo)
tableNamestringFilter by specific table name

list_default_constraints List Default Constraints

List all default value constraints and their definitions

ParameterTypeDescription
connectionNamestringNamed connection to use (e.g., 'production', 'staging')
schemastringSchema name (default: dbo)
tableNamestringFilter by specific table name

analyze_data_distribution Analyze Data Distribution

Get data distribution patterns for columns to understand data quality and patterns

ParameterTypeDescription
tableName *stringName of the table to analyze
columnNamestringSpecific column to analyze (analyzes all if not provided)
connectionNamestringNamed connection to use (e.g., 'production', 'staging')
sampleSizenumberSample size for analysis (default: 1000)
schemastringSchema name (default: dbo)

find_lookup_tables Find Lookup Tables

Identify reference/lookup tables automatically based on table patterns

ParameterTypeDescription
connectionNamestringNamed connection to use (e.g., 'production', 'staging')
maxRowsnumberMaximum rows to consider as lookup table (default: 1000)
schemastringSchema name (default: dbo)

analyze_null_patterns Analyze NULL Patterns

Find columns with high null percentages and analyze null patterns

ParameterTypeDescription
connectionNamestringNamed connection to use (e.g., 'production', 'staging')
minNullPercentagenumberMinimum null percentage to include (default: 10)
schemastringSchema name (default: dbo)

detect_audit_columns Detect Audit Columns

Identify common audit trail patterns (created/modified dates, user tracking)

ParameterTypeDescription
connectionNamestringNamed connection to use (e.g., 'production', 'staging')
schemastringSchema name (default: dbo)

get_stored_procedure_definition Get Stored Procedure Definition

Get the complete SQL query/definition of a stored procedure - this is the actual source code

ParameterTypeDescription
procedureName *stringName of the stored procedure to get definition for
connectionNamestringNamed connection to use (e.g., 'production', 'staging')
formatOutputbooleanFormat the SQL output for better readability (default: true)
schemastringSchema name (default: dbo)

get_multiple_stored_procedure_definitions Get Multiple Stored Procedure Definitions

Get complete SQL definitions for multiple stored procedures at once

ParameterTypeDescription
procedureNames *arrayArray of stored procedure names to get definitions for
connectionNamestringNamed connection to use (e.g., 'production', 'staging')
includeMetadatabooleanInclude metadata like creation date, modification date (default: true)
schemastringSchema name (default: dbo)

get_all_stored_procedure_definitions Get All Stored Procedure Definitions

Get complete SQL definitions for all stored procedures in a schema

ParameterTypeDescription
connectionNamestringNamed connection to use (e.g., 'production', 'staging')
includeSystemProceduresbooleanInclude system stored procedures (default: false)
maxResultsnumberMaximum number of procedures to return (default: 50, max: 100)
schemastringSchema name (default: dbo)

search_stored_procedures_by_content Search Stored Procedures by Content

Search for stored procedures containing specific text or patterns in their SQL definition

ParameterTypeDescription
searchText *stringText or pattern to search for in procedure definitions
caseSensitivebooleanCase sensitive search (default: false)
connectionNamestringNamed connection to use (e.g., 'production', 'staging')
includeDefinitionsbooleanInclude full procedure definitions in results (default: false)
schemastringSchema name (default: dbo)