Commit db06a4b
authored
feat(connectors): generic MCP connector + schema-typed action outputs (#263)
* feat(connectors): generic MCP connector + schema-typed action outputs
Add a generic MCP connector that spawns any stdio MCP server, discovers
its tools via tools/list, and exposes them as first-class connector
actions. Tool inputSchema/outputSchema flow through to the workflow
editor so arg fields and {{steps.x.field}} autocomplete stay
schema-driven — same shape as static connectors.
Also:
- GitHub actions now declare outputSchemas; createIssue / closeIssue /
commentOnIssue return their API payloads as structuredOutput so
downstream steps can reference html_url, number, state, etc.
- Template resolver walks arbitrary dotted paths; object/array leaves
JSON-stringify.
- Deleting a condition node cascades the if/else subtree up to the join
point instead of leaving two dangling parallel paths.
- MCP icon reuses the ModelContextProtocol mark in both the connector
badge and the workflow icon picker.
* fix: export json-schema-utils subpath, update connector-form-panels mocks
Two CI regressions from the previous commit:
- Vite respects the package.json `exports` field for subpath resolution,
so `@vornrun/shared/json-schema-utils` needed an entry next to the
other subpaths. Without it, every server test that imported the
scheduler (transitively: mcp.ts) failed module resolution.
- connector-form-panels.test.tsx mocked `window.api.listConnectors`/
`listConnections` but not the new `listConnectionActions`; the form
also now uses a textarea-based VariableAutocomplete for arg fields, so
the element query needed to target `textarea`.
* test: cover MCP connector, schema utils, walk-path resolver, condition cascade
CI's diff-cover gate requires 80% on changed lines. New tests:
- json-schema-utils: 100%
- mcp-connector: tool→action mapping, structuredContent unwrap, MCP error
surfacing, type coercion (number/bool/object), empty-string drop
- mcp-clients: spawn config from filters, decrypted secretEnv merge,
cache reuse, transport-onclose drops the entry, stopClient/stopAllClients
- template-vars: walk nested paths, JSON-stringify object/array leaves,
schema-derived buildStepGroups keys
- workflow-helpers removeNode: condition cascade-delete + terminal case
- ConnectorIcon: MCP brand-mark renders with both paths
Patch coverage now 85% (above the 80% gate).
* fix: address Copilot review comments
- McpToolsPanel: guard discoveredTools cast with Array.isArray so a
malformed filters payload can't crash .map at render.
- InvokeToolDialog: key on tool.name so switching tools remounts with a
fresh args stub + cleared result instead of leaking previous state.
- WorkflowEditor prefetch: catch per-connection rejections so a single
dead connection doesn't blank the autocomplete for healthy ones.
- mcp.ts describe(): comment now points at connection:listActions, the
endpoint the workflow editor actually consumes.
* fix: address second batch of Copilot review comments
- mcp-clients: build the child-process env from getSafeEnv() instead of
process.env so the same secret allowlist that protects gh / agent
detection / tailscale child invocations also covers MCP servers. GH /
NPM / API tokens never reach an arbitrary MCP server now.
- workflow-execution: arrays were sneaking into structuredOutput via
`typeof === 'object'`; that breaks buildStepOutputsMap which spreads
the value into a string-keyed map. Restrict to plain objects only.
- CallConnectorActionNodeForm: render select fields with SelectPicker so
enum-backed args (declared via JSON-Schema enum) keep their dropdown.
text / textarea still flow through VariableAutocomplete.
* chore: fix CardHeader formatting (broken on main, surfaced after rebase)
* test: align card-context-menu test with #264 menu pruning
#264 dropped Expand / Rename / Close from the ⋯ context menu since
those moved to first-class header buttons. The test still asserted
their presence; updating it to check for the actually-present entries.
* fix: avoid stale action list on connection switch
Connection-change effect now clears `actions` immediately and ignores a
late response via a cancellation flag, so switching connections never
flashes the previous connection's actions or fires onChange against a
stale set.
* fix: serialize concurrent MCP startups + preserve empty strings on string fields
Two valid Copilot review concerns:
- mcp-clients getOrStartClient: two concurrent callers hitting a cache
miss could both spawn separate child processes before the first call
ran clients.set(). Cache the in-flight Promise per connectionId so
parallel calls share the same startup.
- mcp coerceMcpArgs: dropping every empty string is too aggressive.
Empty for a string field is a legitimate value the user may want to
send; empty for a required non-string is something the MCP server's
own validator should reject explicitly. Only drop empty for
optional non-string types now.1 parent 153ba67 commit db06a4b
31 files changed
Lines changed: 1939 additions & 135 deletions
File tree
- packages
- server/src
- connectors
- src
- main
- preload
- renderer
- components
- card
- project-sidebar
- settings
- workflow-editor
- panels
- lib
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
16 | 50 | | |
17 | 51 | | |
18 | 52 | | |
| |||
317 | 351 | | |
318 | 352 | | |
319 | 353 | | |
320 | | - | |
321 | | - | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
322 | 358 | | |
323 | 359 | | |
324 | 360 | | |
325 | 361 | | |
326 | | - | |
| 362 | + | |
327 | 363 | | |
328 | 364 | | |
329 | | - | |
| 365 | + | |
330 | 366 | | |
331 | 367 | | |
332 | 368 | | |
| |||
401 | 437 | | |
402 | 438 | | |
403 | 439 | | |
404 | | - | |
| 440 | + | |
| 441 | + | |
405 | 442 | | |
406 | 443 | | |
407 | 444 | | |
| |||
416 | 453 | | |
417 | 454 | | |
418 | 455 | | |
419 | | - | |
| 456 | + | |
| 457 | + | |
420 | 458 | | |
421 | 459 | | |
422 | 460 | | |
| |||
438 | 476 | | |
439 | 477 | | |
440 | 478 | | |
441 | | - | |
| 479 | + | |
| 480 | + | |
442 | 481 | | |
443 | 482 | | |
444 | 483 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
4 | 7 | | |
5 | 8 | | |
6 | 9 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
0 commit comments