py-mcp-mssql

py-mcp-mssql

18

The Python MSSQL MCP Server is a Model Context Protocol server that facilitates access to Microsoft SQL Server databases. It supports asynchronous operations and integrates with FastAPI for creating API endpoints, allowing language models to query databases through a standardized interface.

Python MSSQL MCP Server

A Model Context Protocol server implementation in Python that provides access to Microsoft SQL Server databases. Key features include:

Features

  • Asynchronous operation
  • Environment-based configuration
  • Comprehensive logging
  • Connection pooling via pyodbc
  • FastAPI integration
  • Pydantic models for data validation

Prerequisites

  • Python 3.x
  • Required packages: pyodbc, pydantic, python-dotenv, mcp-server
  • ODBC Driver 17 for SQL Server

Installation

Clone the repository and install dependencies from the requirements.txt.

Configuration

Environment variables are used for configuration, which can be set in a .env file.

Error Handling

Comprehensive error handling including database connection and SQL query validations.

Security Features

  • Environment variable-based configuration
  • Connection security and input validation

Contact

For questions, you can contact Amornpan Phornchaicharoen.