Skip to content

fix(#396): lazy-load MCP SDK to prevent build failures when not installed - #398

Merged
admarble merged 2 commits into
mainfrom
feature/396-fix-lazy-load-mcp-sdk-to-prevent-build-failure
Mar 23, 2026
Merged

admarble merged 2 commits into
mainfrom
feature/396-fix-lazy-load-mcp-sdk-to-prevent-build-failure

Conversation

@admarble

Copy link
Copy Markdown
Contributor

Summary

  • Lazy-load serveCommand in bin/cli.ts via dynamic import() so non-MCP commands don't require the SDK
  • Create ambient type declarations (src/mcp/sdk-types.d.ts) as fallback for tsc when SDK is not installed
  • Move @modelcontextprotocol/sdk from dependencies to optional peerDependencies
  • Guard all MCP test files with describe.skipIf(!mcpSdkAvailable) for graceful skip
  • sequant serve shows a clear error with install instructions when SDK is missing

Test plan

  • npm run build passes with SDK installed
  • npm run build passes without SDK installed (ambient types as fallback)
  • npm test passes with SDK installed (1663 tests, 69 files)
  • npm test passes without SDK installed (1628 passed, 3 skipped, 0 failed)
  • npm run lint passes
  • sequant doctor works without SDK (MCP check shows warn, not error)
  • sequant serve shows clear error message without SDK
  • All non-MCP commands work without SDK

Closes #396

🤖 Generated with Claude Code

…lled

- Lazy-load serveCommand in bin/cli.ts via dynamic import() inside .action()
- Add ambient type declarations (src/mcp/sdk-types.d.ts) as fallback for tsc
- Move @modelcontextprotocol/sdk from dependencies to optional peerDependencies
- Guard MCP test files with describe.skipIf(!mcpSdkAvailable)
- Add *.d.ts to ESLint ignores
- sequant serve shows clear error with install instructions when SDK missing
Runtime errors from serveCommand() (e.g., port in use) should propagate
normally, not show the "SDK not installed" message.
@admarble
admarble merged commit 200f363 into main Mar 23, 2026
3 of 5 checks passed
@admarble
admarble deleted the feature/396-fix-lazy-load-mcp-sdk-to-prevent-build-failure branch March 23, 2026 13:33
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.

fix: lazy-load MCP SDK to prevent build failures when SDK is not installed

1 participant