Date: 2026-01-21 Status: NEW architecture implemented, enhancements planned
| Aspect | OLD Version | NEW Version |
|---|---|---|
| Purpose | Stateless mental models lookup | Stateful sessions + observability |
| Storage | None (ephemeral) | Redis (cache) + D1 (persistent) |
| Observability | None | Full stack (logs, metrics, traces) |
| Complexity | ~500 LOC | ~2,000+ LOC |
| Deployment | stdio only | stdio + potential HTTP/SSE |
| State | None | Session + History tracking |
βββββββββββββββββββββββββββββββββββββββ
β MCP Client (Claude) β
βββββββββββββββββββ¬ββββββββββββββββββββ
β stdio
βΌ
βββββββββββββββββββββββββββββββββββββββ
β HUMMBL MCP Server β
β βββββββββββββββββββββββββββββββββ β
β β Tools Layer (6 tools) β β
β βββββββββββββββββββββββββββββββββ€ β
β β Resources (3 URIs) β β
β βββββββββββββββββββββββββββββββββ€ β
β β Base120 Framework (data) β β
β βββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββ
Characteristics:
- β Simple, fast, reliable
- β Perfect for read-only mental models
- β No state persistence
- β No usage tracking
- β Can't build on previous interactions
βββββββββββββββββββββββββββββββββββββββ
β MCP Client (Claude) β
βββββββββββββββββββ¬ββββββββββββββββββββ
β stdio
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β HUMMBL MCP Server β
β βββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Tools Layer (6 + new) β β
β β β’ get_model β β
β β β’ search_models β β
β β β’ recommend_models β β
β β β’ [future: guided workflows] β β
β βββββββββββββββββββββββββββββββββββββββββββββββββ β
β β β
β ββββββββββββββββββββββββββ΄βββββββββββββββββββββββ β
β β Storage Layer β β
β β ββββββββββββββββ ββββββββββββββββ β β
β β β Session Mgr β β History Mgr β β β
β β ββββββββ¬ββββββββ ββββββββ¬ββββββββ β β
β β β β β β
β β ββββββββΌββββββββ ββββββββΌββββββββ β β
β β β Redis Client β β D1 Client β β β
β β β (cache) β β (durable) β β β
β β ββββββββββββββββ ββββββββββββββββ β β
β βββββββββββββββββββββββββββββββββββββββββββββββββ β
β β β
β ββββββββββββββββββββββββββ΄βββββββββββββββββββββββ β
β β Observability Layer β β
β β ββββββββββ βββββββββββ ββββββββββββ β β
β β β Logger β β Metrics β β Tracing β β β
β β β(struct)β β(Prom) β β (OTEL) β β β
β β ββββββββββ βββββββββββ ββββββββββββ β β
β βββββββββββββββββββββββββββββββββββββββββββββββββ β
β β β
β ββββββββββββββββββββββββββ΄βββββββββββββββββββββββ β
β β Base120 Framework β β
β β (120 Mental Models) β β
β βββββββββββββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β
βΌ βΌ
ββββββββββββ ββββββββββββββ
β Redis β β Cloudflare β
β Cache β β D1 β
ββββββββββββ ββββββββββββββ
Characteristics:
- β All benefits of OLD version
- β State persistence across conversations
- β Multi-turn workflows possible
- β Production observability (logs, metrics, traces)
- β Usage analytics capability
- β Scalable architecture (cache + database)
// 6 basic tools, no state
- get_model(code)
- list_all_models(filter?)
- search_models(query)
- recommend_models(problem)
- get_transformation(key)
- search_problem_patterns(query)// Same 6 tools + infrastructure for stateful tools
- [All above tools] β
- [PLANNED] apply_guided_workflow(problem, type)
- [PLANNED] get_my_usage_stats(period)β None - fully stateless
β
SessionManager
- Redis cache (hot data, 24h TTL)
- D1 database (cold storage, permanent)
- Session versioning (optimistic locking)
- Activity tracking
β
HistoryManager
- Message history per session
- Conversation context preservation
- Replay capabilitiesStorage Flow:
Request β SessionManager.get(sessionId)
β
Redis Check
βββ HIT β return from Redis
βββ MISS β fetch from D1 β cache in Redis
Update β SessionManager.update(session)
β
Write to Redis (immediate)
β
Write to D1 (async, durable)
β None - no visibility into usage
β
Logger (src/observability/logger.ts)
- Structured JSON logs
- Contextual data (userId, sessionId)
- Log levels (debug, info, warn, error)
- Timer decorators for performance
β
Metrics (src/observability/metrics.ts)
- Counter: session create/get/update counts
- Gauge: active sessions
- Histogram: operation durations
- Cache hit/miss rates
β
Tracing (src/observability/tracing.ts)
- OpenTelemetry instrumentation
- Span creation with @trace decorator
- Distributed tracing ready
- Performance profilingMetrics Available:
- session_create_total
- session_create_duration_seconds
- cache_hit_total / cache_miss_total
- active_sessions_count
- d1_write_total / d1_read_total// Basic types only
- MentalModel
- Transformation
- ProblemPattern
- Result<T, E>// Enhanced type coverage
- [All OLD types] β
- Session (with metadata)
- SessionMetadata (tracking)
- DomainState (flexible state)
- Message (conversation history)
- MessageRole (user/assistant/system)src/
βββ index.ts (80 LOC)
βββ server.ts (27 LOC)
βββ framework/
β βββ base120.ts (~1500 LOC - data)
βββ tools/
β βββ models.ts (405 LOC)
βββ resources/
β βββ models.ts (109 LOC)
βββ types/
β βββ domain.ts (70 LOC)
βββ utils/
βββ result.ts (25 LOC)
Total: ~2,200 LOC (mostly data)
src/
βββ index.ts (26 LOC)
βββ server.ts (27 LOC)
βββ framework/
β βββ base120.ts (~1500 LOC - data)
βββ tools/
β βββ models.ts (405 LOC)
βββ resources/
β βββ models.ts (109 LOC)
βββ storage/ β NEW
β βββ session-manager.ts (350 LOC)
β βββ history-manager.ts (280 LOC)
β βββ redis-client.ts (100 LOC)
β βββ d1-client.ts (120 LOC)
βββ observability/ β NEW
β βββ logger.ts (180 LOC)
β βββ metrics.ts (200 LOC)
β βββ tracing.ts (180 LOC)
βββ types/
β βββ domain.ts (70 LOC)
β βββ session.ts β NEW (80 LOC)
β βββ message.ts β NEW (60 LOC)
βββ utils/
βββ result.ts (25 LOC)
βββ sanitize.ts β NEW (120 LOC)
Total: ~3,800 LOC (+73% code, infrastructure)
| Operation | OLD | NEW (Cache Hit) | NEW (Cache Miss) |
|---|---|---|---|
| Get Model | ~2ms | ~2ms | ~2ms |
| Search | ~5ms | ~5ms | ~5ms |
| Create Session | N/A | ~15ms (Redis) | ~50ms (Redis+D1) |
| Get Session | N/A | ~3ms (Redis) | ~20ms (D1) |
| Update Session | N/A | ~8ms (Redis) | ~30ms (Redis+D1) |
Memory:
- OLD: ~10MB (data only)
- NEW: ~15MB (data + Redis client + OTEL)
# No breaking changes - NEW is backward compatible
npm install @hummbl/mcp-server@latest
# Optional: Enable storage (requires env vars)
REDIS_URL=redis://localhost:6379
D1_DATABASE_ID=your-d1-id
# Optional: Enable observability
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318- NEW version works exactly like OLD (stateless mode)
- Storage only activates when Redis URL is configured
- Zero performance penalty if not used
- β Simple mental model lookup
- β One-off queries
- β No need for history
- β Minimal dependencies
- β Learning/experimentation
- β Multi-turn problem solving
- β Guided workflows
- β Usage analytics needed
- β Production deployment
- β Team/organization rollout
- β Continuous improvement based on data
With the NEW architecture, we can now build:
-
Guided Workflows β¨
- Multi-step problem solving
- Session-based state tracking
- Resume interrupted analysis
-
User Analytics π
- Which models are most useful
- Common problem patterns
- Workflow success rates
-
Personalization π―
- Recommend models based on user history
- Adapt to user expertise level
- Custom workflow templates
-
Collaboration π€
- Share analysis sessions
- Team-wide usage patterns
- Organizational learning
-
Production Operations π
- Monitor health and performance
- Debug issues with traces
- Scale based on metrics
The NEW version is backward compatible but adds a production-grade foundation for:
- State persistence
- Multi-turn interactions
- Usage analytics
- Operational visibility
The mental models are the same. The capabilities are vastly expanded.
Ready for enhancement implementation. See ENHANCEMENT_PLAN.md for next steps.