Skip to content
MCP server
Registry

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.

by hlgurgelMITPython0 stars
Trust score
58Fair
Trust score 58 of 100, Fair

Fair trust

58 of 100 from six public signals. Nobody can buy a point.

  • Listed in the official MCP registry.
  • OSI-style license: mit.
How we score trust
Scorecard

License, quality and maintenance

How grades work
Trust breakdown

Where the 58 comes from

22 + 15 + 0 + 10 + 4 + 7 = 58. Each factor is capped, so no single signal can carry a listing.

Registry22 / 30

Active in the official MCP registry, plus a known vendor namespace.

Registry: 22 of 30 points.
Maintenance15 / 20

How recently the repository saw a commit or release.

Maintenance: 15 of 20 points.
Popularity0 / 20

GitHub stars and weekly downloads, on a log scale.

Popularity: 0 of 20 points.
License10 / 10

A clear, OSI-style open-source license.

License: 10 of 10 points.
Security4 / 10

Not archived, a secure install path, a pinned version.

Security: 4 of 10 points.
Docs7 / 10

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.

~/Library/Application Support/Claude/claude_desktop_config.json
{  "mcpServers": {    "hlgurgel-mcp-sqlserver": {      "command": "uvx",      "args": [        "sqlserver-mcp-tools"      ],      "env": {        "MSSQL_CONNECTION_STRING": "YOUR_MSSQL_CONNECTION_STRING"      }    }  }}

Environment variables

NameRequiredNotes
MSSQL_CONNECTION_STRINGSecretRequiredString de conexão ODBC para o SQL Server

Tools 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

PyPI version License: MIT Python versions

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 consulta bloqueia 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 (roles sysadmin, db_owner, db_datawriter ou db_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

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:

  1. Variável de ambiente MSSQL_CONNECTION_STRING
  2. Variável de ambiente MSSQL_ENV_FILE apontando para um arquivo .env
  3. Arquivo .env no 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):

FerramentaDescrição
consultaExecuta SELECT (somente leitura, bloqueia DDL/DML)
listar_bancosLista os bancos de dados acessíveis
listar_tabelasLista tabelas e views de um banco
descrever_tabelaEstrutura de uma tabela (colunas, tipos, PK)
listar_indicesÍndices de uma tabela
listar_proceduresLista stored procedures
ler_procedureCódigo-fonte de uma procedure
listar_funcoesLista funções (scalar e table-valued)
ler_funcaoCódigo-fonte de uma função
listar_constraintsConstraints de uma tabela (PK, FK, UNIQUE, CHECK, DEFAULT)
estatisticas_tabelaEstatísticas (linhas, tamanho, uso de dados)
plano_execucaoPlano de execução estimado (sem executar)
status_jobsStatus da última execução de jobs do SQL Agent

Escrita (só com permissão de escrita na conexão):

FerramentaDescrição
executar_procedureExecuta uma stored procedure
executar_updateExecuta UPDATE (exige WHERE)
criar_indiceCria índice
alterar_procedureAltera procedure com backup automático
executar_ddlExecuta 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

5 star0 reviews at 5 stars
4 star0 reviews at 4 stars
3 star0 reviews at 3 stars
2 star0 reviews at 2 stars
1 star0 reviews at 1 stars

No published reviews yet. Used it? Tell the next person how it went.

Add badge to your README

Paste either snippet into the repository README. The image links to this listing.

Listed on MCPpedia

Top 5 MCP servers

Daily or weekly. Confirm by email, unsubscribe any time.

How often

Manage this listing

Claim this server