Skip to content

feat(relay): dormant mode for MCP server#13

Merged
Narrator merged 1 commit intomainfrom
feat/mcp-dormant-mode
Mar 26, 2026
Merged

feat(relay): dormant mode for MCP server#13
Narrator merged 1 commit intomainfrom
feat/mcp-dormant-mode

Conversation

@Narrator
Copy link
Copy Markdown
Member

Summary

  • Problem: The MCP server crashes with exit(1) when no .domscribe/ directory exists. Since the plugin is installed at user scope, this shows a "failed" MCP server in every agent session opened outside a domscribe workspace.
  • Solution: Instead of crashing, the MCP server starts in dormant mode — a healthy MCP server with a single domscribe.status diagnostic tool that explains the workspace isn't active and how to set it up.
  • Design: McpAdapterOptions is now a discriminated union (active | dormant). The command orchestrator selects the mode; the adapter stays pure wiring.

Changes

File What
dormant-status.tool.ts New DormantStatusTool — returns { active: false, cwd, guidance }
mcp-adapter.ts Discriminated union options, dormant branch in constructor
mcp.command.ts Remove crash, add dormant fallback, extract shutdown handler
*.spec.ts Tests for both modes

Test plan

  • nx test domscribe-relay — 274 tests pass (including new dormant mode tests)
  • nx lint domscribe-relay — clean
  • nx typecheck domscribe-relay — clean
  • nx build domscribe-relay — clean
  • Manual: run npx domscribe mcp outside a workspace — process stays alive, tools/list returns 1 tool
  • Manual: run npx domscribe mcp inside a workspace — all 12 tools + 4 prompts (no regression)

…ected

Instead of crashing with exit(1) when no .domscribe/ directory exists,
the MCP server now starts in dormant mode with a single diagnostic
status tool. This prevents "failed" MCP server noise in agent sessions
opened outside domscribe workspaces.

- Add DormantStatusTool returning workspace status and setup guidance
- Introduce discriminated union on McpAdapterOptions (active | dormant)
- McpAdapter branches on mode: full tools+prompts vs diagnostic-only
- Extract setupShutdownHandlers in mcp.command.ts to avoid duplication
@nx-cloud
Copy link
Copy Markdown

nx-cloud bot commented Mar 26, 2026

View your CI Pipeline Execution ↗ for commit 1725b06

Command Status Duration Result
nx run domscribe-test-fixtures:integration--web... ✅ Succeeded 1m 46s View ↗
nx run domscribe-test-fixtures:integration--web... ✅ Succeeded 1m 47s View ↗
nx run domscribe-test-fixtures:integration--web... ✅ Succeeded 1m 42s View ↗
nx run domscribe-test-fixtures:integration--web... ✅ Succeeded 1m 36s View ↗
nx run domscribe-test-fixtures:install-fixture-... ✅ Succeeded 58s View ↗
nx run domscribe-test-fixtures:install-fixture-... ✅ Succeeded 48s View ↗
nx run domscribe-test-fixtures:integration--vit... ✅ Succeeded 32s View ↗
nx run domscribe-test-fixtures:install-fixture-... ✅ Succeeded 23s View ↗
Additional runs (18) ✅ Succeeded ... View ↗

☁️ Nx Cloud last updated this comment at 2026-03-26 17:28:26 UTC

@Narrator Narrator merged commit c9212f9 into main Mar 26, 2026
24 checks passed
@Narrator Narrator deleted the feat/mcp-dormant-mode branch March 26, 2026 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant