mssql-mcp-server-ishaan


Namemssql-mcp-server-ishaan JSON
Version 0.1.7 PyPI version JSON
download
home_pageNone
SummaryA Model Context Protocol (MCP) server that enables secure interaction with Microsoft SQL Server databases.
upload_time2025-08-18 10:06:22
maintainerNone
docs_urlNone
authorNone
requires_python>=3.11
licenseMIT
keywords ai database mcp mssql sql-server
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Microsoft SQL Server MCP Server (Ishaan's Version)

[![PyPI](https://img.shields.io/pypi/v/mssql_mcp_server_ishaan)](https://pypi.org/project/mssql_mcp_server_ishaan/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Python](https://img.shields.io/pypi/pyversions/mssql_mcp_server_ishaan)](https://pypi.org/project/mssql_mcp_server_ishaan/)

A Model Context Protocol (MCP) server for secure SQL Server database access through Claude Desktop.

## ๐Ÿš€ Quick Start

### Prerequisites
- **Python 3.11 or higher** (Python 3.12 recommended)
- **FreeTDS** (for SQL Server connectivity)

### Install FreeTDS
```bash
# macOS
brew install freetds

# Ubuntu/Debian
sudo apt-get install freetds-dev

# RHEL/CentOS
sudo yum install freetds-devel
```

### Install the Package
```bash
pip install mssql-mcp-server-ishaan
```

### Configure Claude Desktop

Add to your `claude_desktop_config.json`:

```json
{
  "mcpServers": {
    "mssql": {
      "command": "python",
      "args": ["-m", "mssql_mcp_server_ishaan"],
      "env": {
        "MSSQL_CONNECTION_STRING": "server=your-server;database=your-db;uid=your-user;pwd=your-password;encrypt=true;trustServerCertificate=true"
      }
    }
  }
}
```

## ๐Ÿ“‹ Features

- **Secure SQL Server connectivity** with encrypted connections
- **Read-only operations** for safety (SELECT queries only)
- **Table schema inspection** and metadata retrieval
- **SQL injection protection** with parameterized queries
- **Connection validation** and error handling
- **Comprehensive logging** for debugging

## ๐Ÿ”ง Configuration Options

### Environment Variables

```bash
# Basic connection (choose one method)
MSSQL_CONNECTION_STRING="server=localhost;database=mydb;uid=user;pwd=pass"
# OR individual components:
MSSQL_SERVER=localhost
MSSQL_DATABASE=mydb
MSSQL_USERNAME=your_user
MSSQL_PASSWORD=your_password

# Optional settings
MSSQL_PORT=1433                 # Custom port (default: 1433)
MSSQL_ENCRYPT=true              # Enable encryption (true/false)
```

## ๐Ÿ› ๏ธ Available Tools

### 1. `execute_query`
Execute SELECT queries on the database.

**Parameters:**
- `query` (string): SQL SELECT statement
- `parameters` (array, optional): Query parameters for safe parameterization

**Example:**
```sql
SELECT TOP 10 * FROM Users WHERE Department = ?
```

### 2. `list_tables`
List all tables in the database with their schemas.

### 3. `describe_table`
Get detailed schema information for a specific table.

**Parameters:**
- `table_name` (string): Name of the table to describe

### 4. `get_table_sample`
Retrieve a sample of data from a table.

**Parameters:**
- `table_name` (string): Name of the table
- `limit` (integer, optional): Number of rows to return (default: 10)

## ๐Ÿ”’ Security Features

- **Read-only access**: Only SELECT operations are allowed
- **SQL injection protection**: All queries use parameterized statements
- **Input validation**: Table names and queries are validated
- **Connection encryption**: Supports encrypted connections
- **Error sanitization**: Database errors are sanitized before returning

## ๐Ÿ“ฆ Installation Methods

### Method 1: PyPI (Recommended)
```bash
pip install mssql-mcp-server-ishaan
```

### Method 2: From Source
```bash
git clone https://github.com/ishaan119/mssql_mcp_server.git
cd mssql_mcp_server
pip install -e .
```

## ๐Ÿงช Testing the Installation

```bash
# Test import
python -c "import mssql_mcp_server_ishaan; print('โœ… Package imported successfully!')"

# Run the server (requires connection string)
python -m mssql_mcp_server_ishaan

# Or use the command-line script
mssql_mcp_server_ishaan
```

## ๐Ÿ› Troubleshooting

### Common Issues

1. **Python Version Error**
   ```
   ERROR: Requires-Python >=3.11
   ```
   **Solution**: Upgrade to Python 3.11 or higher
   ```bash
   brew install python@3.12  # macOS
   ```

2. **FreeTDS Not Found**
   ```
   error: Microsoft SQL Server Native Client
   ```
   **Solution**: Install FreeTDS
   ```bash
   brew install freetds  # macOS
   ```

3. **Connection Issues**
   - Verify your connection string format
   - Check firewall settings
   - Ensure SQL Server allows remote connections
   - Try adding `trustServerCertificate=true` for self-signed certificates

### Debug Mode

Enable detailed logging by setting the log level:
```bash
export PYTHONPATH=.
python -c "
import logging
logging.basicConfig(level=logging.DEBUG)
import mssql_mcp_server_ishaan
"
```

## ๐Ÿ“š Example Usage

### Basic Query
```json
{
  "tool": "execute_query",
  "arguments": {
    "query": "SELECT TOP 5 CustomerID, CompanyName FROM Customers"
  }
}
```

### Parameterized Query
```json
{
  "tool": "execute_query",
  "arguments": {
    "query": "SELECT * FROM Orders WHERE CustomerID = ? AND OrderDate > ?",
    "parameters": ["ALFKI", "2023-01-01"]
  }
}
```

### Table Information
```json
{
  "tool": "describe_table",
  "arguments": {
    "table_name": "Customers"
  }
}
```

## ๐Ÿค Contributing

This is a fork of the original [mssql_mcp_server](https://github.com/RichardHan/mssql_mcp_server) by Richard Han. 

### Development Setup
```bash
git clone https://github.com/ishaan119/mssql_mcp_server.git
cd mssql_mcp_server
pip install -e ".[dev]"
```

### Running Tests
```bash
pytest
```

## ๐Ÿ“„ License

MIT License - see [LICENSE](LICENSE) file for details.

## ๐Ÿ”— Links

- **PyPI Package**: https://pypi.org/project/mssql-mcp-server-ishaan/
- **Original Repository**: https://github.com/RichardHan/mssql_mcp_server
- **Model Context Protocol**: https://modelcontextprotocol.io/

## ๐Ÿ“ˆ Version History

- **v0.1.3**: Current stable version with Python 3.11+ support
- **v0.1.2**: Attempted Python 3.10+ support  
- **v0.1.1**: Attempted Python 3.9+ support
- **v0.1.0**: Initial release with Python 3.11+ requirement

---

**Note**: This package requires Python 3.11+ due to the Model Context Protocol (MCP) library dependency. For the best experience, use Python 3.12.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "mssql-mcp-server-ishaan",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": null,
    "keywords": "ai, database, mcp, mssql, sql-server",
    "author": null,
    "author_email": "Ishaan <noreply@example.com>",
    "download_url": "https://files.pythonhosted.org/packages/5d/3c/631dad0a04cdc42be91c0357b294aa6384d5c3169b1a714b40f6fc18da9b/mssql_mcp_server_ishaan-0.1.7.tar.gz",
    "platform": null,
    "description": "# Microsoft SQL Server MCP Server (Ishaan's Version)\n\n[![PyPI](https://img.shields.io/pypi/v/mssql_mcp_server_ishaan)](https://pypi.org/project/mssql_mcp_server_ishaan/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Python](https://img.shields.io/pypi/pyversions/mssql_mcp_server_ishaan)](https://pypi.org/project/mssql_mcp_server_ishaan/)\n\nA Model Context Protocol (MCP) server for secure SQL Server database access through Claude Desktop.\n\n## \ud83d\ude80 Quick Start\n\n### Prerequisites\n- **Python 3.11 or higher** (Python 3.12 recommended)\n- **FreeTDS** (for SQL Server connectivity)\n\n### Install FreeTDS\n```bash\n# macOS\nbrew install freetds\n\n# Ubuntu/Debian\nsudo apt-get install freetds-dev\n\n# RHEL/CentOS\nsudo yum install freetds-devel\n```\n\n### Install the Package\n```bash\npip install mssql-mcp-server-ishaan\n```\n\n### Configure Claude Desktop\n\nAdd to your `claude_desktop_config.json`:\n\n```json\n{\n  \"mcpServers\": {\n    \"mssql\": {\n      \"command\": \"python\",\n      \"args\": [\"-m\", \"mssql_mcp_server_ishaan\"],\n      \"env\": {\n        \"MSSQL_CONNECTION_STRING\": \"server=your-server;database=your-db;uid=your-user;pwd=your-password;encrypt=true;trustServerCertificate=true\"\n      }\n    }\n  }\n}\n```\n\n## \ud83d\udccb Features\n\n- **Secure SQL Server connectivity** with encrypted connections\n- **Read-only operations** for safety (SELECT queries only)\n- **Table schema inspection** and metadata retrieval\n- **SQL injection protection** with parameterized queries\n- **Connection validation** and error handling\n- **Comprehensive logging** for debugging\n\n## \ud83d\udd27 Configuration Options\n\n### Environment Variables\n\n```bash\n# Basic connection (choose one method)\nMSSQL_CONNECTION_STRING=\"server=localhost;database=mydb;uid=user;pwd=pass\"\n# OR individual components:\nMSSQL_SERVER=localhost\nMSSQL_DATABASE=mydb\nMSSQL_USERNAME=your_user\nMSSQL_PASSWORD=your_password\n\n# Optional settings\nMSSQL_PORT=1433                 # Custom port (default: 1433)\nMSSQL_ENCRYPT=true              # Enable encryption (true/false)\n```\n\n## \ud83d\udee0\ufe0f Available Tools\n\n### 1. `execute_query`\nExecute SELECT queries on the database.\n\n**Parameters:**\n- `query` (string): SQL SELECT statement\n- `parameters` (array, optional): Query parameters for safe parameterization\n\n**Example:**\n```sql\nSELECT TOP 10 * FROM Users WHERE Department = ?\n```\n\n### 2. `list_tables`\nList all tables in the database with their schemas.\n\n### 3. `describe_table`\nGet detailed schema information for a specific table.\n\n**Parameters:**\n- `table_name` (string): Name of the table to describe\n\n### 4. `get_table_sample`\nRetrieve a sample of data from a table.\n\n**Parameters:**\n- `table_name` (string): Name of the table\n- `limit` (integer, optional): Number of rows to return (default: 10)\n\n## \ud83d\udd12 Security Features\n\n- **Read-only access**: Only SELECT operations are allowed\n- **SQL injection protection**: All queries use parameterized statements\n- **Input validation**: Table names and queries are validated\n- **Connection encryption**: Supports encrypted connections\n- **Error sanitization**: Database errors are sanitized before returning\n\n## \ud83d\udce6 Installation Methods\n\n### Method 1: PyPI (Recommended)\n```bash\npip install mssql-mcp-server-ishaan\n```\n\n### Method 2: From Source\n```bash\ngit clone https://github.com/ishaan119/mssql_mcp_server.git\ncd mssql_mcp_server\npip install -e .\n```\n\n## \ud83e\uddea Testing the Installation\n\n```bash\n# Test import\npython -c \"import mssql_mcp_server_ishaan; print('\u2705 Package imported successfully!')\"\n\n# Run the server (requires connection string)\npython -m mssql_mcp_server_ishaan\n\n# Or use the command-line script\nmssql_mcp_server_ishaan\n```\n\n## \ud83d\udc1b Troubleshooting\n\n### Common Issues\n\n1. **Python Version Error**\n   ```\n   ERROR: Requires-Python >=3.11\n   ```\n   **Solution**: Upgrade to Python 3.11 or higher\n   ```bash\n   brew install python@3.12  # macOS\n   ```\n\n2. **FreeTDS Not Found**\n   ```\n   error: Microsoft SQL Server Native Client\n   ```\n   **Solution**: Install FreeTDS\n   ```bash\n   brew install freetds  # macOS\n   ```\n\n3. **Connection Issues**\n   - Verify your connection string format\n   - Check firewall settings\n   - Ensure SQL Server allows remote connections\n   - Try adding `trustServerCertificate=true` for self-signed certificates\n\n### Debug Mode\n\nEnable detailed logging by setting the log level:\n```bash\nexport PYTHONPATH=.\npython -c \"\nimport logging\nlogging.basicConfig(level=logging.DEBUG)\nimport mssql_mcp_server_ishaan\n\"\n```\n\n## \ud83d\udcda Example Usage\n\n### Basic Query\n```json\n{\n  \"tool\": \"execute_query\",\n  \"arguments\": {\n    \"query\": \"SELECT TOP 5 CustomerID, CompanyName FROM Customers\"\n  }\n}\n```\n\n### Parameterized Query\n```json\n{\n  \"tool\": \"execute_query\",\n  \"arguments\": {\n    \"query\": \"SELECT * FROM Orders WHERE CustomerID = ? AND OrderDate > ?\",\n    \"parameters\": [\"ALFKI\", \"2023-01-01\"]\n  }\n}\n```\n\n### Table Information\n```json\n{\n  \"tool\": \"describe_table\",\n  \"arguments\": {\n    \"table_name\": \"Customers\"\n  }\n}\n```\n\n## \ud83e\udd1d Contributing\n\nThis is a fork of the original [mssql_mcp_server](https://github.com/RichardHan/mssql_mcp_server) by Richard Han. \n\n### Development Setup\n```bash\ngit clone https://github.com/ishaan119/mssql_mcp_server.git\ncd mssql_mcp_server\npip install -e \".[dev]\"\n```\n\n### Running Tests\n```bash\npytest\n```\n\n## \ud83d\udcc4 License\n\nMIT License - see [LICENSE](LICENSE) file for details.\n\n## \ud83d\udd17 Links\n\n- **PyPI Package**: https://pypi.org/project/mssql-mcp-server-ishaan/\n- **Original Repository**: https://github.com/RichardHan/mssql_mcp_server\n- **Model Context Protocol**: https://modelcontextprotocol.io/\n\n## \ud83d\udcc8 Version History\n\n- **v0.1.3**: Current stable version with Python 3.11+ support\n- **v0.1.2**: Attempted Python 3.10+ support  \n- **v0.1.1**: Attempted Python 3.9+ support\n- **v0.1.0**: Initial release with Python 3.11+ requirement\n\n---\n\n**Note**: This package requires Python 3.11+ due to the Model Context Protocol (MCP) library dependency. For the best experience, use Python 3.12.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A Model Context Protocol (MCP) server that enables secure interaction with Microsoft SQL Server databases.",
    "version": "0.1.7",
    "project_urls": null,
    "split_keywords": [
        "ai",
        " database",
        " mcp",
        " mssql",
        " sql-server"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "f35de8ae71dda90501f9470e9d045572489ba84a53253560f658b973c3679376",
                "md5": "f6695bd4fce99be0af1e8c90739d7745",
                "sha256": "368fa4de7365db5b817802ce7e568b336799b4f5d9b6360c8ea6f1757c025893"
            },
            "downloads": -1,
            "filename": "mssql_mcp_server_ishaan-0.1.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f6695bd4fce99be0af1e8c90739d7745",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 8458,
            "upload_time": "2025-08-18T10:06:21",
            "upload_time_iso_8601": "2025-08-18T10:06:21.025490Z",
            "url": "https://files.pythonhosted.org/packages/f3/5d/e8ae71dda90501f9470e9d045572489ba84a53253560f658b973c3679376/mssql_mcp_server_ishaan-0.1.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "5d3c631dad0a04cdc42be91c0357b294aa6384d5c3169b1a714b40f6fc18da9b",
                "md5": "35264d4ed94462c2e16742c50f43ec86",
                "sha256": "7b9b60aa5ad685c8ba5794cc637855ccfab3f6b6c0013325b5e987e178094ec8"
            },
            "downloads": -1,
            "filename": "mssql_mcp_server_ishaan-0.1.7.tar.gz",
            "has_sig": false,
            "md5_digest": "35264d4ed94462c2e16742c50f43ec86",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 39938,
            "upload_time": "2025-08-18T10:06:22",
            "upload_time_iso_8601": "2025-08-18T10:06:22.734780Z",
            "url": "https://files.pythonhosted.org/packages/5d/3c/631dad0a04cdc42be91c0357b294aa6384d5c3169b1a714b40f6fc18da9b/mssql_mcp_server_ishaan-0.1.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-18 10:06:22",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "mssql-mcp-server-ishaan"
}
        
Elapsed time: 0.99932s