{"id":43036,"library":"mcp-sql-server","title":"MCP SQL Server","description":"A Model Context Protocol (MCP) server that provides SQL Server database query capabilities using the tedious driver. Current stable version is 1.0.1, released with no formal release cadence. It enables AI agents (via MCP) to execute SQL queries on SQL Server databases. Key differentiators: pure JavaScript implementation with no native dependencies, environment-based configuration, and support for encrypted/unencrypted connections. Requires Node.js >=18, ESM only. Suitable for local development and production workloads with trusted certificates.","status":"active","version":"1.0.1","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","modelcontextprotocol","mcp","server","sql","database"],"install":[{"cmd":"npm install mcp-sql-server","lang":"bash","label":"npm"},{"cmd":"yarn add mcp-sql-server","lang":"bash","label":"yarn"},{"cmd":"pnpm add mcp-sql-server","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"MCP server framework","package":"@modelcontextprotocol/sdk","optional":false},{"reason":"SQL Server driver","package":"tedious","optional":false}],"imports":[{"note":"ESM-only; subpath import required.","wrong":"import { Server } from '@modelcontextprotocol/sdk'","symbol":"Server","correct":"import { Server } from '@modelcontextprotocol/sdk/server/index.js'"},{"note":"ESM-only; subpath import required.","wrong":"import { StdioServerTransport } from '@modelcontextprotocol/sdk'","symbol":"StdioServerTransport","correct":"import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'"},{"note":"ESM-only; subpath import required.","wrong":"import { CallToolRequestSchema } from '@modelcontextprotocol/sdk'","symbol":"CallToolRequestSchema","correct":"import { CallToolRequestSchema } from '@modelcontextprotocol/sdk/types.js'"}],"quickstart":{"code":"# Install and run with environment variables\n# Ensure you have Node.js >=18\nnpm install mcp-sql-server\n\n# Start the server with required env vars\nDB_HOST=localhost \\\nDB_PORT=1433 \\\nDB_DATABASE=mydb \\\nDB_USER=sa \\\nDB_PASSWORD=MyPassword123! \\\nnpm start\n\n# Or run directly with node\nDB_HOST=localhost \\\nDB_DATABASE=mydb \\\nDB_USER=sa \\\nDB_PASSWORD=MyPassword123! \\\nnode build/index.js\n\n# Configure MCP client to use this server with StdioServerTransport\n# The server exposes a 'query' tool that accepts a 'sql' string parameter","lang":"javascript","description":"Runs the MCP SQL Server with environment-based configuration, connecting to a local SQL Server instance."},"warnings":[{"fix":"Use ES module imports (import ... from ...) and ensure 'type': 'module' in package.json.","message":"ESM-only package. Must use import syntax, not require().","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Set DB_TRUST_SERVER_CERTIFICATE=true (not 'true') and DB_PORT=1433 (not '1433').","message":"All environment variables except DB_PORT and DB_TRUST_SERVER_CERTIFICATE are strings. Do not quote boolean values.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Configure SQL Server to enable mixed mode authentication.","message":"The package does not support Windows Authentication; only SQL Server Authentication.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Set DB_ENCRYPT=false for local development or DB_TRUST_SERVER_CERTIFICATE=true for self-signed certs.","message":"Default encryption (DB_ENCRYPT=true) may fail with self-signed certificates. Set DB_TRUST_SERVER_CERTIFICATE=true to bypass.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.0.1':25 '18':66 'agent':35 'ai':34 'base':57 'cadenc':31 'capabl':16 'certif':78 'configur':58 'connect':63 'context':6 'current':21 'databas':14,45,84 'depend':54 'develop':72 'differenti':47 'driver':20 'enabl':33 'encrypted/unencrypted':62 'environ':56 'environment-bas':55 'esm':67 'execut':39 'formal':29 'implement':50 'javascript':49,79 'key':46 'local':71 'mcp':1,8,37,81 'model':5 'modelcontextprotocol':80 'nativ':53 'node.js':65 'product':74 'protocol':7 'provid':11 'pure':48 'queri':15,41 'releas':26,30 'requir':64 'server':3,9,13,44,82 'sql':2,12,40,43,83 'stabl':22 'suitabl':69 'support':60 'tedious':19 'trust':77 'use':17 'version':23 'via':36 'workload':75","created_at":"2026-06-05T16:57:52.329463+00:00","updated_at":"2026-06-05T16:57:52.329463+00:00","problems":[{"fix":"Run 'npm install @modelcontextprotocol/sdk' or ensure it is listed in package.json and node_modules are installed.","cause":"Missing or incorrect MCP SDK dependency.","error":"Error: Cannot find module '@modelcontextprotocol/sdk/server/index.js'"},{"fix":"Verify DB_HOST and DB_PORT are correct, and that SQL Server is running and accessible.","cause":"SQL Server host/port unreachable or DNS resolution failure.","error":"Error: ConnectionError: Failed to connect to localhost:1433 - getaddrinfo ENOTFOUND localhost"},{"fix":"Check DB_USER and DB_PASSWORD environment variables. Enable SQL Server Authentication (mixed mode) in SQL Server.","cause":"Invalid credentials or SQL Server authentication not enabled.","error":"Error: ConnectionError: Login failed for user 'sa'."},{"fix":"Set DB_TRUST_SERVER_CERTIFICATE=true to trust all certificates, or install a valid certificate.","cause":"Self-signed or mismatched certificate, and DB_TRUST_SERVER_CERTIFICATE is not set to true.","error":"Error: ConnectionError: The server certificate did not match the expected certificate"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":"mcp-sql-server","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-05","next_check":"2026-09-03","install_tag":null}}