deepthinking-mcp 3.0.0 → 3.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,10 +1,10 @@
1
- # DeepThinking MCP v2.5
1
+ # DeepThinking MCP v3.0.2
2
2
 
3
- A comprehensive Model Context Protocol (MCP) server featuring **13 advanced reasoning modes** with intelligent mode recommendation and visual export capabilities for complex problem-solving, analysis, and decision-making.
3
+ A comprehensive Model Context Protocol (MCP) server featuring **13 advanced reasoning modes** with intelligent mode recommendation, visual export capabilities, high-performance validation caching, comprehensive testing, and automated CI/CD for complex problem-solving, analysis, and decision-making.
4
4
 
5
5
  ## Overview
6
6
 
7
- DeepThinking MCP v2.5 provides a complete toolkit for structured reasoning with 13 specialized modes, an intelligent recommendation system, and powerful visual export capabilities:
7
+ DeepThinking MCP v3.0 provides a complete toolkit for structured reasoning with 13 specialized modes, an intelligent recommendation system, powerful visual export capabilities, and optimized performance through validation caching:
8
8
 
9
9
  ### Core Modes
10
10
  - **Sequential**: Iterative refinement with revision capabilities
@@ -73,6 +73,23 @@ n#### Phase 3 Reasoning Modes (v2.3+)
73
73
  - **Problem Characteristics Analysis**: Analyzes domain, complexity, uncertainty, time-dependence, and more
74
74
  - **Ranked Recommendations**: Returns modes sorted by suitability score with detailed reasoning
75
75
 
76
+ ### Performance & Optimization (v3.0)
77
+ - **Validation Caching**: LRU cache with content-based hashing for validation results
78
+ - **1.4-17x speedup** for repeated validations (typically 4-5x in realistic workloads)
79
+ - **O(1) lookup complexity** regardless of cache size
80
+ - **95%+ hit rates** in typical usage patterns
81
+ - Configurable cache size (default: 1000 entries)
82
+ - Automatic cache statistics tracking in session metrics
83
+ - **Modular Validator Architecture**: Clean separation of concerns with mode-specific validators
84
+ - **Session Metrics**: Comprehensive performance tracking including cache statistics
85
+
86
+ ### Configuration Options
87
+ ```javascript
88
+ // Environment variables for performance tuning
89
+ MCP_ENABLE_VALIDATION_CACHE=true // Enable/disable caching (default: true)
90
+ MCP_VALIDATION_CACHE_SIZE=1000 // Max cache entries (default: 1000)
91
+ ```
92
+
76
93
  ## Installation
77
94
 
78
95
  ```bash
@@ -618,6 +635,87 @@ npm test
618
635
  npm run typecheck
619
636
  ```
620
637
 
