Commit a1fdc54
committed
fix(opencode-plugin): prevent MCP server startup when loaded as plugin
The isMainModule guard in mcp-server/src/index.ts included
endsWith('index.js') which matched /$bunfs/root/src/index.js —
the entry point of opencode's bun bundle. This caused the full MCP
server (createResponsibleVibeMCPServer) to start inside the plugin
process on every plugin load, flooding stderr with INFO logs from
WorkflowManager/StateMachineLoader before WorkflowsPlugin was called
and the OpenCode log sink registered.
Fix: remove the unreliable endsWith('index.js') heuristic. The two
remaining checks are sufficient:
- import.meta.url === file://${process.argv[1]} for node dist/index.js
- endsWith('ade-workflows-server') for the npx bin symlink
Also deduplicate @codemcp/workflows-core in the opencode plugin bundle
via a tsup esbuildOptions alias that resolves @codemcp/workflows-server
from source, preventing two separate logSinkInstance globals.1 parent f8fa8b0 commit a1fdc54
2 files changed
Lines changed: 21 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
99 | | - | |
| 98 | + | |
100 | 99 | | |
101 | 100 | | |
102 | 101 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
2 | 6 | | |
3 | 7 | | |
4 | 8 | | |
| |||
22 | 26 | | |
23 | 27 | | |
24 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
25 | 45 | | |
0 commit comments