{"id":27143,"library":"mcpql","title":"MCPQL - SQL Server MCP Server","description":"MCPQL (v1.1.0) is a Model Context Protocol server for SQL Server database analysis and operations, targeting Node.js 18+. It provides 10 tools for database analysis, object discovery, and data manipulation via MCP. Differentiators: native MCP protocol support, works with Claude Desktop/Cursor IDE/Trae AI, supports SQL Server 2016+ and Azure SQL, Docker-ready. Released under MIT, actively maintained.","status":"active","version":"1.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/hendrickcastro/MCPQL","tags":["javascript","mcp","model-context-protocol","sql-server","azure-sql","database","database-analysis","database-tools","mssql"],"install":[{"cmd":"npm install mcpql","lang":"bash","label":"npm"},{"cmd":"yarn add mcpql","lang":"bash","label":"yarn"},{"cmd":"pnpm add mcpql","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"MCP protocol implementation","package":"@modelcontextprotocol/sdk","optional":false},{"reason":"SQL Server database client","package":"mssql","optional":false},{"reason":"Underlying SQL Server driver for mssql","package":"tedious","optional":true}],"imports":[{"note":"Package is ESM-only since v1.0.0; CommonJS require will fail.","wrong":"const startServer = require('mcpql')","symbol":"startServer","correct":"import { startServer } from 'mcpql'"},{"note":"TypeScript type export; use for config type safety.","wrong":"","symbol":"MCPQLConfig","correct":"import { MCPQLConfig } from 'mcpql'"},{"note":"Default export exposes the main server factory function; namespace import may break.","wrong":"import * as mcpql from 'mcpql'","symbol":"default","correct":"import mcpql from 'mcpql'"}],"quickstart":{"code":"import { startServer } from 'mcpql';\n\nconst config = {\n  authentication: {\n    type: 'sql',\n    options: {\n      userName: process.env.DB_USER ?? 'sa',\n      password: process.env.DB_PASSWORD ?? '',\n    },\n  },\n  server: process.env.DB_SERVER ?? 'localhost',\n  port: parseInt(process.env.DB_PORT ?? '1433', 10),\n  database: process.env.DB_NAME ?? 'master',\n  options: {\n    encrypt: process.env.DB_ENCRYPT === 'true',\n    trustServerCertificate: process.env.DB_TRUST_SERVER_CERTIFICATE === 'true',\n  },\n};\n\nstartServer(config).catch(console.error);","lang":"typescript","description":"Shows how to start the MCPQL server programmatically with environment variable based SQL Server configuration."},"warnings":[{"fix":"Use import syntax or ensure your project is configured for ESM (e.g., type: 'module' in package.json).","message":"Package is ESM-only; CommonJS require() will throw error.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Upgrade Node.js to version 18 or later.","message":"Support for Node.js <18 will be removed in v2.","severity":"deprecated","affected_versions":">=1.0.0 <2.0.0"},{"fix":"Use secure credential management (e.g., secret managers) and avoid hardcoding in config files.","message":"Database connection credentials (DB_PASSWORD, etc.) are passed as environment variables; accidental exposure in logs or client configs is a security risk.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use the server within an MCP-compatible host (e.g., Claude Desktop) or wrap with an MCP-to-HTTP bridge.","message":"The server expects MCP messages on stdin/stdout; not suitable for use as an HTTP API without additional adaptation.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use local installation: npm install -g mcpql or run via Docker.","message":"When using npx, the `-y` flag may not work in all environments (e.g., restricted network); pre-install locally instead.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Switch to import syntax or set type: 'module' in package.json.","cause":"Using CommonJS require() to load an ESM-only package.","error":"require is not defined in ES module scope"},{"fix":"Run npm install mcpql or use npx. Check that you are in the correct directory.","cause":"Package not installed or not in node_modules.","error":"Cannot find module 'mcpql'"},{"fix":"Verify DB_SERVER, DB_PORT, DB_USER, DB_PASSWORD environment variables. Check network connectivity and SQL Server instance configuration.","cause":"SQL Server not reachable, wrong credentials, or firewall blocking port 1433.","error":"ConnectionError: Failed to connect to server: localhost in 15000ms"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}