Skip to content

Commit 54fe97d

Browse files
committed
Add DaxFormatter MCP server (typescript/stdio)
1 parent a5f2b96 commit 54fe97d

27 files changed

Lines changed: 3179 additions & 1 deletion

‎.github/dependabot.yml‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,15 @@ updates:
1919
interval: "weekly"
2020
open-pull-requests-limit: 10
2121
assignees:
22-
- "albertospelta"
22+
- "albertospelta"
23+
24+
- package-ecosystem: "npm"
25+
directory: "/mcp"
26+
schedule:
27+
interval: "weekly"
28+
open-pull-requests-limit: 10
29+
assignees:
30+
- "albertospelta"
31+
groups:
32+
dev-dependencies:
33+
dependency-type: "development"

‎.github/workflows/ci-mcp.yml‎

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: ci-mcp
2+
3+
on:
4+
pull_request:
5+
branches: [master]
6+
paths:
7+
- mcp/**
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
build-and-test:
15+
name: build-and-test
16+
runs-on: ubuntu-latest
17+
timeout-minutes: 15
18+
steps:
19+
- uses: actions/checkout@v6
20+
with:
21+
persist-credentials: false
22+
23+
- uses: actions/setup-node@v6
24+
with:
25+
node-version: "20"
26+
cache: npm
27+
cache-dependency-path: mcp/package-lock.json
28+
29+
- name: install
30+
working-directory: mcp
31+
run: npm ci
32+
33+
- name: lint
34+
working-directory: mcp
35+
run: npm run lint
36+
37+
- name: typecheck
38+
working-directory: mcp
39+
run: npm run typecheck
40+
41+
- name: build
42+
working-directory: mcp
43+
run: npm run build
44+
45+
- name: test
46+
working-directory: mcp
47+
run: npm test

‎.github/workflows/publish-mcp.yml‎

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: publish-mcp
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: read
8+
id-token: write # npm provenance
9+
10+
jobs:
11+
release:
12+
runs-on: ubuntu-latest
13+
timeout-minutes: 15
14+
steps:
15+
- uses: actions/checkout@v6
16+
with:
17+
fetch-depth: 0 # Nerdbank.GitVersioning needs full history
18+
persist-credentials: false
19+
20+
- uses: actions/setup-dotnet@v5
21+
with:
22+
global-json-file: global.json
23+
24+
- name: install
25+
working-directory: mcp
26+
run: npm ci
27+
28+
- name: build
29+
working-directory: mcp
30+
run: npm run build
31+
32+
- name: test
33+
working-directory: mcp
34+
run: npm test
35+
36+
- uses: actions/setup-node@v6
37+
with:
38+
node-version: "20"
39+
registry-url: "https://registry.npmjs.org"
40+
cache: npm
41+
cache-dependency-path: mcp/package-lock.json
42+
43+
# `prepack` stamps the Nerdbank.GitVersioning version into package.json; `postpack` resets it.
44+
- name: publish
45+
working-directory: mcp
46+
run: npm publish --provenance --access public
47+
env:
48+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

‎mcp/.gitignore‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules/
2+
dist/
3+
coverage/
4+
*.tsbuildinfo

‎mcp/README.md‎

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
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+
[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install_DAX_Formatter-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](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+
[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install_DAX_Formatter-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](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)

‎mcp/biome.json‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
3+
"organizeImports": { "enabled": false },
4+
"linter": {
5+
"enabled": true,
6+
"rules": { "recommended": true }
7+
},
8+
"formatter": {
9+
"enabled": true,
10+
"indentStyle": "space",
11+
"indentWidth": 4,
12+
"lineWidth": 100
13+
},
14+
"files": {
15+
"ignore": ["dist", "node_modules", "coverage"]
16+
},
17+
"overrides": [
18+
{
19+
"include": ["*.json", "*.jsonc"],
20+
"formatter": { "indentWidth": 2 }
21+
}
22+
]
23+
}

0 commit comments

Comments
 (0)