SQL Server MCP Server
Servidor MCP para SQL Server com controle de permissões e modo somente-leitura
SQL Server scores 58 (Fair), licensed MIT and written in Python. It installs as a local process. It does not declare tools yet. Filed under Databases. GitHub shows 0 stars. Package registries report about 26 downloads a week. Install configs are generated for 10 clients. Being listed in the registry is not the same as being vendor-official.
Fair trust
58 of 100 from six public signals. Nobody can buy a point.
- Listed in the official MCP registry.
- OSI-style license: mit.
License, quality and maintenance
Quality: Grade C
65/100 for listing completeness. Lost points: no listed tools, short summary.
How quality is graded
Where the 58 comes from
22 + 15 + 0 + 10 + 4 + 7 = 58. Each factor is capped, so no single signal can carry a listing.
Active in the official MCP registry, plus a known vendor namespace.
Registry: 22 of 30 points.How recently the repository saw a commit or release.
Maintenance: 15 of 20 points.GitHub stars and weekly downloads, on a log scale.
Popularity: 0 of 20 points.A clear, OSI-style open-source license.
License: 10 of 10 points.Not archived, a secure install path, a pinned version.
Security: 4 of 10 points.A real summary, a README with depth, listed tools.
Docs: 7 of 10 points.Install
Pick your client, copy the config, paste it in.
Needs Cursor or VS Code installed on this device. The button opens the app and asks you to confirm before it adds the server.
{ "mcpServers": { "hlgurgel-mcp-sqlserver": { "command": "uvx", "args": [ "sqlserver-mcp-tools" ], "env": { "MSSQL_CONNECTION_STRING": "YOUR_MSSQL_CONNECTION_STRING" } } }}
Environment variables
| Name | Required | Notes |
|---|---|---|
MSSQL_CONNECTION_STRINGSecret | Required | String de conexão ODBC para o SQL Server |
Tools
All capabilitiesTools show up when the registry metadata or the repository README lists them. Public READMEs are read directly. A GitHub token is used only when one is already configured.
About
mcp-sqlserver
Servidor MCP (Model Context Protocol) para SQL Server, com controle de permissões e modo somente-leitura por padrão. Permite que agentes de IA (Claude, opencode e outros clientes MCP) consultem e administrem bancos SQL Server de forma segura.
Segurança
- Credenciais nunca expostas ao LLM — a string de conexão é lida do ambiente e nunca aparece nas respostas nem nos logs.
- Somente leitura por padrão — a ferramenta
consultabloqueia DDL/DML (INSERT, UPDATE, DELETE, DROP, etc.). - Escrita sob demanda — ferramentas de escrita (
executar_update,executar_ddl, etc.) só são expostas quando o usuário da conexão possui permissão de escrita (rolessysadmin,db_owner,db_datawriteroudb_ddladmin), e exigem confirmação explícita antes de cada execução.
Pré-requisitos
- Python 3.10+
- Driver ODBC Driver 18 for SQL Server:
- macOS:
brew install msodbcsql18 - Windows/Linux: instale o driver correspondente da Microsoft
- macOS:
Instalação
Via PyPI:
pip install sqlserver-mcp-tools
Ou, sem instalar nada (executa direto do PyPI com cache):
uvx --from sqlserver-mcp-tools mcp-sqlserver
Configuração
O servidor lê a string de conexão das seguintes fontes, em ordem de prioridade:
- Variável de ambiente
MSSQL_CONNECTION_STRING - Variável de ambiente
MSSQL_ENV_FILEapontando para um arquivo.env - Arquivo
.envno diretório de trabalho (ou na raiz do projeto)
Exemplo de string de conexão:
DRIVER={ODBC Driver 18 for SQL Server};SERVER=localhost,1433;DATABASE=seu_banco;UID=seu_usuario;PWD=sua_senha;TrustServerCertificate=yes
Uso com clientes MCP
Claude Desktop
Adicione ao claude_desktop_config.json:
{
"mcpServers": {
"mcp-sqlserver": {
"command": "uvx",
"args": ["--from", "sqlserver-mcp-tools", "mcp-sqlserver"],
"env": {
"MSSQL_CONNECTION_STRING": "DRIVER={ODBC Driver 18 for SQL Server};SERVER=...;DATABASE=...;UID=...;PWD=...;TrustServerCertificate=yes"
}
}
}
}
Se instalou via pip install, pode usar o entry point diretamente:
{
"mcpServers": {
"mcp-sqlserver": {
"command": "mcp-sqlserver",
"env": {
"MSSQL_CONNECTION_STRING": "DRIVER={ODBC Driver 18 for SQL Server};SERVER=...;DATABASE=...;UID=...;PWD=...;TrustServerCertificate=yes"
}
}
}
}
OpenCode
No opencode.json do projeto:
{
"mcp": {
"sqlserver": {
"type": "local",
"command": ["mcp-sqlserver"],
"environment": {
"MSSQL_CONNECTION_STRING": "DRIVER={ODBC Driver 18 for SQL Server};SERVER=...;DATABASE=...;UID=...;PWD=...;TrustServerCertificate=yes"
}
}
}
}
Alternativa: apontar para um arquivo .env local, mantendo a senha fora do JSON:
{
"mcp": {
"sqlserver": {
"type": "local",
"command": ["mcp-sqlserver"],
"environment": {
"MSSQL_ENV_FILE": "/caminho/para/seu/.env"
}
}
}
}
Servidor HTTP (Streamable HTTP)
Além do modo local (stdio), o servidor pode ser executado como um MCP remoto
via Streamable HTTP, expondo o endpoint /mcp. Instale com o extra server:
pip install 'sqlserver-mcp-tools[server]'
Inicie o servidor:
MSSQL_CONNECTION_STRING="DRIVER={ODBC Driver 18 for SQL Server};SERVER=...;DATABASE=...;UID=...;PWD=...;TrustServerCertificate=yes" \
mcp-sqlserver-http
Opcionalmente, ajuste host/porta com MCP_HOST (padrão 0.0.0.0) e MCP_PORT
(padrão 8090). O endpoint MCP fica em http://<host>:<porta>/mcp.
Para consumir remotamente no opencode:
{
"mcp": {
"sqlserver": {
"type": "remote",
"url": "http://10.177.51.228:8090/mcp"
}
}
}
Ferramentas disponíveis
Somente leitura (sempre disponíveis):
| Ferramenta | Descrição |
|---|---|
consulta | Executa SELECT (somente leitura, bloqueia DDL/DML) |
listar_bancos | Lista os bancos de dados acessíveis |
listar_tabelas | Lista tabelas e views de um banco |
descrever_tabela | Estrutura de uma tabela (colunas, tipos, PK) |
listar_indices | Índices de uma tabela |
listar_procedures | Lista stored procedures |
ler_procedure | Código-fonte de uma procedure |
listar_funcoes | Lista funções (scalar e table-valued) |
ler_funcao | Código-fonte de uma função |
listar_constraints | Constraints de uma tabela (PK, FK, UNIQUE, CHECK, DEFAULT) |
estatisticas_tabela | Estatísticas (linhas, tamanho, uso de dados) |
plano_execucao | Plano de execução estimado (sem executar) |
status_jobs | Status da última execução de jobs do SQL Agent |
Escrita (só com permissão de escrita na conexão):
| Ferramenta | Descrição |
|---|---|
executar_procedure | Executa uma stored procedure |
executar_update | Executa UPDATE (exige WHERE) |
criar_indice | Cria índice |
alterar_procedure | Altera procedure com backup automático |
executar_ddl | Executa DDL com backup do script de reversão |
Licença
MIT
Frequently asked questions
What is SQL Server MCP Server?
Servidor MCP para SQL Server com controle de permissões e modo somente-leitura
How do I install SQL Server MCP Server in Claude Desktop, Cursor, or VS Code?
Pick your client in the Install section on this page and copy the generated config into the client's config file. Step-by-step guides: Claude Desktop, Cursor, and VS Code. SQL Server MCP Server runs locally from the PyPI package sqlserver-mcp-tools with the command uvx sqlserver-mcp-tools.
Is SQL Server MCP Server free and open source?
Yes. SQL Server MCP Server is released under the MIT license, an OSI-approved open-source license, so you can use, modify, and self-host it under those terms.
Does SQL Server MCP Server support remote (HTTP) connections?
No remote endpoint is listed for SQL Server MCP Server. It runs locally on your machine over stdio, started by your MCP client.
How is SQL Server MCP Server's trust score calculated?
SQL Server MCP Server scores 58 out of 100 (Fair). The score adds six capped public signals: registry status, maintenance, popularity, license, documentation, and security. Nobody can pay for points. Read the methodology for the full formula.
Reviews
No reviews yet—Be the first to review
No published reviews yet. Used it? Tell the next person how it went.
Sign inA verified email is required to review this server.
Add badge to your README
Paste either snippet into the repository README. The image links to this listing.