
amornpan/py-mcp-mssql
Developer tools이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기
py-mcp-mssql의
개요
Microsoft SQL Server 데이터베이스에 대한 액세스를 제공하는 Python의 모델 Context Protocol 서버 구현. 이 서버는 테이블 스키마를 검사하고 표준화 된 인터페이스를 통해 SQL 쿼리를 실행하는 언어 모델을 활성화합니다. * Python의 asyncio * python-dotenv * 포괄적인 로깅 시스템을 사용하여 환경 기반 구성 * pyodbc * 오류 처리 및 복구를 통해 연결 풀 및 관리 * API 엔드 포인트에 대한 FastAPI 통합 * 데이터 검증을위한 Pydantic 모델 * ODBC 드라이버와 MSSQL 연결 처리 * Python 3.x * 필수 Python 패키지: * pyodbc * pydantic * python-dotenv * mcp-server * SQL Server용 ODBC 드라이버 17 위의 스크린 샷은 Claude와 함께 SQL 데이터를 분석하고 시각화 할 수 있습니다. * src/mssql/ - 메인 소스 코드 디렉토리 * .py - 패키지 초기화 * server.py - 메인 서버 구현 * 테스트 / - 테스트 파일 디렉토리 * .py - 테스트 패키지 초기화 * test mssql.
개요(AI 번역)
Microsoft SQL Server 데이터베이스에 대한 액세스를 제공하는 Python의 모델 Context Protocol 서버 구현. 이 서버는 테이블 스키마를 검사하고 표준화 된 인터페이스를 통해 SQL 쿼리를 실행하는 언어 모델을 활성화합니다.
특징
핵심 기능
- Python의
asyncio를 이용한 비동기 작동 - 환경 기반 구성
python-dotenv - 포괄적인 로깅 시스템
- pyodbc를 통해 연결 풀 및 관리
- 오류 처리 및 복구
- API 엔드포인트에 대한 FastAPI 통합
- 데이터 검증을위한 Pydantic 모델
- ODBC 드라이버로 MSSQL 연결 처리
필수품
- 파이썬 3.x
- 필수 파이썬 패키지:
- pyodbc는
- pydantic의
- python-dotenv는
- mcp 서버
- SQL Server용 ODBC 드라이버 17
설치
스크린샷
위의 스크린 샷은 Claude와 함께 SQL 데이터를 분석하고 시각화 할 수 있습니다.
프로젝트 구조
디렉토리 구조 설명
src/mssql/- 메인 소스 코드 디렉토리__init__.py- 패키지 초기화server.py- 메인 서버 구현tests/- 파일 디렉토리를 테스트__init__.py- 테스트 패키지 초기화- `test mssql``.
이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요.
README
원문 README의 일부입니다. 원문 보기.
Python MSSQL MCP Server
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
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
│ ├── test_mssql.py
│ └── test_packages.py
├── .env
├── .env.example
├── .gitignore
├── README.md
└── requirements.txt
Directory Structure Explanation
src/mssql/- Main source code directory__init__.py- Package initializationserver.py- Main server implementation
tests/- Test files directory__init__.py- Test package initializationtest_mssql.py- MSSQL functionality teststest_packages.py- Package dependency tests
.env- Environment configuration file (not in git).env.example- Example environment configuration.gitignore- Git ignore rulesREADME.md- Project documentationrequirements.txt- Project dependencies
Configuration
Create a .env file in the project root:
MSSQL_SERVER=your_server
MSSQL_DATABASE=your_database
MSSQL_USER=your_username
MSSQL_PASSWORD=your_password
MSSQL_DRIVER={ODBC Driver 17 for SQL Server}
API Implementation Details
Resource Listing
@app.list_resources()
async def list_resources() -> 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
@app.read_resource()
설치
This server does not publish a one-line install command.
Open the repository installation guide MCP 초보자라면? mcpskill.org 가이드부터 시작하세요 →설정
{
"mcpServers": {
"mssql": {
"command": "python",
"args": [
"server.py"
],
"env": {
"MSSQL_SERVER": "your_server",
"MSSQL_DATABASE": "your_database",
"MSSQL_USER": "your_username",
"MSSQL_PASSWORD": "your_password",
"MSSQL_DRIVER": "{ODBC Driver 17 for SQL Server}"
}
}
}
}