Skip to content

feat(docker): add Streamable HTTP transport deployment with TDD unit tests#37

Open
gthieleb wants to merge 2 commits into
codefuturist:mainfrom
gthieleb:feat/http-transport-deployment
Open

feat(docker): add Streamable HTTP transport deployment with TDD unit tests#37
gthieleb wants to merge 2 commits into
codefuturist:mainfrom
gthieleb:feat/http-transport-deployment

Conversation

@gthieleb

Copy link
Copy Markdown

Summary

Enables Docker deployment of the Streamable HTTP transport with proper health checks, optional compose override pattern, and TDD unit tests for the HTTP handler.

What's New

HTTP Handler Extraction (src/http-handler.ts)

  • Extracted HTTP handler logic from main.ts into createHttpHandler(deps) factory function
  • Handles /health (GET), /mcp (POST) routing, and session management
  • Minimal extraction — no behavioral changes to existing stdio transport

TDD Unit Tests (src/http-handler.test.ts)

  • 8 unit tests covering: health endpoint, MCP routing, session management, error handling
  • Uses vi.hoisted() + vi.mock() for clean SDK mocking
  • All 158 existing tests + 8 new tests pass

Docker Improvements

  • Both Dockerfile and Dockerfile.alpine now EXPOSE 8080 with HEALTHCHECK
  • New docker-healthcheck.js — readable health check script (replaces cryptic oneliner)
  • Port configurable via CLI argument: node docker-healthcheck.js 8080

Docker Compose: Optional HTTP Override Pattern

  • Base docker-compose.yml → stdio only (default, unchanged behavior)
  • docker-compose.override.example.yml → template for HTTP mode
  • Users activate HTTP with: cp docker-compose.override.example.yml docker-compose.override.yml
  • Override file is gitignored — user's local config, never committed

Documentation

  • README updated with HTTP Docker deployment instructions
  • Explains override pattern, health check, and configuration

Files Changed (12 files, +580 / -109)

File Change
src/http-handler.ts New — Extracted HTTP handler with createHttpHandler() factory
src/http-handler.test.ts New — 8 TDD unit tests
src/main.ts Simplified — imports extracted handler
src/services/hooks.service.ts Minor — hooks start on client initialized (HTTP mode)
Dockerfile Added EXPOSE, HEALTHCHECK via docker-healthcheck.js
Dockerfile.alpine Same as slim variant
docker-healthcheck.js New — Readable health check script
docker-compose.yml Simplified — single service, stdio only
docker-compose.override.example.yml New — HTTP override template
server.json Added streamable-http transport package entry
README.md HTTP Docker deployment docs
.gitignore Added .sisyphus/ and docker-compose.override.yml

Testing

  • pnpm test166 tests pass (158 existing + 8 new)
  • Docker container: healthy, /health returns 200, MCP handshake verified
  • Full MCP protocol tested: initializenotifications/initializedtools/list returns 47+ tools
  • Tested on Tailscale/WireGuard interface (100.108.41.111:15002)

Breaking Changes

None. Default behavior (stdio transport) is unchanged.

Notes

  • No new dependencies added
  • No SSE transport implementation — Streamable HTTP only
  • No auth, CORS, TLS, or reverse proxy configuration
  • docker-compose.override.yml is gitignored by design (user-specific)

gthieleb added 2 commits May 19, 2026 15:46
Extract HTTP handler from main.ts into testable module (src/http-handler.ts)
Add 8 TDD unit tests for HTTP transport layer (src/http-handler.test.ts)
Update both Dockerfiles: EXPOSE 8080, Node-based HEALTHCHECK, suppress lefthook
Rewrite docker-compose.yml with stdio/http profiles, fix stdin_open and volume path bugs
Add streamable-http transport entry to server.json
Update README with HTTP Docker deployment documentation
- Replace profiles with docker-compose.override.yml pattern
- Default is stdio (docker compose up just works)
- HTTP via: cp docker-compose.override.example.yml docker-compose.override.yml
- Bind HTTP to 127.0.0.1 only (not 0.0.0.0)
- Extract healthcheck into docker-healthcheck.js (readable, no oneliner)
- Update README: document HTTP mode, override pattern
- Add docker-compose.override.yml to .gitignore
@gthieleb

gthieleb commented Jun 6, 2026

Copy link
Copy Markdown
Author

Reopened this PR against the more actively maintained fork: wgs4/email-mcp#16

No changes to the implementation — just rebased onto wgs4/main which includes additional bug fixes and features (attachment support, search improvements, cross-account move). All 389 tests pass.

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