Skip to main content

j-mssql-mcp

SQL Server MCP Server with Windows Authentication support for Kiro AI.

Features

  • Windows Authentication / Kerberos (Trusted Connection) for SQL Server
  • Works on Windows, Mac, and Linux
  • Environment-based configuration
  • Read-only query execution for safety
  • No passwords in configuration files

Installation

Option 1: From PyPI with uvx (Recommended)

No installation needed! Just configure in your mcp.json:

{
  "mcpServers": {
    "my-sql-server": {
      "command": "uvx",
      "args": ["j-mssql-mcp"],
      "env": {
        "SQL_SERVER": "your-server.example.com",
        "SQL_DATABASE": "YourDatabase",
        "SQL_PORT": "1433"
      }
    }
  }
}

Option 2: Direct from GitHub with uvx

Prerequisites: Git must be installed on your system.

{
  "mcpServers": {
    "my-sql-server": {
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/TheJamesWilliams/j-mssql-mcp.git",
        "j-mssql-mcp"
      ],
      "env": {
        "SQL_SERVER": "your-server.example.com",
        "SQL_DATABASE": "YourDatabase",
        "SQL_PORT": "1433"
      }
    }
  }
}

Option 3: Install via pip

If you don't have Git installed, you can install directly via pip:

pip install j-mssql-mcp

Then use in your mcp.json:

{
  "mcpServers": {
    "my-sql-server": {
      "command": "j-mssql-mcp",
      "args": [],
      "env": {
        "SQL_SERVER": "your-server.example.com",
        "SQL_DATABASE": "YourDatabase",
        "SQL_PORT": "1433"
      }
    }
  }
}

Option 4: From Private PyPI/Artifactory

If you have published to your internal package repository, the installation is the same as Option 1 but will pull from your private server instead of public PyPI.

Configuration

Set these environment variables in your MCP config:

  • SQL_SERVER: SQL Server hostname (e.g., your-server.example.com)
  • SQL_DATABASE: Database name (e.g., YourDatabase)
  • SQL_PORT: Port number (default: 1433)

Usage

The server provides one tool:

execute_sql

Execute read-only SQL queries against the configured database.

Parameters:

  • query (string): The SQL SELECT statement to execute

Example:

SELECT TOP 10 * FROM dbo.YourTable

Safety

  • Only SELECT statements are allowed
  • No data modification operations (INSERT, UPDATE, DELETE, etc.)
  • Queries are executed with read-only intent

Troubleshooting

"Git executable not found" Error

Problem: uvx needs Git to install from GitHub.

Check if Git is installed:

git --version

If Git is installed but still getting the error (Windows):

Git is installed but not in the system PATH. Fix it:

  1. Find Git location:

    where git
    # Usually: C:\Program Files\Git\cmd\git.exe
    
  2. Add to System PATH:

    • Press Win + X → System → Advanced system settings
    • Environment Variables → System variables → Path → Edit
    • Add: C:\Program Files\Git\cmd
    • Click OK on all dialogs
    • Restart Kiro/your terminal

Alternative: Use pip installation instead (see Option 3 in Installation section above)

If Git is not installed:

  • Windows: Download from git-scm.com or winget install Git.Git
  • Mac: brew install git or install Xcode Command Line Tools
  • Linux: sudo apt install git or sudo yum install git

"Can't open lib 'ODBC Driver 18 for SQL Server'"

Install the ODBC driver:

"Login failed" or Authentication Errors

Mac/Linux users: Run kinit your-username@YOUR-DOMAIN.COM to get Kerberos tickets

Windows users: Ensure your machine is domain-joined and you're logged in with domain credentials

Check Your Kerberos Tickets (Mac/Linux)

klist
# Look for a ticket like: MSSQLSvc/your-server.domain.com:1433@DOMAIN.COM

Requirements

  • Python 3.10+
  • ODBC Driver 18 for SQL Server (or compatible)
  • Network access to SQL Server
  • Domain-joined machine OR Kerberos authentication configured
  • Git (required for installation from GitHub)

Prerequisites by Platform

Windows Users

If your machine is joined to the domain, you're all set! Windows Authentication will work automatically using your logged-in credentials.

Mac/Linux Users

You need to authenticate with Kerberos before using the MCP:

# Authenticate with your domain credentials
kinit your-username@YOUR-DOMAIN.COM

# Verify you have tickets
klist

# You should see tickets including one for MSSQLSvc

Note: Kerberos tickets typically expire after 8-10 hours. If the MCP stops working, run kinit again to refresh your tickets.

Tip: If you already use Azure Data Studio or other domain-authenticated tools, you likely already have valid tickets!

Development

Local Setup

# Clone the repository
git clone https://github.com/TheJamesWilliams/j-mssql-mcp.git
cd j-mssql-mcp

# Install in development mode
pip install -e .

# Run locally
j-mssql-mcp

Testing

# Set environment variables
export SQL_SERVER="your-server.example.com"
export SQL_DATABASE="YourDatabase"
export SQL_PORT="1433"

# Run the server
j-mssql-mcp

Publishing

To GitHub

git add .
git commit -m "Update package"
git push origin main

To PyPI

# Install build tools (first time only)
pip install build twine

# Build the package
python3 -m build

# Upload to PyPI
python3 -m twine upload dist/*
# Username: __token__
# Password: your-pypi-api-token

To S3 Artifactory

# Build the package
python3 -m build

# Upload to S3 (configure your S3 credentials first)
aws s3 cp dist/j_mssql_mcp-1.0.0-py3-none-any.whl s3://your-bucket/python-packages/

License

MIT License - Free to use and modify

Metadata

Release files for j-mssql-mcp 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for j-mssql-mcp 1.2.0
File Size Uploaded
j_mssql_mcp-1.2.0.tar.gz 6.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for j-mssql-mcp 1.2.0
File Interpreter ABI Platform
j_mssql_mcp-1.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 14.9 kB

Release files / j_mssql_mcp-1.2.0.tar.gz

Download URL j_mssql_mcp-1.2.0.tar.gz
Size 6.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a3856766e3beec2746b18e09a724f098a660d53f80c74b7ac40a6c7db7ebf761
BLAKE2b-256 checksum
How to use checksums
a36d4c76501b214eb9fd08d8f7f0417ee45e5b8bb5b5edbb87061632f17b6b28
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / j_mssql_mcp-1.2.0-py3-none-any.whl

Download URL j_mssql_mcp-1.2.0-py3-none-any.whl
Size 8.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eecdb0c20d3d16c2794e2c5ac7167755dab3fae89ddd139c059e87353ae99d84
BLAKE2b-256 checksum
How to use checksums
0f44edd093be8082dc91955d41baebb6ecfb18c0329cedcce55c7b72a3fc47d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

1.2.0 This release

2 release files

1.1.0

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page