Metadata-Version: 2.4
Name: enterprise-data-agent
Version: 0.1.0
Summary: MCP server that connects Claude/AI agents to Azure Synapse SQL data warehouses
Project-URL: Homepage, https://github.com/your-org/enterprise-data-agent
Project-URL: Bug Tracker, https://github.com/your-org/enterprise-data-agent/issues
License: MIT License
        
        Copyright (c) 2024
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: ai-agent,azure,claude,data-warehouse,mcp,synapse
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Database
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.9
Requires-Dist: azure-identity>=1.15.0
Requires-Dist: mcp[cli]>=1.0.0
Requires-Dist: pyodbc>=4.0.39
Requires-Dist: python-dotenv>=1.0.0
Requires-Dist: pyyaml>=6.0
Description-Content-Type: text/markdown

# enterprise-data-agent

An MCP (Model Context Protocol) server that connects Claude and other AI agents to Azure Synapse SQL data warehouses. Once installed, Claude can list tables, describe schemas, and run read-only SQL queries directly against your warehouse.

## Prerequisites

**Python 3.9+** and the **Microsoft ODBC Driver 17 (or 18) for SQL Server** must be installed on the machine running this server.

- Windows/macOS/Linux: [Download ODBC Driver for SQL Server](https://learn.microsoft.com/en-us/sql/connect/odbc/download-odbc-driver-for-sql-server)

> **Note:** `pyodbc` installs via pip but will fail at runtime without the system-level ODBC driver.

## Installation

```bash
pip install enterprise-data-agent
```

All Python dependencies (python-dotenv, pyodbc, azure-identity, mcp, pyyaml) are installed automatically.

## Configuration

Create a `.env` file in the directory where you run the server, or pass environment variables directly via your MCP client config (recommended for Claude Desktop).

### Environment Variables

| Variable | Required | Description |
|---|---|---|
| `WAREHOUSE_HOST` | Yes | Azure Synapse SQL server hostname (e.g. `workspace-ondemand.sql.azuresynapse.net`) |
| `WAREHOUSE_DATABASE` | Yes | Database name |
| `WAREHOUSE_SCHEMA` | No | Default schema (default: `dbo`) |
| `WAREHOUSE_PORT` | No | TCP port (default: `1433`) |
| `WAREHOUSE_AUTH_METHOD` | No | `basic` or `azure_ad` (default: `basic`) |
| `WAREHOUSE_USER` | If basic auth | Database username |
| `WAREHOUSE_PASSWORD` | If basic auth | Database password |
| `AZURE_TENANT_ID` | If azure_ad | Azure tenant ID |
| `AZURE_CLIENT_ID` | If azure_ad | Azure app/client ID |
| `AZURE_CLIENT_SECRET` | If azure_ad | Azure client secret (leave blank for interactive MFA) |

### Example .env file

```env
WAREHOUSE_HOST=your-workspace-ondemand.sql.azuresynapse.net
WAREHOUSE_PORT=1433
WAREHOUSE_DATABASE=your-database
WAREHOUSE_SCHEMA=your-schema

# Authentication Method: "basic" or "azure_ad"
WAREHOUSE_AUTH_METHOD=azure_ad

# Basic Auth (only needed if WAREHOUSE_AUTH_METHOD=basic)
WAREHOUSE_USER=your-username
WAREHOUSE_PASSWORD=your-password

# Azure AD Auth (only needed if WAREHOUSE_AUTH_METHOD=azure_ad)
# Leave AZURE_CLIENT_SECRET blank for interactive MFA login
AZURE_TENANT_ID=your-tenant-id
AZURE_CLIENT_ID=your-client-id
AZURE_CLIENT_SECRET=your-client-secret
```

## Usage with Claude Desktop

Add the following to your `claude_desktop_config.json` (found at `~/Library/Application Support/Claude/` on macOS or `%APPDATA%\Claude\` on Windows):

```json
{
  "mcpServers": {
    "enterprise-data-agent": {
      "command": "enterprise-data-agent",
      "env": {
        "WAREHOUSE_HOST": "your-workspace-ondemand.sql.azuresynapse.net",
        "WAREHOUSE_DATABASE": "your-database",
        "WAREHOUSE_SCHEMA": "cinq",
        "WAREHOUSE_AUTH_METHOD": "azure_ad",
        "AZURE_TENANT_ID": "your-tenant-id",
        "AZURE_CLIENT_ID": "your-client-id",
        "AZURE_CLIENT_SECRET": "your-client-secret"
      }
    }
  }
}
```

## Authentication Modes

### Azure AD — Service Principal (unattended)
Set `WAREHOUSE_AUTH_METHOD=azure_ad` and provide all three of `AZURE_TENANT_ID`, `AZURE_CLIENT_ID`, `AZURE_CLIENT_SECRET`. Best for automated/production use.

### Azure AD — Interactive MFA (browser login)
Set `WAREHOUSE_AUTH_METHOD=azure_ad`, provide `AZURE_TENANT_ID` and `AZURE_CLIENT_ID`, but leave `AZURE_CLIENT_SECRET` blank. A browser window will open for login on first run.

### Basic Auth (username/password)
Set `WAREHOUSE_AUTH_METHOD=basic` and provide `WAREHOUSE_USER` and `WAREHOUSE_PASSWORD`.

## Available MCP Tools

| Tool | Description |
|---|---|
| `query` | Execute a read-only SELECT statement (write operations are blocked) |
| `list_tables` | List all tables and views in a schema |
| `describe_schema` | Return column-level structure for a table, enriched with statistics and sample data |

## Available MCP Resources

| Resource | Description |
|---|---|
| `context://tables` | List all tables that have a context YAML file |
| `context://tables/{schema}.{table}` | Full column stats, categorical values, and sample rows for a table |
| `context://relationships` | Table relationship and join-candidate definitions |

## Running Manually

```bash
# With .env file in current directory
enterprise-data-agent

# Or via python -m
python -m enterprise_data_agent
```

## License

MIT
