A
amornpan/py-mcp-mssql
py-mcp-mssql
在 GitHub 查看 ↗链接已于 2026-11-12 核查 · HTTP 200 · 打开的是厂商自己的官网
我们没有从该仓库取到可核对的安装命令,也没有公开的远端端点。这两样都没有时,我们不出配置——编一条出来比不给更糟。 各客户端的接法 →
- 来源明细
- 收录自 abordage/awesome-mcp 榜单(我们从中收集的条目之一) · 条目类型:MCP 服务
- 收录与活跃
- 收录于 2026-11-05 · 最近见到 2026-11-14 · 共见到 10 次 · 被 10 个来源列出
- 评分构成
- 综合分 1,003 · 10 个来源 · mcp
常见问题(答案都来自我们的记录)
它适合谁 / 用来做什么?
我们把它归在这些标签下: MCP 服务。标签来自条目自身,不是我们强加的分类。
谁维护它、还在更新吗?
我们收录于 2026-11-05;最近见到 2026-11-14。这里没有"官方认证"或"质量评级"——我们只记录来源与时间。
# Python MSSQL MCP Server
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
A Model Context Protocol server implementation in Python that provides access to Microsoft SQL Server databases. This server enables Language Models to inspect table schemas and execute SQL queries through a standardized interface.
## Features
### Core Functionality
Asynchronous operation using Python's asyncio
Environment-based configuration using python-dotenv
Comprehensive logging system
Connection pooling and management via pyodbc
Error handling and recovery
FastAPI integration for API endpoints
Pydantic models for data validation
MSSQL connection handling with ODBC Driver
## Prerequisites
Python 3.x
Required Python packages:
pyodbc
pydantic
python-dotenv
mcp-server
ODBC Driver 17 for SQL Server
## Installation
bash
git clone https://github.com/amornpan/py-mcp-mssql.git
cd py-mcp-mssql
pip install -r requirements.txt
## Screenshots
The screenshot above demonstrates the server being used with Claude to analyze and visualize SQL data.
## Project Structure
PY-MCP-MSSQL/
├── src/
│ └── mssql/
│ ├── init.py
│ └── server.py
├── tests/
│ ├── init.py
│ ├── testmssql.py
│ └── testpackages.py
├── .env
├── .env.example
├── .gitignore
├── README.md
└── requirements.txt
### Directory Structure Explanation
src/mssql/ - Main source code directory
init.py - Package initialization
server.py - Main server implementation
tests/ - Test files directory
init.py - Test package initialization
testmssql.py - MSSQL functionality tests
testpackages.py - Package dependency tests
.env - Environment configuration file (not in git)
.env.example - Example environment configuration
.gitignore - Git ignore rules
README.md - Project documentation
requirements.txt - Project dependencies
## Configuration
Create a .env file in the project root:
env
MSSQLSERVER=yourserver
MSSQLDATABASE=yourdatabase
MSSQLUSER=yourusername
MSSQLPASSWORD=yourpassword
MSSQLDRIVER={ODBC Driver 17 for SQL Server}
## API Implementation Details
### Resource Listing
python
@app.listresources()
async def listresources() -> list[Resource]
Lists all available tables in the database
Returns table names with URIs in the format mssql:// /data
Includes table descriptions and MIME types
### Resource Reading
python
@app.readresource()
async def readresource(uri: AnyUrl) -> str
Reads data from specified table
Accepts URIs in the format mssql:// /data
Returns first 100 rows in CSV format
Includes column headers
### SQL Execution
python
@app.calltool()
async def calltool(name: str, arguments: dict) -> list[TextContent]
Executes SQL queries
Supports both SELECT and modification queries
Returns results in CSV format for SELECT queries
Returns affected row count for modification queries
## Usage with Claude Desktop
Add to your Claude Desktop configuration:
On MacOS: ~/Library/Application Support/Claude/claudedesktopconfig.json
On Windows: %APPDATA%/Claude/claudedesktopconfig.json
json
"mcpServers": {
"mssql": {
"command": "python",
"args": [
"server.py"
],
"env": {
"MSSQLSERVER": "yourserver",
"MSSQLDATABASE": "yourdatabase",
"MSSQLUSER": "yourusername",
"MSSQLPASSWORD": "yourpassword",
## Features
### Core Functionality
Asynchronous operation using Python's asyncio
Environment-based configuration using python-dotenv
Comprehensive logging system
Connection pooling and management via pyodbc
Error handling and recovery
FastAPI integration for API endpoints
Pydantic models for data validation
MSSQL connection handling with ODBC Driver
## Prerequisites
Python 3.x
Required Python packages:
pyodbc
pydantic
python-dotenv
mcp-server
ODBC Driver 17 for SQL Server
## Installation
bash
git clone https://github.com/amornpan/py-mcp-mssql.git
cd py-mcp-mssql
pip install -r requirements.txt
## Screenshots
The screenshot above demonstrates the server being used with Claude to analyze and visualize SQL data.
## Project Structure
PY-MCP-MSSQL/
├── src/
│ └── mssql/
│ ├── init.py
│ └── server.py
├── tests/
│ ├── init.py
│ ├── testmssql.py
│ └── testpackages.py
├── .env
├── .env.example
├── .gitignore
├── README.md
└── requirements.txt
### Directory Structure Explanation
src/mssql/ - Main source code directory
init.py - Package initialization
server.py - Main server implementation
tests/ - Test files directory
init.py - Test package initialization
testmssql.py - MSSQL functionality tests
testpackages.py - Package dependency tests
.env - Environment configuration file (not in git)
.env.example - Example environment configuration
.gitignore - Git ignore rules
README.md - Project documentation
requirements.txt - Project dependencies
## Configuration
Create a .env file in the project root:
env
MSSQLSERVER=yourserver
MSSQLDATABASE=yourdatabase
MSSQLUSER=yourusername
MSSQLPASSWORD=yourpassword
MSSQLDRIVER={ODBC Driver 17 for SQL Server}
## API Implementation Details
### Resource Listing
python
@app.listresources()
async def listresources() -> list[Resource]
Lists all available tables in the database
Returns table names with URIs in the format mssql:// /data
Includes table descriptions and MIME types
### Resource Reading
python
@app.readresource()
async def readresource(uri: AnyUrl) -> str
Reads data from specified table
Accepts URIs in the format mssql:// /data
Returns first 100 rows in CSV format
Includes column headers
### SQL Execution
python
@app.calltool()
async def calltool(name: str, arguments: dict) -> list[TextContent]
Executes SQL queries
Supports both SELECT and modification queries
Returns results in CSV format for SELECT queries
Returns affected row count for modification queries
## Usage with Claude Desktop
Add to your Claude Desktop configuration:
On MacOS: ~/Library/Application Support/Claude/claudedesktopconfig.json
On Windows: %APPDATA%/Claude/claudedesktopconfig.json
json
"mcpServers": {
"mssql": {
"command": "python",
"args": [
"server.py"
],
"env": {
"MSSQLSERVER": "yourserver",
"MSSQLDATABASE": "yourdatabase",
"MSSQLUSER": "yourusername",
"MSSQLPASSWORD": "yourpassword",
收录徽章(可选)
想把收录标记放进 README 就复制这行,可选,不影响收录。
[](https://anclum.com/zh/s/amornpan-py-mcp-mssql/)
- 来源
- awesome · https://github.com/amornpan/py-mcp-mssql
- 按领域浏览
- MCP 服务
- 收录来源
- 10 个独立来源
- 收录于
- 今天
同类推荐
所属领域与标签
每个标签都能点进去看同类的全部条目。数字是当前库里的真实条数。