mssql-mcp

v3.0.0
mssql-mcp Checked 6 hours ago Published 2 months ago

MCP Server for MS SQL Server integration with Claude Desktop, Cursor, Windsurf and VS Code

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

mssql_connect_database Connect Database

Connects to MS SQL Server using environment variables (DB_SERVER, DB_DATABASE, DB_USER, DB_PASSWORD, DB_PORT, DB_ENCRYPT, DB_TRUST_SERVER_CERTIFICATE). No credentials accepted as parameters — all connection settings come from the server environment only. Idempotent: calling again reconnects.

mssql_disconnect_database Disconnect Database

Closes the current database connection and releases the connection pool. Safe to call even if not connected. Idempotent.

mssql_connection_status Connection Status

Returns the current connection status, server address, database name, and connection pool metrics. Read-only. Safe to call at any time.

mssql_run_sql_query Run SQL Query

Executes an arbitrary SQL statement against the connected database. ⚠️ WARNING: This tool can read AND modify data (INSERT, UPDATE, DELETE, DDL). Always prefer parameterized inputs via the 'parameters' field — never embed user-supplied values directly in the query string. Example: query='SELECT * FROM dbo.Users WHERE Id = @id', parameters={id: 42}

ParameterTypeDescription
query *stringSQL statement to execute
parametersobjectNamed parameters referenced in the query via @paramName
response_formatstringOutput format: 'json' for structured data, 'markdown' for human-readable table

mssql_execute_query Execute Query (deprecated — use mssql_run_sql_query)

Deprecated alias for mssql_run_sql_query. Use mssql_run_sql_query instead. ⚠️ This tool can read AND modify data.

ParameterTypeDescription
query *stringSQL query to execute
parametersobjectQuery parameters
response_formatstring

mssql_list_schema_objects List Schema Objects

Lists tables, views, stored procedures, or functions in the connected database. Read-only. Supports filtering by schema name and pagination. Example: objectType='tables', schemaName='dbo', limit=20

ParameterTypeDescription
limitintegerMax objects (default 20)
objectTypestringType of objects to list (default: tables)
offsetintegerSkip N objects
response_formatstringOutput format: 'json' for structured data, 'markdown' for human-readable table
schemaNamestringFilter to a specific schema (e.g. 'dbo')

mssql_get_schema Get Schema (deprecated — use mssql_list_schema_objects)

Deprecated alias for mssql_list_schema_objects. Use mssql_list_schema_objects instead.

ParameterTypeDescription
objectTypestring
response_formatstring
schemaNamestring

mssql_describe_table_columns Describe Table Columns

Returns column definitions for a table: name, data type, length, nullability, default, and ordinal position. Read-only. Uses parameterized queries to prevent injection.

ParameterTypeDescription
tableName *stringTable name
response_formatstringOutput format: 'json' for structured data, 'markdown' for human-readable table
schemaNamestringSchema name (default: dbo)

mssql_describe_table Describe Table (deprecated — use mssql_describe_table_columns)

Deprecated alias for mssql_describe_table_columns.

ParameterTypeDescription
tableName *string
response_formatstring
schemaNamestring

mssql_read_table_rows Read Table Rows

Returns rows from a table with optional column projection, WHERE filtering, ORDER BY, and pagination. Read-only. Table and schema names are validated as safe identifiers. WHERE clause values MUST be passed via 'parameters' using @paramName placeholders. Pagination: limit (1-200, default 20) and offset. Example: tableName='Orders', schemaName='dbo', columns=['OrderId','Total'], limit=50

ParameterTypeDescription
tableName *stringTable name
columnsarrayColumns to return (default: all)
limitintegerMax rows (1-200)
offsetintegerRows to skip
orderBystringORDER BY expression. Example: 'CreatedAt DESC, Id ASC'
parametersobjectValues for WHERE clause @paramName placeholders
response_formatstringOutput format: 'json' for structured data, 'markdown' for human-readable table
schemaNamestringSchema name (default: dbo)
whereClausestringWHERE predicate without WHERE keyword. Use @paramName for all values. Example: 'Status = @status AND Amount > @minAmount'

mssql_get_table_data Get Table Data (deprecated — use mssql_read_table_rows)

Deprecated alias for mssql_read_table_rows. Use mssql_read_table_rows instead. ⚠️ whereClause must use @paramName placeholders for all values.

ParameterTypeDescription
tableName *string
limitinteger
offsetinteger
orderBystring
parametersobject
response_formatstring
schemaNamestring
whereClausestring

mssql_execute_stored_procedure Execute Stored Procedure

Executes a stored procedure by name. ⚠️ May modify data — use only when an action is intended. Schema and procedure names are validated as safe identifiers. Pass all value parameters via 'parameters'.

ParameterTypeDescription
procedureName *stringStored procedure name
parametersobjectProcedure input parameters (key-value pairs)
response_formatstringOutput format: 'json' for structured data, 'markdown' for human-readable tables
schemaNamestringSchema name (default: dbo)

mssql_execute_procedure Execute Procedure (deprecated — use mssql_execute_stored_procedure)

Deprecated alias for mssql_execute_stored_procedure.

ParameterTypeDescription
procedureName *stringName of the stored procedure
parametersobject
response_formatstring
schemaNamestring

mssql_list_databases List Databases

Lists all databases visible on the connected SQL Server instance with state and recovery information. Read-only. Supports pagination.

ParameterTypeDescription
limitintegerMax databases (default 20)
offsetintegerSkip N databases
response_formatstringOutput format: 'json' for structured data, 'markdown' for human-readable table