Microsoft SQL Server MCP Server
Enables AI assistants to connect and query Microsoft SQL Server databases using natural language, executing read-only SQL queries for safe data inspection and analysis.
README
Microsoft SQL Server MCP Server
Un servidor personalizado para MCP (Model Context Protocol) que permite conectar tu asistente de IA (Claude, Windsurf, Cursor) con tu base de datos Microsoft SQL Server.
Características
- Consultas Naturales: Pregunta cosas como "¿Cuántos usuarios hay?" y el servidor ejecutará el SQL por ti.
- Solo Lectura (Seguro): Diseñado para inspección y análisis.
- Optimizado: Mantiene una conexión persistente para respuestas instantáneas.
- Compatible: Funciona con Windsurf y Cursor.
Requisitos
- Python 3.11 o superior.
- Driver ODBC para SQL Server 17 (o superior) instalado en Windows.
- Acceso a una base de datos SQL Server.
Instalación
- Clona este repositorio.
- Crea un entorno virtual e instala las dependencias:
python -m venv venv
.\venv\Scripts\Activate.ps1
pip install -e .
Configuración
Debes configurar las credenciales de tu base de datos en las variables de entorno dentro de la configuración de tu editor.
1. Windsurf
Edita tu archivo de configuración de MCP en Windsurf (Generalmente en %APPDATA%\Windsurf\Config\mcp_config.json o accesible desde el menú de configuración de MCP).
Añade lo siguiente:
{
"mcpServers": {
"sqlServer": {
"command": "C:\\Ruta\\A\\Tu\\Repo\\venv\\Scripts\\python.exe",
"args": ["-m", "mssql_mcp_server"],
"env": {
"MSSQL_SERVER": "TU_IP_O_HOST",
"MSSQL_DATABASE": "NOMBRE_BASE_DE_DATOS",
"MSSQL_USER": "TU_USUARIO",
"MSSQL_PASSWORD": "TU_CONTRASEÑA",
"MSSQL_ENCRYPT": "true",
"MSSQL_TRUST_SERVER_CERTIFICATE": "true",
"PYTHONPATH": "C:\\Ruta\\A\\Tu\\Repo\\src"
}
}
}
}
IMPORTANTE: Reemplaza
C:\\Ruta\\A\\Tu\\Repocon la ruta absoluta donde clonaste este proyecto. Asegúrate de usar doble barra invertida\\en Windows.
2. Antigravity (Gemini)
Edita el archivo de configuración de MCP en Antigravity para añadir el servidor.
-
Localiza el archivo de configuración en:
C:\Users\<TU_USUARIO>\.gemini\antigravity\mcp_config.json -
Añade la configuración del servidor dentro del objeto
mcpServers. Si el archivo ya tiene otros servidores (comoperplexity-ask), añadesqlServercomo una nueva clave.
{
"mcpServers": {
"sqlServer": {
"command": "C:\\Ruta\\A\\Tu\\Repo\\venv\\Scripts\\python.exe",
"args": ["-m", "mssql_mcp_server"],
"env": {
"MSSQL_SERVER": "TU_IP_O_HOST",
"MSSQL_DATABASE": "NOMBRE_BASE_DE_DATOS",
"MSSQL_USER": "TU_USUARIO",
"MSSQL_PASSWORD": "TU_CONTRASEÑA",
"MSSQL_ENCRYPT": "true",
"MSSQL_TRUST_SERVER_CERTIFICATE": "true",
"PYTHONPATH": "C:\\Ruta\\A\\Tu\\Repo\\src"
}
}
}
}
NOTA: Asegúrate de que las rutas al ejecutable de Python y al repositorio sean correctas y absolutas.
Desarrollo y Pruebas
Para probar la conexión sin el asistente, usa el script incluido:
# Configura las variables en la sesión temporalmente
$env:MSSQL_SERVER="tu_ip"
$env:MSSQL_DATABASE="tu_db"
# ... resto de variables ...
# Ejecuta el test
python test_connection.py
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.