-
Notifications
You must be signed in to change notification settings - Fork 52.3k
feat(editor): Connect workflows from MCP settings page #23025
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(editor): Connect workflows from MCP settings page #23025
Conversation
BundleMonFiles added (2)
Total files change +255.73KB Groups added (2)
Final result: ✅ View report in BundleMon website ➡️ |
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
7 issues found across 20 files
Prompt for AI agents (all 7 issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="packages/@n8n/db/src/utils/build-workflows-by-nodes-query.ts">
<violation number="1" location="packages/@n8n/db/src/utils/build-workflows-by-nodes-query.ts:38">
P2: Tests may need updating to match new column quoting behavior. The `quoteColumnRef` function will now output `"workflow"."nodes"` (PostgreSQL/SQLite) or `` `workflow`.`nodes` `` (MySQL), but existing tests expect unquoted `workflow.nodes`. Consider updating test assertions to expect quoted column references.</violation>
</file>
<file name="packages/frontend/editor-ui/src/features/ai/mcpAccess/components/WorkflowLocation.vue">
<violation number="1" location="packages/frontend/editor-ui/src/features/ai/mcpAccess/components/WorkflowLocation.vue:72">
P3: The `$style['project-link']` class is referenced but never defined in the CSS module. This is dead code that should be removed from the class binding.</violation>
</file>
<file name="packages/frontend/@n8n/design-system/src/components/N8nNotice/Notice.vue">
<violation number="1" location="packages/frontend/@n8n/design-system/src/components/N8nNotice/Notice.vue:46">
P1: Setting `allowedTags: ['ul', 'li']` replaces the default allowed tags entirely, which means anchor tags (`a`) will be stripped despite having `allowedAttributes` configured for them. This breaks the existing click handler functionality that relies on anchor tags with `data-key` attributes. Consider including `'a'` in the allowed tags or extending the defaults like done in `n8n-html.ts`.</violation>
</file>
<file name="packages/frontend/editor-ui/src/features/ai/mcpAccess/components/MCPWorkflowsSelect.vue">
<violation number="1" location="packages/frontend/editor-ui/src/features/ai/mcpAccess/components/MCPWorkflowsSelect.vue:44">
P2: Potential race condition: multiple rapid searches can cause loading state to become out of sync. Each search schedules its own setTimeout in the finally block, so an earlier search's timeout can prematurely set `isLoading = false` while a later request is still in flight. Consider clearing the previous timeout when starting a new search.</violation>
</file>
<file name="packages/cli/src/middlewares/list-query/filter.ts">
<violation number="1" location="packages/cli/src/middlewares/list-query/filter.ts:22">
P2: The `req.path.endsWith('workflows')` condition was added here but not to the related `select.ts` and `sort-by.ts` middlewares. Since all three are used together via `listQueryMiddleware`, the MCP workflows endpoint will have filter support but select/sort-by may not function as expected. Consider applying the same condition to `select.ts:18` and `sort-by.ts:20` for consistency.</violation>
</file>
<file name="packages/frontend/editor-ui/src/features/ai/mcpAccess/components/tabs/WorkflowsTable.vue">
<violation number="1" location="packages/frontend/editor-ui/src/features/ai/mcpAccess/components/tabs/WorkflowsTable.vue:99">
P1: Rule violated: **Tests**
The existing tests will fail due to behavior and data-testid changes. The empty state button test expects `router.push` but now emits `connectWorkflows` event. Location tests expect `mcp-workflow-*` data-testids but `WorkflowLocation` component uses `workflow-location-*` ids. Tests must be updated to reflect these changes.</violation>
</file>
<file name="packages/cli/src/modules/mcp/mcp.settings.controller.ts">
<violation number="1" location="packages/cli/src/modules/mcp/mcp.settings.controller.ts:71">
P1: Rule violated: **Tests**
The new `GET /mcp/workflows` endpoint (`getMcpEligibleWorkflows`) lacks test coverage. This is core API functionality with specific filtering logic and permission requirements that should be tested to ensure correct behavior.</violation>
</file>
Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR
packages/frontend/editor-ui/src/features/ai/mcpAccess/components/WorkflowLocation.vue
Outdated
Show resolved
Hide resolved
packages/frontend/@n8n/design-system/src/components/N8nNotice/Notice.vue
Outdated
Show resolved
Hide resolved
packages/frontend/editor-ui/src/features/ai/mcpAccess/components/MCPWorkflowsSelect.vue
Outdated
Show resolved
Hide resolved
packages/frontend/editor-ui/src/features/ai/mcpAccess/components/tabs/WorkflowsTable.vue
Show resolved
Hide resolved
This comment has been minimized.
This comment has been minimized.
|
E2E Tests: n8n tests passed after 8m 5.9s Run Details
Groups
This message was posted automatically by
currents.dev | Integration Settings
|
…mcp-page' into ADO-4437-connect-workflows-from-mcp-page
This comment has been minimized.
This comment has been minimized.
…mcp-page' into ADO-4437-connect-workflows-from-mcp-page
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
RicardoE105
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good and tested it locally and everything seem to work fine. 🚀
| includeScopes?: boolean, | ||
| includeFolders?: boolean, | ||
| onlySharedWithMe?: boolean, | ||
| requiredScopes: Scope[] = ['workflow:read'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick(non-blocking): Should we document this so when the people the the method the know what requiredScopes is 🤔 ?
Summary
Adding a new modal that lets users enable mcp access for workflows from the settings page. For this to work, I needed to introduce some additional back-end changes:
triggerNodeTypeto accept string arrays so we can filter workflows by multiple triggers. Also renamed it totriggerNodeTypesgetManymethod in the workflows service to accept required scopes as a parameter since for mcp we want only workflows withupdatepermissions/mcp/workflowsendpoint, I needed to update the list-query middleware to accept all paths ending withworkflowsavailableInMCPfilter to treatNULLasfalseScreenshot of the new modal:
Related Linear tickets, Github issues, and Community forum posts
Closes ADO-4437
Review / Merge checklist
release/backport(if the PR is an urgent fix that needs to be backported)