638
+ ### Testing & CI/CD
639
+
640
+ #### Comprehensive Test Suite (v3.0.2)
641
+
642
+ DeepThinking MCP includes **397 tests** across **24 test files** with **100% pass rate**:
643
+
644
+ - **Unit Tests**: Core functionality, validators, session management
645
+ - **Integration Tests (94 tests)**: MCP protocol compliance, multi-session scenarios, error handling
646
+ - **Benchmark Tests**: Performance validation (15x speedup with caching)
647
+ - **Mode-Specific Tests**: All 13 reasoning modes thoroughly tested
648
+
649
+ **Test Coverage:**
650
+ ```bash
651
+ # Run full test suite
652
+ npm test
653
+
654
+ # Run with coverage report
655
+ npm run test:coverage
656
+
657
+ # Run specific test file
658
+ npm test -- tests/integration/mcp-protocol.test.ts
659
+ ```
660
+
661
+ **Test Results:**
662
+ - Test Files: 24 passed
663
+ - Tests: 397 passed
664
+ - Duration: ~7-8 seconds
665
+ - Pass Rate: 100%
666
+
667
+ #### CI/CD Pipeline
668
+
669
+ Automated workflows using GitHub Actions ensure code quality and reliability:
670
+
671
+ **Test Workflow** (`.github/workflows/test.yml`):
672
+ - Multi-OS testing: Ubuntu, Windows, macOS
673
+ - Multi-Node version: 18.x, 20.x, 22.x
674
+ - Runs: TypeScript checks, linter, formatter, full test suite
675
+ - Test result artifacts with 30-day retention
676
+
677
+ **Coverage Workflow** (`.github/workflows/coverage.yml`):
678
+ - Generates detailed coverage reports
679
+ - Codecov integration for coverage tracking
680
+ - PR comments with coverage summary
681
+ - Coverage badge generation
682
+ - Threshold warnings (<60% triggers warning)
683
+
684
+ **Release Workflow** (`.github/workflows/release.yml`):
685
+ - Automated releases on version tags (v*.*.*)
686
+ - Pre-release testing (type check + full test suite)
687
+ - GitHub release creation with changelog
688
+ - npm publishing (requires NPM_TOKEN)
689
+ - Workflow dispatch for manual releases
690
+
691
+ **Branch Protection:**
692
+ See `.github/BRANCH_PROTECTION.md` for recommended settings:
693
+ - Required status checks before merging
694
+ - PR review requirements
695
+ - Linear history enforcement
696
+ - Force push protection
697
+
698
+ #### Integration Tests
699
+
700
+ **MCP Protocol Compliance** (43 tests):
701
+ - Tool schema validation for all 13 modes
702
+ - Required/optional field validation
703
+ - MCP response format compliance
704
+ - Error handling for invalid inputs
705
+
706
+ **Multi-Session Scenarios** (18 tests):
707
+ - Session isolation and concurrent operations
708
+ - Resource management (50+ sessions)
709
+ - State consistency verification
710
+ - Concurrent error handling
711
+
712
+ **Error Handling & Edge Cases** (36 tests):
713
+ - Invalid session operations
714
+ - Boundary conditions (0, 1, MAX_SAFE_INTEGER)
715
+ - Large data handling (100 thoughts, 50 dependencies)
716
+ - Unicode and special character support
717
+ - Mode-specific edge cases
718
+
621
719
  ## Architecture
622
720
 
