SQL Server MCP Server
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@SQL Server MCP Serverlist the first 10 records from the Customers table"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
SQL Server MCP Server (Python)
A Model Context Protocol (MCP) server in Python for integration with Microsoft SQL Server databases.
The server provides complete schema inspection tools and CRUD (Create, Read, Update, Delete) operations, as well as MCP resources for quick data and schema queries.
Available Tools
Schema & Inspection
list_schemas(): Lists all user schemas present in the database.list_tables(schema_name=None): Lists database tables and views with the option to filter by schema.get_table_schema(table_name, schema_name="dbo"): Returns structural details of the table (columns, data types, primary keys, foreign keys, and identities).get_database_schema(schema_name=None, table_name=None): Returns the complete database schema or a filtered one.
CRUD Operations
read_records(table_name, schema_name="dbo", columns=None, where_clause=None, params=None, order_by=None, limit=100, offset=0): Queries records from a table with custom columns, parameterizedWHEREfilters, ordering, and pagination.read_query(sql_query, params=None): Executes a customSELECTquery in T-SQL with support for positional parameters (?).insert_record(table_name, data, schema_name="dbo"): Inserts a single record (key/value dictionary) into a table.bulk_insert_records(table_name, records, schema_name="dbo"): Inserts multiple records in batch within a transaction.update_records(table_name, data, where_clause, where_params=None, schema_name="dbo"): Updates records matching a parameterizedWHEREclause.delete_records(table_name, where_clause, params=None, schema_name="dbo"): Safely removes records matching aWHEREclause.execute_sql(sql_statement, params=None): Executes arbitrary DDL/DML commands (CREATE, ALTER, DROP, INSERT, UPDATE, DELETE).
Related MCP server: SQL Server MCP
MCP Resources
sqlserver://schema: Returns the complete database schema in JSON format.sqlserver://tables: Returns the list of available tables and views.
Installation and Configuration
1. Requirements
Python >= 3.10
SQL Server Driver (Supports
pyodbcwith SQL Server ODBC Driver andpymssqlfor pure Python connections).
2. Environment Configuration (.env)
Create a .env file in the project root or define the environment variables:
SQLSERVER_HOST=localhost
SQLSERVER_PORT=1433
SQLSERVER_DATABASE=MeuBanco
SQLSERVER_USER=sa
SQLSERVER_PASSWORD=SuaSenha123!
SQLSERVER_DRIVER_TYPE=auto
SQLSERVER_TRUST_SERVER_CERTIFICATE=true3. Installation
python -m venv .venv
# Windows
.\.venv\Scripts\activate
# Linux/macOS
source .venv/bin/activate
pip install -e .Configuration in MCP Clients
Example of mcp.json / Client Configuration
{
"mcpServers": {
"sql-server": {
"command": "python",
"args": [
"-m",
"sql_server_mcp.server"
],
"env": {
"SQLSERVER_HOST": "localhost",
"SQLSERVER_PORT": "1433",
"SQLSERVER_DATABASE": "MeuBanco",
"SQLSERVER_USER": "sa",
"SQLSERVER_PASSWORD": "SuaSenha123!",
"SQLSERVER_TRUST_SERVER_CERTIFICATE": "true"
}
}
}
}🐳 Docker & Makefile
You can use the Makefile to facilitate building and running via Docker:
# Compilar a imagem Docker
make build
# Executar o servidor MCP em container utilizando as variáveis do .env
make run
# Rodar os testes unitários dentro do container Docker
make docker-test
# Exibir ajuda dos comandos Makefile
make help🧪 Tests
To run the application's unit tests:
pytestMaintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceAn MCP server that enables interaction with Microsoft SQL Server instances using Windows or SQL Server authentication via native ODBC drivers. It allows users to execute SQL queries, list tables, and inspect schemas across multiple configured database environments through natural language.746MIT
- AlicenseBqualityDmaintenanceAn MCP server that connects AI assistants to Microsoft SQL Server databases, enabling schema exploration and read-only queries safely.49234MIT
- AlicenseNot gradedqualityDmaintenanceA comprehensive MCP server for SQL Server database operations, enabling CRUD operations, schema exploration, and stored procedure execution through natural language.8MIT
- AlicenseNot gradedqualityCmaintenanceMCP server for Microsoft SQL Server enabling safe read-only queries, schema discovery, and natural-language query via LangChain.MIT
Related MCP Connectors
GibsonAI MCP server: manage your databases with natural language
Official Microsoft MCP Server to query Microsoft Entra data using natural language
Analytical memory for AI agents: a real Postgres queried in plain English over MCP. One command.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Thiago-Fernandes-Dias/sql_server_mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server