Metadata-Version: 2.5
Name: fabric-iq-server
Version: 0.1.0
Summary: Microsoft Fabric Warehouse and Semantic Model tools as an MCP server, with a one-time local setup.
Project-URL: Homepage, https://github.com/monishkumar3499/fabric-mcp-server
Project-URL: Repository, https://github.com/monishkumar3499/fabric-mcp-server
Author: JMAN Group
License: Proprietary
Keywords: dax,mcp,microsoft-fabric,power-bi,semantic-model,warehouse
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Database :: Front-Ends
Requires-Python: >=3.10
Requires-Dist: anyio>=4.5
Requires-Dist: azure-identity>=1.17.0
Requires-Dist: mcp<2,>=1.27
Requires-Dist: msal>=1.28.0
Requires-Dist: pyjwt[crypto]>=2.8.0
Requires-Dist: pyodbc>=5.1.0
Requires-Dist: python-dotenv>=1.0.1
Requires-Dist: requests>=2.32.0
Requires-Dist: starlette>=0.40
Provides-Extra: dev
Requires-Dist: build>=1.2; extra == 'dev'
Requires-Dist: httpx>=0.27; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: uvicorn>=0.30; extra == 'dev'
Description-Content-Type: text/markdown

# fabric-iq-server

Microsoft Fabric **Warehouse** and **Semantic Model** tools as an MCP server,
for one person on one machine. Configure it once, then point any MCP client at
it over stdio.

```
uvx fabric-iq-server setup     →  Azure sign-in
                               →  pick a Workspace
                               →  pick a Warehouse
                               →  pick a Semantic Model
                               →  saved to a local JSON file

uvx fabric-iq-server           →  MCP server over stdio (never prompts)
```

---

## Requirements

* **Python 3.10+**
* **Azure CLI, signed in.** This is how the package authenticates, and it is why
  no credential is ever written to disk:

  ```bash
  az login --allow-no-subscriptions
  # or, if you belong to more than one tenant:
  az login --allow-no-subscriptions --tenant <tenant-id>
  ```
* **Microsoft ODBC Driver 18 for SQL Server** — only for the warehouse tools.
  The semantic-model tools are pure REST and need nothing extra.

## Install

```bash
# One-off, nothing installed permanently
uvx fabric-iq-server setup

# Or a normal install
pip install fabric-iq-server
fabric-iq-server setup
```

## Setup

```
$ fabric-iq-server setup

Signing in with your Azure CLI identity...
Signed in as alice@contoso.com  (tenant 1111…)

Select a workspace:
   1. Intelligence Layer R&D
   2. Sales Analytics
workspace [1-2]: 1

Select a warehouse:
   1. warehouse_data_mart
   0. (none)
warehouse [0-1]: 1

Select a semantic model:
   1. Customer Semantic Model
   0. (none)
semantic model [0-1]: 1

Saved to C:\Users\alice\AppData\Roaming\fabric-iq-server\config.json
No tokens or secrets are stored -- only the identifiers above.
```

Every prompt has a flag, so setup can also run unattended:

```bash
fabric-iq-server setup --non-interactive \
  --workspace "Intelligence Layer R&D" \
  --warehouse warehouse_data_mart \
  --semantic-model "Customer Semantic Model"
```

Other commands: `fabric-iq-server config` prints the saved selection and where
it lives, `fabric-iq-server reset` deletes it, and `--config PATH` points any
command at a different file.

## Register it with an MCP client

```json
{
  "mcpServers": {
    "fabric-iq": {
      "command": "uvx",
      "args": ["fabric-iq-server"]
    }
  }
}
```

Or, after `pip install`, `"command": "fabric-iq-server"` with no arguments.
The server reads its configuration from the file `setup` wrote, so the client
never has to supply environment variables. It never prompts, and it writes
nothing but JSON-RPC to stdout — logs go to stderr.

If no configuration exists the server exits immediately with a message telling
you to run `setup`, rather than hanging on a prompt no client can answer.

## What is stored

| Location | |
|---|---|
| Windows | `%APPDATA%\fabric-iq-server\config.json` |
| macOS / Linux | `$XDG_CONFIG_HOME/fabric-iq-server/config.json`, else `~/.config/…` |
| Override | `$FABRIC_IQ_CONFIG` or `--config PATH` |

```json
{
  "version": 1,
  "tenant_id": "…", "upn": "alice@contoso.com",
  "workspace_id": "…", "workspace_name": "Intelligence Layer R&D",
  "connection_type": "warehouse",
  "warehouse_id": "…", "warehouse_name": "warehouse_data_mart",
  "sql_endpoint": "….datawarehouse.fabric.microsoft.com",
  "database_name": "warehouse_data_mart",
  "semantic_model_id": "…", "semantic_model_name": "Customer Semantic Model",
  "updated_at": "2026-01-01T00:00:00+00:00"
}
```

Identifiers and endpoints only. Access tokens, refresh tokens, passwords and
client secrets are **never** written — the writer refuses a payload containing
any of them rather than filtering it. Tokens are fetched from the Azure CLI at
the moment they are needed and held only in memory, so revoking your Azure
session revokes this tool's access with it.

## Tools

| Tool | When to use |
|---|---|
| `warehouse_map(tables="", include_row_counts=true, refresh=false)` | **First, for any warehouse question.** Every table/view with columns, types and nullability, plus row counts, primary keys, the inferred join graph, and the detected modelling pattern (star / snowflake / data vault / mixed). Cached 10 min. |
| `warehouse_profile(tables, sample_rows=5, checks=true)` | Grain, key uniqueness, join fan-out, NULL-key row loss and time coverage — for a list of tables in one call. |
| `warehouse_query(sql, max_rows=0)` | Guarded read-only T-SQL. `sql` accepts a list, so several queries are one round trip. |
| `semantic_models()` | Models in your configured workspace; your selected one is marked. |
| `semantic_model_map(model="", include_columns=false)` | A model's analytical contract: tables, measures with their full DAX, relationships. |
| `semantic_query(dax, model="", max_rows=0)` | Guarded read-only DAX, including model measures and query-scoped `DEFINE MEASURE`. `dax` accepts a list. |
| `fabric_health()` | Who you are, what you're connected to, whether it's reachable, and the active guardrails. Run this first when something breaks. |

Both families work at once: selecting a warehouse *and* a semantic model during
setup enables all seven tools.

## Safety

Every query is read-only and guarded before it is sent: statement-type checks,
a rejection of anything that writes, row caps, and per-query timeouts. Results
are rendered for a model rather than a terminal — bare numbers, no lost decimal
precision on monetary sums, and a character budget the warehouse map degrades
against instead of growing without limit.

---

Source: <https://github.com/monishkumar3499/fabric-mcp-server>
