bc-telemetry-buddy-mcp 3.5.2 → 3.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/README.md +39 -2
- package/dist/cli.js +168 -166
- package/dist/server.js +154 -152
- package/package.json +10 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,32 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [3.7.0] - 2026-07-18
|
|
11
|
+
|
|
12
|
+
_Highest blast-radius rating across all plans landed in this release: `low-risk`._
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
- **MCP Embedded Resources for `query_telemetry`**: New `resultFormat` (`text` | `resource`) and `fileFormat` (`json` | `csv`) parameters. When `resultFormat: "resource"`, query results are returned as an MCP embedded resource file (CSV or JSON) with a brief text summary in model context — enabling agents with code interpreters to process large datasets. Aligned with Microsoft BC MCP 2026 Wave 1 pattern. Spec: [docs/specs/131-query-telemetry-embedded-resources.md](../../docs/specs/131-query-telemetry-embedded-resources.md).
|
|
16
|
+
- **Resource template** `bctb://exports/{filename}`: Clients can list and read exported files via `resources/list` and `resources/read`. Embedded and listed resources always use the `bctb://` scheme (never `file://` absolute paths).
|
|
17
|
+
- **`resources` capability** added to server capabilities.
|
|
18
|
+
- **`ExportService`** in shared package: CSV/JSON file exports to `.vscode/.bctb/exports/` (git-ignored) with 24h auto-cleanup keyed on `mtime`.
|
|
19
|
+
- **Telemetry**: `TB-MCP-117` (`RESOURCE_EXPORTED`) event ID for tracking resource exports with format and row/column counts.
|
|
20
|
+
|
|
21
|
+
### Fixed
|
|
22
|
+
- **`query_telemetry` responses now contain real column names.** The App Insights v1 API returns columns as `{name, type}`, but parsing mapped the Kusto-native `columnName` field — so the `columns` array was `[null, …]` for every query. Both shapes are now accepted. (Found by the PR #108 embedded-resources smoke test: CSV exports had an empty header row.)
|
|
23
|
+
|
|
24
|
+
## [3.6.0] - 2026-07-18
|
|
25
|
+
|
|
26
|
+
_Highest blast-radius rating across all plans landed in this release: `low-risk`._
|
|
27
|
+
|
|
28
|
+
### Added
|
|
29
|
+
- **Per-workspace connections are now discoverable and selectable under Claude Code (and other roots-advertising hosts).** A workspace's own flat `.bctb-config.json` connection is discovered from `CLAUDE_PROJECT_DIR` (synchronous, checked at the opened folder and one level below — so the `…/<Customer>/TelemetryAnalysis/.bctb-config.json` layout is found) and from the MCP `roots` capability. Discovered connections appear in `list_profiles` tagged `source:"workspace"` and are selectable with `switch_profile <name>` — no global-config edit, no restart. A single globally-registered server can now query any customer workspace you open. See [docs/plans/mcp-workspace-connection-discovery.md](../../docs/plans/mcp-workspace-connection-discovery.md).
|
|
30
|
+
- **Opt-in auto-activation of the local connection.** Set `BCTB_AUTO_WORKSPACE_CONNECTION=true` in the server `env` and, when exactly one workspace connection is discovered, it becomes the active connection at startup (with a loud `[MCP] AUTO-ACTIVATED …` stderr line). Default is OFF; discovery never silently retargets which App Insights resource is queried (cross-tenant safety). More than one discovered connection → no auto-pick.
|
|
31
|
+
- **New telemetry** `TB-MCP-006` (`WorkspaceProfileSwitch`, emitted when a workspace connection is activated) and a `connectionsFound` count added to `TB-MCP-004` (`RootsDiscovery`) — both path-free.
|
|
32
|
+
|
|
33
|
+
### Fixed
|
|
34
|
+
- **Switching to a workspace connection no longer strands you.** `list_profiles`/`switch_profile` are now anchored to the pinned/global config file (`baseConfigFilePath`), so after selecting a workspace connection the global profiles remain listed and switchable. Profile-switch service re-initialization is now atomic — a mid-switch failure leaves the previous connection fully intact.
|
|
35
|
+
|
|
10
36
|
## [3.5.2] - 2026-06-25
|
|
11
37
|
|
|
12
38
|
_Highest blast-radius rating across all plans landed in this release: `low-risk`._
|
package/README.md
CHANGED
|
@@ -267,6 +267,25 @@ Outside VS Code there is no extension to inject `BCTB_WORKSPACE_PATH`, so the se
|
|
|
267
267
|
|
|
268
268
|
If knowledge can't be located, `get_knowledge` returns a diagnostic naming the exact path it looked under and why (e.g. `reason: no-workspace-config`) — so a missing Knowledge Base is debuggable rather than silent. The server also logs a `[KB]` line to stderr at startup.
|
|
269
269
|
|
|
270
|
+
#### Per-workspace connections (`list_profiles` / `switch_profile`)
|
|
271
|
+
|
|
272
|
+
The workspace folder(s) you open are also scanned for their own `.bctb-config.json` **connections**, so a single globally-registered server can query any customer without editing the global config. Discovered connections show up in `list_profiles` tagged `source:"workspace"` and are selectable with `switch_profile <name>` — no restart, no global-file edit. Two discovery signals feed this:
|
|
273
|
+
|
|
274
|
+
- **`CLAUDE_PROJECT_DIR`** — Claude Code sets this to the opened project root. The server checks it and one level below it (so `…/<Customer>/TelemetryAnalysis/.bctb-config.json` is found even though the config is a subfolder of the opened root). This is synchronous, so the connection is available on the very first `list_profiles` call.
|
|
275
|
+
- **MCP `roots`** — every advertised root is scanned the same way.
|
|
276
|
+
|
|
277
|
+
Discovered connections are keyed by the opened folder's name (e.g. `Coeck`), because most customer configs share the same `connectionName`. When two discovered connections share a name, `switch_profile` by that name returns an "ambiguous" error listing the exact keys to use instead.
|
|
278
|
+
|
|
279
|
+
**Safety — discovery never silently retargets your queries.** By default a workspace connection is only made *selectable*; the active App Insights resource changes only when *you* call `switch_profile`. To make the local connection win automatically on open, opt in with:
|
|
280
|
+
|
|
281
|
+
```json
|
|
282
|
+
"env": { "BCTB_AUTO_WORKSPACE_CONNECTION": "true" }
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
When set, and when **exactly one** workspace connection is discovered, the server activates it at startup and prints a loud `[MCP] AUTO-ACTIVATED …` line to stderr. Setting this flag means: *I accept that opening a workspace retargets which App Insights resource is queried.* With more than one connection discovered, it does nothing (ambiguous) and you pick with `switch_profile`.
|
|
286
|
+
|
|
287
|
+
> **Auth note (`azure_cli`):** switching connection changes the App Insights *resource*, not your identity — `azure_cli` uses your current `az login` session and ignores the config's `tenantId`. If a query returns 403 after switching, run `az login --tenant <tenantId>`.
|
|
288
|
+
|
|
270
289
|
### With Copilot Studio
|
|
271
290
|
|
|
272
291
|
Register as Custom Action:
|
|
@@ -427,8 +446,9 @@ The server exposes **11 tools** to language models (GitHub Copilot, Claude Deskt
|
|
|
427
446
|
|
|
428
447
|
### Query Execution (Step 4 of workflow)
|
|
429
448
|
- **`query_telemetry`**: Execute KQL queries against Application Insights
|
|
430
|
-
- Parameters: `kql` (required KQL query string), `useContext` (boolean, default: true), `includeExternal` (boolean, default: true)
|
|
449
|
+
- Parameters: `kql` (required KQL query string), `useContext` (boolean, default: true), `includeExternal` (boolean, default: true), `resultFormat` (enum: `text` | `resource`, default: `text`), `fileFormat` (enum: `json` | `csv`, default: `csv`)
|
|
431
450
|
- Returns: Query results with summary, recommendations, and chart suggestions
|
|
451
|
+
- **Embedded Resources**: Set `resultFormat: "resource"` to receive results as an MCP embedded resource file instead of inline text. The response contains a brief text summary (for lightweight model context) plus an embedded resource with the full data as CSV or JSON. This enables agents with code interpreters (e.g., Python/pandas) to process large datasets, create visualizations, and perform structured analysis. CSV is the default file format as it works natively with `pd.read_csv()`.
|
|
432
452
|
- **When to use**: After discovery and understanding phases - execute the actual query with precise KQL
|
|
433
453
|
|
|
434
454
|
### Query Library (Step 3 of workflow)
|
|
@@ -696,7 +716,7 @@ The MCP server uses `@bctb/shared` for core functionality (auth, kusto, cache, q
|
|
|
696
716
|
**`mcpSdkServer.ts`** - MCP SDK server for stdio mode (primary)
|
|
697
717
|
- Uses official `@modelcontextprotocol/sdk` (protocol 2025-06-18)
|
|
698
718
|
- `StdioServerTransport` for JSON-RPC 2.0 over stdin/stdout
|
|
699
|
-
- Capabilities: `tools` (with `listChanged`), `logging`
|
|
719
|
+
- Capabilities: `tools` (with `listChanged`), `resources`, `prompts`, `logging`
|
|
700
720
|
- Automatic Zod schema conversion from JSON Schema tool definitions
|
|
701
721
|
|
|
702
722
|
**`tools/toolDefinitions.ts`** - Single source of truth for all tool metadata
|
|
@@ -727,6 +747,7 @@ The MCP server uses `@bctb/shared` for core functionality (auth, kusto, cache, q
|
|
|
727
747
|
- **`sanitize.ts`** - PII removal and data sanitization
|
|
728
748
|
- **`eventLookup.ts`** - Telemetry event catalog and schema discovery
|
|
729
749
|
- **`references.ts`** - External KQL example fetching
|
|
750
|
+
- **`exports.ts`** - File export service for embedded MCP resources (CSV/JSON)
|
|
730
751
|
|
|
731
752
|
### Data Flow
|
|
732
753
|
|
|
@@ -743,6 +764,22 @@ The MCP server uses `@bctb/shared` for core functionality (auth, kusto, cache, q
|
|
|
743
764
|
3. **Execution**: Same business logic methods on MCPServer class
|
|
744
765
|
4. **Response**: JSON-RPC response over HTTP
|
|
745
766
|
|
|
767
|
+
### Embedded Resources (MCP Resource Support)
|
|
768
|
+
|
|
769
|
+
The MCP server supports **embedded resources** for `query_telemetry`, enabling agents to receive large result sets as file references instead of inline text. This is aligned with Microsoft's BC MCP 2026 Wave 1 pattern.
|
|
770
|
+
|
|
771
|
+
**How it works:**
|
|
772
|
+
1. Agent calls `query_telemetry` with `resultFormat: "resource"` (and optionally `fileFormat: "csv"` or `"json"`)
|
|
773
|
+
2. Server executes the query, writes results to a file in `{workspace}/.vscode/.bctb/exports/`
|
|
774
|
+
3. Response contains a brief text summary + an MCP embedded resource (`{type: "resource", resource: {uri, mimeType, text}}`)
|
|
775
|
+
4. Agent passes the file reference to a code interpreter for analysis, charts, etc.
|
|
776
|
+
|
|
777
|
+
**Resource template:** `bctb://exports/{filename}` — clients can list and read exported files via `resources/list` and `resources/read`.
|
|
778
|
+
|
|
779
|
+
**File cleanup:** Export files older than 24 hours are automatically cleaned up on server startup and after each new export.
|
|
780
|
+
|
|
781
|
+
**Backward compatible:** Without `resultFormat` (or with `resultFormat: "text"`), behavior is unchanged — results are returned as inline JSON text.
|
|
782
|
+
|
|
746
783
|
## Publishing
|
|
747
784
|
|
|
748
785
|
### Publish to NPM
|