Add MCP workflow telemetry for AI plugins#2979
Conversation
📊 Performance Test ResultsComparing 85e2639 vs trunk app-size
site-editor
site-startup
Results are median values from multiple test runs. Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff) |
|
Hi @glendaviesnz , does this PR relate to any Linear issue? is necessary for Telex? Thank you! |
Sorry @sejas, meant to add more detail, done now with a link to Linear issue. I am very open to alternative approaches to this, just let me know if you see a better way to handle it. |
There was a problem hiding this comment.
Code wise, it works as described. It add these new MCP tool mcp__studio__record_workflow_event that can be called externally from any MCP client that passes the --telemetry-group argument.
I saw the comment in Linear and I wonder if Studio MCP should be aware of the workflows that are external to Studio CLI and Studio Code, such as auditing, theme-build etc. https://github.com/Automattic/studio/pull/2979/changes#diff-293dca55bfcd55dab52ea4082275ad8b9093c06127027f1d1aaef2659450f82dR10-R16
So, I believe the best place to add this telemetry would be were they are invoked, inside the codex and claude plugins. Using PreTool and PostTool hooks inside the skills could be a good approach. What do you think?
I’ll defer to the PED trio, @Poliuk, @wojtekn and @shaunandrews , to decide whether to include this Telemetry MCP tool.
| .option( 'help', { type: 'boolean' } ) | ||
| .option( 'telemetry-group', { | ||
| type: 'string', | ||
| hidden: true, |
There was a problem hiding this comment.
I see that this telemetry group is a hidden option, so users won’t get confused about it 👍 .
Fixes: https://linear.app/a8c/issue/STU-1530/add-telemetry-for-external-agents
Summary
This adds plugin-aware MCP workflow telemetry for Studio's AI integrations. This is needed so we can track usage of the Studio MCP by external agents, eg. https://github.com/Automattic/build-with-wordpress
Changes include:
studio mcp --telemetry-group <group>option so different AI plugin integrations can identify themselves when they launch the Studio MCP serverrecord_workflow_eventMCP tool that records workflow milestones liketheme-build-started,theme-build-completed, andtheme-build-failedThis is designed to support plugin-grouped telemetry such as:
codex-plugin+theme-build-startedclaude-code-plugin+theme-build-completedTesting
Automated
npm test -- apps/cli/ai/tests/tools.test.tsManual
studio mcp --telemetry-group codex-pluginrecord_workflow_eventtool is available.workflow: theme-buildstage: startedcompletedandfailedstages and with another workflow such assite-build.studio mcpwithout--telemetry-groupand confirm the tool reports that workflow telemetry was skipped because no plugin group was configured.Notes
npx tsc -p apps/cli/tsconfig.json --noEmit, but it still reports an existing unrelatedmemfstest typing issue inapps/cli/lib/tests/snapshots.test.ts.