|
| 1 | +# @sqlbi/daxformatter-mcp |
| 2 | + |
| 3 | +A [Model Context Protocol](https://modelcontextprotocol.io) (MCP) server that formats and validates DAX from any MCP-enabled AI client — Claude Code, Claude Desktop, Cursor, VS Code, and others — using the SQLBI DAX Formatter service. |
| 4 | + |
| 5 | +Local **stdio** server, run on demand via `npx`. Requires [Node.js](https://nodejs.org) 18+. |
| 6 | + |
| 7 | +## Installation guide |
| 8 | + |
| 9 | +The server is **local, stdio, anonymous** — no install step, no API key, no login. It exposes one tool, `format_dax`. After connecting, just ask the agent to format DAX. |
| 10 | + |
| 11 | +The registration name below is `DaxFormatter`, matching the remote Streamable HTTP server, so a single name works across both. |
| 12 | + |
| 13 | +### Visual Studio Code |
| 14 | + |
| 15 | +[](https://vscode.dev/redirect/mcp/install?name=DaxFormatter&config=%7B%22type%22%3A%22stdio%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40sqlbi%2Fdaxformatter-mcp%22%5D%7D) |
| 16 | +[](https://insiders.vscode.dev/redirect/mcp/install?name=DaxFormatter&config=%7B%22type%22%3A%22stdio%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40sqlbi%2Fdaxformatter-mcp%22%5D%7D&quality=insiders) |
| 17 | + |
| 18 | +Click a badge to install (VS Code asks for confirmation), or add it from the command line: |
| 19 | + |
| 20 | +```bash |
| 21 | +code --add-mcp '{"name":"DaxFormatter","type":"stdio","command":"npx","args":["-y","@sqlbi/daxformatter-mcp"]}' |
| 22 | +``` |
| 23 | + |
| 24 | +### Claude Code (CLI) |
| 25 | + |
| 26 | +```bash |
| 27 | +# add the server (-s user enables it in every project; omit -s for the current project only) |
| 28 | +claude mcp add -s user DaxFormatter -- npx -y @sqlbi/daxformatter-mcp |
| 29 | + |
| 30 | +# verify it was added and check the connection status |
| 31 | +claude mcp get DaxFormatter |
| 32 | +``` |
| 33 | + |
| 34 | +### Claude Desktop / other clients (config file) |
| 35 | + |
| 36 | +Add this to the client's MCP configuration file (e.g. `claude_desktop_config.json`, or a `.mcp.json` at the repo root): |
| 37 | + |
| 38 | +```json |
| 39 | +{ |
| 40 | + "mcpServers": { |
| 41 | + "DaxFormatter": { |
| 42 | + "command": "npx", |
| 43 | + "args": ["-y", "@sqlbi/daxformatter-mcp"] |
| 44 | + } |
| 45 | + } |
| 46 | +} |
| 47 | +``` |
| 48 | + |
| 49 | +No separate install step: `npx` downloads and runs the server on demand. |
| 50 | + |
| 51 | +## What it does |
| 52 | + |
| 53 | +The server exposes a single tool, **`format_dax`** — just ask your assistant to format or check some DAX and it will use it: |
| 54 | + |
| 55 | +- Formats one or more DAX expressions in a single call. |
| 56 | +- Reports syntax errors with their line and column, so the same call both **formats** and **validates** (an expression that can't be parsed comes back unformatted, with the errors). |
| 57 | +- Optional formatting controls: line style, spacing, and the list/decimal separators. |
| 58 | + |
| 59 | +## Privacy |
| 60 | + |
| 61 | +Your DAX is sent to the DAX Formatter web service (`daxformatter.com`), where the formatting happens. If you provide server or database names, they are **SHA-256 hashed** before being sent — they never leave your machine in clear text. |
| 62 | + |
| 63 | +## License |
| 64 | + |
| 65 | +[MIT](https://github.com/sql-bi/DaxFormatter/blob/master/LICENSE.md) |
0 commit comments