microsoft_sql_server_mcp_haibt 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- microsoft_sql_server_mcp_haibt-0.1.0/.dockerignore +28 -0
- microsoft_sql_server_mcp_haibt-0.1.0/.github/workflows/ci.yml +120 -0
- microsoft_sql_server_mcp_haibt-0.1.0/.github/workflows/publish.yml +88 -0
- microsoft_sql_server_mcp_haibt-0.1.0/.github/workflows/release.yml +59 -0
- microsoft_sql_server_mcp_haibt-0.1.0/.github/workflows/security.yml +68 -0
- microsoft_sql_server_mcp_haibt-0.1.0/.gitignore +82 -0
- microsoft_sql_server_mcp_haibt-0.1.0/Dockerfile +20 -0
- microsoft_sql_server_mcp_haibt-0.1.0/LICENSE +21 -0
- microsoft_sql_server_mcp_haibt-0.1.0/Makefile +65 -0
- microsoft_sql_server_mcp_haibt-0.1.0/PKG-INFO +130 -0
- microsoft_sql_server_mcp_haibt-0.1.0/README.md +111 -0
- microsoft_sql_server_mcp_haibt-0.1.0/SECURITY.md +34 -0
- microsoft_sql_server_mcp_haibt-0.1.0/close_fixed_issues.sh +91 -0
- microsoft_sql_server_mcp_haibt-0.1.0/docker-compose.example.yml +31 -0
- microsoft_sql_server_mcp_haibt-0.1.0/docker-compose.yml +41 -0
- microsoft_sql_server_mcp_haibt-0.1.0/pyproject.toml +38 -0
- microsoft_sql_server_mcp_haibt-0.1.0/pytest.ini +5 -0
- microsoft_sql_server_mcp_haibt-0.1.0/requirements-dev.txt +25 -0
- microsoft_sql_server_mcp_haibt-0.1.0/requirements.txt +2 -0
- microsoft_sql_server_mcp_haibt-0.1.0/run_tests.py +105 -0
- microsoft_sql_server_mcp_haibt-0.1.0/src/mssql_mcp_server/__init__.py +9 -0
- microsoft_sql_server_mcp_haibt-0.1.0/src/mssql_mcp_server/__main__.py +5 -0
- microsoft_sql_server_mcp_haibt-0.1.0/src/mssql_mcp_server/server.py +292 -0
- microsoft_sql_server_mcp_haibt-0.1.0/test_connection.py +41 -0
- microsoft_sql_server_mcp_haibt-0.1.0/tests/conftest.py +45 -0
- microsoft_sql_server_mcp_haibt-0.1.0/tests/test_config.py +168 -0
- microsoft_sql_server_mcp_haibt-0.1.0/tests/test_error_handling.py +311 -0
- microsoft_sql_server_mcp_haibt-0.1.0/tests/test_integration.py +254 -0
- microsoft_sql_server_mcp_haibt-0.1.0/tests/test_performance.py +322 -0
- microsoft_sql_server_mcp_haibt-0.1.0/tests/test_security.py +188 -0
- microsoft_sql_server_mcp_haibt-0.1.0/tests/test_server.py +46 -0
- microsoft_sql_server_mcp_haibt-0.1.0/uv.lock +330 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Git
|
|
2
|
+
.git
|
|
3
|
+
.gitignore
|
|
4
|
+
|
|
5
|
+
# Virtual Environment
|
|
6
|
+
venv/
|
|
7
|
+
__pycache__/
|
|
8
|
+
*.py[cod]
|
|
9
|
+
*$py.class
|
|
10
|
+
*.so
|
|
11
|
+
.Python
|
|
12
|
+
.pytest_cache/
|
|
13
|
+
.coverage
|
|
14
|
+
htmlcov/
|
|
15
|
+
|
|
16
|
+
# Logs
|
|
17
|
+
*.log
|
|
18
|
+
|
|
19
|
+
# Docker
|
|
20
|
+
Dockerfile
|
|
21
|
+
.dockerignore
|
|
22
|
+
docker-compose.yml
|
|
23
|
+
|
|
24
|
+
# Editor directories and files
|
|
25
|
+
.idea/
|
|
26
|
+
.vscode/
|
|
27
|
+
*.swp
|
|
28
|
+
*.swo
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
name: CI/CD Pipeline
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ main, develop ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ main ]
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
test:
|
|
12
|
+
name: Test Python ${{ matrix.python-version }}
|
|
13
|
+
runs-on: ${{ matrix.os }}
|
|
14
|
+
strategy:
|
|
15
|
+
fail-fast: false
|
|
16
|
+
matrix:
|
|
17
|
+
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
18
|
+
python-version: ['3.11', '3.12']
|
|
19
|
+
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v4
|
|
22
|
+
|
|
23
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
24
|
+
uses: actions/setup-python@v5
|
|
25
|
+
with:
|
|
26
|
+
python-version: ${{ matrix.python-version }}
|
|
27
|
+
|
|
28
|
+
- name: Install system dependencies (Ubuntu)
|
|
29
|
+
if: matrix.os == 'ubuntu-latest'
|
|
30
|
+
run: |
|
|
31
|
+
sudo apt-get update
|
|
32
|
+
sudo apt-get install -y freetds-dev
|
|
33
|
+
|
|
34
|
+
- name: Install system dependencies (macOS)
|
|
35
|
+
if: matrix.os == 'macos-latest'
|
|
36
|
+
run: |
|
|
37
|
+
brew install freetds
|
|
38
|
+
|
|
39
|
+
- name: Install dependencies
|
|
40
|
+
run: |
|
|
41
|
+
python -m pip install --upgrade pip
|
|
42
|
+
pip install -r requirements.txt
|
|
43
|
+
pip install -r requirements-dev.txt
|
|
44
|
+
pip install -e .
|
|
45
|
+
|
|
46
|
+
- name: Lint with ruff
|
|
47
|
+
run: |
|
|
48
|
+
pip install ruff
|
|
49
|
+
ruff check src tests
|
|
50
|
+
|
|
51
|
+
- name: Type check with mypy
|
|
52
|
+
run: |
|
|
53
|
+
pip install mypy
|
|
54
|
+
mypy src --ignore-missing-imports
|
|
55
|
+
|
|
56
|
+
- name: Test with pytest
|
|
57
|
+
run: |
|
|
58
|
+
pytest tests -v --tb=short
|
|
59
|
+
env:
|
|
60
|
+
MSSQL_SERVER: localhost
|
|
61
|
+
MSSQL_USER: test
|
|
62
|
+
MSSQL_PASSWORD: test
|
|
63
|
+
MSSQL_DATABASE: test
|
|
64
|
+
|
|
65
|
+
- name: Check package build
|
|
66
|
+
run: |
|
|
67
|
+
pip install hatch
|
|
68
|
+
hatch build
|
|
69
|
+
ls -la dist/
|
|
70
|
+
|
|
71
|
+
security-scan:
|
|
72
|
+
name: Security Scan
|
|
73
|
+
runs-on: ubuntu-latest
|
|
74
|
+
|
|
75
|
+
steps:
|
|
76
|
+
- uses: actions/checkout@v4
|
|
77
|
+
|
|
78
|
+
- name: Set up Python
|
|
79
|
+
uses: actions/setup-python@v5
|
|
80
|
+
with:
|
|
81
|
+
python-version: '3.11'
|
|
82
|
+
|
|
83
|
+
- name: Install dependencies
|
|
84
|
+
run: |
|
|
85
|
+
python -m pip install --upgrade pip
|
|
86
|
+
pip install bandit[toml] safety
|
|
87
|
+
|
|
88
|
+
- name: Run Bandit security scan
|
|
89
|
+
run: bandit -r src -f json -o bandit-report.json || true
|
|
90
|
+
|
|
91
|
+
- name: Run Safety check
|
|
92
|
+
run: |
|
|
93
|
+
pip install -r requirements.txt
|
|
94
|
+
safety check --json || true
|
|
95
|
+
|
|
96
|
+
- name: Upload security reports
|
|
97
|
+
uses: actions/upload-artifact@v4
|
|
98
|
+
if: always()
|
|
99
|
+
with:
|
|
100
|
+
name: security-reports
|
|
101
|
+
path: |
|
|
102
|
+
bandit-report.json
|
|
103
|
+
|
|
104
|
+
docker-build:
|
|
105
|
+
name: Docker Build Test
|
|
106
|
+
runs-on: ubuntu-latest
|
|
107
|
+
|
|
108
|
+
steps:
|
|
109
|
+
- uses: actions/checkout@v4
|
|
110
|
+
|
|
111
|
+
- name: Set up Docker Buildx
|
|
112
|
+
uses: docker/setup-buildx-action@v3
|
|
113
|
+
|
|
114
|
+
- name: Build Docker image
|
|
115
|
+
run: |
|
|
116
|
+
docker build -t mssql-mcp-server:test .
|
|
117
|
+
|
|
118
|
+
- name: Test Docker image
|
|
119
|
+
run: |
|
|
120
|
+
docker run --rm mssql-mcp-server:test python --version
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
inputs:
|
|
8
|
+
test_pypi:
|
|
9
|
+
description: 'Publish to Test PyPI first'
|
|
10
|
+
required: false
|
|
11
|
+
default: true
|
|
12
|
+
type: boolean
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
build:
|
|
16
|
+
name: Build distribution packages
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v4
|
|
21
|
+
|
|
22
|
+
- name: Set up Python
|
|
23
|
+
uses: actions/setup-python@v5
|
|
24
|
+
with:
|
|
25
|
+
python-version: '3.11'
|
|
26
|
+
|
|
27
|
+
- name: Install build dependencies
|
|
28
|
+
run: |
|
|
29
|
+
python -m pip install --upgrade pip
|
|
30
|
+
pip install hatch
|
|
31
|
+
|
|
32
|
+
- name: Build package
|
|
33
|
+
run: hatch build
|
|
34
|
+
|
|
35
|
+
- name: Store the distribution packages
|
|
36
|
+
uses: actions/upload-artifact@v4
|
|
37
|
+
with:
|
|
38
|
+
name: python-package-distributions
|
|
39
|
+
path: dist/
|
|
40
|
+
|
|
41
|
+
publish-to-test-pypi:
|
|
42
|
+
name: Publish to Test PyPI
|
|
43
|
+
if: github.event_name == 'workflow_dispatch' && github.event.inputs.test_pypi == 'true'
|
|
44
|
+
needs: build
|
|
45
|
+
runs-on: ubuntu-latest
|
|
46
|
+
|
|
47
|
+
environment:
|
|
48
|
+
name: test-pypi
|
|
49
|
+
url: https://test.pypi.org/p/microsoft_sql_server_mcp
|
|
50
|
+
|
|
51
|
+
permissions:
|
|
52
|
+
id-token: write # IMPORTANT: mandatory for trusted publishing
|
|
53
|
+
|
|
54
|
+
steps:
|
|
55
|
+
- name: Download all the dists
|
|
56
|
+
uses: actions/download-artifact@v4
|
|
57
|
+
with:
|
|
58
|
+
name: python-package-distributions
|
|
59
|
+
path: dist/
|
|
60
|
+
|
|
61
|
+
- name: Publish to Test PyPI
|
|
62
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
63
|
+
with:
|
|
64
|
+
repository-url: https://test.pypi.org/legacy/
|
|
65
|
+
skip-existing: true
|
|
66
|
+
|
|
67
|
+
publish-to-pypi:
|
|
68
|
+
name: Publish to PyPI
|
|
69
|
+
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.test_pypi == 'false')
|
|
70
|
+
needs: build
|
|
71
|
+
runs-on: ubuntu-latest
|
|
72
|
+
|
|
73
|
+
environment:
|
|
74
|
+
name: pypi
|
|
75
|
+
url: https://pypi.org/p/microsoft_sql_server_mcp
|
|
76
|
+
|
|
77
|
+
permissions:
|
|
78
|
+
id-token: write # IMPORTANT: mandatory for trusted publishing
|
|
79
|
+
|
|
80
|
+
steps:
|
|
81
|
+
- name: Download all the dists
|
|
82
|
+
uses: actions/download-artifact@v4
|
|
83
|
+
with:
|
|
84
|
+
name: python-package-distributions
|
|
85
|
+
path: dist/
|
|
86
|
+
|
|
87
|
+
- name: Publish to PyPI
|
|
88
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
name: Create Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*' # Trigger on version tags like v1.0.0
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
inputs:
|
|
9
|
+
version:
|
|
10
|
+
description: 'Version to release (e.g., 1.0.0)'
|
|
11
|
+
required: true
|
|
12
|
+
type: string
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
create-release:
|
|
16
|
+
name: Create GitHub Release
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
permissions:
|
|
19
|
+
contents: write
|
|
20
|
+
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v4
|
|
23
|
+
with:
|
|
24
|
+
fetch-depth: 0 # Get all history for changelog
|
|
25
|
+
|
|
26
|
+
- name: Set up Python
|
|
27
|
+
uses: actions/setup-python@v5
|
|
28
|
+
with:
|
|
29
|
+
python-version: '3.11'
|
|
30
|
+
|
|
31
|
+
- name: Generate changelog
|
|
32
|
+
id: changelog
|
|
33
|
+
run: |
|
|
34
|
+
# Generate changelog from git history
|
|
35
|
+
echo "## What's Changed" > RELEASE_NOTES.md
|
|
36
|
+
echo "" >> RELEASE_NOTES.md
|
|
37
|
+
|
|
38
|
+
# Get commits since last tag
|
|
39
|
+
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
|
|
40
|
+
if [ -z "$LAST_TAG" ]; then
|
|
41
|
+
git log --pretty=format:"* %s (%h)" >> RELEASE_NOTES.md
|
|
42
|
+
else
|
|
43
|
+
git log ${LAST_TAG}..HEAD --pretty=format:"* %s (%h)" >> RELEASE_NOTES.md
|
|
44
|
+
fi
|
|
45
|
+
|
|
46
|
+
echo "" >> RELEASE_NOTES.md
|
|
47
|
+
echo "**Full Changelog**: https://github.com/${{ github.repository }}/compare/${LAST_TAG}...v${{ github.event.inputs.version || github.ref_name }}" >> RELEASE_NOTES.md
|
|
48
|
+
|
|
49
|
+
- name: Create Release
|
|
50
|
+
env:
|
|
51
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
52
|
+
run: |
|
|
53
|
+
VERSION="${{ github.event.inputs.version || github.ref_name }}"
|
|
54
|
+
VERSION="${VERSION#v}" # Remove 'v' prefix if present
|
|
55
|
+
|
|
56
|
+
gh release create "v${VERSION}" \
|
|
57
|
+
--title "Release v${VERSION}" \
|
|
58
|
+
--notes-file RELEASE_NOTES.md \
|
|
59
|
+
--draft
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
name: Security Scan
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
schedule:
|
|
5
|
+
- cron: '0 0 * * 1' # Weekly on Monday
|
|
6
|
+
push:
|
|
7
|
+
branches: [ main ]
|
|
8
|
+
pull_request:
|
|
9
|
+
branches: [ main ]
|
|
10
|
+
workflow_dispatch:
|
|
11
|
+
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
security-events: write
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
dependency-check:
|
|
18
|
+
name: Dependency Security Check
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v4
|
|
23
|
+
|
|
24
|
+
- name: Set up Python
|
|
25
|
+
uses: actions/setup-python@v5
|
|
26
|
+
with:
|
|
27
|
+
python-version: '3.11'
|
|
28
|
+
|
|
29
|
+
- name: Install dependencies
|
|
30
|
+
run: |
|
|
31
|
+
python -m pip install --upgrade pip
|
|
32
|
+
pip install safety pip-audit
|
|
33
|
+
pip install -r requirements.txt
|
|
34
|
+
|
|
35
|
+
- name: Run Safety check
|
|
36
|
+
run: |
|
|
37
|
+
safety check --json --output safety-report.json || true
|
|
38
|
+
|
|
39
|
+
- name: Run pip-audit
|
|
40
|
+
run: |
|
|
41
|
+
pip-audit --format json --output pip-audit-report.json || true
|
|
42
|
+
|
|
43
|
+
- name: Upload security reports
|
|
44
|
+
uses: actions/upload-artifact@v4
|
|
45
|
+
if: always()
|
|
46
|
+
with:
|
|
47
|
+
name: dependency-security-reports
|
|
48
|
+
path: |
|
|
49
|
+
safety-report.json
|
|
50
|
+
pip-audit-report.json
|
|
51
|
+
|
|
52
|
+
codeql-analysis:
|
|
53
|
+
name: CodeQL Analysis
|
|
54
|
+
runs-on: ubuntu-latest
|
|
55
|
+
|
|
56
|
+
steps:
|
|
57
|
+
- uses: actions/checkout@v4
|
|
58
|
+
|
|
59
|
+
- name: Initialize CodeQL
|
|
60
|
+
uses: github/codeql-action/init@v3
|
|
61
|
+
with:
|
|
62
|
+
languages: python
|
|
63
|
+
|
|
64
|
+
- name: Autobuild
|
|
65
|
+
uses: github/codeql-action/autobuild@v3
|
|
66
|
+
|
|
67
|
+
- name: Perform CodeQL Analysis
|
|
68
|
+
uses: github/codeql-action/analyze@v3
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
*.egg-info/
|
|
24
|
+
.installed.cfg
|
|
25
|
+
*.egg
|
|
26
|
+
MANIFEST
|
|
27
|
+
|
|
28
|
+
# PyInstaller
|
|
29
|
+
*.manifest
|
|
30
|
+
*.spec
|
|
31
|
+
|
|
32
|
+
# Unit test / coverage reports
|
|
33
|
+
htmlcov/
|
|
34
|
+
.tox/
|
|
35
|
+
.coverage
|
|
36
|
+
.coverage.*
|
|
37
|
+
.cache
|
|
38
|
+
nosetests.xml
|
|
39
|
+
coverage.xml
|
|
40
|
+
*.cover
|
|
41
|
+
.hypothesis/
|
|
42
|
+
.pytest_cache/
|
|
43
|
+
|
|
44
|
+
# Virtual environments
|
|
45
|
+
venv/
|
|
46
|
+
ENV/
|
|
47
|
+
env/
|
|
48
|
+
.venv
|
|
49
|
+
|
|
50
|
+
# IDEs
|
|
51
|
+
.vscode/
|
|
52
|
+
.idea/
|
|
53
|
+
*.swp
|
|
54
|
+
*.swo
|
|
55
|
+
*~
|
|
56
|
+
|
|
57
|
+
# OS
|
|
58
|
+
.DS_Store
|
|
59
|
+
.DS_Store?
|
|
60
|
+
._*
|
|
61
|
+
.Spotlight-V100
|
|
62
|
+
.Trashes
|
|
63
|
+
Thumbs.db
|
|
64
|
+
ehthumbs.db
|
|
65
|
+
|
|
66
|
+
# Environment variables
|
|
67
|
+
.env
|
|
68
|
+
*.env
|
|
69
|
+
!.env.example
|
|
70
|
+
|
|
71
|
+
# Logs
|
|
72
|
+
*.log
|
|
73
|
+
|
|
74
|
+
# Database
|
|
75
|
+
*.db
|
|
76
|
+
*.sqlite
|
|
77
|
+
|
|
78
|
+
# MCP specific
|
|
79
|
+
mcp-workspace/
|
|
80
|
+
|
|
81
|
+
# Claude local settings
|
|
82
|
+
.claude/
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
FROM python:3.11-slim
|
|
2
|
+
|
|
3
|
+
WORKDIR /app
|
|
4
|
+
|
|
5
|
+
# Install system dependencies for pymssql
|
|
6
|
+
RUN apt-get update && apt-get install -y \
|
|
7
|
+
freetds-dev \
|
|
8
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
9
|
+
|
|
10
|
+
# Copy requirements
|
|
11
|
+
COPY requirements.txt .
|
|
12
|
+
|
|
13
|
+
# Install Python dependencies
|
|
14
|
+
RUN pip install --no-cache-dir -r requirements.txt
|
|
15
|
+
|
|
16
|
+
# Copy project files
|
|
17
|
+
COPY . .
|
|
18
|
+
|
|
19
|
+
# Run the MCP server
|
|
20
|
+
CMD ["python", "-m", "mssql_mcp_server"]
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Dana K. Williams
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
.PHONY: venv install install-dev test lint format clean run docker-build docker-up docker-down docker-test docker-exec
|
|
2
|
+
|
|
3
|
+
PYTHON := python3
|
|
4
|
+
VENV := venv
|
|
5
|
+
BIN := $(VENV)/bin
|
|
6
|
+
|
|
7
|
+
venv:
|
|
8
|
+
$(PYTHON) -m venv $(VENV)
|
|
9
|
+
|
|
10
|
+
install: venv
|
|
11
|
+
$(BIN)/pip install -r requirements.txt
|
|
12
|
+
|
|
13
|
+
install-dev: install
|
|
14
|
+
$(BIN)/pip install -r requirements-dev.txt
|
|
15
|
+
$(BIN)/pip install -e .
|
|
16
|
+
|
|
17
|
+
test: install-dev
|
|
18
|
+
$(BIN)/pytest -v
|
|
19
|
+
|
|
20
|
+
lint: install-dev
|
|
21
|
+
$(BIN)/black --check src tests
|
|
22
|
+
$(BIN)/isort --check src tests
|
|
23
|
+
$(BIN)/mypy src tests
|
|
24
|
+
|
|
25
|
+
format: install-dev
|
|
26
|
+
$(BIN)/black src tests
|
|
27
|
+
$(BIN)/isort src tests
|
|
28
|
+
|
|
29
|
+
clean:
|
|
30
|
+
rm -rf $(VENV) __pycache__ .pytest_cache .coverage
|
|
31
|
+
find . -type d -name "__pycache__" -exec rm -rf {} +
|
|
32
|
+
find . -type d -name "*.egg-info" -exec rm -rf {} +
|
|
33
|
+
find . -type f -name "*.pyc" -delete
|
|
34
|
+
|
|
35
|
+
run: install
|
|
36
|
+
$(BIN)/python -m mssql_mcp_server
|
|
37
|
+
|
|
38
|
+
# Docker commands
|
|
39
|
+
docker-build:
|
|
40
|
+
docker-compose build
|
|
41
|
+
|
|
42
|
+
docker-up:
|
|
43
|
+
docker-compose up -d
|
|
44
|
+
|
|
45
|
+
docker-down:
|
|
46
|
+
docker-compose down
|
|
47
|
+
|
|
48
|
+
docker-test:
|
|
49
|
+
docker-compose exec mcp_server pytest -v
|
|
50
|
+
|
|
51
|
+
docker-exec:
|
|
52
|
+
docker-compose exec mcp_server bash
|
|
53
|
+
|
|
54
|
+
# Test MSSQL connection
|
|
55
|
+
test-connection:
|
|
56
|
+
$(PYTHON) test_connection.py --server $${MSSQL_SERVER:-localhost} --port $${HOST_SQL_PORT:-1434} --user $${MSSQL_USER:-sa} --password $${MSSQL_PASSWORD:-StrongPassword123!} --database $${MSSQL_DATABASE:-master}
|
|
57
|
+
|
|
58
|
+
# Set environment variables for testing
|
|
59
|
+
test-env:
|
|
60
|
+
@echo "Export your database credentials before running tests:"
|
|
61
|
+
@echo "export MSSQL_SERVER=your_server"
|
|
62
|
+
@echo "export MSSQL_PORT=1433"
|
|
63
|
+
@echo "export MSSQL_USER=your_username"
|
|
64
|
+
@echo "export MSSQL_PASSWORD=your_password"
|
|
65
|
+
@echo "export MSSQL_DATABASE=your_database"
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: microsoft_sql_server_mcp_haibt
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A Model Context Protocol (MCP) server that enables secure interaction with Microsoft SQL Server databases.
|
|
5
|
+
Author-email: Richard Han <noreply@example.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Keywords: ai,database,mcp,mssql,sql-server
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Requires-Python: >=3.11
|
|
16
|
+
Requires-Dist: mcp>=1.0.0
|
|
17
|
+
Requires-Dist: pymssql>=2.2.8
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
|
|
20
|
+
# Microsoft SQL Server MCP Server
|
|
21
|
+
|
|
22
|
+
[](https://pypi.org/project/microsoft_sql_server_mcp/)
|
|
23
|
+
[](https://opensource.org/licenses/MIT)
|
|
24
|
+
|
|
25
|
+
<a href="https://glama.ai/mcp/servers/29cpe19k30">
|
|
26
|
+
<img width="380" height="200" src="https://glama.ai/mcp/servers/29cpe19k30/badge" alt="Microsoft SQL Server MCP server" />
|
|
27
|
+
</a>
|
|
28
|
+
|
|
29
|
+
A Model Context Protocol (MCP) server for secure SQL Server database access through Claude Desktop.
|
|
30
|
+
|
|
31
|
+
## Features
|
|
32
|
+
|
|
33
|
+
- 🔍 List database tables
|
|
34
|
+
- 📊 Execute SQL queries (SELECT, INSERT, UPDATE, DELETE)
|
|
35
|
+
- 🔐 Multiple authentication methods (SQL, Windows, Azure AD)
|
|
36
|
+
- 🏢 LocalDB and Azure SQL support
|
|
37
|
+
- 🔌 Custom port configuration
|
|
38
|
+
|
|
39
|
+
## Quick Start
|
|
40
|
+
|
|
41
|
+
### Install with Claude Desktop
|
|
42
|
+
|
|
43
|
+
Add to your `claude_desktop_config.json`:
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
{
|
|
47
|
+
"mcpServers": {
|
|
48
|
+
"mssql": {
|
|
49
|
+
"command": "uvx",
|
|
50
|
+
"args": ["microsoft_sql_server_mcp"],
|
|
51
|
+
"env": {
|
|
52
|
+
"MSSQL_SERVER": "localhost",
|
|
53
|
+
"MSSQL_DATABASE": "your_database",
|
|
54
|
+
"MSSQL_USER": "your_username",
|
|
55
|
+
"MSSQL_PASSWORD": "your_password"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Configuration
|
|
63
|
+
|
|
64
|
+
### Basic SQL Authentication
|
|
65
|
+
```bash
|
|
66
|
+
MSSQL_SERVER=localhost # Required
|
|
67
|
+
MSSQL_DATABASE=your_database # Required
|
|
68
|
+
MSSQL_USER=your_username # Required for SQL auth
|
|
69
|
+
MSSQL_PASSWORD=your_password # Required for SQL auth
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Windows Authentication
|
|
73
|
+
```bash
|
|
74
|
+
MSSQL_SERVER=localhost
|
|
75
|
+
MSSQL_DATABASE=your_database
|
|
76
|
+
MSSQL_WINDOWS_AUTH=true # Use Windows credentials
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Azure SQL Database
|
|
80
|
+
```bash
|
|
81
|
+
MSSQL_SERVER=your-server.database.windows.net
|
|
82
|
+
MSSQL_DATABASE=your_database
|
|
83
|
+
MSSQL_USER=your_username
|
|
84
|
+
MSSQL_PASSWORD=your_password
|
|
85
|
+
# Encryption is automatic for Azure
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Optional Settings
|
|
89
|
+
```bash
|
|
90
|
+
MSSQL_PORT=1433 # Custom port (default: 1433)
|
|
91
|
+
MSSQL_ENCRYPT=true # Force encryption
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Alternative Installation Methods
|
|
95
|
+
|
|
96
|
+
### Using pip
|
|
97
|
+
```bash
|
|
98
|
+
pip install microsoft_sql_server_mcp
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Then in `claude_desktop_config.json`:
|
|
102
|
+
```json
|
|
103
|
+
{
|
|
104
|
+
"mcpServers": {
|
|
105
|
+
"mssql": {
|
|
106
|
+
"command": "python",
|
|
107
|
+
"args": ["-m", "mssql_mcp_server"],
|
|
108
|
+
"env": { ... }
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Development
|
|
115
|
+
```bash
|
|
116
|
+
git clone https://github.com/RichardHan/mssql_mcp_server.git
|
|
117
|
+
cd mssql_mcp_server
|
|
118
|
+
pip install -e .
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Security
|
|
122
|
+
|
|
123
|
+
- Create a dedicated SQL user with minimal permissions
|
|
124
|
+
- Never use admin/sa accounts
|
|
125
|
+
- Use Windows Authentication when possible
|
|
126
|
+
- Enable encryption for sensitive data
|
|
127
|
+
|
|
128
|
+
## License
|
|
129
|
+
|
|
130
|
+
MIT
|