{"library":"mssql-mcp-server","title":"MSSQL Model Context Protocol Server","description":"The `mssql-mcp-server` package provides a Model Context Protocol (MCP) server specifically designed for Microsoft SQL Server, enabling comprehensive database schema exploration and modernization planning. Currently at version 1.2.2, this server facilitates detailed analysis of database structures, including tables, views, stored procedures, triggers, and functions. It leverages the `tedious` library for pure JavaScript connectivity, supporting crucial features like Windows Authentication (NTLM), which necessitates explicit domain credentials through environment variables for secure, non-interactive background processes. Key differentiators include its extensive suite of 29 analytical tools, capabilities for extracting full SQL source code from stored procedures for business logic analysis, and a focus on assisting with modernization efforts for applications like Classic ASP to modern .NET/Angular architectures. While a specific release cadence isn't detailed, the project appears actively maintained with recent updates focused on enhancing core analysis capabilities.","language":"javascript","status":"active","last_verified":"Tue Apr 21","install":{"commands":["npm install mssql-mcp-server"],"cli":{"name":"mssql-mcp-server","version":null}},"imports":["import { MssqlMcpServer } from 'mssql-mcp-server';","import type { MssqlMcpServerOptions } from 'mssql-mcp-server';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { MssqlMcpServer } from 'mssql-mcp-server';\nimport * as dotenv from 'dotenv'; // For local development, install with `npm install dotenv`\n\ndotenv.config(); // Load environment variables from .env file\n\n// Configure SQL Server connection details using environment variables\nconst SQL_SERVER_HOST = process.env.SQL_SERVER_HOST ?? 'localhost';\nconst SQL_SERVER_PORT = parseInt(process.env.SQL_SERVER_PORT ?? '1433', 10);\nconst SQL_SERVER_USER = process.env.SQL_SERVER_USER ?? ''; // For NTLM Windows Authentication\nconst SQL_SERVER_PASSWORD = process.env.SQL_SERVER_PASSWORD ?? ''; // For NTLM\nconst SQL_SERVER_DOMAIN = process.env.SQL_SERVER_DOMAIN ?? ''; // For NTLM\nconst SQL_SERVER_DATABASE = process.env.SQL_SERVER_DATABASE ?? 'master';\nconst SERVER_PORT = parseInt(process.env.MCP_SERVER_PORT ?? '3000', 10); // Port for the MCP server itself\n\nasync function startMcpServer() {\n  if (!SQL_SERVER_USER || !SQL_SERVER_PASSWORD || !SQL_SERVER_DOMAIN) {\n    console.warn(\"WARNING: NTLM credentials (SQL_SERVER_USER, SQL_SERVER_PASSWORD, SQL_SERVER_DOMAIN) are not fully set. Windows Authentication might fail.\");\n  }\n\n  try {\n    // Instantiate the MCP server with a default connection\n    const server = new MssqlMcpServer({\n      connections: {\n        default: {\n          server: SQL_SERVER_HOST,\n          port: SQL_SERVER_PORT,\n          userName: SQL_SERVER_USER,\n          password: SQL_SERVER_PASSWORD,\n          domain: SQL_SERVER_DOMAIN,\n          options: {\n            database: SQL_SERVER_DATABASE,\n            encrypt: true, // Recommended for Azure SQL DB and modern instances\n            trustServerCertificate: true // Set to false in production if using trusted certificates\n          }\n        }\n      },\n      serverPort: SERVER_PORT\n    });\n\n    await server.start();\n    console.log(`MSSQL MCP Server started successfully on port ${SERVER_PORT}`);\n\n    // --- Simulate an external client (e.g., an AI agent) calling a tool ---\n    console.log('\\n--- Simulating API call to test_connection tool ---');\n    const toolCallResponse = await fetch(`http://localhost:${SERVER_PORT}/api/tool`, {\n      method: 'POST',\n      headers: { 'Content-Type': 'application/json' },\n      body: JSON.stringify({\n        toolName: 'test_connection',\n        toolArgs: { connectionName: 'default' }\n      })\n    });\n\n    const result = await toolCallResponse.json();\n    console.log('Result from test_connection:', result);\n\n  } catch (error) {\n    console.error('Failed to start MSSQL MCP Server or call tool:', error);\n    process.exit(1);\n  }\n}\n\nstartMcpServer();","lang":"typescript","description":"This quickstart demonstrates how to programmatically initialize and start the `mssql-mcp-server` using environment variables for SQL Server connection details, including NTLM authentication. It then shows a hypothetical HTTP POST request to the running server to execute the `test_connection` tool, simulating how an external client or AI agent would interact with the server's API.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}