sql-server-mcp
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
sql-server-mcp
An MCP server (Streamable HTTP) for SQL Server. It stores several connections (connection strings encrypted on disk with AES-256-GCM) and grants access and keeps an audit log per API key: each key is bound to a list of connections, read-only or read-write. Administration happens in a web page that only opens on the server itself.
Listens on
127.0.0.1:47201. MCP endpoint:http://127.0.0.1:47201/mcp, headerAuthorization: Bearer <key>.MCP tools:
sql_list_connections,sql_schema,sql_query(+sql_executefor read-write keys). Results over 200 rows are paged; call again withoffset.Admin page:
http://127.0.0.1:47201/(you create the admin password on first visit).
Install on Windows
PowerShell:
irm https://github.com/tungminsoft/sql-server-mcp/releases/latest/download/install.ps1 | iexCMD:
curl -fsSL https://github.com/tungminsoft/sql-server-mcp/releases/latest/download/install.cmd -o install.cmd && install.cmd && del install.cmdThe installer asks for admin rights, ships its own node.exe (no Node install needed), then:
puts the program in
%ProgramData%\sql-server-mcp\appand data in%ProgramData%\sql-server-mcp\data(readable only by Administrators and SYSTEM);registers a Task Scheduler task
sql-server-mcpthat runs as SYSTEM at boot (no one needs to sign in) and restarts after 5 seconds if it dies;stops with a clear message if port 47201 is already taken; it never picks another port.
Running the installer again upgrades in place and keeps the data. Offline machine: copy
sql-server-mcp-<version>-win-x64.zip and install.ps1 over, then in an elevated window run
powershell -ExecutionPolicy Bypass -File install.ps1 -ArchivePath <package.zip>.
Uninstall: powershell -ExecutionPolicy Bypass -File "%ProgramData%\sql-server-mcp\uninstall.ps1" (asks before deleting
data; pass -KeepData or -RemoveData to skip the question).
Related MCP server: dynamic-db-mcp-server
Install on Linux (systemd)
Requires Node.js 22 or newer (the installer checks and tells you how to install it; it does not install Node itself).
curl -fsSL https://github.com/tungminsoft/sql-server-mcp/releases/latest/download/install.sh | sudo bashThe program lives in /opt/sql-server-mcp, data in /var/lib/sql-server-mcp (mode 700, owned by the system user
sql-server-mcp), and the service is sql-server-mcp.service (Restart=always). On a server without a browser, reach
the admin page through an SSH tunnel: ssh -L 47201:127.0.0.1:47201 <user>@<server>, then open http://127.0.0.1:47201/.
Uninstall: curl -fsSL https://github.com/tungminsoft/sql-server-mcp/releases/latest/download/uninstall.sh | sudo bash.
Docker
docker run -d --name sql-server-mcp --restart unless-stopped -v sql-server-mcp-data:/data -p 127.0.0.1:47201:47201 ghcr.io/tungminsoft/sql-server-mcp:latestTo run next to an app on the same Docker network, see docker-compose.example.yml. The app
calls http://sql-server-mcp:47201/mcp; SQL_SERVER_MCP_ALLOWED_HOSTS=sql-server-mcp allows that host name on /mcp.
The admin page still accepts only 127.0.0.1/localhost as Host, so publish the port on 127.0.0.1 only.
Using it from an MCP client
Admin page › Connections: add a connection (a SQL login with only
db_datareaderis recommended for the read string).Access keys: create a key, pick its connections and whether it may write. The key is shown once; copy it right away.
Settings: copy the MCP configuration into your client and add the header
Authorization: Bearer <key>.Audit log: every statement, filterable by key and connection.
Deleting a key in the admin page rejects the next call made with it immediately.
Import from an older sql-gateway data directory
If you ran the earlier sql-gateway service (same connections.json + key layout), copy its data directory and run:
sql-server-mcp import-gateway <old data directory>Windows (elevated):
"%ProgramData%\sql-server-mcp\app\node.exe" "%ProgramData%\sql-server-mcp\app\out\index.js" import-gateway <dir>Linux:
sudo -u sql-server-mcp SQL_SERVER_MCP_DATA=/var/lib/sql-server-mcp node /opt/sql-server-mcp/out/index.js import-gateway <dir>Docker: mount the old directory read-only (e.g.
-v <old>:/old:ro) and runnode out/index.js import-gateway /old.
The old directory is only read. Connections are re-encrypted with this server's key; IDs that already exist are skipped, so running it twice is safe. The output lists connection IDs and counts only, never strings or passwords. Restart the service afterwards, then create access keys in the admin page (keys are not imported).
Forgot the admin password
Clear the password (connections and keys are kept), then open the page to set a new one:
Windows (elevated):
"%ProgramData%\sql-server-mcp\app\node.exe" "%ProgramData%\sql-server-mcp\app\out\index.js" reset-adminLinux:
sudo -u sql-server-mcp SQL_SERVER_MCP_DATA=/var/lib/sql-server-mcp node /opt/sql-server-mcp/out/index.js reset-admin && sudo systemctl restart sql-server-mcpDocker:
docker exec sql-server-mcp node out/index.js reset-admin && docker restart sql-server-mcp
Environment variables
Variable | Default | Notes |
|
| Windows accepts loopback only. Docker sets |
|
| |
| Windows | |
| (empty) | Extra host names allowed on |
|
|
Development
npm ci
npm test # tests (fake SQL Server, no real server needed)
npm run typecheck
npm run dev # run from source
npm run release # build packages into release/ and smoke-test each oneReleasing: push a tag vX.Y.Z matching version in package.json; GitHub Actions
(.github/workflows/release.yml) runs the tests, builds the packages, creates the Release and pushes the image to ghcr.io.
License
MIT
Tiếng Việt
sql-server-mcp là MCP server (HTTP) cho SQL Server: giữ nhiều kết nối mã hoá trên đĩa, cấp quyền và ghi nhật ký
theo từng khoá (chỉ đọc hoặc đọc-ghi). Nghe 127.0.0.1:47201; trang quản trị http://127.0.0.1:47201/ chỉ mở được
trên chính máy chủ, lần đầu vào thì tạo mật khẩu.
Cài: Windows chạy lệnh
irm ... | iexở mục Install on Windows; Linux chạycurl ... | sudo bashở mục Install on Linux; Docker xem mục Docker. Chạy lại lệnh cài là cập nhật, dữ liệu giữ nguyên.Dùng: thêm kết nối → tạo khoá → chép cấu hình MCP vào app, thêm header
Authorization: Bearer <khoá>.Chuyển từ cổng
sql-gatewaycũ:sql-server-mcp import-gateway <thư mục dữ liệu cũ>(chỉ đọc thư mục cũ, không in chuỗi kết nối hay mật khẩu; khoá truy cập tạo lại ở trang quản trị).Quên mật khẩu quản trị: lệnh
reset-adminở mục Forgot the admin password.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Governed SQL access to your databases: redaction, query review and an audit log.
Safe, read-only Postgres and MySQL access for AI agents. Audit log + column-level controls.
Query 40 databases from Claude, ChatGPT, or Cursor — on any device. Read-only, encrypted, audited.
Read, write, and combine connected apps and databases with shared code and per-person permissions.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables secure database interactions with MySQL, PostgreSQL, and SQLite through granular permissions, multi-database support, and cloud-ready SSL/TLS connections. Supports read-only modes, schema-specific permissions, and transaction management for safe database operations.13 npm1MIT
- AlicenseNot gradedqualityCmaintenanceEnables secure, controlled access to existing relational databases via MCP, with API key authorization, read/write permissions, table-level allow/deny lists, SQL validation, rate limiting, audit logging, and a web management console. Supports PostgreSQL, MySQL, SQLite, SQL Server, and Oracle.38 npm2MIT
- AlicenseNot gradedqualityCmaintenanceEnables controlled access to Oracle/PLSQL databases, allowing querying, schema browsing, and optional PL/SQL execution with per-connection safety controls.MIT
- AlicenseAqualityBmaintenanceEnables AI agents to query and explore PostgreSQL and MySQL clusters from a single main configuration, with dynamic per-database routing, automatic database discovery and sync, table/schema inspection, and hierarchical write-rule protection that can block or allow specific SQL mutation operations.9MIT