623
721
  ```
@@ -650,21 +748,38 @@ deepthinking-mcp/
650
748
  - ✅ Comprehensive test suite (77 tests)
651
749
  - ✅ Enhanced type safety
652
750
 
653
- ### Phase 3 (In Progress)
751
+ ### Phase 3 (Completed - v3.0.2)
654
752
  - ✅ Temporal reasoning mode (v2.1)
655
753
  - ✅ Game theory mode (v2.2)
656
754
  - ✅ Evidential reasoning mode (v2.3)
657
755
  - ✅ Mode recommendation system (v2.4)
658
756
  - ✅ Visual exports - Mermaid, DOT, ASCII (v2.5)
659
757
  - ✅ Export to LaTeX/Jupyter/HTML (v2.5)
758
+ - ✅ Performance optimization with validation caching (v3.0)
759
+ - ✅ Integration tests & MCP compliance (v3.0.2)
760
+ - ✅ CI/CD pipeline with GitHub Actions (v3.0.2)
761
+
762
+ ### Phase 4 (Planned)
660
763
  - [ ] Math-MCP integration
661
764
  - [ ] Persistence layer
662
765
  - [ ] Collaborative thinking sessions
663
766
  - [ ] Pattern learning from successful reasoning chains
767
+ - [ ] Advanced visualization dashboard
768
+ - [ ] Real-time reasoning collaboration
664
769
 
665
770
  ## Contributing
666
771
 
667
- Contributions welcome! Please read our contributing guidelines and submit PRs.
772
+ Contributions welcome! Please ensure:
773
+
774
+ 1. **All tests pass**: Run `npm test` before submitting PRs
775
+ 2. **Type checking passes**: Run `npm run typecheck`
776
+ 3. **Code formatting**: Run `npm run format:check` or `npm run format`
777
+ 4. **Linting passes**: Run `npm run lint`
778
+ 5. **CI/CD workflows pass**: All GitHub Actions checks must pass
779
+ 6. **Test coverage**: Maintain or improve test coverage
780
+ 7. **Documentation**: Update README.md and CHANGELOG.md for new features
781
+
782
+ See `.github/BRANCH_PROTECTION.md` for branch protection requirements and `.github/workflows/` for CI/CD pipeline details.
668
783
 
669
784
  ## License
670
785
 
package/dist/index.js CHANGED
@@ -847,19 +847,15 @@ Choose the mode that best fits your problem type, or use recommend_mode to get i
847
847
  }
848
848
  };
849
849
 
850
- // src/types/modes/temporal.ts
850
+ // src/types/core.ts
851
851
  function isTemporalThought(thought) {
852
- return thought.mode === "temporal";
852
+ return thought.mode === "temporal" /* TEMPORAL */;
853
853
  }
854
-
855
- // src/types/modes/gametheory.ts
856
854
  function isGameTheoryThought(thought) {
857
- return thought.mode === "gametheory";
855
+ return thought.mode === "gametheory" /* GAMETHEORY */;
858
856
  }
859
-
860
- // src/types/modes/evidential.ts
861
857
  function isEvidentialThought(thought) {
862
- return thought.mode === "evidential";
858
+ return thought.mode === "evidential" /* EVIDENTIAL */;
863
859
  }
864
860
 
865
861
  // src/types/modes/recommendations.ts
@@ -1113,15 +1109,9 @@ var DeepThinkingError = class extends Error {
1113
1109
  };
1114
1110
  }
1115
1111
  };
1116
- var SessionError = class extends DeepThinkingError {
1117
- constructor(message, context) {
1118
- super(message, "SESSION_ERROR", context);
1119
- }
1120
- };
1121
- var SessionNotFoundError = class extends SessionError {
1112
+ var SessionNotFoundError = class extends DeepThinkingError {
1122
1113
  constructor(sessionId) {
1123
- super(`Session not found: ${sessionId}`, { sessionId });
1124
- this.code = "SESSION_NOT_FOUND";
1114
+ super(`Session not found: ${sessionId}`, "SESSION_NOT_FOUND", { sessionId });
1125
1115
  }
1126
1116
  };
1127
1117
 
@@ -1613,7 +1603,7 @@ var SessionManager = class {
1613
1603
  let session = this.activeSessions.get(sessionId);
1614
1604
  if (!session && this.storage) {
1615
1605
  try {
1616
- session = await this.storage.loadSession(sessionId);
1606
+ session = await this.storage.loadSession(sessionId) ?? void 0;
1617
1607
  if (session) {
1618
1608
  this.activeSessions.set(sessionId, session);
1619
1609
  this.logger.debug("Session loaded from storage", { sessionId });
@@ -1911,7 +1901,7 @@ var SessionManager = class {
1911
1901
  updateMetrics(session, thought) {
1912
1902
  const metrics = session.metrics;
1913
1903
  metrics.totalThoughts = session.thoughts.length;
1914
- const thoughtType = thought.type || "unknown";
1904
+ const thoughtType = thought.mode || "unknown";
1915
1905
  metrics.thoughtsByType[thoughtType] = (metrics.thoughtsByType[thoughtType] || 0) + 1;
1916
1906
  if (thought.isRevision) {
1917
1907
  metrics.revisionCount++;
@@ -1921,9 +1911,11 @@ var SessionManager = class {
1921
1911
  const uncertaintyValue = thought.uncertainty;
1922
1912
  const currentSum = metrics._uncertaintySum || 0;
1923
1913
  const currentCount = metrics._uncertaintyCount || 0;
1924
- metrics._uncertaintySum = currentSum + uncertaintyValue;
1925
- metrics._uncertaintyCount = currentCount + 1;
1926
- metrics.averageUncertainty = metrics._uncertaintySum / metrics._uncertaintyCount;
1914
+ const newSum = currentSum + uncertaintyValue;
1915
+ const newCount = currentCount + 1;
1916
+ metrics._uncertaintySum = newSum;
1917
+ metrics._uncertaintyCount = newCount;
1918
+ metrics.averageUncertainty = newSum / newCount;
1927
1919
  }
1928
1920
  if ("dependencies" in thought && thought.dependencies) {
1929
1921
  const deps = thought.dependencies;
@@ -2269,7 +2261,7 @@ var VisualExporter = class {
2269
2261
  return ascii;
2270
2262
  }
2271
2263
  // ===== Game Theory Exporters =====
2272
- gameTreeToMermaid(thought, colorScheme, includeLabels, includeMetrics) {
2264
+ gameTreeToMermaid(thought, _colorScheme, includeLabels, includeMetrics) {
2273
2265
  let mermaid = "graph TD\n";
2274
2266
  if (!thought.game) {
2275
2267
  return mermaid + " root[No game defined]\n";
@@ -2277,8 +2269,8 @@ var VisualExporter = class {
2277
2269
  if (thought.gameTree && thought.gameTree.nodes) {
2278
2270
  for (const node of thought.gameTree.nodes) {
2279
2271
  const nodeId = this.sanitizeId(node.id);
2280
- const label = includeLabels ? node.name : nodeId;
2281
- const shape = node.isTerminal ? ["[[", "]]"] : ["[", "]"];
2272
+ const label = includeLabels ? node.action || node.id : nodeId;
2273
+ const shape = node.type === "terminal" ? ["[[", "]]"] : ["[", "]"];
2282
2274
  mermaid += ` ${nodeId}${shape[0]}${label}${shape[1]}
2283
2275
  `;
2284
2276
  }
@@ -2322,8 +2314,8 @@ var VisualExporter = class {
2322
2314
  if (thought.gameTree && thought.gameTree.nodes) {
2323
2315
  for (const node of thought.gameTree.nodes) {
2324
2316
  const nodeId = this.sanitizeId(node.id);
2325
- const label = includeLabels ? node.name : nodeId;
2326
- const shape = node.isTerminal ? "doublecircle" : "circle";
2317
+ const label = includeLabels ? node.action || node.id : nodeId;
2318
+ const shape = node.type === "terminal" ? "doublecircle" : "circle";
2327
2319
  dot += ` ${nodeId} [label="${label}", shape=${shape}];
2328
2320
  `;
2329
2321
  }
@@ -2355,13 +2347,14 @@ var VisualExporter = class {
2355
2347
  if (thought.strategies && thought.strategies.length > 0) {
2356
2348
  ascii += "Strategies:\n";
2357
2349
  for (const strategy of thought.strategies) {
2358
- ascii += ` \u2022 ${strategy.name} (${strategy.type})
2350
+ const strategyType = strategy.isPure ? "Pure" : "Mixed";
2351
+ ascii += ` \u2022 ${strategy.name} (${strategyType})
2359
2352
  `;
2360
2353
  }
2361
2354
  }
2362
- if (thought.equilibria && thought.equilibria.length > 0) {
2355
+ if (thought.nashEquilibria && thought.nashEquilibria.length > 0) {
2363
2356
  ascii += "\nEquilibria:\n";
2364
- for (const eq of thought.equilibria) {
2357
+ for (const eq of thought.nashEquilibria) {
2365
2358
  ascii += ` \u2696 ${eq.type}: ${eq.strategyProfile.join(", ")}
2366
2359
  `;
2367
2360
  ascii += ` Payoffs: [${eq.payoffs.join(", ")}]
@@ -2371,7 +2364,7 @@ var VisualExporter = class {
2371
2364
  return ascii;
2372
2365
  }
2373
2366
  // ===== Bayesian Network Exporters =====
2374
- bayesianToMermaid(thought, colorScheme, includeLabels, includeMetrics) {
2367
+ bayesianToMermaid(thought, colorScheme, _includeLabels, includeMetrics) {
2375
2368
  let mermaid = "graph LR\n";
2376
2369
  mermaid += ` H([Hypothesis])
2377
2370
  `;
@@ -2396,7 +2389,7 @@ var VisualExporter = class {
2396
2389
  }
2397
2390
  return mermaid;
2398
2391
  }
2399
- bayesianToDOT(thought, includeLabels, includeMetrics) {
2392
+ bayesianToDOT(thought, _includeLabels, includeMetrics) {
2400
2393
  let dot = "digraph BayesianNetwork {\n";
2401
2394
  dot += " rankdir=LR;\n";
2402
2395
  dot += " node [shape=ellipse];\n\n";
@@ -2431,14 +2424,14 @@ var VisualExporter = class {
2431
2424
  if (thought.evidence && thought.evidence.length > 0) {
2432
2425
  ascii += "Evidence:\n";
2433
2426
  for (const ev of thought.evidence) {
2434
- ascii += ` \u2022 ${ev.observation}
2427
+ ascii += ` \u2022 ${ev.description}
2435
2428
  `;
2436
2429
  }
2437
2430
  ascii += "\n";
2438
2431
  }
2439
2432
  ascii += `Posterior Probability: ${thought.posterior.probability.toFixed(3)}
2440
2433
  `;
2441
- ascii += ` Justification: ${thought.posterior.justification}
2434
+ ascii += ` Calculation: ${thought.posterior.calculation}
2442
2435
  `;
2443
2436
  if (thought.bayesFactor !== void 0) {
2444
2437
  ascii += `