@player-devtools/mcp 0.15.1--canary.29.1254 → 0.15.1--canary.28.1248

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/README.md CHANGED
@@ -6,7 +6,7 @@ Player instance: list running Players, read their flow / data / logs / config,
6
6
  inspect plugin state, select a Player, and invoke plugin actions.
7
7
 
8
8
  It is the agent-facing sibling of the [browser extension] and the
9
- [Flipper plugin](../flipper-plugin): all three are Devtools _clients_ that speak
9
+ [Flipper plugin](../flipper-plugin): all three are Devtools *clients* that speak
10
10
  to the same Player Devtools plugins over the [messenger](../messenger) protocol.
11
11
  The MCP server connects to those plugins through a running
12
12
  [`flipper-server`](https://github.com/facebook/flipper) and re-exposes them as
@@ -61,38 +61,23 @@ The server registers the following tools (defined as `ToolDef`s in
61
61
  player-scoped tool takes an optional `playerId` and falls back to the currently
62
62
  selected Player when it's omitted.
63
63
 
64
- | Tool | Args | Returns |
65
- | ------------------- | --------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
66
- | `list_players` | — | All known Player instances and which one is selected. |
67
- | `get_player_status` | `playerId?` | Active status + registered plugin IDs. |
68
- | `get_flow` | `playerId?` | The current flow (from the basic plugin). |
69
- | `get_data` | `playerId?` | The current flow data model. |
70
- | `get_logs` | `playerId?` | Accumulated runtime logs. |
71
- | `get_plugin_data` | `playerId?`, `pluginId`, `dataKey` | A specific data key from any plugin. |
72
- | `describe_plugin` | `playerId?`, `pluginId` | The plugin's capability descriptor — the data keys and actions it exposes. **Call this first** to discover what a plugin supports. |
73
- | `select_player` | `playerId` | Selects a Player as the default target for later calls. |
74
- | `invoke_action` | `playerId?`, `pluginId`, `action`, `payload?` | Invokes a named action (validated against the plugin's declared capabilities). |
64
+ | Tool | Args | Returns |
65
+ | --- | --- | --- |
66
+ | `list_players` | — | All known Player instances and which one is selected. |
67
+ | `get_player_status` | `playerId?` | Active status + registered plugin IDs. |
68
+ | `get_flow` | `playerId?` | The current flow (from the basic plugin). |
69
+ | `get_data` | `playerId?` | The current flow data model. |
70
+ | `get_logs` | `playerId?` | Accumulated runtime logs. |
71
+ | `get_plugin_data` | `playerId?`, `pluginId`, `dataKey` | A specific data key from any plugin. |
72
+ | `describe_plugin` | `playerId?`, `pluginId` | The plugin's capability descriptor — the data keys and actions it exposes. **Call this first** to discover what a plugin supports. |
73
+ | `select_player` | `playerId` | Selects a Player as the default target for later calls. |
74
+ | `invoke_action` | `playerId?`, `pluginId`, `action`, `payload?` | Invokes a named action (validated against the plugin's declared capabilities). |
75
75
 
76
76
  A typical agent flow: `list_players` → `select_player` → `describe_plugin` →
77
77
  `get_*` / `invoke_action`.
78
78
 
79
- ### Diagnostics
80
-
81
- These tools inspect and manage the MCP server's connection to the shared
82
- [`flipper-server` daemon](#shared-flipper-server-daemon) itself, rather than
83
- any Player instance behind it — useful when an agent needs to tell "no Players
84
- are connected" apart from "the Flipper transport itself is unhealthy." They
85
- soft-error when the server isn't running on a `FlipperServerTransport`.
86
-
87
- | Tool | Args | Returns |
88
- | ----------------------------------- | ---- | ------------------------------------------------------------------------------------------------------ |
89
- | `get_flipper_status` | — | Connection health: `connected`, `host`, `port`, `owns`, `refs`. |
90
- | `get_flipper_consumers` | — | `owns`, `refs` (daemon-wide, not just this process), and `activeClientIds`. |
91
- | `restart_flipper_server` | — | Restarts the daemon — only when this process owns it and is its sole consumer, otherwise a soft error. |
92
- | `get_flipper_plugin_install_status` | — | Whether the Player UI Devtools Flipper plugin is installed on the daemon. |
93
-
94
79
  > **NOTE**
95
- > Tool handlers return _soft errors_ (e.g. `{ "error": "player not found" }`) as
80
+ > Tool handlers return *soft errors* (e.g. `{ "error": "player not found" }`) as
96
81
  > normal results rather than throwing, so a failed call still returns a
97
82
  > structured payload the agent can read.
98
83
 
@@ -110,10 +95,10 @@ await server.start();
110
95
 
111
96
  `FlipperServerTransport` options:
112
97
 
113
- | Option | Default | Description |
114
- | ------ | ------------- | ------------------------------ |
115
- | `host` | `"localhost"` | Flipper server host. |
116
- | `port` | `52342` | Flipper server WebSocket port. |
98
+ | Option | Default | Description |
99
+ | --- | --- | --- |
100
+ | `host` | `"localhost"` | Flipper server host. |
101
+ | `port` | `52342` | Flipper server WebSocket port. |
117
102
 
118
103
  ### Shared `flipper-server` daemon
119
104
 
@@ -155,10 +140,10 @@ Register it with an MCP client (e.g. Claude) by pointing the client at the
155
140
  The server reports anonymous usage analytics so we can tell how widely it's used
156
141
  and whether it's working in the field. It is **on by default** and sends:
157
142
 
158
- | | |
159
- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
160
- | Identity | A random UUID generated on first run and stored at `~/.player-ui-devtools/install.json`. It is not derived from anything about you or your machine — delete the file and a new one is generated. |
161
- | Events | Session start (`$mcp_initialize`), tool calls (`$mcp_tool_call`), tool listing (`$mcp_tools_list`), and errors (`$exception`). |
143
+ | | |
144
+ | --- | --- |
145
+ | Identity | A random UUID generated on first run and stored at `~/.player-ui-devtools/install.json`. It is not derived from anything about you or your machine — delete the file and a new one is generated. |
146
+ | Events | Session start (`$mcp_initialize`), tool calls (`$mcp_tool_call`), tool listing (`$mcp_tools_list`), and errors (`$exception`). |
162
147
  | Properties | Tool **name**, call duration, whether the call errored, the MCP client name/version (e.g. which editor), the devtools version, OS platform, Node major version, and whether the Flipper transport connected. |
163
148
 
164
149
  **Tool arguments and tool responses are never transmitted.** Those can contain
@@ -61,6 +61,14 @@ function resolveBasicPlugin(client, playerId) {
61
61
  if (!basicPlugin) return { error: "no plugin registered for this player" };
62
62
  return { id, player, basicPlugin };
63
63
  }
64
+ function ok(value) {
65
+ return { content: [{ type: "text", text: JSON.stringify(value) }] };
66
+ }
67
+ function err(message) {
68
+ return {
69
+ content: [{ type: "text", text: JSON.stringify({ error: message }) }]
70
+ };
71
+ }
64
72
  function handleGetFlow(client, input) {
65
73
  const { playerId } = PlayerInput.parse(input);
66
74
  const resolved = resolveBasicPlugin(client, playerId);
@@ -129,16 +137,41 @@ var playerIdShape2 = {
129
137
  var GetPlayerStatusInput = import_zod2.z.object(playerIdShape2);
130
138
  function handleListPlayers(client) {
131
139
  const { players, current } = client.getState();
132
- return ok({ players: Object.keys(players), current: current.player });
140
+ return {
141
+ content: [
142
+ {
143
+ type: "text",
144
+ text: JSON.stringify({
145
+ players: Object.keys(players),
146
+ current: current.player
147
+ })
148
+ }
149
+ ]
150
+ };
133
151
  }
134
152
  function handleGetPlayerStatus(client, input) {
135
153
  const { playerId } = GetPlayerStatusInput.parse(input);
136
154
  const { players, current } = client.getState();
137
155
  const id = playerId ?? current.player;
138
- if (!id) return err("no player selected");
156
+ if (!id) return errorResult("no player selected");
139
157
  const player = players[id];
140
- if (!player) return err(`player not found: ${id}`);
141
- return ok({ active: player.active, plugins: Object.keys(player.plugins) });
158
+ if (!player) return errorResult(`player not found: ${id}`);
159
+ return {
160
+ content: [
161
+ {
162
+ type: "text",
163
+ text: JSON.stringify({
164
+ active: player.active,
165
+ plugins: Object.keys(player.plugins)
166
+ })
167
+ }
168
+ ]
169
+ };
170
+ }
171
+ function errorResult(message) {
172
+ return {
173
+ content: [{ type: "text", text: JSON.stringify({ error: message }) }]
174
+ };
142
175
  }
143
176
  var listPlayersDef = {
144
177
  name: "list_players",
@@ -160,18 +193,26 @@ var describePluginShape = {
160
193
  pluginId: import_zod3.z.string().describe("Plugin ID.")
161
194
  };
162
195
  var DescribePluginInput = import_zod3.z.object(describePluginShape);
196
+ function err2(message) {
197
+ return {
198
+ content: [{ type: "text", text: JSON.stringify({ error: message }) }]
199
+ };
200
+ }
201
+ function ok2(value) {
202
+ return { content: [{ type: "text", text: JSON.stringify(value) }] };
203
+ }
163
204
  function handleDescribePlugin(client, input) {
164
205
  const { playerId, pluginId } = DescribePluginInput.parse(input);
165
206
  const { players, current } = client.getState();
166
207
  const id = playerId ?? current.player;
167
- if (!id) return err("no player selected");
208
+ if (!id) return err2("no player selected");
168
209
  const player = players[id];
169
- if (!player) return err(`player not found: ${id}`);
210
+ if (!player) return err2(`player not found: ${id}`);
170
211
  const plugin = player.plugins[pluginId];
171
- if (!plugin) return err(`plugin not found: ${pluginId}`);
212
+ if (!plugin) return err2(`plugin not found: ${pluginId}`);
172
213
  if (!plugin.capabilities)
173
- return err(`plugin "${pluginId}" has no capabilities declared`);
174
- return ok(plugin.capabilities);
214
+ return err2(`plugin "${pluginId}" has no capabilities declared`);
215
+ return ok2(plugin.capabilities);
175
216
  }
176
217
  var describePluginDef = {
177
218
  name: "describe_plugin",
@@ -193,27 +234,35 @@ var invokeActionShape = {
193
234
  };
194
235
  var SelectPlayerInput = import_zod4.z.object(selectPlayerShape);
195
236
  var InvokeActionInput = import_zod4.z.object(invokeActionShape);
237
+ function err3(message) {
238
+ return {
239
+ content: [{ type: "text", text: JSON.stringify({ error: message }) }]
240
+ };
241
+ }
242
+ function ok3(value) {
243
+ return { content: [{ type: "text", text: JSON.stringify(value) }] };
244
+ }
196
245
  function handleSelectPlayer(client, input) {
197
246
  const { playerId } = SelectPlayerInput.parse(input);
198
247
  const { players } = client.getState();
199
- if (!players[playerId]) return err(`player not found: ${playerId}`);
248
+ if (!players[playerId]) return err3(`player not found: ${playerId}`);
200
249
  client.selectPlayer(playerId);
201
- return ok({ selected: playerId });
250
+ return ok3({ selected: playerId });
202
251
  }
203
252
  function handleInvokeAction(client, input) {
204
253
  const { playerId, pluginId, action, payload } = InvokeActionInput.parse(input);
205
254
  const { players, current } = client.getState();
206
255
  const id = playerId ?? current.player;
207
- if (!id) return err("no player selected");
256
+ if (!id) return err3("no player selected");
208
257
  const player = players[id];
209
- if (!player) return err(`player not found: ${id}`);
258
+ if (!player) return err3(`player not found: ${id}`);
210
259
  const plugin = player.plugins[pluginId];
211
- if (!plugin) return err(`plugin not found: ${pluginId}`);
260
+ if (!plugin) return err3(`plugin not found: ${pluginId}`);
212
261
  if (plugin.capabilities?.actions && !(action in plugin.capabilities.actions)) {
213
- return err(`action "${action}" not declared in plugin capabilities`);
262
+ return err3(`action "${action}" not declared in plugin capabilities`);
214
263
  }
215
264
  client.handleInteraction({ type: action, payload, target: id });
216
- return ok({ invoked: action });
265
+ return ok3({ invoked: action });
217
266
  }
218
267
  var selectPlayerDef = {
219
268
  name: "select_player",
@@ -228,78 +277,7 @@ var invokeActionDef = {
228
277
  handle: handleInvokeAction
229
278
  };
230
279
 
231
- // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/mcp/src/tools/flipper.ts
232
- var import_client_flipper = require("@player-devtools/client-flipper");
233
- function asFlipperTransport(transport) {
234
- return transport instanceof import_client_flipper.FlipperServerTransport ? transport : null;
235
- }
236
- function handleGetFlipperStatus(_client, _args, transport) {
237
- const flipper = asFlipperTransport(transport);
238
- if (!flipper) return err("not using a Flipper transport");
239
- const { connected, host, port, owns, refs } = flipper.getDiagnostics();
240
- return ok({ connected, host, port, owns, refs });
241
- }
242
- function handleGetFlipperConsumers(_client, _args, transport) {
243
- const flipper = asFlipperTransport(transport);
244
- if (!flipper) return err("not using a Flipper transport");
245
- const { owns, refs, activeClientIds } = flipper.getDiagnostics();
246
- return ok({ owns, refs, activeClientIds });
247
- }
248
- async function handleRestartFlipperServer(_client, _args, transport) {
249
- const flipper = asFlipperTransport(transport);
250
- if (!flipper) return err("not using a Flipper transport");
251
- const result = await flipper.restart();
252
- if (!result.ok) return err(result.reason);
253
- return ok({ restarted: true, host: result.host, port: result.port });
254
- }
255
- async function handleGetFlipperPluginInstallStatus(_client, _args, transport) {
256
- const flipper = asFlipperTransport(transport);
257
- if (!flipper) return err("not using a Flipper transport");
258
- if (!flipper.getDiagnostics().connected) {
259
- return err("flipper transport not connected");
260
- }
261
- const status = await flipper.getPluginInstallStatus();
262
- if (!status.installed && status.reason) return err(status.reason);
263
- return ok(status);
264
- }
265
- var getFlipperStatusDef = {
266
- name: "get_flipper_status",
267
- description: "Get the MCP server's connection status to the shared flipper-server daemon (host, port, ownership, refcount).",
268
- inputSchema: {},
269
- annotations: { readOnlyHint: true, destructiveHint: false },
270
- handle: handleGetFlipperStatus
271
- };
272
- var getFlipperConsumersDef = {
273
- name: "get_flipper_consumers",
274
- description: "Get the active devtools clients attached through this Flipper connection, plus the daemon-wide refcount (reflects all consumers of the shared daemon, not just this process).",
275
- inputSchema: {},
276
- annotations: { readOnlyHint: true, destructiveHint: false },
277
- handle: handleGetFlipperConsumers
278
- };
279
- var restartFlipperServerDef = {
280
- name: "restart_flipper_server",
281
- description: "Restart the shared flipper-server daemon. Only succeeds when this MCP server owns the daemon and is its sole consumer; otherwise returns a soft error rather than disrupting other consumers.",
282
- inputSchema: {},
283
- annotations: { readOnlyHint: false, destructiveHint: true },
284
- handle: handleRestartFlipperServer
285
- };
286
- var getFlipperPluginInstallStatusDef = {
287
- name: "get_flipper_plugin_install_status",
288
- description: "Check whether the Player UI Devtools Flipper plugin is installed on the connected daemon.",
289
- inputSchema: {},
290
- annotations: { readOnlyHint: true, destructiveHint: false },
291
- handle: handleGetFlipperPluginInstallStatus
292
- };
293
-
294
280
  // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/mcp/src/tools/index.ts
295
- function ok(value) {
296
- return { content: [{ type: "text", text: JSON.stringify(value) }] };
297
- }
298
- function err(message) {
299
- return {
300
- content: [{ type: "text", text: JSON.stringify({ error: message }) }]
301
- };
302
- }
303
281
  var TOOL_DEFS = [
304
282
  listPlayersDef,
305
283
  getPlayerStatusDef,
@@ -309,11 +287,7 @@ var TOOL_DEFS = [
309
287
  getPluginDataDef,
310
288
  describePluginDef,
311
289
  selectPlayerDef,
312
- invokeActionDef,
313
- getFlipperStatusDef,
314
- getFlipperConsumersDef,
315
- restartFlipperServerDef,
316
- getFlipperPluginInstallStatusDef
290
+ invokeActionDef
317
291
  ];
318
292
 
319
293
  // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/mcp/src/telemetry/index.ts
@@ -422,7 +396,7 @@ function allowlistEventProperties(event) {
422
396
  }
423
397
 
424
398
  // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/mcp/src/telemetry/index.ts
425
- var MCP_VERSION = true ? "0.15.1--canary.29.1254" : "unstamped";
399
+ var MCP_VERSION = true ? "0.15.1--canary.28.1248" : "unstamped";
426
400
  function createAnalytics(server, deps) {
427
401
  try {
428
402
  const config = resolveTelemetryConfig();
@@ -482,12 +456,8 @@ var MCPServer = class {
482
456
  const register = this.server.registerTool.bind(this.server);
483
457
  register(
484
458
  def.name,
485
- {
486
- description: def.description,
487
- inputSchema: def.inputSchema,
488
- annotations: def.annotations
489
- },
490
- (args) => def.handle(this.client, args, this.transport)
459
+ { description: def.description, inputSchema: def.inputSchema },
460
+ (args) => def.handle(this.client, args)
491
461
  );
492
462
  }
493
463
  }
@@ -497,10 +467,10 @@ var MCPServer = class {
497
467
  try {
498
468
  await this.transport.connect();
499
469
  this.transportConnected = true;
500
- } catch (err2) {
470
+ } catch (err4) {
501
471
  console.warn(
502
472
  "[MCPServer] Transport connect failed (will operate in disconnected mode):",
503
- err2 instanceof Error ? err2.message : err2
473
+ err4 instanceof Error ? err4.message : err4
504
474
  );
505
475
  }
506
476
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/mcp/src/index.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/mcp/src/server.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/mcp/src/tools/flow.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/mcp/src/tools/players.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/mcp/src/tools/plugins.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/mcp/src/tools/select.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/mcp/src/tools/flipper.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/mcp/src/tools/index.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/mcp/src/telemetry/index.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/mcp/src/telemetry/config.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/mcp/src/telemetry/installId.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/mcp/src/telemetry/redaction.ts"],"sourcesContent":["export { MCPServer } from \"./server\";\n","import {\n createExtensionClient,\n type ExtensionClient,\n} from \"@player-devtools/client\";\nimport type { Transport } from \"@player-devtools/types\";\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\";\nimport type { CallToolResult } from \"@modelcontextprotocol/sdk/types.js\";\nimport type { PostHog } from \"posthog-node\";\n\nimport { TOOL_DEFS, type ToolDef } from \"./tools\";\nimport { createAnalytics, MCP_VERSION } from \"./telemetry\";\n\nexport class MCPServer {\n private client: ExtensionClient;\n private server: McpServer;\n private analytics: PostHog | null;\n private transportConnected = false;\n\n constructor(private transport: Transport) {\n this.client = createExtensionClient(transport);\n this.server = new McpServer({\n name: \"player-devtools\",\n version: MCP_VERSION,\n });\n // Instrument before registering tools so every handler is wrapped.\n this.analytics = createAnalytics(this.server, {\n isTransportConnected: () => this.transportConnected,\n });\n this.registerTools();\n }\n\n private registerTools(): void {\n for (const def of TOOL_DEFS) {\n // `registerTool` is heavily generic over the Zod input shape; inferring\n // that across a heterogeneous array trips TS2589 (excessively deep). The\n // shapes are validated at runtime by the SDK, so register through a\n // loosely-typed view to keep inference shallow.\n const register = this.server.registerTool.bind(this.server) as (\n name: string,\n config: {\n description: string;\n inputSchema: ToolDef[\"inputSchema\"];\n annotations?: ToolDef[\"annotations\"];\n },\n cb: (args: unknown) => CallToolResult | Promise<CallToolResult>,\n ) => unknown;\n\n register(\n def.name,\n {\n description: def.description,\n inputSchema: def.inputSchema,\n annotations: def.annotations,\n },\n (args) => def.handle(this.client, args, this.transport),\n );\n }\n }\n\n async start(): Promise<void> {\n const stdioTransport = new StdioServerTransport();\n await this.server.connect(stdioTransport);\n try {\n await this.transport.connect();\n this.transportConnected = true;\n } catch (err) {\n console.warn(\n \"[MCPServer] Transport connect failed (will operate in disconnected mode):\",\n err instanceof Error ? err.message : err,\n );\n }\n }\n\n async stop(): Promise<void> {\n // Flush buffered events first: bin/run calls process.exit(0) as soon as\n // this resolves, which would otherwise drop them. Never fail shutdown on a\n // telemetry error.\n try {\n await this.analytics?.shutdown();\n } catch {\n /* best-effort */\n }\n this.client.destroy();\n await this.transport.close();\n await this.server.close();\n }\n}\n","import type { ExtensionClient } from \"@player-devtools/client\";\nimport type { PluginData } from \"@player-devtools/types\";\nimport type { CallToolResult } from \"@modelcontextprotocol/sdk/types.js\";\nimport { z } from \"zod\";\n\nimport { ok, err, type ToolDef } from \"./index\";\n\ntype Failure = { error: string };\ntype PlayerOk = {\n id: string;\n player: {\n plugins: Record<string, PluginData>;\n active: boolean;\n config: Record<string, unknown>;\n };\n};\ntype BasicPluginOk = PlayerOk & { basicPlugin: PluginData };\n\n/** Optional player id, shared by the player-scoped read tools. */\nconst playerIdShape = {\n playerId: z\n .string()\n .optional()\n .describe(\"Player ID. Defaults to the currently selected player.\"),\n};\n\nconst PlayerInput = z.object(playerIdShape);\n\nfunction resolvePlayer(\n client: ExtensionClient,\n playerId?: string,\n): Failure | PlayerOk {\n const { players, current } = client.getState();\n const id = playerId ?? current.player;\n if (!id) return { error: \"no player selected\" };\n const player = players[id];\n if (!player) return { error: `player not found: ${id}` };\n return { id, player };\n}\n\nfunction resolveBasicPlugin(\n client: ExtensionClient,\n playerId?: string,\n): Failure | BasicPluginOk {\n const resolved = resolvePlayer(client, playerId);\n if (\"error\" in resolved) return resolved;\n const { id, player } = resolved;\n // Find the first plugin — by convention the basic plugin is registered first\n const [basicPlugin] = Object.values(player.plugins);\n if (!basicPlugin) return { error: \"no plugin registered for this player\" };\n return { id, player, basicPlugin };\n}\n\nexport function handleGetFlow(\n client: ExtensionClient,\n input: unknown,\n): CallToolResult {\n const { playerId } = PlayerInput.parse(input);\n const resolved = resolveBasicPlugin(client, playerId);\n if (\"error\" in resolved) return err(resolved.error);\n return ok(resolved.basicPlugin.flow);\n}\n\nexport function handleGetData(\n client: ExtensionClient,\n input: unknown,\n): CallToolResult {\n const { playerId } = PlayerInput.parse(input);\n const resolved = resolveBasicPlugin(client, playerId);\n if (\"error\" in resolved) return err(resolved.error);\n return ok(resolved.basicPlugin.flow?.data ?? null);\n}\n\nexport function handleGetLogs(\n client: ExtensionClient,\n input: unknown,\n): CallToolResult {\n const { playerId } = PlayerInput.parse(input);\n const resolved = resolveBasicPlugin(client, playerId);\n if (\"error\" in resolved) return err(resolved.error);\n // Logs live in the plugin's flow data under a \"logs\" key by convention\n return ok(\n (resolved.basicPlugin.flow?.data as Record<string, unknown>)?.logs ?? [],\n );\n}\n\nconst getPluginDataShape = {\n ...playerIdShape,\n pluginId: z.string().describe(\"Plugin ID.\"),\n dataKey: z.string().describe(\"Key to retrieve from the plugin's data.\"),\n};\n\nconst GetPluginDataInput = z.object(getPluginDataShape);\n\nexport function handleGetPluginData(\n client: ExtensionClient,\n input: unknown,\n): CallToolResult {\n const { playerId, pluginId, dataKey } = GetPluginDataInput.parse(input);\n const resolved = resolvePlayer(client, playerId);\n if (\"error\" in resolved) return err(resolved.error);\n const plugin = resolved.player.plugins[pluginId];\n if (!plugin) return err(`plugin not found: ${pluginId}`);\n const value = (plugin.flow?.data as Record<string, unknown> | undefined)?.[\n dataKey\n ];\n return ok(value ?? null);\n}\n\nexport const getFlowDef: ToolDef = {\n name: \"get_flow\",\n description:\n \"Get the current flow from the basic devtools plugin for a Player instance.\",\n inputSchema: playerIdShape,\n handle: handleGetFlow,\n};\n\nexport const getDataDef: ToolDef = {\n name: \"get_data\",\n description:\n \"Get the current flow data model from the basic devtools plugin for a Player instance.\",\n inputSchema: playerIdShape,\n handle: handleGetData,\n};\n\nexport const getLogsDef: ToolDef = {\n name: \"get_logs\",\n description:\n \"Get the logs from the basic devtools plugin for a Player instance.\",\n inputSchema: playerIdShape,\n handle: handleGetLogs,\n};\n\nexport const getPluginDataDef: ToolDef = {\n name: \"get_plugin_data\",\n description: \"Get a specific data key from any plugin for a Player instance.\",\n inputSchema: getPluginDataShape,\n handle: handleGetPluginData,\n};\n","import type { ExtensionClient } from \"@player-devtools/client\";\nimport type { CallToolResult } from \"@modelcontextprotocol/sdk/types.js\";\nimport { z } from \"zod\";\n\nimport { ok, err, type ToolDef } from \"./index\";\n\nconst playerIdShape = {\n playerId: z\n .string()\n .optional()\n .describe(\"Player ID. Defaults to the currently selected player.\"),\n};\n\nconst GetPlayerStatusInput = z.object(playerIdShape);\n\nexport function handleListPlayers(client: ExtensionClient): CallToolResult {\n const { players, current } = client.getState();\n return ok({ players: Object.keys(players), current: current.player });\n}\n\nexport function handleGetPlayerStatus(\n client: ExtensionClient,\n input: unknown,\n): CallToolResult {\n const { playerId } = GetPlayerStatusInput.parse(input);\n const { players, current } = client.getState();\n const id = playerId ?? current.player;\n if (!id) return err(\"no player selected\");\n const player = players[id];\n if (!player) return err(`player not found: ${id}`);\n return ok({ active: player.active, plugins: Object.keys(player.plugins) });\n}\n\nexport const listPlayersDef: ToolDef = {\n name: \"list_players\",\n description:\n \"List all Player instances known to the devtools, and which one is currently selected.\",\n inputSchema: {},\n handle: (client) => handleListPlayers(client),\n};\n\nexport const getPlayerStatusDef: ToolDef = {\n name: \"get_player_status\",\n description:\n \"Get the active status and registered plugin IDs for a Player instance.\",\n inputSchema: playerIdShape,\n handle: handleGetPlayerStatus,\n};\n","import type { ExtensionClient } from \"@player-devtools/client\";\nimport type { CallToolResult } from \"@modelcontextprotocol/sdk/types.js\";\nimport { z } from \"zod\";\n\nimport { ok, err, type ToolDef } from \"./index\";\n\nconst describePluginShape = {\n playerId: z\n .string()\n .optional()\n .describe(\"Player ID. Defaults to the currently selected player.\"),\n pluginId: z.string().describe(\"Plugin ID.\"),\n};\n\nconst DescribePluginInput = z.object(describePluginShape);\n\nexport function handleDescribePlugin(\n client: ExtensionClient,\n input: unknown,\n): CallToolResult {\n const { playerId, pluginId } = DescribePluginInput.parse(input);\n const { players, current } = client.getState();\n const id = playerId ?? current.player;\n if (!id) return err(\"no player selected\");\n const player = players[id];\n if (!player) return err(`player not found: ${id}`);\n const plugin = player.plugins[pluginId];\n if (!plugin) return err(`plugin not found: ${pluginId}`);\n if (!plugin.capabilities)\n return err(`plugin \"${pluginId}\" has no capabilities declared`);\n return ok(plugin.capabilities);\n}\n\nexport const describePluginDef: ToolDef = {\n name: \"describe_plugin\",\n description:\n \"Get the capability descriptor declared by a plugin at registration time. Use this to discover what data keys and actions the plugin exposes.\",\n inputSchema: describePluginShape,\n handle: handleDescribePlugin,\n};\n","import type { ExtensionClient } from \"@player-devtools/client\";\nimport type { CallToolResult } from \"@modelcontextprotocol/sdk/types.js\";\nimport { z } from \"zod\";\n\nimport { ok, err, type ToolDef } from \"./index\";\n\nconst selectPlayerShape = {\n playerId: z.string().describe(\"The Player ID to select.\"),\n};\n\nconst invokeActionShape = {\n playerId: z\n .string()\n .optional()\n .describe(\"Player ID. Defaults to the currently selected player.\"),\n pluginId: z.string().describe(\"Plugin ID.\"),\n action: z.string().describe(\"Action name.\"),\n payload: z.string().optional().describe(\"Optional stringified payload.\"),\n};\n\nconst SelectPlayerInput = z.object(selectPlayerShape);\n\nconst InvokeActionInput = z.object(invokeActionShape);\n\nexport function handleSelectPlayer(\n client: ExtensionClient,\n input: unknown,\n): CallToolResult {\n const { playerId } = SelectPlayerInput.parse(input);\n const { players } = client.getState();\n if (!players[playerId]) return err(`player not found: ${playerId}`);\n client.selectPlayer(playerId);\n return ok({ selected: playerId });\n}\n\nexport function handleInvokeAction(\n client: ExtensionClient,\n input: unknown,\n): CallToolResult {\n const { playerId, pluginId, action, payload } =\n InvokeActionInput.parse(input);\n const { players, current } = client.getState();\n const id = playerId ?? current.player;\n if (!id) return err(\"no player selected\");\n const player = players[id];\n if (!player) return err(`player not found: ${id}`);\n const plugin = player.plugins[pluginId];\n if (!plugin) return err(`plugin not found: ${pluginId}`);\n if (\n plugin.capabilities?.actions &&\n !(action in plugin.capabilities.actions)\n ) {\n return err(`action \"${action}\" not declared in plugin capabilities`);\n }\n client.handleInteraction({ type: action, payload, target: id });\n return ok({ invoked: action });\n}\n\nexport const selectPlayerDef: ToolDef = {\n name: \"select_player\",\n description:\n \"Select a Player instance as the active target for subsequent tool calls.\",\n inputSchema: selectPlayerShape,\n handle: handleSelectPlayer,\n};\n\nexport const invokeActionDef: ToolDef = {\n name: \"invoke_action\",\n description:\n \"Invoke a named action on a plugin. Use describe_plugin first to discover available actions.\",\n inputSchema: invokeActionShape,\n handle: handleInvokeAction,\n};\n","import type { ExtensionClient } from \"@player-devtools/client\";\nimport type { CallToolResult } from \"@modelcontextprotocol/sdk/types.js\";\nimport type { Transport } from \"@player-devtools/types\";\nimport { FlipperServerTransport } from \"@player-devtools/client-flipper\";\n\nimport { ok, err, type ToolDef } from \"./index\";\n\n/** Narrow the generic `Transport` to the concrete Flipper implementation. */\nfunction asFlipperTransport(\n transport: Transport | undefined,\n): FlipperServerTransport | null {\n return transport instanceof FlipperServerTransport ? transport : null;\n}\n\nexport function handleGetFlipperStatus(\n _client: ExtensionClient,\n _args: unknown,\n transport?: Transport,\n): CallToolResult {\n const flipper = asFlipperTransport(transport);\n if (!flipper) return err(\"not using a Flipper transport\");\n\n const { connected, host, port, owns, refs } = flipper.getDiagnostics();\n return ok({ connected, host, port, owns, refs });\n}\n\nexport function handleGetFlipperConsumers(\n _client: ExtensionClient,\n _args: unknown,\n transport?: Transport,\n): CallToolResult {\n const flipper = asFlipperTransport(transport);\n if (!flipper) return err(\"not using a Flipper transport\");\n\n const { owns, refs, activeClientIds } = flipper.getDiagnostics();\n return ok({ owns, refs, activeClientIds });\n}\n\nexport async function handleRestartFlipperServer(\n _client: ExtensionClient,\n _args: unknown,\n transport?: Transport,\n): Promise<CallToolResult> {\n const flipper = asFlipperTransport(transport);\n if (!flipper) return err(\"not using a Flipper transport\");\n\n const result = await flipper.restart();\n if (!result.ok) return err(result.reason);\n return ok({ restarted: true, host: result.host, port: result.port });\n}\n\nexport async function handleGetFlipperPluginInstallStatus(\n _client: ExtensionClient,\n _args: unknown,\n transport?: Transport,\n): Promise<CallToolResult> {\n const flipper = asFlipperTransport(transport);\n if (!flipper) return err(\"not using a Flipper transport\");\n\n if (!flipper.getDiagnostics().connected) {\n return err(\"flipper transport not connected\");\n }\n\n const status = await flipper.getPluginInstallStatus();\n if (!status.installed && status.reason) return err(status.reason);\n return ok(status);\n}\n\nexport const getFlipperStatusDef: ToolDef = {\n name: \"get_flipper_status\",\n description:\n \"Get the MCP server's connection status to the shared flipper-server daemon (host, port, ownership, refcount).\",\n inputSchema: {},\n annotations: { readOnlyHint: true, destructiveHint: false },\n handle: handleGetFlipperStatus,\n};\n\nexport const getFlipperConsumersDef: ToolDef = {\n name: \"get_flipper_consumers\",\n description:\n \"Get the active devtools clients attached through this Flipper connection, plus the daemon-wide refcount (reflects all consumers of the shared daemon, not just this process).\",\n inputSchema: {},\n annotations: { readOnlyHint: true, destructiveHint: false },\n handle: handleGetFlipperConsumers,\n};\n\nexport const restartFlipperServerDef: ToolDef = {\n name: \"restart_flipper_server\",\n description:\n \"Restart the shared flipper-server daemon. Only succeeds when this MCP server owns the daemon and is its sole consumer; otherwise returns a soft error rather than disrupting other consumers.\",\n inputSchema: {},\n annotations: { readOnlyHint: false, destructiveHint: true },\n handle: handleRestartFlipperServer,\n};\n\nexport const getFlipperPluginInstallStatusDef: ToolDef = {\n name: \"get_flipper_plugin_install_status\",\n description:\n \"Check whether the Player UI Devtools Flipper plugin is installed on the connected daemon.\",\n inputSchema: {},\n annotations: { readOnlyHint: true, destructiveHint: false },\n handle: handleGetFlipperPluginInstallStatus,\n};\n","import type { ExtensionClient } from \"@player-devtools/client\";\nimport type {\n CallToolResult,\n ToolAnnotations,\n} from \"@modelcontextprotocol/sdk/types.js\";\nimport type { Transport } from \"@player-devtools/types\";\nimport type { ZodRawShape } from \"zod\";\n\n/**\n * A tool definition consumed by the MCP server. `inputSchema` is a Zod raw\n * shape — the SDK derives the JSON Schema, validates input, and types the\n * handler's `args`. The handler receives the running devtools client, the\n * validated args, and the raw `Transport` for tools that need connection-level\n * diagnostics `ExtensionClient` doesn't expose.\n */\nexport type ToolDef<Shape extends ZodRawShape = ZodRawShape> = {\n name: string;\n description: string;\n inputSchema: Shape;\n annotations?: ToolAnnotations;\n handle: (\n client: ExtensionClient,\n args: unknown,\n transport?: Transport,\n ) => CallToolResult | Promise<CallToolResult>;\n};\n\n/** Shared JSON-envelope helpers used by every tool handler in this package. */\nexport function ok(value: unknown): CallToolResult {\n return { content: [{ type: \"text\", text: JSON.stringify(value) }] };\n}\n\nexport function err(message: string): CallToolResult {\n return {\n content: [{ type: \"text\", text: JSON.stringify({ error: message }) }],\n };\n}\n\nexport * from \"./flow\";\nexport * from \"./players\";\nexport * from \"./plugins\";\nexport * from \"./select\";\nexport * from \"./flipper\";\n\nimport { listPlayersDef, getPlayerStatusDef } from \"./players\";\nimport { getFlowDef, getDataDef, getLogsDef, getPluginDataDef } from \"./flow\";\nimport { describePluginDef } from \"./plugins\";\nimport { selectPlayerDef, invokeActionDef } from \"./select\";\nimport {\n getFlipperStatusDef,\n getFlipperConsumersDef,\n restartFlipperServerDef,\n getFlipperPluginInstallStatusDef,\n} from \"./flipper\";\n\n/** Every tool the MCP server exposes. */\nexport const TOOL_DEFS: ToolDef[] = [\n listPlayersDef,\n getPlayerStatusDef,\n getFlowDef,\n getDataDef,\n getLogsDef,\n getPluginDataDef,\n describePluginDef,\n selectPlayerDef,\n invokeActionDef,\n getFlipperStatusDef,\n getFlipperConsumersDef,\n restartFlipperServerDef,\n getFlipperPluginInstallStatusDef,\n];\n","import * as os from \"os\";\nimport { instrument } from \"@posthog/mcp\";\nimport { PostHog } from \"posthog-node\";\n\nimport { resolveTelemetryConfig } from \"./config\";\nimport { getInstallId } from \"./installId\";\nimport { allowlistEventProperties } from \"./redaction\";\n\nexport {\n ALLOWED_EVENT_PROPERTIES,\n allowlistEventProperties,\n} from \"./redaction\";\nexport { resolveTelemetryConfig, type TelemetryConfig } from \"./config\";\nexport { getInstallId, type InstallIdDeps } from \"./installId\";\n\ndeclare global {\n const __VERSION__: string;\n}\n\n/**\n * Stamped at release build time by tsup (see devtools/tsup.config.ts). The\n * guard is required — the global is absent in local and test builds.\n */\nexport const MCP_VERSION: string =\n typeof __VERSION__ !== \"undefined\" ? __VERSION__ : \"unstamped\";\n\nexport type AnalyticsDeps = {\n /** Reports whether the devtools transport is currently connected. */\n isTransportConnected: () => boolean;\n};\n\n/**\n * Instruments `server` with anonymous usage analytics.\n *\n * Returns the PostHog client so the caller can flush it on shutdown, or `null`\n * when telemetry is disabled or no durable identity is available. Never throws:\n * telemetry must not be able to prevent the server from starting.\n */\nexport function createAnalytics(\n server: object,\n deps: AnalyticsDeps,\n): PostHog | null {\n try {\n const config = resolveTelemetryConfig();\n if (!config.enabled) return null;\n\n const installId = getInstallId();\n if (installId === null) return null;\n\n const posthog = new PostHog(config.apiKey, {\n host: config.host,\n // The load-bearing privacy control. Runs inside posthog-node's capture(),\n // so it applies to everything the MCP SDK emits regardless of the SDK's\n // own hooks. See redaction.ts for why this is an allowlist.\n before_send: [allowlistEventProperties],\n });\n\n instrument(server, posthog, {\n // Defaults to ON, and would inject a *required* `context` parameter into\n // every tool schema asking the agent to narrate user intent — mutating\n // our public tool API and adding per-call token cost.\n context: false,\n identify: { distinctId: installId },\n eventProperties: () => ({\n mcp_version: MCP_VERSION,\n os_platform: os.platform(),\n node_major: Number.parseInt(\n process.versions.node.split(\".\")[0] ?? \"\",\n 10,\n ),\n transport_connected: deps.isTransportConnected(),\n surface: \"mcp-server\",\n }),\n // Redundant with `before_send` above, kept as a second independent layer.\n // This hook fails closed: the SDK drops the event if it throws.\n beforeSend: allowlistEventProperties,\n });\n\n return posthog;\n } catch {\n // Telemetry is strictly best-effort — a misconfiguration must never take\n // down the server.\n return null;\n }\n}\n","declare global {\n const __POSTHOG_KEY__: string;\n}\n\n/**\n * PostHog project API key, stamped at release build time from the\n * `POSTHOG_PROJECT_KEY` CI environment variable (see\n * helpers/release/workspace-status.sh and tsup.config.ts), mirroring how\n * `__VERSION__` is stamped.\n *\n * This is a *public, write-only* ingestion token — it can only send events and\n * cannot read data back, which is why it is safe to ship in an open-source\n * package.\n *\n * The `typeof` guard is required: the global is absent in local and test\n * builds, where it resolves to an empty string and disables telemetry.\n */\nconst POSTHOG_PROJECT_KEY =\n typeof __POSTHOG_KEY__ !== \"undefined\" ? __POSTHOG_KEY__ : \"\";\n\nconst DEFAULT_POSTHOG_HOST = \"https://us.i.posthog.com\";\n\nexport type TelemetryConfig =\n | { readonly enabled: false }\n | { readonly enabled: true; readonly apiKey: string; readonly host: string };\n\n/**\n * Presence of the variable opts out, *except* for explicit negatives —\n * `DO_NOT_TRACK=0` means \"tracking is fine\", not \"opted out\".\n */\nfunction isTruthy(value: string | undefined): boolean {\n if (value === undefined) return false;\n const normalized = value.trim().toLowerCase();\n if (normalized === \"\" || normalized === \"0\" || normalized === \"false\") {\n return false;\n }\n return true;\n}\n\nfunction isOptedOut(env: NodeJS.ProcessEnv): boolean {\n return (\n isTruthy(env.PLAYER_DEVTOOLS_TELEMETRY_DISABLED) ||\n // Cross-vendor convention (consoledonottrack.com) — honored so a user who\n // sets it once is covered everywhere.\n isTruthy(env.DO_NOT_TRACK)\n );\n}\n\nexport function resolveTelemetryConfig(\n env: NodeJS.ProcessEnv = process.env,\n): TelemetryConfig {\n if (isOptedOut(env)) return { enabled: false };\n\n const apiKey = env.PLAYER_DEVTOOLS_TELEMETRY_KEY ?? POSTHOG_PROJECT_KEY;\n // Unstamped (local/dev builds) or unset in CI — stay silent rather than\n // firing doomed requests at PostHog on every startup.\n if (!apiKey) return { enabled: false };\n // Only public write-only project keys may ship. A `phx_` (personal) or\n // `phs_` (project secret) key is a real credential and must never be baked\n // into a published artifact, so refuse to use one even if stamped.\n if (!apiKey.startsWith(\"phc_\")) return { enabled: false };\n\n const host = (\n env.PLAYER_DEVTOOLS_TELEMETRY_HOST ?? DEFAULT_POSTHOG_HOST\n ).replace(/\\/+$/, \"\");\n\n return { enabled: true, apiKey, host };\n}\n","import { randomUUID } from \"crypto\";\nimport * as fs from \"fs\";\nimport * as os from \"os\";\nimport * as path from \"path\";\n\nexport type InstallIdDeps = {\n /** Resolves the user's home directory. */\n homedir: () => string;\n /** Reads the install file. */\n readFileSync: typeof fs.readFileSync;\n /** Writes the install file. */\n writeFileSync: typeof fs.writeFileSync;\n /** Creates the install directory. */\n mkdirSync: typeof fs.mkdirSync;\n /** Mints a new identifier. */\n randomUUID: () => string;\n};\n\nconst defaultDeps: InstallIdDeps = {\n homedir: os.homedir,\n readFileSync: fs.readFileSync,\n writeFileSync: fs.writeFileSync,\n mkdirSync: fs.mkdirSync,\n randomUUID,\n};\n\ntype InstallFile = { installId: string };\n\nconst UUID_PATTERN =\n /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n\nexport const INSTALL_DIR_NAME = \".player-ui-devtools\";\nexport const INSTALL_FILE_NAME = \"install.json\";\n\n/**\n * A stable, anonymous per-machine identifier.\n *\n * Stored under the user's home directory rather than the OS temp dir the\n * flipper refcount uses: temp is periodically reaped, which would regenerate\n * the id on every reboot and turn \"unique installs\" into \"unique boots\".\n *\n * Returns `null` when the id can neither be read nor persisted (read-only FS,\n * sandbox, absent HOME). Callers treat that as \"telemetry off\" — returning an\n * in-memory id instead would register a brand-new install on every run and\n * systematically inflate counts for exactly the sandboxed population least\n * likely to be real users.\n */\nexport function getInstallId(deps: InstallIdDeps = defaultDeps): string | null {\n const dir = path.join(deps.homedir(), INSTALL_DIR_NAME);\n const file = path.join(dir, INSTALL_FILE_NAME);\n\n try {\n const parsed = JSON.parse(\n deps.readFileSync(file, \"utf8\") as string,\n ) as Partial<InstallFile>;\n // Validate the shape, not just the parse: `{\"installId\": 42}` parses fine\n // but is not a usable identity.\n if (\n typeof parsed.installId === \"string\" &&\n UUID_PATTERN.test(parsed.installId)\n ) {\n return parsed.installId;\n }\n } catch {\n /* missing or corrupt — fall through and regenerate */\n }\n\n const installId = deps.randomUUID();\n try {\n deps.mkdirSync(dir, { recursive: true });\n const contents: InstallFile = { installId };\n // 0600: a stable per-user identifier should not be world-readable.\n deps.writeFileSync(file, JSON.stringify(contents), { mode: 0o600 });\n } catch {\n return null;\n }\n\n return installId;\n}\n","/**\n * Event property allowlist.\n *\n * `@posthog/mcp` captures tool arguments (`$mcp_parameters`) and tool results\n * (`$mcp_response`) unconditionally — there is no SDK option to disable it, and\n * its built-in sanitizer only matches sensitive *key names* (`token`,\n * `password`, ...), so a field named `flowContent` would be transmitted\n * verbatim. Devtools tool arguments carry player/plugin ids and `invoke_action`\n * payloads, i.e. potentially customer flow data.\n *\n * This is an allowlist rather than a denylist on purpose: the SDK is 0.x and\n * ships frequently, so a denylist naming today's two payload keys would\n * silently start leaking the moment a release adds a third. Anything not\n * explicitly listed here never reaches the wire.\n */\nexport const ALLOWED_EVENT_PROPERTIES: ReadonlySet<string> = new Set([\n // MCP tool call shape — names and timings only, never payloads.\n \"$mcp_tool_name\",\n \"$mcp_duration_ms\",\n \"$mcp_is_error\",\n \"$mcp_error_type\",\n \"$mcp_listed_tool_names\",\n \"$mcp_missing_capability\",\n // Which editor/agent is driving the server.\n \"$mcp_client_name\",\n \"$mcp_client_version\",\n \"$mcp_server_name\",\n \"$mcp_server_version\",\n \"$mcp_protocol_version\",\n // PostHog bookkeeping.\n \"$session_id\",\n \"$process_person_profile\",\n \"$lib\",\n \"$lib_version\",\n // Our own event properties.\n \"mcp_version\",\n \"os_platform\",\n \"node_major\",\n \"transport_connected\",\n \"surface\",\n]);\n\nexport type CapturedEvent = {\n /** Event name. */\n event?: string;\n /** Event properties. */\n properties?: Record<string, unknown>;\n};\n\n/**\n * Drops every property not in {@link ALLOWED_EVENT_PROPERTIES}.\n *\n * Installed as a `posthog-node` client-level `before_send`, which runs inside\n * `capture()` — a chokepoint the MCP SDK cannot route around, since we own the\n * client instance and it does not.\n *\n * Accepts `null` because `before_send` hooks compose: an earlier hook may have\n * already dropped the event.\n */\nexport function allowlistEventProperties<Event extends CapturedEvent>(\n event: Event | null,\n): Event | null {\n if (!event?.properties) return event;\n\n event.properties = Object.fromEntries(\n Object.entries(event.properties).filter(([key]) =>\n ALLOWED_EVENT_PROPERTIES.has(key),\n ),\n );\n\n return event;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,oBAGO;AAEP,IAAAA,cAA0B;AAC1B,mBAAqC;;;ACHrC,iBAAkB;AAgBlB,IAAM,gBAAgB;AAAA,EACpB,UAAU,aACP,OAAO,EACP,SAAS,EACT,SAAS,uDAAuD;AACrE;AAEA,IAAM,cAAc,aAAE,OAAO,aAAa;AAE1C,SAAS,cACP,QACA,UACoB;AACpB,QAAM,EAAE,SAAS,QAAQ,IAAI,OAAO,SAAS;AAC7C,QAAM,KAAK,YAAY,QAAQ;AAC/B,MAAI,CAAC,GAAI,QAAO,EAAE,OAAO,qBAAqB;AAC9C,QAAM,SAAS,QAAQ,EAAE;AACzB,MAAI,CAAC,OAAQ,QAAO,EAAE,OAAO,qBAAqB,EAAE,GAAG;AACvD,SAAO,EAAE,IAAI,OAAO;AACtB;AAEA,SAAS,mBACP,QACA,UACyB;AACzB,QAAM,WAAW,cAAc,QAAQ,QAAQ;AAC/C,MAAI,WAAW,SAAU,QAAO;AAChC,QAAM,EAAE,IAAI,OAAO,IAAI;AAEvB,QAAM,CAAC,WAAW,IAAI,OAAO,OAAO,OAAO,OAAO;AAClD,MAAI,CAAC,YAAa,QAAO,EAAE,OAAO,uCAAuC;AACzE,SAAO,EAA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,OAAO,MAAM;AAAA,EAC1B;AACF;","names":["import_mcp","import_zod","playerIdShape","import_zod","import_zod","os","err"]}
1
+ {"version":3,"sources":["../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/mcp/src/index.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/mcp/src/server.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/mcp/src/tools/flow.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/mcp/src/tools/players.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/mcp/src/tools/plugins.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/mcp/src/tools/select.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/mcp/src/tools/index.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/mcp/src/telemetry/index.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/mcp/src/telemetry/config.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/mcp/src/telemetry/installId.ts","../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/mcp/src/telemetry/redaction.ts"],"sourcesContent":["export { MCPServer } from \"./server\";\n","import {\n createExtensionClient,\n type ExtensionClient,\n} from \"@player-devtools/client\";\nimport type { Transport } from \"@player-devtools/types\";\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\";\nimport type { CallToolResult } from \"@modelcontextprotocol/sdk/types.js\";\nimport type { PostHog } from \"posthog-node\";\n\nimport { TOOL_DEFS, type ToolDef } from \"./tools\";\nimport { createAnalytics, MCP_VERSION } from \"./telemetry\";\n\nexport class MCPServer {\n private client: ExtensionClient;\n private server: McpServer;\n private analytics: PostHog | null;\n private transportConnected = false;\n\n constructor(private transport: Transport) {\n this.client = createExtensionClient(transport);\n this.server = new McpServer({\n name: \"player-devtools\",\n version: MCP_VERSION,\n });\n // Instrument before registering tools so every handler is wrapped.\n this.analytics = createAnalytics(this.server, {\n isTransportConnected: () => this.transportConnected,\n });\n this.registerTools();\n }\n\n private registerTools(): void {\n for (const def of TOOL_DEFS) {\n // `registerTool` is heavily generic over the Zod input shape; inferring\n // that across a heterogeneous array trips TS2589 (excessively deep). The\n // shapes are validated at runtime by the SDK, so register through a\n // loosely-typed view to keep inference shallow.\n const register = this.server.registerTool.bind(this.server) as (\n name: string,\n config: { description: string; inputSchema: ToolDef[\"inputSchema\"] },\n cb: (args: unknown) => CallToolResult,\n ) => unknown;\n\n register(\n def.name,\n { description: def.description, inputSchema: def.inputSchema },\n (args) => def.handle(this.client, args),\n );\n }\n }\n\n async start(): Promise<void> {\n const stdioTransport = new StdioServerTransport();\n await this.server.connect(stdioTransport);\n try {\n await this.transport.connect();\n this.transportConnected = true;\n } catch (err) {\n console.warn(\n \"[MCPServer] Transport connect failed (will operate in disconnected mode):\",\n err instanceof Error ? err.message : err,\n );\n }\n }\n\n async stop(): Promise<void> {\n // Flush buffered events first: bin/run calls process.exit(0) as soon as\n // this resolves, which would otherwise drop them. Never fail shutdown on a\n // telemetry error.\n try {\n await this.analytics?.shutdown();\n } catch {\n /* best-effort */\n }\n this.client.destroy();\n await this.transport.close();\n await this.server.close();\n }\n}\n","import type { ExtensionClient } from \"@player-devtools/client\";\nimport type { PluginData } from \"@player-devtools/types\";\nimport type { CallToolResult } from \"@modelcontextprotocol/sdk/types.js\";\nimport { z } from \"zod\";\n\nimport type { ToolDef } from \"./index\";\n\ntype Failure = { error: string };\ntype PlayerOk = {\n id: string;\n player: {\n plugins: Record<string, PluginData>;\n active: boolean;\n config: Record<string, unknown>;\n };\n};\ntype BasicPluginOk = PlayerOk & { basicPlugin: PluginData };\n\n/** Optional player id, shared by the player-scoped read tools. */\nconst playerIdShape = {\n playerId: z\n .string()\n .optional()\n .describe(\"Player ID. Defaults to the currently selected player.\"),\n};\n\nconst PlayerInput = z.object(playerIdShape);\n\nfunction resolvePlayer(\n client: ExtensionClient,\n playerId?: string,\n): Failure | PlayerOk {\n const { players, current } = client.getState();\n const id = playerId ?? current.player;\n if (!id) return { error: \"no player selected\" };\n const player = players[id];\n if (!player) return { error: `player not found: ${id}` };\n return { id, player };\n}\n\nfunction resolveBasicPlugin(\n client: ExtensionClient,\n playerId?: string,\n): Failure | BasicPluginOk {\n const resolved = resolvePlayer(client, playerId);\n if (\"error\" in resolved) return resolved;\n const { id, player } = resolved;\n // Find the first plugin — by convention the basic plugin is registered first\n const [basicPlugin] = Object.values(player.plugins);\n if (!basicPlugin) return { error: \"no plugin registered for this player\" };\n return { id, player, basicPlugin };\n}\n\nfunction ok(value: unknown): CallToolResult {\n return { content: [{ type: \"text\", text: JSON.stringify(value) }] };\n}\n\nfunction err(message: string): CallToolResult {\n return {\n content: [{ type: \"text\", text: JSON.stringify({ error: message }) }],\n };\n}\n\nexport function handleGetFlow(\n client: ExtensionClient,\n input: unknown,\n): CallToolResult {\n const { playerId } = PlayerInput.parse(input);\n const resolved = resolveBasicPlugin(client, playerId);\n if (\"error\" in resolved) return err(resolved.error);\n return ok(resolved.basicPlugin.flow);\n}\n\nexport function handleGetData(\n client: ExtensionClient,\n input: unknown,\n): CallToolResult {\n const { playerId } = PlayerInput.parse(input);\n const resolved = resolveBasicPlugin(client, playerId);\n if (\"error\" in resolved) return err(resolved.error);\n return ok(resolved.basicPlugin.flow?.data ?? null);\n}\n\nexport function handleGetLogs(\n client: ExtensionClient,\n input: unknown,\n): CallToolResult {\n const { playerId } = PlayerInput.parse(input);\n const resolved = resolveBasicPlugin(client, playerId);\n if (\"error\" in resolved) return err(resolved.error);\n // Logs live in the plugin's flow data under a \"logs\" key by convention\n return ok(\n (resolved.basicPlugin.flow?.data as Record<string, unknown>)?.logs ?? [],\n );\n}\n\nconst getPluginDataShape = {\n ...playerIdShape,\n pluginId: z.string().describe(\"Plugin ID.\"),\n dataKey: z.string().describe(\"Key to retrieve from the plugin's data.\"),\n};\n\nconst GetPluginDataInput = z.object(getPluginDataShape);\n\nexport function handleGetPluginData(\n client: ExtensionClient,\n input: unknown,\n): CallToolResult {\n const { playerId, pluginId, dataKey } = GetPluginDataInput.parse(input);\n const resolved = resolvePlayer(client, playerId);\n if (\"error\" in resolved) return err(resolved.error);\n const plugin = resolved.player.plugins[pluginId];\n if (!plugin) return err(`plugin not found: ${pluginId}`);\n const value = (plugin.flow?.data as Record<string, unknown> | undefined)?.[\n dataKey\n ];\n return ok(value ?? null);\n}\n\nexport const getFlowDef: ToolDef = {\n name: \"get_flow\",\n description:\n \"Get the current flow from the basic devtools plugin for a Player instance.\",\n inputSchema: playerIdShape,\n handle: handleGetFlow,\n};\n\nexport const getDataDef: ToolDef = {\n name: \"get_data\",\n description:\n \"Get the current flow data model from the basic devtools plugin for a Player instance.\",\n inputSchema: playerIdShape,\n handle: handleGetData,\n};\n\nexport const getLogsDef: ToolDef = {\n name: \"get_logs\",\n description:\n \"Get the logs from the basic devtools plugin for a Player instance.\",\n inputSchema: playerIdShape,\n handle: handleGetLogs,\n};\n\nexport const getPluginDataDef: ToolDef = {\n name: \"get_plugin_data\",\n description: \"Get a specific data key from any plugin for a Player instance.\",\n inputSchema: getPluginDataShape,\n handle: handleGetPluginData,\n};\n","import type { ExtensionClient } from \"@player-devtools/client\";\nimport type { CallToolResult } from \"@modelcontextprotocol/sdk/types.js\";\nimport { z } from \"zod\";\n\nimport type { ToolDef } from \"./index\";\n\nconst playerIdShape = {\n playerId: z\n .string()\n .optional()\n .describe(\"Player ID. Defaults to the currently selected player.\"),\n};\n\nconst GetPlayerStatusInput = z.object(playerIdShape);\n\nexport function handleListPlayers(client: ExtensionClient): CallToolResult {\n const { players, current } = client.getState();\n return {\n content: [\n {\n type: \"text\",\n text: JSON.stringify({\n players: Object.keys(players),\n current: current.player,\n }),\n },\n ],\n };\n}\n\nexport function handleGetPlayerStatus(\n client: ExtensionClient,\n input: unknown,\n): CallToolResult {\n const { playerId } = GetPlayerStatusInput.parse(input);\n const { players, current } = client.getState();\n const id = playerId ?? current.player;\n if (!id) return errorResult(\"no player selected\");\n const player = players[id];\n if (!player) return errorResult(`player not found: ${id}`);\n return {\n content: [\n {\n type: \"text\",\n text: JSON.stringify({\n active: player.active,\n plugins: Object.keys(player.plugins),\n }),\n },\n ],\n };\n}\n\nfunction errorResult(message: string): CallToolResult {\n return {\n content: [{ type: \"text\", text: JSON.stringify({ error: message }) }],\n };\n}\n\nexport const listPlayersDef: ToolDef = {\n name: \"list_players\",\n description:\n \"List all Player instances known to the devtools, and which one is currently selected.\",\n inputSchema: {},\n handle: (client) => handleListPlayers(client),\n};\n\nexport const getPlayerStatusDef: ToolDef = {\n name: \"get_player_status\",\n description:\n \"Get the active status and registered plugin IDs for a Player instance.\",\n inputSchema: playerIdShape,\n handle: handleGetPlayerStatus,\n};\n","import type { ExtensionClient } from \"@player-devtools/client\";\nimport type { CallToolResult } from \"@modelcontextprotocol/sdk/types.js\";\nimport { z } from \"zod\";\n\nimport type { ToolDef } from \"./index\";\n\nconst describePluginShape = {\n playerId: z\n .string()\n .optional()\n .describe(\"Player ID. Defaults to the currently selected player.\"),\n pluginId: z.string().describe(\"Plugin ID.\"),\n};\n\nconst DescribePluginInput = z.object(describePluginShape);\n\nfunction err(message: string): CallToolResult {\n return {\n content: [{ type: \"text\", text: JSON.stringify({ error: message }) }],\n };\n}\n\nfunction ok(value: unknown): CallToolResult {\n return { content: [{ type: \"text\", text: JSON.stringify(value) }] };\n}\n\nexport function handleDescribePlugin(\n client: ExtensionClient,\n input: unknown,\n): CallToolResult {\n const { playerId, pluginId } = DescribePluginInput.parse(input);\n const { players, current } = client.getState();\n const id = playerId ?? current.player;\n if (!id) return err(\"no player selected\");\n const player = players[id];\n if (!player) return err(`player not found: ${id}`);\n const plugin = player.plugins[pluginId];\n if (!plugin) return err(`plugin not found: ${pluginId}`);\n if (!plugin.capabilities)\n return err(`plugin \"${pluginId}\" has no capabilities declared`);\n return ok(plugin.capabilities);\n}\n\nexport const describePluginDef: ToolDef = {\n name: \"describe_plugin\",\n description:\n \"Get the capability descriptor declared by a plugin at registration time. Use this to discover what data keys and actions the plugin exposes.\",\n inputSchema: describePluginShape,\n handle: handleDescribePlugin,\n};\n","import type { ExtensionClient } from \"@player-devtools/client\";\nimport type { CallToolResult } from \"@modelcontextprotocol/sdk/types.js\";\nimport { z } from \"zod\";\n\nimport type { ToolDef } from \"./index\";\n\nconst selectPlayerShape = {\n playerId: z.string().describe(\"The Player ID to select.\"),\n};\n\nconst invokeActionShape = {\n playerId: z\n .string()\n .optional()\n .describe(\"Player ID. Defaults to the currently selected player.\"),\n pluginId: z.string().describe(\"Plugin ID.\"),\n action: z.string().describe(\"Action name.\"),\n payload: z.string().optional().describe(\"Optional stringified payload.\"),\n};\n\nconst SelectPlayerInput = z.object(selectPlayerShape);\n\nconst InvokeActionInput = z.object(invokeActionShape);\n\nfunction err(message: string): CallToolResult {\n return {\n content: [{ type: \"text\", text: JSON.stringify({ error: message }) }],\n };\n}\n\nfunction ok(value: unknown): CallToolResult {\n return { content: [{ type: \"text\", text: JSON.stringify(value) }] };\n}\n\nexport function handleSelectPlayer(\n client: ExtensionClient,\n input: unknown,\n): CallToolResult {\n const { playerId } = SelectPlayerInput.parse(input);\n const { players } = client.getState();\n if (!players[playerId]) return err(`player not found: ${playerId}`);\n client.selectPlayer(playerId);\n return ok({ selected: playerId });\n}\n\nexport function handleInvokeAction(\n client: ExtensionClient,\n input: unknown,\n): CallToolResult {\n const { playerId, pluginId, action, payload } =\n InvokeActionInput.parse(input);\n const { players, current } = client.getState();\n const id = playerId ?? current.player;\n if (!id) return err(\"no player selected\");\n const player = players[id];\n if (!player) return err(`player not found: ${id}`);\n const plugin = player.plugins[pluginId];\n if (!plugin) return err(`plugin not found: ${pluginId}`);\n if (\n plugin.capabilities?.actions &&\n !(action in plugin.capabilities.actions)\n ) {\n return err(`action \"${action}\" not declared in plugin capabilities`);\n }\n client.handleInteraction({ type: action, payload, target: id });\n return ok({ invoked: action });\n}\n\nexport const selectPlayerDef: ToolDef = {\n name: \"select_player\",\n description:\n \"Select a Player instance as the active target for subsequent tool calls.\",\n inputSchema: selectPlayerShape,\n handle: handleSelectPlayer,\n};\n\nexport const invokeActionDef: ToolDef = {\n name: \"invoke_action\",\n description:\n \"Invoke a named action on a plugin. Use describe_plugin first to discover available actions.\",\n inputSchema: invokeActionShape,\n handle: handleInvokeAction,\n};\n","import type { ExtensionClient } from \"@player-devtools/client\";\nimport type { CallToolResult } from \"@modelcontextprotocol/sdk/types.js\";\nimport type { ZodRawShape } from \"zod\";\n\n/**\n * A tool definition consumed by the MCP server. `inputSchema` is a Zod raw\n * shape — the SDK derives the JSON Schema, validates input, and types the\n * handler's `args`. The handler receives the running devtools client plus the\n * validated args.\n */\nexport type ToolDef<Shape extends ZodRawShape = ZodRawShape> = {\n name: string;\n description: string;\n inputSchema: Shape;\n handle: (client: ExtensionClient, args: unknown) => CallToolResult;\n};\n\nexport * from \"./flow\";\nexport * from \"./players\";\nexport * from \"./plugins\";\nexport * from \"./select\";\n\nimport { listPlayersDef, getPlayerStatusDef } from \"./players\";\nimport { getFlowDef, getDataDef, getLogsDef, getPluginDataDef } from \"./flow\";\nimport { describePluginDef } from \"./plugins\";\nimport { selectPlayerDef, invokeActionDef } from \"./select\";\n\n/** Every tool the MCP server exposes. */\nexport const TOOL_DEFS: ToolDef[] = [\n listPlayersDef,\n getPlayerStatusDef,\n getFlowDef,\n getDataDef,\n getLogsDef,\n getPluginDataDef,\n describePluginDef,\n selectPlayerDef,\n invokeActionDef,\n];\n","import * as os from \"os\";\nimport { instrument } from \"@posthog/mcp\";\nimport { PostHog } from \"posthog-node\";\n\nimport { resolveTelemetryConfig } from \"./config\";\nimport { getInstallId } from \"./installId\";\nimport { allowlistEventProperties } from \"./redaction\";\n\nexport {\n ALLOWED_EVENT_PROPERTIES,\n allowlistEventProperties,\n} from \"./redaction\";\nexport { resolveTelemetryConfig, type TelemetryConfig } from \"./config\";\nexport { getInstallId, type InstallIdDeps } from \"./installId\";\n\ndeclare global {\n const __VERSION__: string;\n}\n\n/**\n * Stamped at release build time by tsup (see devtools/tsup.config.ts). The\n * guard is required — the global is absent in local and test builds.\n */\nexport const MCP_VERSION: string =\n typeof __VERSION__ !== \"undefined\" ? __VERSION__ : \"unstamped\";\n\nexport type AnalyticsDeps = {\n /** Reports whether the devtools transport is currently connected. */\n isTransportConnected: () => boolean;\n};\n\n/**\n * Instruments `server` with anonymous usage analytics.\n *\n * Returns the PostHog client so the caller can flush it on shutdown, or `null`\n * when telemetry is disabled or no durable identity is available. Never throws:\n * telemetry must not be able to prevent the server from starting.\n */\nexport function createAnalytics(\n server: object,\n deps: AnalyticsDeps,\n): PostHog | null {\n try {\n const config = resolveTelemetryConfig();\n if (!config.enabled) return null;\n\n const installId = getInstallId();\n if (installId === null) return null;\n\n const posthog = new PostHog(config.apiKey, {\n host: config.host,\n // The load-bearing privacy control. Runs inside posthog-node's capture(),\n // so it applies to everything the MCP SDK emits regardless of the SDK's\n // own hooks. See redaction.ts for why this is an allowlist.\n before_send: [allowlistEventProperties],\n });\n\n instrument(server, posthog, {\n // Defaults to ON, and would inject a *required* `context` parameter into\n // every tool schema asking the agent to narrate user intent — mutating\n // our public tool API and adding per-call token cost.\n context: false,\n identify: { distinctId: installId },\n eventProperties: () => ({\n mcp_version: MCP_VERSION,\n os_platform: os.platform(),\n node_major: Number.parseInt(\n process.versions.node.split(\".\")[0] ?? \"\",\n 10,\n ),\n transport_connected: deps.isTransportConnected(),\n surface: \"mcp-server\",\n }),\n // Redundant with `before_send` above, kept as a second independent layer.\n // This hook fails closed: the SDK drops the event if it throws.\n beforeSend: allowlistEventProperties,\n });\n\n return posthog;\n } catch {\n // Telemetry is strictly best-effort — a misconfiguration must never take\n // down the server.\n return null;\n }\n}\n","declare global {\n const __POSTHOG_KEY__: string;\n}\n\n/**\n * PostHog project API key, stamped at release build time from the\n * `POSTHOG_PROJECT_KEY` CI environment variable (see\n * helpers/release/workspace-status.sh and tsup.config.ts), mirroring how\n * `__VERSION__` is stamped.\n *\n * This is a *public, write-only* ingestion token — it can only send events and\n * cannot read data back, which is why it is safe to ship in an open-source\n * package.\n *\n * The `typeof` guard is required: the global is absent in local and test\n * builds, where it resolves to an empty string and disables telemetry.\n */\nconst POSTHOG_PROJECT_KEY =\n typeof __POSTHOG_KEY__ !== \"undefined\" ? __POSTHOG_KEY__ : \"\";\n\nconst DEFAULT_POSTHOG_HOST = \"https://us.i.posthog.com\";\n\nexport type TelemetryConfig =\n | { readonly enabled: false }\n | { readonly enabled: true; readonly apiKey: string; readonly host: string };\n\n/**\n * Presence of the variable opts out, *except* for explicit negatives —\n * `DO_NOT_TRACK=0` means \"tracking is fine\", not \"opted out\".\n */\nfunction isTruthy(value: string | undefined): boolean {\n if (value === undefined) return false;\n const normalized = value.trim().toLowerCase();\n if (normalized === \"\" || normalized === \"0\" || normalized === \"false\") {\n return false;\n }\n return true;\n}\n\nfunction isOptedOut(env: NodeJS.ProcessEnv): boolean {\n return (\n isTruthy(env.PLAYER_DEVTOOLS_TELEMETRY_DISABLED) ||\n // Cross-vendor convention (consoledonottrack.com) — honored so a user who\n // sets it once is covered everywhere.\n isTruthy(env.DO_NOT_TRACK)\n );\n}\n\nexport function resolveTelemetryConfig(\n env: NodeJS.ProcessEnv = process.env,\n): TelemetryConfig {\n if (isOptedOut(env)) return { enabled: false };\n\n const apiKey = env.PLAYER_DEVTOOLS_TELEMETRY_KEY ?? POSTHOG_PROJECT_KEY;\n // Unstamped (local/dev builds) or unset in CI — stay silent rather than\n // firing doomed requests at PostHog on every startup.\n if (!apiKey) return { enabled: false };\n // Only public write-only project keys may ship. A `phx_` (personal) or\n // `phs_` (project secret) key is a real credential and must never be baked\n // into a published artifact, so refuse to use one even if stamped.\n if (!apiKey.startsWith(\"phc_\")) return { enabled: false };\n\n const host = (\n env.PLAYER_DEVTOOLS_TELEMETRY_HOST ?? DEFAULT_POSTHOG_HOST\n ).replace(/\\/+$/, \"\");\n\n return { enabled: true, apiKey, host };\n}\n","import { randomUUID } from \"crypto\";\nimport * as fs from \"fs\";\nimport * as os from \"os\";\nimport * as path from \"path\";\n\nexport type InstallIdDeps = {\n /** Resolves the user's home directory. */\n homedir: () => string;\n /** Reads the install file. */\n readFileSync: typeof fs.readFileSync;\n /** Writes the install file. */\n writeFileSync: typeof fs.writeFileSync;\n /** Creates the install directory. */\n mkdirSync: typeof fs.mkdirSync;\n /** Mints a new identifier. */\n randomUUID: () => string;\n};\n\nconst defaultDeps: InstallIdDeps = {\n homedir: os.homedir,\n readFileSync: fs.readFileSync,\n writeFileSync: fs.writeFileSync,\n mkdirSync: fs.mkdirSync,\n randomUUID,\n};\n\ntype InstallFile = { installId: string };\n\nconst UUID_PATTERN =\n /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n\nexport const INSTALL_DIR_NAME = \".player-ui-devtools\";\nexport const INSTALL_FILE_NAME = \"install.json\";\n\n/**\n * A stable, anonymous per-machine identifier.\n *\n * Stored under the user's home directory rather than the OS temp dir the\n * flipper refcount uses: temp is periodically reaped, which would regenerate\n * the id on every reboot and turn \"unique installs\" into \"unique boots\".\n *\n * Returns `null` when the id can neither be read nor persisted (read-only FS,\n * sandbox, absent HOME). Callers treat that as \"telemetry off\" — returning an\n * in-memory id instead would register a brand-new install on every run and\n * systematically inflate counts for exactly the sandboxed population least\n * likely to be real users.\n */\nexport function getInstallId(deps: InstallIdDeps = defaultDeps): string | null {\n const dir = path.join(deps.homedir(), INSTALL_DIR_NAME);\n const file = path.join(dir, INSTALL_FILE_NAME);\n\n try {\n const parsed = JSON.parse(\n deps.readFileSync(file, \"utf8\") as string,\n ) as Partial<InstallFile>;\n // Validate the shape, not just the parse: `{\"installId\": 42}` parses fine\n // but is not a usable identity.\n if (\n typeof parsed.installId === \"string\" &&\n UUID_PATTERN.test(parsed.installId)\n ) {\n return parsed.installId;\n }\n } catch {\n /* missing or corrupt — fall through and regenerate */\n }\n\n const installId = deps.randomUUID();\n try {\n deps.mkdirSync(dir, { recursive: true });\n const contents: InstallFile = { installId };\n // 0600: a stable per-user identifier should not be world-readable.\n deps.writeFileSync(file, JSON.stringify(contents), { mode: 0o600 });\n } catch {\n return null;\n }\n\n return installId;\n}\n","/**\n * Event property allowlist.\n *\n * `@posthog/mcp` captures tool arguments (`$mcp_parameters`) and tool results\n * (`$mcp_response`) unconditionally — there is no SDK option to disable it, and\n * its built-in sanitizer only matches sensitive *key names* (`token`,\n * `password`, ...), so a field named `flowContent` would be transmitted\n * verbatim. Devtools tool arguments carry player/plugin ids and `invoke_action`\n * payloads, i.e. potentially customer flow data.\n *\n * This is an allowlist rather than a denylist on purpose: the SDK is 0.x and\n * ships frequently, so a denylist naming today's two payload keys would\n * silently start leaking the moment a release adds a third. Anything not\n * explicitly listed here never reaches the wire.\n */\nexport const ALLOWED_EVENT_PROPERTIES: ReadonlySet<string> = new Set([\n // MCP tool call shape — names and timings only, never payloads.\n \"$mcp_tool_name\",\n \"$mcp_duration_ms\",\n \"$mcp_is_error\",\n \"$mcp_error_type\",\n \"$mcp_listed_tool_names\",\n \"$mcp_missing_capability\",\n // Which editor/agent is driving the server.\n \"$mcp_client_name\",\n \"$mcp_client_version\",\n \"$mcp_server_name\",\n \"$mcp_server_version\",\n \"$mcp_protocol_version\",\n // PostHog bookkeeping.\n \"$session_id\",\n \"$process_person_profile\",\n \"$lib\",\n \"$lib_version\",\n // Our own event properties.\n \"mcp_version\",\n \"os_platform\",\n \"node_major\",\n \"transport_connected\",\n \"surface\",\n]);\n\nexport type CapturedEvent = {\n /** Event name. */\n event?: string;\n /** Event properties. */\n properties?: Record<string, unknown>;\n};\n\n/**\n * Drops every property not in {@link ALLOWED_EVENT_PROPERTIES}.\n *\n * Installed as a `posthog-node` client-level `before_send`, which runs inside\n * `capture()` — a chokepoint the MCP SDK cannot route around, since we own the\n * client instance and it does not.\n *\n * Accepts `null` because `before_send` hooks compose: an earlier hook may have\n * already dropped the event.\n */\nexport function allowlistEventProperties<Event extends CapturedEvent>(\n event: Event | null,\n): Event | null {\n if (!event?.properties) return event;\n\n event.properties = Object.fromEntries(\n Object.entries(event.properties).filter(([key]) =>\n ALLOWED_EVENT_PROPERTIES.has(key),\n ),\n );\n\n return event;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,oBAGO;AAEP,IAAAA,cAA0B;AAC1B,mBAAqC;;;ACHrC,iBAAkB;AAgBlB,IAAM,gBAAgB;AAAA,EACpB,UAAU,aACP,OAAO,EACP,SAAS,EACT,SAAS,uDAAuD;AACrE;AAEA,IAAM,cAAc,aAAE,OAAO,aAAa;AAE1C,SAAS,cACP,QACA,UACoB;AACpB,QAAM,EAAE,SAAS,QAAQ,IAAI,OAAO,SAAS;AAC7C,QAAM,KAAK,YAAY,QAAQ;AAC/B,MAAI,CAAC,GAAI,QAAO,EAAE,OAAO,qBAAqB;AAC9C,QAAM,SAAS,QAAQ,EAAE;AACzB,MAAI,CAAC,OAAQ,QAAO,EAAE,OAAO,qBAAqB,EAAE,GAAG;AACvD,SAAO,EAAE,IAAI,OAAO;AACtB;AAEA,SAAS,mBACP,QACA,UACyB;AACzB,QAAM,WAAW,cAAc,QAAQ,QAAQ;AAC/C,MAAI,WAAW,SAAU,QAAO;AAChC,QAAM,EAAE,IAAI,OAAO,IAAI;AAEvB,QAAM,CAAC,WAAW,IAAI,OAAO,OAAO,OAAO,OAAO;AAClD,MAAI,CAAC,YAAa,QAAO,EAAE,OAAO,uCAAuC;AACzE,SAAO,EAAE,IAAI,QAAQ,YAAY;AACnC;AAEA,SAAS,GAAG,OAAgC;AAC1C,SAAO,EAAE,SAAS,CAAC,EAAE,MAAM,QAAQ,MAAM,KAAK,UAAU,KAAK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