# MCP Privacy Proxy

A Windows application that functions as a privacy proxy between Claude Desktop and the Power BI Modeling MCP Server. The proxy masks sensitive data in DAX query results before they reach the AI model.

## Architecture

```
Claude Desktop ───▶ Privacy Proxy ───▶ Power BI MCP Server ───▶ Power BI Desktop
    (client)          (this app)           (subprocess)
```

## Features

- **MCP Privacy Proxy**: Controls messages between Claude Desktop and Power BI MCP Server
- **Readonly Filter**: Only allows read operations, blocks all create/update/delete operations (optional)
- **Data Masking**: Masks sensitive columns in DAX query results with `***`
- **Generic Field Matching**: Uses a configurable set of sensitive field definitions that are automatically matched against any Power BI model

## Installation

1. Download `mcp-privacy-proxy.exe`
2. Place it in a folder of your choice (e.g., `C:\Tools\MCPPrivacyProxy\`)
3. Configure Claude Desktop (see below)

## Configuration

Add to your Claude Desktop configuration file (`claude_desktop_config.json`). See Claude Desktop MCP documentation for more information on configuring MCP servers.

**Important:** Only add the MCP Privacy Proxy to your Claude Desktop configuration, not the Power BI Modeling MCP Server itself. If you add both, Claude could bypass the proxy and connect directly to the Power BI Modeling MCP Server without privacy protection.

```json
{
  "mcpServers": {
    "powerbi-mcp-privacy-proxy": {
      "command": "C:\\Tools\\MCPPrivacyProxy\\mcp-privacy-proxy.exe",
      "args": [
        "--proxy",
        "--server-path",
        "C:\\path\\to\\powerbi-modeling-mcp.exe",
        "--start"
      ]
    }
  }
}
```

Replace the paths with the actual locations on your system.

You also need to configure the path to the Power BI Modeling MCP Server in the MCP Privacy Proxy application itself. Go to **File > Settings** and select the `powerbi-modeling-mcp.exe` file.

## How It Works

The MCP Privacy Proxy sits between Claude Desktop and the Power BI MCP Server. When DAX queries are executed:

1. The query passes through the privacy proxy to the Power BI MCP Server
2. The MCP Server returns the DAX query results
3. The privacy proxy checks if any sensitive fields are present in the results
4. Sensitive values are masked before being sent to Claude

## Field Configuration

The masking configuration works **across all Power BI models**. You define a set of sensitive fields once (table + column combinations), and these are automatically matched against any Power BI file you work with.

For example, if you configure:
- Table: `Customers`, Column: `Email`
- Table: `Customers`, Column: `PhoneNumber`

Then whenever a DAX query returns results containing these fields - regardless of which Power BI file you're connected to - the values will be masked with `***`.

## User Interface

### Menu Options

- **File > Load Model from MCP Server**: Connect to a running Power BI file and load its table/column structure
- **File > Import Config**: Import a JSON file with predefined sensitive field definitions
- **File > Export Config**: Export your current field configuration to a JSON file
- **File > Clear All Fields**: Remove all configured sensitive fields
- **File > Settings**: Configure the path to the Power BI Modeling MCP Server executable and the Readonly Mode setting
- **File > Exit**: Close the application

### Toolbar Buttons

- **Load Model**: Connect to a running Power BI file and load its table/column structure to view and select fields
- **Import Config**: Import masking configuration from a JSON file
- **Export Config**: Export current masking configuration to a JSON file

### Settings

- **Power BI MCP Server Path**: Path to the `powerbi-modeling-mcp.exe` executable
- **Readonly Mode**: When enabled, blocks all write operations (create, update, delete, rename) to protect your Power BI model from modifications. Requires restart of Claude Desktop to take effect.

### Field List

The main window shows a tree view of tables and columns. Check the boxes next to columns that contain sensitive data to mask them in query results. Changes are saved automatically.

## Requirements

- Windows 11
- Claude Desktop (https://claude.com/download)
- Power BI Modeling MCP Server (https://github.com/microsoft/powerbi-modeling-mcp)

## License

See [LICENSE](LICENSE) file.
