deepthinking-mcp 3.0.2 → 3.5.0

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,798 +1,641 @@
1
- # DeepThinking MCP v3.0.2
2
-
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
-
5
- ## Overview
6
-
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
-
9
- ### Core Modes
10
- - **Sequential**: Iterative refinement with revision capabilities
11
- - **Shannon**: 5-stage systematic problem-solving methodology
12
- - **Mathematics**: Theorem proving and symbolic computation
13
- - **Physics**: Tensor mathematics and field theory
14
- - **Hybrid**: Intelligently combines multiple approaches
15
-
16
- ### Advanced Modes (v2.0)
17
- - **Abductive**: Inference to the best explanation, hypothesis generation and evaluation
18
- - **Causal**: Cause-effect analysis with causal graphs and interventions
19
- - **Bayesian**: Probabilistic reasoning with evidence updates
20
- - **Counterfactual**: What-if scenario analysis and alternative histories
21
- - **Analogical**: Cross-domain pattern matching and knowledge transfer
22
- n### Phase 3 Modes (v2.3+)
23
- - **Temporal**: Event timelines, temporal constraints, Allen's interval algebra, causal relations over time
24
- - **Game Theory**: Nash equilibria, strategic analysis, payoff matrices, dominant strategies, game trees
25
- - **Evidential**: Dempster-Shafer theory, belief functions, evidence combination, uncertainty intervals
26
-
27
- ## Features
28
-
29
- ### 13 Specialized Reasoning Modes
30
-
31
- #### Core Modes
32
- - **Sequential**: Iterative refinement with revision capabilities and branching
33
- - **Shannon**: Systematic 5-stage problem-solving (problem definition constraints model proof → implementation)
34
- - **Mathematics**: Theorem proving, lemma derivation, symbolic computation
35
- - **Physics**: Tensor formulation, dimensional analysis, conservation laws
36
- - **Hybrid**: Intelligently combines modes based on problem characteristics
37
-
38
- #### Advanced Reasoning Modes (v2.0)
39
- - **Abductive**: Generate and evaluate hypotheses to explain observations. Perfect for debugging, root cause analysis, and diagnostic reasoning.
40
- - **Causal**: Build causal graphs with nodes and edges, analyze interventions and their effects. Ideal for impact analysis and system design.
41
- - **Bayesian**: Update beliefs using probabilistic reasoning with priors, likelihoods, and evidence. Essential for risk assessment and A/B testing.
42
- - **Counterfactual**: Explore alternative scenarios and compare outcomes. Excellent for post-mortems and strategic planning.
43
- - **Analogical**: Transfer knowledge across domains by identifying structural similarities. Great for design patterns and innovative problem-solving.
44
- n#### Phase 3 Reasoning Modes (v2.3+)
45
- - **Temporal**: Model events, intervals, and temporal relationships using Allen's interval algebra. Track causality over time with timestamps, durations, and temporal constraints. Perfect for timeline analysis, scheduling problems, and understanding event sequences.
46
- - **Game Theory**: Analyze strategic interactions between rational agents. Define games, players, and strategies. Compute Nash equilibria (pure and mixed), identify dominant strategies, construct payoff matrices, and build extensive-form game trees. Ideal for competitive analysis, mechanism design, and strategic decision-making.
47
- - **Evidential**: Apply Dempster-Shafer theory for reasoning with uncertain and incomplete evidence. Define hypotheses, collect evidence with reliability scores, assign belief functions with mass assignments, combine evidence using Dempster's rule, compute belief and plausibility intervals, and make decisions under uncertainty. Ideal for sensor fusion, diagnostic reasoning, intelligence analysis, and situations with incomplete information.
48
-
49
- ### Mathematical Enhancements
50
- - **Symbolic computation** support with LaTeX and symbolic formats
51
- - **Theorem and proof** structures
52
- - **Lemma derivation** and corollary tracking
53
- - **Algebraic manipulation** and numerical analysis
54
- - **Logical form** with premises, conclusions, and inference rules
55
-
56
- ### Physics Capabilities
57
- - **Tensor mathematics** with rank, symmetries, and invariants
58
- - **Dimensional analysis** for unit consistency
59
- - **Conservation law** verification
60
- - **Field theory** context (Lagrangian, Hamiltonian, gauge symmetries)
61
- - **Physical interpretation** with units and observables
62
-
63
- ### Session Management
64
- - Persistent thinking sessions
65
- - Automatic metrics tracking
66
- - Mode switching during problem-solving
67
- - Export to multiple formats (Markdown, LaTeX, JSON)
68
-
69
- ### Mode Recommendation System (v2.4)
70
- - **Intelligent Mode Selection**: Automatically recommends the best reasoning modes based on problem characteristics
71
- - **Combination Suggestions**: Identifies synergistic mode combinations for complex problems
72
- - **Quick Recommendations**: Simple problem-type based recommendations
73
- - **Problem Characteristics Analysis**: Analyzes domain, complexity, uncertainty, time-dependence, and more
74
- - **Ranked Recommendations**: Returns modes sorted by suitability score with detailed reasoning
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
-
93
- ## Installation
94
-
95
- ```bash
96
- npm install deepthinking-mcp
97
- ```
98
-
99
- ## Configuration
100
-
101
- Add to your Claude Desktop config (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS or `%APPDATA%\Claude\claude_desktop_config.json` on Windows):
102
-
103
- ```json
104
- {
105
- "mcpServers": {
106
- "deepthinking": {
107
- "command": "npx",
108
- "args": ["-y", "deepthinking-mcp"]
109
- }
110
- }
111
- }
112
- ```
113
-
114
- ## Usage
115
-
116
- ### Basic Sequential Thinking
117
-
118
- ```
119
- Use the deepthinking tool to help me think through this step by step...
120
- ```
121
-
122
- The tool will automatically create a session and track your thoughts.
123
-
124
- ### Mathematical Reasoning
125
-
126
- ```
127
- Use deepthinking in mathematics mode to prove the Pythagorean theorem...
128
- ```
129
-
130
- ### Physics Problems
131
-
132
- ```
133
- Use deepthinking in physics mode to derive the electromagnetic tensor formulation...
134
- ```
135
-
136
- ### Hybrid Mode (Default)
137
-
138
- ```
139
- Use deepthinking to solve this complex problem...
140
- ```
141
-
142
- The hybrid mode automatically selects the best features from each mode.
143
-
144
- ### Mode Recommendations (v2.4)
145
-
146
- The recommendation system helps you choose the best reasoning mode for your problem:
147
-
148
- ```
149
- What mode should I use for debugging this application?
150
- ```
151
-
152
- Returns: **Abductive mode** - Perfect for hypothesis generation and root cause analysis.
153
-
154
- ```
155
- I need to analyze a competitive business scenario with multiple players. What modes should I use?
156
- ```
157
-
158
- Returns: **Game Theory mode** for strategic analysis, potentially combined with **Counterfactual mode** for scenario exploration.
159
-
160
- #### Problem Characteristics
161
-
162
- The recommender analyzes:
163
- - **Domain**: General, mathematics, physics, engineering, etc.
164
- - **Complexity**: Low, medium, or high
165
- - **Uncertainty**: How much unknown information exists
166
- - **Time-dependent**: Whether events occur over time
167
- - **Multi-agent**: Whether multiple actors interact strategically
168
- - **Requires proof**: Whether formal mathematical proof is needed
169
- - **Requires quantification**: Whether probabilities or measurements are needed
170
- - **Incomplete information**: Whether data gaps exist
171
- - **Requires explanation**: Whether understanding "why" is important
172
- - **Has alternatives**: Whether alternative scenarios should be explored
173
-
174
- #### Quick Recommendations
175
-
176
- For simple cases, use problem-type keywords:
177
- - `debugging` → Abductive mode
178
- - `proof` → Mathematics mode
179
- - `timeline` Temporal mode
180
- - `strategy` → Game Theory mode
181
- - `uncertainty` → Evidential mode
182
- - `causality` → Causal mode
183
- - `probability` Bayesian mode
184
- - `what-if` → Counterfactual mode
185
-
186
- ### Visual Exports (v2.5)
187
-
188
- Export your reasoning sessions as visual diagrams in multiple formats for presentation, documentation, and analysis:
189
-
190
- #### Supported Formats
191
- - **Mermaid**: Flowcharts, Gantt charts, and graphs (compatible with GitHub, Markdown renderers, and documentation tools)
192
- - **DOT**: Graphviz format for professional graph visualization and publication-quality diagrams
193
- - **ASCII**: Plain text diagrams for terminal output, logs, and text-based documentation
194
-
195
- #### Supported Modes
196
- - **Causal Mode**: Export causal graphs showing cause-effect relationships with node types (causes, effects, mediators, confounders) and edge strengths
197
- - **Temporal Mode**: Export timelines as Gantt charts showing events, intervals, and temporal relationships
198
- - **Game Theory Mode**: Export game trees with strategies, decision nodes, and payoffs
199
- - **Bayesian Mode**: Export Bayesian networks showing prior/posterior relationships and evidence flow
200
-
201
- #### Visual Export Examples
202
-
203
- **Causal Graph to Mermaid:**
204
- ```json
205
- {
206
- "action": "export",
207
- "sessionId": "session-id",
208
- "exportFormat": "mermaid"
209
- }
210
- ```
211
-
212
- Returns a Mermaid diagram:
213
- ```mermaid
214
- graph TB
215
- marketing([Marketing Budget])
216
- awareness[Brand Awareness]
217
- revenue[[Revenue]]
218
-
219
- marketing --> |0.80| awareness
220
- awareness --> |0.90| revenue
221
-
222
- style marketing fill:#a8d5ff
223
- style revenue fill:#ffb3b3
224
- ```
225
-
226
- **Temporal Timeline to ASCII:**
227
- ```json
228
- {
229
- "action": "export",
230
- "sessionId": "session-id",
231
- "exportFormat": "ascii"
232
- }
233
- ```
234
-
235
- Returns a text timeline:
236
- ```
237
- Timeline: Project Timeline (days)
238
-
239
- t= 0 ⦿ Project Start
240
- Kickoff meeting
241
-
242
- t= 5 ━ Development (duration: 10 days)
243
- Code implementation
244
-
245
- t= 20 ⦿ Launch
246
- Product release
247
- ```
248
-
249
- **Game Tree to DOT:**
250
- ```json
251
- {
252
- "action": "export",
253
- "sessionId": "session-id",
254
- "exportFormat": "dot"
255
- }
256
- ```
257
-
258
- Returns Graphviz DOT format for rendering with `dot` or graph visualization tools.
259
-
260
- #### Color Schemes
261
- Visual exports support multiple color schemes:
262
- - **default**: Vibrant colors for causes (blue), effects (red), mediators (yellow)
263
- - **pastel**: Soft, pastel colors for presentations
264
- - **monochrome**: No colors for print or accessibility
265
-
266
- #### Integration
267
- Visual exports work seamlessly with:
268
- - GitHub Markdown (Mermaid diagrams render automatically)
269
- - Documentation generators (MkDocs, Docusaurus, etc.)
270
- - Graphviz tools (`dot`, `neato`, `fdp` for DOT format)
271
- - Terminal output (ASCII format)
272
- - Jupyter notebooks (via Mermaid magic)
273
-
274
-
275
- ## Tool Parameters
276
-
277
- ### Core Parameters
278
- - `thought` (string, required): The thought content
279
- - `thoughtNumber` (number, required): Position in sequence
280
- - `totalThoughts` (number, required): Estimated total thoughts needed
281
- - `nextThoughtNeeded` (boolean, required): Whether to continue thinking
282
- - `mode` (string, optional): `sequential`, `shannon`, `mathematics`, `physics`, `hybrid`, `abductive`, `causal`, `bayesian`, `counterfactual`, `analogical`, or `temporal` (default: `hybrid`)
283
-
284
- ### Mode-Specific Parameters
285
-
286
- #### Sequential Mode
287
- - `isRevision`: Whether this revises a previous thought
288
- - `revisesThought`: ID of thought being revised
289
- - `revisionReason`: Why the revision was needed
290
-
291
- #### Shannon Mode
292
- - `stage`: Which Shannon stage (problem_definition, constraints, model, proof, implementation)
293
- - `uncertainty`: Confidence level (0-1)
294
- - `dependencies`: IDs of dependent thoughts
295
- - `assumptions`: Explicit assumptions
296
-
297
- #### Mathematics Mode
298
- - `thoughtType`: Specific type (axiom_definition, theorem_statement, proof_construction, etc.)
299
- - `mathematicalModel`: LaTeX and symbolic representation
300
- - `proofStrategy`: Type and steps of proof
301
- - `logicalForm`: Premises, conclusion, inference rules
302
-
303
- #### Physics Mode
304
- - `thoughtType`: Specific type (tensor_formulation, symmetry_analysis, etc.)
305
- - `tensorProperties`: Rank, components, symmetries, invariants
306
- - `physicalInterpretation`: Quantity, units, conservation laws
307
- - `dimensionalAnalysis`: Unit consistency checking
308
-
309
- #### Abductive Mode
310
- - `observations`: Array of observations requiring explanation (id, description, confidence)
311
- - `hypotheses`: Generated hypotheses with assumptions and predictions
312
- - `evaluationCriteria`: Parsimony, explanatory power, plausibility, testability
313
- - `evidence`: Supporting or contradicting evidence
314
- - `bestExplanation`: Selected hypothesis that best explains observations
315
-
316
- #### Causal Mode
317
- - `causalGraph`: Nodes (causes, effects, mediators) and edges (causal relationships)
318
- - `interventions`: Actions on nodes with expected effects
319
- - `mechanisms`: Direct, indirect, or feedback mechanisms
320
- - `confounders`: Variables affecting multiple nodes
321
-
322
- #### Bayesian Mode
323
- - `hypothesis`: Statement being evaluated
324
- - `prior`: Prior probability with justification
325
- - `likelihood`: P(Evidence|Hypothesis)
326
- - `evidence`: Observations with likelihoods
327
- - `posterior`: Updated belief after seeing evidence
328
- - `bayesFactor`: Strength of evidence (optional)
329
-
330
- #### Counterfactual Mode
331
- - `actual`: The scenario that actually occurred
332
- - `counterfactuals`: Alternative "what if" scenarios
333
- - `interventionPoint`: Where the scenarios diverge
334
- - `comparison`: Differences, insights, and lessons learned
335
- - `causalChains`: Intervention → steps → outcome paths
336
-
337
- #### Analogical Mode
338
- - `sourceDomain`: Known domain with entities and relations
339
- - `targetDomain`: Domain being analyzed
340
- - `mapping`: Entity-to-entity mappings with justifications
341
- - `insights`: Knowledge transferred from source to target
342
- - `inferences`: Predictions based on analogical reasoning
343
- - `limitations`: Where the analogy breaks down
344
- - `analogyStrength`: Overall confidence in the analogy (0-1)
345
- n#### Temporal Mode
346
- - `timeline`: Timeline structure with id, name, timeUnit, events array
347
- - `events`: Temporal events (instant or interval) with timestamps, duration, properties
348
- - `intervals`: Time intervals with start, end, overlaps, contains relationships
349
- - `constraints`: Allen's interval algebra constraints (before, after, during, overlaps, meets, starts, finishes, equals)
350
- - `relations`: Temporal causal relations (causes, enables, prevents, precedes, follows) with strength and delay
351
-
352
- #### Game Theory Mode
353
- - `game`: Game definition (id, name, type, numPlayers, isZeroSum, isPerfectInformation)
354
- - `players`: Player definitions with roles, rationality, available strategies
355
- - `strategies`: Pure or mixed strategies with probabilities
356
- - `payoffMatrix`: Normal-form payoff matrix with strategy profiles and payoffs
357
- - `nashEquilibria`: Nash equilibrium solutions (pure/mixed, strict, stability)
358
- - `dominantStrategies`: Dominant strategy analysis (strictly/weakly dominant)
359
- - `gameTree`: Extensive-form game tree with decision, chance, and terminal nodes
360
-
361
- #### Evidential Mode
362
- - `frameOfDiscernment`: Set of all possible hypotheses being considered
363
- - `hypotheses`: Hypothesis definitions (id, name, description, mutuallyExclusive, subsets)
364
- - `evidence`: Evidence items with source, reliability (0-1), timestamp, supports, contradicts
365
- - `beliefFunctions`: Belief function with mass assignments (hypothesisSet, mass, justification)
366
- - `combinedBelief`: Belief function resulting from Dempster-Shafer combination (includes conflictMass)
367
- - `plausibility`: Plausibility function with belief/plausibility values and uncertainty intervals
368
- - `decisions`: Decision analysis (selectedHypothesis, confidence, reasoning, alternatives)
369
-
370
- ### Actions
371
- - `add_thought` (default): Add a new thought to session
372
- - `summarize`: Generate session summary
373
- - `export`: Export session (requires `exportFormat`)
374
- - `switch_mode`: Change thinking mode (requires `newMode`)
375
- - `get_session`: Get session metadata
376
-
377
- ## Examples
378
-
379
- ### Example 1: Sequential Problem Solving
380
-
381
- ```
382
- Thought 1: "Let me break down this optimization problem..."
383
- - mode: sequential
384
- - thoughtNumber: 1
385
- - nextThoughtNeeded: true
386
-
387
- Thought 2: "Building on my previous thought, I realize..."
388
- - mode: sequential
389
- - thoughtNumber: 2
390
- - buildUpon: [thought1_id]
391
- - nextThoughtNeeded: true
392
-
393
- Thought 3: "Actually, let me revise my first approach..."
394
- - mode: sequential
395
- - isRevision: true
396
- - revisesThought: thought1_id
397
- - revisionReason: "Found a more efficient approach"
398
- ```
399
-
400
- ### Example 2: Mathematical Proof
401
-
402
- ```
403
- Thought 1: "State the theorem: For all right triangles..."
404
- - mode: mathematics
405
- - thoughtType: theorem_statement
406
- - mathematicalModel: { latex: "a^2 + b^2 = c^2", symbolic: "a**2 + b**2 == c**2" }
407
-
408
- Thought 2: "Proof by construction..."
409
- - mode: mathematics
410
- - thoughtType: proof_construction
411
- - proofStrategy: { type: "construction", steps: ["Draw square on each side", ...] }
412
- ```
413
-
414
- ### Example 3: Physics Tensor Analysis
415
-
416
- ```
417
- Thought 1: "Define the electromagnetic field tensor"
418
- - mode: physics
419
- - thoughtType: tensor_formulation
420
- - tensorProperties: {
421
- rank: [2, 0],
422
- components: "F^{μν} = ∂^μ A^ν - ∂^ν A^μ",
423
- latex: "F^{\\mu\\nu}",
424
- symmetries: ["antisymmetric"],
425
- invariants: ["F_{μν}F^{μν}"],
426
- transformation: "contravariant"
427
- }
428
- - physicalInterpretation: {
429
- quantity: "Electromagnetic field strength",
430
- units: "GeV^2",
431
- conservationLaws: ["Energy-momentum", "Charge"]
432
- }
433
- ```
434
-
435
- ### Example 4: Abductive Reasoning (Debugging)
436
-
437
- ```
438
- Thought 1: "System crashes at 3 AM - need to find root cause"
439
- - mode: abductive
440
- - observations: [
441
- { id: "obs1", description: "Crash at 3 AM daily", confidence: 0.95 },
442
- { id: "obs2", description: "Memory usage spikes before crash", confidence: 0.8 }
443
- ]
444
- - hypotheses: [
445
- {
446
- id: "h1",
447
- explanation: "Memory leak in background job",
448
- assumptions: ["Job runs at 3 AM"],
449
- predictions: ["Memory should grow until crash"],
450
- score: 0.85
451
- },
452
- {
453
- id: "h2",
454
- explanation: "External service timeout",
455
- assumptions: ["Service maintenance window at 3 AM"],
456
- predictions: ["Network errors in logs"],
457
- score: 0.6
458
- }
459
- ]
460
- - evaluationCriteria: {
461
- parsimony: 0.7,
462
- explanatoryPower: 0.85,
463
- plausibility: 0.8,
464
- testability: true
465
- }
466
- - bestExplanation: h1
467
- ```
468
-
469
- ### Example 5: Causal Analysis (Impact Assessment)
470
-
471
- ```
472
- Thought 1: "Analyze impact of increasing marketing budget"
473
- - mode: causal
474
- - causalGraph: {
475
- nodes: [
476
- { id: "marketing", name: "Marketing Budget", type: "cause" },
477
- { id: "awareness", name: "Brand Awareness", type: "mediator" },
478
- { id: "leads", name: "Lead Generation", type: "mediator" },
479
- { id: "revenue", name: "Revenue", type: "effect" }
480
- ],
481
- edges: [
482
- { from: "marketing", to: "awareness", strength: 0.8, confidence: 0.9 },
483
- { from: "awareness", to: "leads", strength: 0.7, confidence: 0.85 },
484
- { from: "leads", to: "revenue", strength: 0.9, confidence: 0.95 }
485
- ]
486
- }
487
- - interventions: [
488
- {
489
- nodeId: "marketing",
490
- action: "Increase budget by 20%",
491
- expectedEffects: [
492
- { nodeId: "revenue", expectedChange: "+12%", confidence: 0.7 }
493
- ]
494
- }
495
- ]
496
- ```
497
-
498
- ### Example 6: Bayesian Reasoning (A/B Test Analysis)
499
-
500
- ```
501
- Thought 1: "Evaluate if new feature increases engagement"
502
- - mode: bayesian
503
- - hypothesis: { id: "h1", statement: "New feature increases engagement" }
504
- - prior: {
505
- probability: 0.5,
506
- justification: "No prior information, neutral stance"
507
- }
508
- - evidence: [
509
- {
510
- id: "e1",
511
- description: "Test group showed 15% increase",
512
- likelihoodGivenHypothesis: 0.8,
513
- likelihoodGivenNotHypothesis: 0.2
514
- }
515
- ]
516
- - posterior: {
517
- probability: 0.8,
518
- calculation: "P(H|E) = P(E|H) * P(H) / P(E) = 0.8 * 0.5 / 0.5 = 0.8"
519
- }
520
- - bayesFactor: 4.0 // Strong evidence for hypothesis
521
- ```
522
-
523
- ### Example 7: Counterfactual Analysis (Post-Mortem)
524
-
525
- ```
526
- Thought 1: "What if we had chosen microservices instead of monolith?"
527
- - mode: counterfactual
528
- - actual: {
529
- id: "actual",
530
- name: "Monolithic Architecture",
531
- description: "Built as single application",
532
- conditions: [{ factor: "Architecture", value: "Monolith" }],
533
- outcomes: [
534
- { description: "Deployment bottleneck", impact: "negative", magnitude: 0.7 },
535
- { description: "Fast initial development", impact: "positive", magnitude: 0.8 }
536
- ]
537
- }
538
- - counterfactuals: [
539
- {
540
- id: "cf1",
541
- name: "Microservices Architecture",
542
- description: "Built as independent services",
543
- conditions: [{ factor: "Architecture", value: "Microservices" }],
544
- outcomes: [
545
- { description: "Independent deployment", impact: "positive", magnitude: 0.9 },
546
- { description: "Higher operational complexity", impact: "negative", magnitude: 0.6 }
547
- ]
548
- }
549
- ]
550
- - interventionPoint: {
551
- description: "Initial architecture decision",
552
- alternatives: ["Monolith", "Microservices", "Modular Monolith"]
553
- }
554
- - comparison: {
555
- differences: [
556
- {
557
- aspect: "Scalability",
558
- actual: "Limited",
559
- counterfactual: "Highly scalable",
560
- significance: "high"
561
- }
562
- ],
563
- insights: ["Microservices would have enabled better scaling"],
564
- lessons: ["Consider future scale requirements in architecture decisions"]
565
- }
566
- ```
567
-
568
- ### Example 8: Analogical Reasoning (Design Patterns)
569
-
570
- ```
571
- Thought 1: "Apply immune system principles to cybersecurity"
572
- - mode: analogical
573
- - sourceDomain: {
574
- id: "immune",
575
- name: "Biological Immune System",
576
- entities: [
577
- { id: "antibody", name: "Antibody", type: "defender" },
578
- { id: "pathogen", name: "Pathogen", type: "threat" }
579
- ],
580
- relations: [
581
- { id: "r1", type: "neutralizes", from: "antibody", to: "pathogen" }
582
- ]
583
- }
584
- - targetDomain: {
585
- id: "cyber",
586
- name: "Cybersecurity System",
587
- entities: [
588
- { id: "firewall", name: "Firewall", type: "defender" },
589
- { id: "malware", name: "Malware", type: "threat" }
590
- ],
591
- relations: [
592
- { id: "r2", type: "blocks", from: "firewall", to: "malware" }
593
- ]
594
- }
595
- - mapping: [
596
- {
597
- sourceEntityId: "antibody",
598
- targetEntityId: "firewall",
599
- justification: "Both identify and neutralize threats",
600
- confidence: 0.85
601
- }
602
- ]
603
- - insights: [
604
- {
605
- description: "Layered defense strategy",
606
- sourceEvidence: "Immune system has innate + adaptive layers",
607
- targetApplication: "Implement defense-in-depth security"
608
- }
609
- ]
610
- - limitations: [
611
- "Biological systems self-heal, digital systems don't",
612
- "Pathogens evolve naturally, malware is designed"
613
- ]
614
- - analogyStrength: 0.75
615
- ```
616
-
617
- ## Development
618
-
619
- ### Building
620
-
621
- ```bash
622
- npm install
623
- npm run build
624
- ```
625
-
626
- ### Testing
627
-
628
- ```bash
629
- npm test
630
- ```
631
-
632
- ### Type Checking
633
-
634
- ```bash
635
- npm run typecheck
636
- ```
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
-
719
- ## Architecture
720
-
721
- ```
722
- deepthinking-mcp/
723
- ├── src/
724
- │ ├── types/ # Type definitions
725
- │ │ ├── core.ts # Core thought types
726
- │ │ └── session.ts # Session management types
727
- │ ├── tools/ # MCP tool definitions
728
- │ ├── session/ # Session manager
729
- │ ├── modes/ # Mode implementations
730
- │ ├── validation/ # Validation logic
731
- │ └── index.ts # Main MCP server
732
- ├── tests/ # Test suite
733
- ├── docs/ # Documentation
734
- └── examples/ # Usage examples
735
- ```
736
-
737
- ## Roadmap
738
-
739
- ### Phase 1 (Completed - v1.0)
740
- - ✅ Core type system
741
- - ✅ Session management
742
- - ✅ Unified thinking tool
743
- - ✅ 5 core reasoning modes
744
-
745
- ### Phase 2 (Completed - v2.0)
746
- - ✅ Validation engine
747
- - ✅ 5 advanced reasoning modes (Abductive, Causal, Bayesian, Counterfactual, Analogical)
748
- - ✅ Comprehensive test suite (77 tests)
749
- - ✅ Enhanced type safety
750
-
751
- ### Phase 3 (Completed - v3.0.2)
752
- - ✅ Temporal reasoning mode (v2.1)
753
- - ✅ Game theory mode (v2.2)
754
- - ✅ Evidential reasoning mode (v2.3)
755
- - ✅ Mode recommendation system (v2.4)
756
- - ✅ Visual exports - Mermaid, DOT, ASCII (v2.5)
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)
763
- - [ ] Math-MCP integration
764
- - [ ] Persistence layer
765
- - [ ] Collaborative thinking sessions
766
- - [ ] Pattern learning from successful reasoning chains
767
- - [ ] Advanced visualization dashboard
768
- - [ ] Real-time reasoning collaboration
769
-
770
- ## Contributing
771
-
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.
783
-
784
- ## License
785
-
786
- MIT
787
-
788
- ## Credits
789
-
790
- Built upon:
791
- - [sequential-thinking](https://github.com/modelcontextprotocol/servers/tree/main/src/sequentialthinking) by Anthropic
792
- - [shannon-thinking](https://github.com/olaservo/shannon-thinking) by olaservo
793
- - Enhanced for mathematical and physics reasoning by Daniel Simon Jr.
794
-
795
- ## Support
796
-
797
- - GitHub Issues: [Report bugs or request features](https://github.com/danielsimonjr/deepthinking-mcp/issues)
798
- - Documentation: [Full docs](https://github.com/danielsimonjr/deepthinking-mcp/tree/main/docs)
1
+ # DeepThinking MCP
2
+
3
+ [![TypeScript](https://img.shields.io/badge/TypeScript-100%25-blue.svg)](https://www.typescriptlang.org/)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+ [![MCP Compatible](https://img.shields.io/badge/MCP-Compatible-green.svg)](https://modelcontextprotocol.io)
6
+
7
+ A comprehensive Model Context Protocol (MCP) server featuring **18 advanced reasoning modes** with intelligent mode recommendation, taxonomy-based classification, enterprise security, and production-ready features for complex problem-solving, analysis, and decision-making.
8
+
9
+ > 📋 **Latest Release**: v3.5.0 - See [CHANGELOG](CHANGELOG.md) for updates and improvements.
10
+ >
11
+ > 🎉 **New in v3.5.0**: Production-ready architecture, enterprise security, taxonomy classifier, zero TypeScript suppressions, 30/31 implementation tasks complete!
12
+
13
+ ## Table of Contents
14
+
15
+ - [Features](#features)
16
+ - [Installation](#installation)
17
+ - [Quick Start](#quick-start)
18
+ - [Reasoning Modes](#reasoning-modes)
19
+ - [Usage Examples](#usage-examples)
20
+ - [Production Features](#production-features)
21
+ - [API Documentation](#api-documentation)
22
+ - [Contributing](#contributing)
23
+ - [License](#license)
24
+
25
+ ## Features
26
+
27
+ - **18 Specialized Reasoning Modes** - From sequential thinking to game theory and formal logic
28
+ - **Intelligent Mode Recommendation** - Automatic mode selection based on problem characteristics
29
+ - **Taxonomy Classifier** - 110+ reasoning types across 12 categories for intelligent task classification
30
+ - **Visual Exports** - Generate Mermaid diagrams, DOT graphs, ASCII art, and LaTeX documents
31
+ - **Production-Ready** - Search engine, templates, batch processing, caching, backup/restore
32
+ - **Enterprise Security** - Input validation (Zod), rate limiting, path sanitization, PII redaction
33
+ - **High Performance** - LRU caching with auto-eviction, async I/O, 4-5x validation speedups
34
+ - **Type-Safe** - 100% TypeScript with zero suppressions (down from 231 baseline)
35
+ - **Repository Pattern** - Clean architecture with dependency injection
36
+ - **Extensible** - Plugin architecture for custom reasoning modes
37
+ - **MCP Compatible** - Full integration with Model Context Protocol
38
+
39
+ ## Installation
40
+
41
+ ### NPM Package
42
+
43
+ ```bash
44
+ npm install deepthinking-mcp
45
+ ```
46
+
47
+ ### From Source
48
+
49
+ ```bash
50
+ git clone https://github.com/yourusername/deepthinking-mcp.git
51
+ cd deepthinking-mcp
52
+ npm install
53
+ npm run build
54
+ ```
55
+
56
+ ### MCP Configuration
57
+
58
+ Add to your MCP settings file:
59
+
60
+ ```json
61
+ {
62
+ "mcpServers": {
63
+ "deepthinking": {
64
+ "command": "npx",
65
+ "args": ["deepthinking-mcp"]
66
+ }
67
+ }
68
+ }
69
+ ```
70
+
71
+ ## Quick Start
72
+
73
+ ### Basic Usage
74
+
75
+ ```typescript
76
+ import { DeepThinkingServer } from 'deepthinking-mcp';
77
+
78
+ const server = new DeepThinkingServer();
79
+
80
+ // Start a sequential reasoning session
81
+ const session = await server.startThinking({
82
+ mode: 'sequential',
83
+ problem: 'Analyze the scalability challenges of a distributed system'
84
+ });
85
+
86
+ // Add thoughts iteratively
87
+ await server.addThought(session.id, {
88
+ content: 'First, identify the main bottlenecks...'
89
+ });
90
+
91
+ // Export results
92
+ const markdown = await server.exportSession(session.id, 'markdown');
93
+ ```
94
+
95
+ ### MCP Tool Usage
96
+
97
+ ```typescript
98
+ // Use via MCP protocol
99
+ {
100
+ "tool": "start_thinking",
101
+ "arguments": {
102
+ "mode": "causal",
103
+ "problem": "What caused the service outage?"
104
+ }
105
+ }
106
+ ```
107
+
108
+ ## Reasoning Modes
109
+
110
+ ### Core Modes
111
+
112
+ #### Sequential
113
+ Iterative refinement with revision capabilities. Perfect for step-by-step problem solving.
114
+
115
+ ```typescript
116
+ mode: 'sequential'
117
+ // Use for: Debugging, algorithmic thinking, systematic analysis
118
+ ```
119
+
120
+ #### Shannon
121
+ 5-stage systematic problem-solving methodology (problem → constraints → model → proof → implementation).
122
+
123
+ ```typescript
124
+ mode: 'shannon'
125
+ // Use for: Engineering problems, system design, complex optimizations
126
+ ```
127
+
128
+ #### Mathematics
129
+ Theorem proving, lemma derivation, symbolic computation with LaTeX support.
130
+
131
+ ```typescript
132
+ mode: 'mathematics'
133
+ // Use for: Proofs, mathematical modeling, symbolic algebra
134
+ ```
135
+
136
+ #### Physics
137
+ Tensor mathematics, dimensional analysis, conservation laws, field theory.
138
+
139
+ ```typescript
140
+ mode: 'physics'
141
+ // Use for: Physical modeling, dimensional analysis, scientific computing
142
+ ```
143
+
144
+ #### Hybrid
145
+ Intelligently combines multiple reasoning modes based on problem characteristics.
146
+
147
+ ```typescript
148
+ mode: 'hybrid'
149
+ // Use for: Complex multi-faceted problems requiring diverse approaches
150
+ ```
151
+
152
+ ### Advanced Modes
153
+
154
+ #### Abductive
155
+ Generate and evaluate hypotheses to explain observations.
156
+
157
+ ```typescript
158
+ mode: 'abductive'
159
+ // Use for: Debugging, root cause analysis, diagnostic reasoning
160
+ ```
161
+
162
+ #### Causal
163
+ Build causal graphs, analyze interventions and effects.
164
+
165
+ ```typescript
166
+ mode: 'causal'
167
+ // Use for: Impact analysis, system design, decision making
168
+ ```
169
+
170
+ #### Bayesian
171
+ Probabilistic reasoning with priors, likelihoods, and evidence updates.
172
+
173
+ ```typescript
174
+ mode: 'bayesian'
175
+ // Use for: Risk assessment, A/B testing, uncertainty quantification
176
+ ```
177
+
178
+ #### Counterfactual
179
+ Explore alternative scenarios and compare outcomes.
180
+
181
+ ```typescript
182
+ mode: 'counterfactual'
183
+ // Use for: Post-mortems, strategic planning, what-if analysis
184
+ ```
185
+
186
+ #### Analogical
187
+ Transfer knowledge across domains by identifying structural similarities.
188
+
189
+ ```typescript
190
+ mode: 'analogical'
191
+ // Use for: Design patterns, innovative problem-solving, knowledge transfer
192
+ ```
193
+
194
+ ### Specialized Modes
195
+
196
+ #### Temporal
197
+ Model events, intervals, and temporal relationships using Allen's interval algebra.
198
+
199
+ ```typescript
200
+ mode: 'temporal'
201
+ // Use for: Timeline analysis, scheduling, event sequencing
202
+ ```
203
+
204
+ #### Game Theory
205
+ Analyze strategic interactions, compute Nash equilibria, build game trees.
206
+
207
+ ```typescript
208
+ mode: 'game-theory'
209
+ // Use for: Competitive analysis, mechanism design, strategic decisions
210
+ ```
211
+
212
+ #### Evidential
213
+ Dempster-Shafer theory for reasoning with uncertain evidence.
214
+
215
+ ```typescript
216
+ mode: 'evidential'
217
+ // Use for: Sensor fusion, intelligence analysis, incomplete information
218
+ ```
219
+
220
+ #### First Principles
221
+ Derive conclusions from foundational axioms using deductive reasoning.
222
+
223
+ ```typescript
224
+ mode: 'first-principles'
225
+ // Use for: Fundamental analysis, conceptual understanding, basic truths
226
+ ```
227
+
228
+ #### Systems Thinking
229
+ Holistic analysis of complex systems, feedback loops, and emergence.
230
+
231
+ ```typescript
232
+ mode: 'systems-thinking'
233
+ // Use for: Complex systems, organizational design, ecosystem analysis
234
+ ```
235
+
236
+ #### Scientific Method
237
+ Hypothesis-driven experimentation with research design and statistical analysis.
238
+
239
+ ```typescript
240
+ mode: 'scientific-method'
241
+ // Use for: Experimental design, hypothesis testing, research
242
+ ```
243
+
244
+ #### Optimization
245
+ Constraint satisfaction and optimization with decision variables.
246
+
247
+ ```typescript
248
+ mode: 'optimization'
249
+ // Use for: Resource allocation, scheduling, constrained optimization
250
+ ```
251
+
252
+ #### Formal Logic
253
+ Rigorous logical reasoning with formal systems and proof verification.
254
+
255
+ ```typescript
256
+ mode: 'formal-logic'
257
+ // Use for: Proof verification, logical analysis, formal methods
258
+ ```
259
+
260
+ ## Usage Examples
261
+
262
+ ### Example 1: Debugging with Abductive Reasoning
263
+
264
+ ```typescript
265
+ const session = await server.startThinking({
266
+ mode: 'abductive',
267
+ problem: 'Users report intermittent 500 errors on checkout'
268
+ });
269
+
270
+ await server.addThought(session.id, {
271
+ content: 'Observed: Errors occur during high traffic periods',
272
+ type: 'observation'
273
+ });
274
+
275
+ await server.addThought(session.id, {
276
+ content: 'Hypothesis 1: Database connection pool exhaustion',
277
+ type: 'hypothesis',
278
+ likelihood: 0.8
279
+ });
280
+
281
+ const analysis = await server.analyzeSession(session.id);
282
+ // Returns ranked hypotheses with supporting evidence
283
+ ```
284
+
285
+ ### Example 2: Impact Analysis with Causal Reasoning
286
+
287
+ ```typescript
288
+ const session = await server.startThinking({
289
+ mode: 'causal',
290
+ problem: 'Impact of increasing API rate limits'
291
+ });
292
+
293
+ await server.addThought(session.id, {
294
+ content: 'Build causal graph',
295
+ causalGraph: {
296
+ nodes: ['rate_limit', 'server_load', 'response_time', 'user_satisfaction'],
297
+ edges: [
298
+ { from: 'rate_limit', to: 'server_load', strength: 0.9 },
299
+ { from: 'server_load', to: 'response_time', strength: 0.85 }
300
+ ]
301
+ }
302
+ });
303
+
304
+ const intervention = await server.analyzeIntervention(session.id, {
305
+ variable: 'rate_limit',
306
+ change: '+50%'
307
+ });
308
+ // Returns predicted effects on downstream variables
309
+ ```
310
+
311
+ ### Example 3: Strategic Analysis with Game Theory
312
+
313
+ ```typescript
314
+ const session = await server.startThinking({
315
+ mode: 'game-theory',
316
+ problem: 'Pricing strategy in competitive market'
317
+ });
318
+
319
+ await server.addThought(session.id, {
320
+ content: 'Define game structure',
321
+ game: {
322
+ players: ['us', 'competitor'],
323
+ strategies: {
324
+ us: ['premium', 'competitive', 'discount'],
325
+ competitor: ['premium', 'competitive', 'discount']
326
+ },
327
+ payoffs: {
328
+ // Payoff matrix for each strategy combination
329
+ }
330
+ }
331
+ });
332
+
333
+ const equilibria = await server.findNashEquilibria(session.id);
334
+ // Returns Nash equilibria and dominant strategies
335
+ ```
336
+
337
+ ## Production Features
338
+
339
+ ### Search Engine
340
+
341
+ Full-text search with faceted filtering, autocomplete, and relevance ranking.
342
+
343
+ ```typescript
344
+ const results = await server.search({
345
+ query: 'machine learning optimization',
346
+ facets: ['mode', 'tags'],
347
+ filters: {
348
+ modes: ['optimization', 'mathematics'],
349
+ dateRange: { from: new Date('2024-01-01') }
350
+ }
351
+ });
352
+ ```
353
+
354
+ ### Template System
355
+
356
+ Pre-built templates for common reasoning patterns.
357
+
358
+ ```typescript
359
+ const templates = await server.listTemplates({
360
+ category: 'problem-solving',
361
+ difficulty: 'beginner'
362
+ });
363
+
364
+ const session = await server.instantiateTemplate(templates[0].id, {
365
+ title: 'My Analysis',
366
+ context: 'Specific problem details...'
367
+ });
368
+ ```
369
+
370
+ ### Batch Processing
371
+
372
+ Process multiple sessions concurrently with job tracking.
373
+
374
+ ```typescript
375
+ const jobId = await server.submitBatchJob({
376
+ type: 'export',
377
+ sessionIds: ['session-1', 'session-2', 'session-3'],
378
+ format: 'latex'
379
+ });
380
+
381
+ const status = await server.getJobStatus(jobId);
382
+ ```
383
+
384
+ ### Backup & Restore
385
+
386
+ Automated backup with compression and local storage.
387
+
388
+ ```typescript
389
+ const backupManager = new BackupManager({
390
+ provider: 'local',
391
+ config: { path: './backups' }
392
+ });
393
+
394
+ const backupId = await backupManager.backup(session);
395
+ const restored = await backupManager.restore(backupId);
396
+ ```
397
+
398
+ ### Session Comparison
399
+
400
+ Compare reasoning sessions to analyze differences and similarities.
401
+
402
+ ```typescript
403
+ const comparison = await server.compareSessions(session1, session2);
404
+
405
+ console.log(comparison.similarity); // 0-1 scale
406
+ console.log(comparison.differences); // Detailed diff
407
+ console.log(comparison.metrics); // Quantitative metrics
408
+ ```
409
+
410
+ ### Security & Validation
411
+
412
+ Enterprise-grade security features with input validation, rate limiting, and PII protection.
413
+
414
+ ```typescript
415
+ // Input validation with Zod schemas
416
+ import { validateInput, AddThoughtSchema } from 'deepthinking-mcp/validation';
417
+
418
+ const validated = validateInput(AddThoughtSchema, userInput);
419
+ // Throws ValidationError if invalid
420
+
421
+ // Rate limiting for API protection
422
+ import { RateLimiter } from 'deepthinking-mcp/rate-limit';
423
+
424
+ const limiter = new RateLimiter({
425
+ windowMs: 60000, // 1 minute window
426
+ maxRequests: 100, // 100 requests per window
427
+ keyPrefix: 'api:'
428
+ });
429
+
430
+ await limiter.checkLimit(userId); // Throws RateLimitError if exceeded
431
+
432
+ // Path sanitization prevents directory traversal
433
+ import { sanitizeFilename, validatePath } from 'deepthinking-mcp/utils';
434
+
435
+ const safeFilename = sanitizeFilename(userInput); // Removes dangerous characters
436
+ validatePath(targetPath, baseDir); // Prevents path traversal attacks
437
+
438
+ // Log sanitization for GDPR compliance
439
+ import { sanitizeForLogging } from 'deepthinking-mcp/utils';
440
+
441
+ logger.info('User action', sanitizeForLogging({
442
+ userId: user.id,
443
+ email: user.email, // Will be redacted as [REDACTED]
444
+ action: 'create_session'
445
+ }));
446
+ ```
447
+
448
+ ### Taxonomy Classifier
449
+
450
+ Intelligent classification of reasoning tasks using 110+ reasoning types across 12 categories.
451
+
452
+ ```typescript
453
+ import { TaxonomyClassifier } from 'deepthinking-mcp/taxonomy';
454
+
455
+ const classifier = new TaxonomyClassifier();
456
+
457
+ const result = classifier.classify(
458
+ 'How can we prove that the sum of two even numbers is always even?'
459
+ );
460
+
461
+ console.log(result.primaryCategory); // 'deductive'
462
+ console.log(result.primaryType); // 'Mathematical Proof'
463
+ console.log(result.confidence); // 0.95
464
+ console.log(result.secondaryTypes); // ['Formal Logic', 'Theorem Proving']
465
+
466
+ // Use for automatic mode selection
467
+ const mode = result.primaryType.mode; // Suggests best reasoning mode
468
+ ```
469
+
470
+ ## API Documentation
471
+
472
+ ### Core Methods
473
+
474
+ #### `startThinking(options)`
475
+
476
+ Start a new thinking session.
477
+
478
+ **Parameters:**
479
+ - `mode` (string): Reasoning mode to use
480
+ - `problem` (string): Problem description
481
+ - `context?` (object): Additional context
482
+
483
+ **Returns:** `Promise<ThinkingSession>`
484
+
485
+ #### `addThought(sessionId, thought)`
486
+
487
+ Add a thought to an existing session.
488
+
489
+ **Parameters:**
490
+ - `sessionId` (string): Session identifier
491
+ - `thought` (object): Thought content and metadata
492
+
493
+ **Returns:** `Promise<Thought>`
494
+
495
+ #### `exportSession(sessionId, format)`
496
+
497
+ Export session to specified format.
498
+
499
+ **Parameters:**
500
+ - `sessionId` (string): Session identifier
501
+ - `format` ('markdown' | 'latex' | 'json' | 'mermaid' | 'dot' | 'ascii'): Export format
502
+
503
+ **Returns:** `Promise<string>`
504
+
505
+ ### Advanced Methods
506
+
507
+ #### `recommendMode(problem, characteristics)`
508
+
509
+ Get intelligent mode recommendations.
510
+
511
+ **Parameters:**
512
+ - `problem` (string): Problem description
513
+ - `characteristics?` (object): Problem characteristics
514
+
515
+ **Returns:** `Promise<ModeRecommendation[]>`
516
+
517
+ #### `validateSession(sessionId)`
518
+
519
+ Validate session structure and content.
520
+
521
+ **Parameters:**
522
+ - `sessionId` (string): Session identifier
523
+
524
+ **Returns:** `Promise<ValidationResult>`
525
+
526
+ For complete API documentation, see [API.md](docs/API.md).
527
+
528
+ ## Architecture
529
+
530
+ ### Taxonomy System
531
+
532
+ Intelligent reasoning type classification and navigation.
533
+
534
+ ```
535
+ taxonomy/
536
+ ├── reasoning-types.ts # 100+ reasoning type definitions
537
+ ├── navigator.ts # Query and exploration
538
+ ├── suggestion-engine.ts # Mode recommendations
539
+ └── adaptive-selector.ts # Dynamic mode selection
540
+ ```
541
+
542
+ ### Export Formats
543
+
544
+ Multiple visualization and document formats.
545
+
546
+ ```
547
+ exports/
548
+ ├── latex/ # LaTeX document generation
549
+ ├── markdown/ # Markdown formatting
550
+ ├── mermaid/ # Mermaid diagrams
551
+ ├── dot/ # Graphviz DOT graphs
552
+ └── ascii/ # ASCII art visualizations
553
+ ```
554
+
555
+ ### Production Systems
556
+
557
+ Enterprise-ready features for production deployment.
558
+
559
+ ```
560
+ production/
561
+ ├── search/ # Full-text search with facets & autocomplete
562
+ ├── templates/ # Session templates with usage tracking
563
+ ├── batch/ # Real batch processing (6 operations implemented)
564
+ ├── cache/ # LRU caching with auto-eviction
565
+ ├── backup/ # Local backup with compression
566
+ ├── comparison/ # Session comparison & similarity analysis
567
+ ├── validation/ # Zod-based input validation (8 schemas)
568
+ ├── rate-limit/ # Sliding window rate limiter
569
+ └── repositories/ # Repository pattern with FileSessionRepository
570
+ ```
571
+
572
+ ### Security Features
573
+
574
+ Production-grade security and compliance.
575
+
576
+ ```
577
+ security/
578
+ ├── validation/ # Input validation with Zod schemas
579
+ ├── sanitization/ # Path sanitization & traversal prevention
580
+ ├── rate-limiting/ # Per-key rate limiting with sliding windows
581
+ ├── log-redaction/ # PII redaction for GDPR compliance
582
+ └── error-handling/ # Standardized error hierarchy with context
583
+ ```
584
+
585
+ ## Contributing
586
+
587
+ We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
588
+
589
+ ### Development Setup
590
+
591
+ ```bash
592
+ # Clone repository
593
+ git clone https://github.com/yourusername/deepthinking-mcp.git
594
+ cd deepthinking-mcp
595
+
596
+ # Install dependencies
597
+ npm install
598
+
599
+ # Run tests
600
+ npm test
601
+
602
+ # Run type checking
603
+ npm run typecheck
604
+
605
+ # Build
606
+ npm run build
607
+ ```
608
+
609
+ ### Running Tests
610
+
611
+ ```bash
612
+ # Run all tests
613
+ npm test
614
+
615
+ # Run specific test file
616
+ npm test -- path/to/test.test.ts
617
+
618
+ # Run with coverage
619
+ npm run test:coverage
620
+ ```
621
+
622
+ ## License
623
+
624
+ MIT License - see [LICENSE](LICENSE) file for details.
625
+
626
+ ## Acknowledgments
627
+
628
+ - Built on the [Model Context Protocol](https://modelcontextprotocol.io)
629
+ - Inspired by research in cognitive science and AI reasoning
630
+ - Community contributions from researchers and practitioners
631
+
632
+ ## Support
633
+
634
+ - 📚 [Documentation](docs/)
635
+ - 🐛 [Issue Tracker](https://github.com/yourusername/deepthinking-mcp/issues)
636
+ - 💬 [Discussions](https://github.com/yourusername/deepthinking-mcp/discussions)
637
+ - 📧 Email: support@example.com
638
+
639
+ ---
640
+
641
+ Made with ❤️ by the DeepThinking MCP team