@kingsnow129/database-mcp
v0.4.6
Published
Database MCP server for SQL Server, PostgreSQL, and MySQL with profile-based auto resolution
Maintainers
Readme
Database MCP
Database MCP is an MCP server for SQL Server, PostgreSQL, and MySQL.
It provides tools for:
connecthealth_checklist_schemaslist_tablesdescribe_tablequery(single SELECT only)
Release
Current release:
- NPM package:
@kingsnow129/[email protected] - MCP server name:
database-mcp - VSIX helper:
[email protected]
What Is New In 0.4.6
- Fixed SQL Server integrated-auth instance routing bug: when the configured port can connect but resolves to a different SQL instance, MCP now verifies
@@SERVERNAME, closes the wrong connection, and continues probing candidate ports until it matches the requestedserver\\instance.
What Is New In 0.4.5
- Added SQL Server integrated-auth instance fallback logic: when
hostusesserver\\instanceand direct connect fails, MCP probes candidate ports and validates@@SERVERNAMEto resolve the expected instance. - Added
DB_INSTANCE_PROBE_PORTSenvironment variable for custom probe port lists.
What Is New In 0.4.4
- Fixed SQL Server
integratedAuthconnection handling by building explicit ODBC connection strings formsnodesqlv8. - Added optional
databaseparameter onqueryto support dynamic database switching in one call. - Updated VSIX helper to auto-install MCP runtime on startup activation.
What Is New In 0.4.3
- Removed legacy naming references to
sqlserver-mcp. - MCP registration now keeps only the
databaseMcpserver key.
What Was New In 0.4.2
- Added SQL Server Windows integrated auth support with
integratedAuth. - Added
--integratedAuthCLI override handling inconnectflow. - Added optional dependency
msnodesqlv8for integrated auth SQL Server driver.
What Was Introduced In 0.4.0
- Multi-database profile model (
servers+databases) is now the primary config. - Automatic profile resolution during
connect:- by
alias - by
serverName - by
host - fallback to
currentServer,defaultServer, then legacy alias
- by
- User install directory moved to:
${userHome}/.mcp-servers/database-mcp
- VS Code helper command set simplified and includes:
Database MCP: Manage DatabasesDatabase MCP: Open MCP Server ListDatabase MCP: Uninstall (User)
- Only
databaseMcpkey is written to MCP config.
Quick Start (MCP Config)
Example user/workspace MCP config:
{
"servers": {
"databaseMcp": {
"type": "stdio",
"command": "node",
"args": [
"${userHome}/.mcp-servers/database-mcp/node_modules/@kingsnow129/database-mcp/dist/server.js",
"--profilesFile",
"${userHome}/.mcp-servers/database-mcp/profiles.json"
]
}
}
}You can also run directly with NPX:
{
"mcpServers": {
"database-mcp": {
"command": "npx",
"args": ["-y", "@kingsnow129/database-mcp"]
}
}
}User-Level Install (Windows)
Run:
powershell -ExecutionPolicy Bypass -File .\scripts\install-user.ps1This installs to ${HOME}\\.mcp-servers\\database-mcp and updates %APPDATA%\\Code\\User\\mcp.json.
Profiles Format
profiles.json now uses server-level config with database entries:
{
"defaultServer": "local-server",
"currentServer": "local-server",
"currentDatabase": "master",
"servers": {
"local-server": {
"engine": "sqlserver",
"host": "localhost",
"port": 1433,
"integratedAuth": false,
"user": "sa",
"password": "",
"encrypt": true,
"trustServerCertificate": true,
"databases": [
{ "name": "master", "readOnly": true, "maxRows": 200 }
]
}
}
}VSIX Helper Extension
Build and install locally:
cd vscode-extension
npm install
npm run package
code --install-extension database-mcp-helper-0.4.6.vsix --forceSafety Defaults
- Read-only mode is hard-enforced (
connect.readOnlyoverrides are ignored) - Query tool only accepts one SELECT statement
- Semicolons are blocked
- Stored procedure execution (
exec,execute,sp_*,xp_*) is blocked - Function-call style execution patterns like
schema.fn(...)are blocked - Returned rows are capped (default
200)
Development
npm install
npm run build
npm run devPublish
NPM publish flow:
npm run build
npm publish --access publicVSIX package flow:
cd vscode-extension
npm run package