deepthinking-mcp 6.1.1 → 7.4.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/LICENSE +21 -0
- package/README.md +473 -254
- package/dist/index.js +24701 -3345
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -4,11 +4,17 @@
|
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
5
5
|
[](https://modelcontextprotocol.io)
|
|
6
6
|
|
|
7
|
-
A comprehensive Model Context Protocol (MCP) server featuring **
|
|
7
|
+
A comprehensive Model Context Protocol (MCP) server featuring **33 reasoning modes** (29 with dedicated thought types, 4 advanced runtime modes) including meta-reasoning for strategic oversight, with intelligent mode recommendation, taxonomy-based classification, enterprise security, and production-ready features for complex problem-solving, analysis, and decision-making.
|
|
8
8
|
|
|
9
|
-
> 📋 **Latest Release**:
|
|
9
|
+
> 📋 **Latest Release**: v7.4.0 - See [CHANGELOG](CHANGELOG.md) for updates and improvements.
|
|
10
10
|
>
|
|
11
|
-
> 🎉 **New in
|
|
11
|
+
> 🎉 **New in v7.4.0**: Phase 13 Academic Research Modes for PhD students! Synthesis (literature review), Argumentation (Toulmin model), Critique (peer review), and Analysis (qualitative methods) modes.
|
|
12
|
+
>
|
|
13
|
+
> ✨ **v7.3.0**: Phase 12 Algorithmic Reasoning Mode with comprehensive CLRS coverage! 100+ named algorithms, complexity analysis, design patterns.
|
|
14
|
+
>
|
|
15
|
+
> ✨ **v7.2.0**: Phase 11 Historical Computing Extensions! Computability mode (Turing machines), Cryptanalytic mode (deciban evidence system), extended Game Theory (von Neumann).
|
|
16
|
+
>
|
|
17
|
+
> ✨ **v7.0.0**: Phase 8 Proof Decomposition System with native SVG export! Break proofs into atomic statements, detect gaps and implicit assumptions, track assumption chains.
|
|
12
18
|
|
|
13
19
|
## Table of Contents
|
|
14
20
|
|
|
@@ -16,6 +22,7 @@ A comprehensive Model Context Protocol (MCP) server featuring **21 advanced reas
|
|
|
16
22
|
- [Installation](#installation)
|
|
17
23
|
- [Quick Start](#quick-start)
|
|
18
24
|
- [Reasoning Modes](#reasoning-modes)
|
|
25
|
+
- [Proof Decomposition](#proof-decomposition)
|
|
19
26
|
- [Usage Examples](#usage-examples)
|
|
20
27
|
- [Production Features](#production-features)
|
|
21
28
|
- [API Documentation](#api-documentation)
|
|
@@ -24,12 +31,17 @@ A comprehensive Model Context Protocol (MCP) server featuring **21 advanced reas
|
|
|
24
31
|
|
|
25
32
|
## Features
|
|
26
33
|
|
|
27
|
-
- **
|
|
28
|
-
- **
|
|
34
|
+
- **33 Specialized Reasoning Modes** - From sequential thinking to game theory, formal logic, and meta-reasoning (29 with full thought types, 4 advanced runtime modes)
|
|
35
|
+
- **Academic Research Modes (NEW!)** - Synthesis (literature review), Argumentation (Toulmin), Critique (peer review), Analysis (qualitative methods)
|
|
36
|
+
- **Algorithmic Reasoning (v7.3.0)** - Comprehensive CLRS coverage with 100+ named algorithms, complexity analysis, design patterns
|
|
37
|
+
- **Historical Computing Extensions** - Computability (Turing machines), Cryptanalytic (decibans), extended Game Theory (von Neumann)
|
|
38
|
+
- **Proof Decomposition** - Break proofs into atomic statements, detect gaps, track assumption chains
|
|
39
|
+
- **Native SVG Export** - Direct SVG generation without external tools for proof visualizations
|
|
40
|
+
- **Meta-Reasoning** - Strategic oversight that monitors effectiveness, recommends mode switches, and assesses quality
|
|
29
41
|
- **Adaptive Mode Switching** - Automatic evaluation-based mode switching when effectiveness drops below thresholds
|
|
30
42
|
- **Intelligent Mode Recommendation** - Automatic mode selection based on problem characteristics
|
|
31
|
-
- **Taxonomy Classifier** -
|
|
32
|
-
- **Visual Exports** - Generate Mermaid diagrams, DOT graphs, ASCII art, and LaTeX documents
|
|
43
|
+
- **Taxonomy Classifier** - 69 reasoning types across 12 categories for intelligent task classification (110 planned)
|
|
44
|
+
- **Visual Exports** - Generate Mermaid diagrams, DOT graphs, ASCII art, SVG graphics, and LaTeX documents
|
|
33
45
|
- **Production-Ready** - Search engine, templates, batch processing, caching, backup/restore
|
|
34
46
|
- **Enterprise Security** - Input validation (Zod), rate limiting, path sanitization, PII redaction
|
|
35
47
|
- **High Performance** - LRU caching with auto-eviction, async I/O, 4-5x validation speedups
|
|
@@ -49,7 +61,7 @@ npm install deepthinking-mcp
|
|
|
49
61
|
### From Source
|
|
50
62
|
|
|
51
63
|
```bash
|
|
52
|
-
git clone https://github.com/
|
|
64
|
+
git clone https://github.com/danielsimonjr/deepthinking-mcp.git
|
|
53
65
|
cd deepthinking-mcp
|
|
54
66
|
npm install
|
|
55
67
|
npm run build
|
|
@@ -72,43 +84,89 @@ Add to your MCP settings file:
|
|
|
72
84
|
|
|
73
85
|
## Quick Start
|
|
74
86
|
|
|
75
|
-
###
|
|
76
|
-
|
|
77
|
-
```typescript
|
|
78
|
-
import { DeepThinkingServer } from 'deepthinking-mcp';
|
|
87
|
+
### MCP Tool Usage
|
|
79
88
|
|
|
80
|
-
|
|
89
|
+
DeepThinking MCP provides 10 focused tools for different reasoning domains:
|
|
81
90
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
91
|
+
| Tool | Modes | Description |
|
|
92
|
+
|------|-------|-------------|
|
|
93
|
+
| `deepthinking_core` | inductive, deductive, abductive | Fundamental reasoning |
|
|
94
|
+
| `deepthinking_standard` | sequential, shannon, hybrid | Standard workflow modes |
|
|
95
|
+
| `deepthinking_math` | mathematics, physics | Mathematical/scientific reasoning |
|
|
96
|
+
| `deepthinking_temporal` | temporal | Time-based reasoning |
|
|
97
|
+
| `deepthinking_probabilistic` | bayesian, evidential | Probabilistic reasoning |
|
|
98
|
+
| `deepthinking_causal` | causal, counterfactual | Cause-effect analysis |
|
|
99
|
+
| `deepthinking_strategic` | gametheory, optimization | Strategic reasoning |
|
|
100
|
+
| `deepthinking_analytical` | analogical, firstprinciples, metareasoning | Analytical reasoning |
|
|
101
|
+
| `deepthinking_scientific` | scientificmethod, systemsthinking, formallogic | Scientific reasoning |
|
|
102
|
+
| `deepthinking_session` | - | Session management (summarize, export, switch_mode) |
|
|
87
103
|
|
|
88
|
-
|
|
89
|
-
await server.addThought(session.id, {
|
|
90
|
-
content: 'First, identify the main bottlenecks...'
|
|
91
|
-
});
|
|
104
|
+
### Example: Sequential Reasoning
|
|
92
105
|
|
|
93
|
-
|
|
94
|
-
|
|
106
|
+
```json
|
|
107
|
+
{
|
|
108
|
+
"tool": "deepthinking_standard",
|
|
109
|
+
"arguments": {
|
|
110
|
+
"mode": "sequential",
|
|
111
|
+
"thought": "First, identify the main bottlenecks in the distributed system",
|
|
112
|
+
"thoughtNumber": 1,
|
|
113
|
+
"totalThoughts": 5,
|
|
114
|
+
"nextThoughtNeeded": true
|
|
115
|
+
}
|
|
116
|
+
}
|
|
95
117
|
```
|
|
96
118
|
|
|
97
|
-
###
|
|
119
|
+
### Example: Causal Analysis
|
|
98
120
|
|
|
99
|
-
```
|
|
100
|
-
// Use via MCP protocol
|
|
121
|
+
```json
|
|
101
122
|
{
|
|
102
|
-
"tool": "
|
|
123
|
+
"tool": "deepthinking_causal",
|
|
103
124
|
"arguments": {
|
|
104
125
|
"mode": "causal",
|
|
105
|
-
"
|
|
126
|
+
"thought": "Analyzing the root cause of the service outage",
|
|
127
|
+
"thoughtNumber": 1,
|
|
128
|
+
"totalThoughts": 3,
|
|
129
|
+
"nextThoughtNeeded": true,
|
|
130
|
+
"causalGraph": {
|
|
131
|
+
"nodes": [
|
|
132
|
+
{"id": "n1", "name": "High Load", "type": "cause"},
|
|
133
|
+
{"id": "n2", "name": "Memory Exhaustion", "type": "mediator"},
|
|
134
|
+
{"id": "n3", "name": "Service Crash", "type": "effect"}
|
|
135
|
+
],
|
|
136
|
+
"edges": [
|
|
137
|
+
{"from": "n1", "to": "n2", "strength": 0.9},
|
|
138
|
+
{"from": "n2", "to": "n3", "strength": 0.95}
|
|
139
|
+
]
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Example: Session Export
|
|
146
|
+
|
|
147
|
+
```json
|
|
148
|
+
{
|
|
149
|
+
"tool": "deepthinking_session",
|
|
150
|
+
"arguments": {
|
|
151
|
+
"action": "export",
|
|
152
|
+
"sessionId": "session-123",
|
|
153
|
+
"exportFormat": "markdown"
|
|
106
154
|
}
|
|
107
155
|
}
|
|
108
156
|
```
|
|
109
157
|
|
|
110
158
|
## Reasoning Modes
|
|
111
159
|
|
|
160
|
+
The server supports 33 reasoning modes organized into categories:
|
|
161
|
+
|
|
162
|
+
- **Core Modes (5)**: Sequential, Shannon, Mathematics, Physics, Hybrid
|
|
163
|
+
- **Historical Computing (2)**: Computability (Turing), Cryptanalytic (Turing) - *v7.2.0*
|
|
164
|
+
- **Algorithmic (1)**: Algorithmic (CLRS) - *v7.3.0*
|
|
165
|
+
- **Academic Research (4)**: Synthesis, Argumentation, Critique, Analysis - *v7.4.0*
|
|
166
|
+
- **Advanced Runtime Modes (6)**: Metareasoning, Recursive, Modal, Stochastic, Constraint, Optimization
|
|
167
|
+
- **Fundamental Modes (2)**: Inductive, Deductive
|
|
168
|
+
- **Experimental Modes (13)**: Abductive, Causal, Bayesian, Counterfactual, Analogical, Temporal, Game Theory (+ von Neumann extensions), Evidential, First Principles, Systems Thinking, Scientific Method, Formal Logic, Engineering
|
|
169
|
+
|
|
112
170
|
### Core Modes
|
|
113
171
|
|
|
114
172
|
#### Sequential
|
|
@@ -227,7 +285,7 @@ mode: 'first-principles'
|
|
|
227
285
|
// Use for: Fundamental analysis, conceptual understanding, basic truths
|
|
228
286
|
```
|
|
229
287
|
|
|
230
|
-
#### Meta-Reasoning
|
|
288
|
+
#### Meta-Reasoning
|
|
231
289
|
Strategic oversight of reasoning process - monitors effectiveness, recommends mode switches, assesses quality.
|
|
232
290
|
|
|
233
291
|
```typescript
|
|
@@ -271,334 +329,496 @@ mode: 'formal-logic'
|
|
|
271
329
|
// Use for: Proof verification, logical analysis, formal methods
|
|
272
330
|
```
|
|
273
331
|
|
|
274
|
-
|
|
332
|
+
### Advanced Runtime Modes
|
|
275
333
|
|
|
276
|
-
|
|
334
|
+
#### Recursive
|
|
335
|
+
Recursive problem decomposition - break complex problems into smaller subproblems.
|
|
277
336
|
|
|
278
337
|
```typescript
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
});
|
|
283
|
-
|
|
284
|
-
await server.addThought(session.id, {
|
|
285
|
-
content: 'Observed: Errors occur during high traffic periods',
|
|
286
|
-
type: 'observation'
|
|
287
|
-
});
|
|
338
|
+
mode: 'recursive'
|
|
339
|
+
// Use for: Divide-and-conquer, tree-structured problems, recursive algorithms
|
|
340
|
+
```
|
|
288
341
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
type: 'hypothesis',
|
|
292
|
-
likelihood: 0.8
|
|
293
|
-
});
|
|
342
|
+
#### Modal
|
|
343
|
+
Possibility and necessity reasoning using modal logic.
|
|
294
344
|
|
|
295
|
-
|
|
296
|
-
|
|
345
|
+
```typescript
|
|
346
|
+
mode: 'modal'
|
|
347
|
+
// Use for: What's possible vs necessary, requirement analysis, constraint exploration
|
|
297
348
|
```
|
|
298
349
|
|
|
299
|
-
|
|
350
|
+
#### Stochastic
|
|
351
|
+
Probabilistic state transitions and Markov chain reasoning.
|
|
300
352
|
|
|
301
353
|
```typescript
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
});
|
|
354
|
+
mode: 'stochastic'
|
|
355
|
+
// Use for: Process modeling, state machines, probabilistic sequences
|
|
356
|
+
```
|
|
306
357
|
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
causalGraph: {
|
|
310
|
-
nodes: ['rate_limit', 'server_load', 'response_time', 'user_satisfaction'],
|
|
311
|
-
edges: [
|
|
312
|
-
{ from: 'rate_limit', to: 'server_load', strength: 0.9 },
|
|
313
|
-
{ from: 'server_load', to: 'response_time', strength: 0.85 }
|
|
314
|
-
]
|
|
315
|
-
}
|
|
316
|
-
});
|
|
358
|
+
#### Constraint
|
|
359
|
+
Constraint satisfaction problem solving.
|
|
317
360
|
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
});
|
|
322
|
-
// Returns predicted effects on downstream variables
|
|
361
|
+
```typescript
|
|
362
|
+
mode: 'constraint'
|
|
363
|
+
// Use for: Scheduling, resource allocation, constraint propagation
|
|
323
364
|
```
|
|
324
365
|
|
|
325
|
-
###
|
|
366
|
+
### Fundamental Modes
|
|
367
|
+
|
|
368
|
+
#### Inductive
|
|
369
|
+
Reasoning from specific observations to general principles.
|
|
326
370
|
|
|
327
371
|
```typescript
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
});
|
|
372
|
+
mode: 'inductive'
|
|
373
|
+
// Use for: Pattern recognition, generalization, empirical reasoning
|
|
374
|
+
```
|
|
332
375
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
game: {
|
|
336
|
-
players: ['us', 'competitor'],
|
|
337
|
-
strategies: {
|
|
338
|
-
us: ['premium', 'competitive', 'discount'],
|
|
339
|
-
competitor: ['premium', 'competitive', 'discount']
|
|
340
|
-
},
|
|
341
|
-
payoffs: {
|
|
342
|
-
// Payoff matrix for each strategy combination
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
});
|
|
376
|
+
#### Deductive
|
|
377
|
+
Reasoning from general principles to specific conclusions.
|
|
346
378
|
|
|
347
|
-
|
|
348
|
-
|
|
379
|
+
```typescript
|
|
380
|
+
mode: 'deductive'
|
|
381
|
+
// Use for: Logical proofs, applying rules, deriving conclusions
|
|
349
382
|
```
|
|
350
383
|
|
|
351
|
-
|
|
384
|
+
### Historical Computing Modes (v7.2.0)
|
|
352
385
|
|
|
353
|
-
|
|
386
|
+
Tributes to Alan Turing and John von Neumann's foundational work.
|
|
354
387
|
|
|
355
|
-
|
|
388
|
+
#### Computability
|
|
389
|
+
Turing machines, decidability proofs, reductions, and diagonalization arguments.
|
|
356
390
|
|
|
357
391
|
```typescript
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
filters: {
|
|
362
|
-
modes: ['optimization', 'mathematics'],
|
|
363
|
-
dateRange: { from: new Date('2024-01-01') }
|
|
364
|
-
}
|
|
365
|
-
});
|
|
392
|
+
mode: 'computability'
|
|
393
|
+
// Use for: Decidability analysis, algorithm limits, computational complexity
|
|
394
|
+
// Features: Turing machine simulation, reduction chains, halting problem analysis
|
|
366
395
|
```
|
|
367
396
|
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
Pre-built templates for common reasoning patterns.
|
|
397
|
+
#### Cryptanalytic
|
|
398
|
+
Turing's deciban evidence system from Bletchley Park.
|
|
371
399
|
|
|
372
400
|
```typescript
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
});
|
|
377
|
-
|
|
378
|
-
const session = await server.instantiateTemplate(templates[0].id, {
|
|
379
|
-
title: 'My Analysis',
|
|
380
|
-
context: 'Specific problem details...'
|
|
381
|
-
});
|
|
401
|
+
mode: 'cryptanalytic'
|
|
402
|
+
// Use for: Evidence quantification, hypothesis testing, code-breaking analysis
|
|
403
|
+
// Features: Deciban accumulation (10 db ≈ 10:1 odds), frequency analysis, Banburismus
|
|
382
404
|
```
|
|
383
405
|
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
Process multiple sessions concurrently with job tracking.
|
|
406
|
+
#### Extended Game Theory (v7.2.0)
|
|
407
|
+
Von Neumann's minimax theorem, cooperative games, and Shapley values.
|
|
387
408
|
|
|
388
409
|
```typescript
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
format: 'latex'
|
|
393
|
-
});
|
|
394
|
-
|
|
395
|
-
const status = await server.getJobStatus(jobId);
|
|
410
|
+
mode: 'gametheory'
|
|
411
|
+
// Enhanced with: Minimax analysis, cooperative game theory, coalition analysis
|
|
412
|
+
// Use for: Zero-sum games, fair value distribution, strategic decision-making
|
|
396
413
|
```
|
|
397
414
|
|
|
398
|
-
###
|
|
415
|
+
### Algorithmic Mode (v7.3.0)
|
|
399
416
|
|
|
400
|
-
|
|
417
|
+
#### Algorithmic
|
|
418
|
+
Comprehensive coverage of algorithms from "Introduction to Algorithms" (CLRS) with 100+ named algorithms.
|
|
401
419
|
|
|
402
420
|
```typescript
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
const backupId = await backupManager.backup(session);
|
|
409
|
-
const restored = await backupManager.restore(backupId);
|
|
421
|
+
mode: 'algorithmic'
|
|
422
|
+
// Use for: Algorithm design, complexity analysis, correctness proofs
|
|
423
|
+
// Features: Divide-and-conquer, dynamic programming, greedy, graph algorithms
|
|
424
|
+
// Coverage: Sorting, searching, graph, string, computational geometry
|
|
410
425
|
```
|
|
411
426
|
|
|
412
|
-
###
|
|
427
|
+
### Academic Research Modes (v7.4.0)
|
|
428
|
+
|
|
429
|
+
Designed for PhD students and scientific paper writing.
|
|
413
430
|
|
|
414
|
-
|
|
431
|
+
#### Synthesis
|
|
432
|
+
Literature review and knowledge integration.
|
|
415
433
|
|
|
416
434
|
```typescript
|
|
417
|
-
|
|
435
|
+
mode: 'synthesis'
|
|
436
|
+
// Use for: Literature reviews, theme extraction, knowledge integration
|
|
437
|
+
// Features: Source synthesis, pattern identification, gap analysis
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
#### Argumentation
|
|
441
|
+
Academic argumentation using the Toulmin model.
|
|
418
442
|
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
443
|
+
```typescript
|
|
444
|
+
mode: 'argumentation'
|
|
445
|
+
// Use for: Building arguments, dialectical reasoning, rhetorical analysis
|
|
446
|
+
// Features: Toulmin model (claim, data, warrant, backing), counter-arguments
|
|
422
447
|
```
|
|
423
448
|
|
|
424
|
-
|
|
449
|
+
#### Critique
|
|
450
|
+
Critical analysis and peer review frameworks.
|
|
425
451
|
|
|
426
|
-
|
|
452
|
+
```typescript
|
|
453
|
+
mode: 'critique'
|
|
454
|
+
// Use for: Peer review, methodology evaluation, evidence assessment
|
|
455
|
+
// Features: Systematic critique, strengths/weaknesses analysis
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
#### Analysis
|
|
459
|
+
Qualitative analysis methods.
|
|
427
460
|
|
|
428
461
|
```typescript
|
|
429
|
-
|
|
430
|
-
|
|
462
|
+
mode: 'analysis'
|
|
463
|
+
// Use for: Thematic analysis, grounded theory, discourse analysis
|
|
464
|
+
// Features: Multiple qualitative analysis frameworks, coding support
|
|
465
|
+
```
|
|
431
466
|
|
|
432
|
-
|
|
433
|
-
// Throws ValidationError if invalid
|
|
467
|
+
## Proof Decomposition
|
|
434
468
|
|
|
435
|
-
|
|
436
|
-
import { RateLimiter } from 'deepthinking-mcp/rate-limit';
|
|
469
|
+
**New in v7.0.0!** The proof decomposition system provides advanced mathematical reasoning capabilities:
|
|
437
470
|
|
|
438
|
-
|
|
439
|
-
windowMs: 60000, // 1 minute window
|
|
440
|
-
maxRequests: 100, // 100 requests per window
|
|
441
|
-
keyPrefix: 'api:'
|
|
442
|
-
});
|
|
471
|
+
### Components
|
|
443
472
|
|
|
444
|
-
|
|
473
|
+
| Component | Purpose |
|
|
474
|
+
|-----------|---------|
|
|
475
|
+
| **ProofDecomposer** | Breaks proofs into atomic statements with dependency tracking |
|
|
476
|
+
| **GapAnalyzer** | Detects missing steps, unjustified leaps, and implicit assumptions |
|
|
477
|
+
| **AssumptionTracker** | Traces conclusions back to their supporting assumptions |
|
|
478
|
+
| **InconsistencyDetector** | Detects circular dependencies and contradictions |
|
|
479
|
+
| **MathematicsReasoningEngine** | Integrated proof analysis with improvement suggestions |
|
|
445
480
|
|
|
446
|
-
|
|
447
|
-
import { sanitizeFilename, validatePath } from 'deepthinking-mcp/utils';
|
|
481
|
+
### Features
|
|
448
482
|
|
|
449
|
-
|
|
450
|
-
|
|
483
|
+
- **Atomic Statement Types**: axiom, hypothesis, definition, derived, lemma, conclusion
|
|
484
|
+
- **Inference Rules**: algebraic_manipulation, substitution, modus_ponens, universal_instantiation, etc.
|
|
485
|
+
- **Gap Detection**: Identify missing steps with severity levels (minor, significant, critical)
|
|
486
|
+
- **Rigor Levels**: informal, textbook, rigorous, formal
|
|
487
|
+
- **Visual Export**: Mermaid, DOT, ASCII, and native SVG formats
|
|
451
488
|
|
|
452
|
-
|
|
453
|
-
import { sanitizeForLogging } from 'deepthinking-mcp/utils';
|
|
489
|
+
### Example: Proof Analysis
|
|
454
490
|
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
491
|
+
```json
|
|
492
|
+
{
|
|
493
|
+
"tool": "deepthinking_math",
|
|
494
|
+
"arguments": {
|
|
495
|
+
"mode": "mathematics",
|
|
496
|
+
"thought": "Analyzing the proof that n² is even when n is even",
|
|
497
|
+
"thoughtNumber": 1,
|
|
498
|
+
"totalThoughts": 3,
|
|
499
|
+
"nextThoughtNeeded": true,
|
|
500
|
+
"proofDecomposition": {
|
|
501
|
+
"theorem": "If n is even, then n² is even",
|
|
502
|
+
"atoms": [
|
|
503
|
+
{"id": "a1", "content": "n is an even integer", "type": "hypothesis"},
|
|
504
|
+
{"id": "a2", "content": "n = 2k for some integer k", "type": "definition"},
|
|
505
|
+
{"id": "a3", "content": "n² = 4k² = 2(2k²)", "type": "derived"},
|
|
506
|
+
{"id": "a4", "content": "n² is even", "type": "conclusion"}
|
|
507
|
+
],
|
|
508
|
+
"dependencies": {
|
|
509
|
+
"nodes": ["a1", "a2", "a3", "a4"],
|
|
510
|
+
"edges": [
|
|
511
|
+
{"from": "a1", "to": "a2"},
|
|
512
|
+
{"from": "a2", "to": "a3"},
|
|
513
|
+
{"from": "a3", "to": "a4"}
|
|
514
|
+
]
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
}
|
|
460
519
|
```
|
|
461
520
|
|
|
462
|
-
###
|
|
521
|
+
### Visual Export Formats
|
|
463
522
|
|
|
464
|
-
|
|
523
|
+
Export proof decompositions to multiple visual formats:
|
|
465
524
|
|
|
466
525
|
```typescript
|
|
467
|
-
|
|
526
|
+
// Native SVG (no external tools required)
|
|
527
|
+
exportProofDecomposition(decomposition, {
|
|
528
|
+
format: 'svg',
|
|
529
|
+
colorScheme: 'default', // 'default' | 'pastel' | 'monochrome'
|
|
530
|
+
includeMetrics: true,
|
|
531
|
+
svgWidth: 1200,
|
|
532
|
+
svgHeight: 800
|
|
533
|
+
});
|
|
534
|
+
|
|
535
|
+
// Mermaid diagram
|
|
536
|
+
exportProofDecomposition(decomposition, { format: 'mermaid' });
|
|
468
537
|
|
|
469
|
-
|
|
538
|
+
// GraphViz DOT
|
|
539
|
+
exportProofDecomposition(decomposition, { format: 'dot' });
|
|
540
|
+
|
|
541
|
+
// ASCII text
|
|
542
|
+
exportProofDecomposition(decomposition, { format: 'ascii' });
|
|
543
|
+
```
|
|
544
|
+
|
|
545
|
+
## Usage Examples
|
|
470
546
|
|
|
471
|
-
|
|
472
|
-
'How can we prove that the sum of two even numbers is always even?'
|
|
473
|
-
);
|
|
547
|
+
### Example 1: Debugging with Abductive Reasoning
|
|
474
548
|
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
549
|
+
```json
|
|
550
|
+
// Step 1: Start with observation
|
|
551
|
+
{
|
|
552
|
+
"tool": "deepthinking_core",
|
|
553
|
+
"arguments": {
|
|
554
|
+
"mode": "abductive",
|
|
555
|
+
"thought": "Observed: Users report intermittent 500 errors on checkout during high traffic periods",
|
|
556
|
+
"thoughtNumber": 1,
|
|
557
|
+
"totalThoughts": 4,
|
|
558
|
+
"nextThoughtNeeded": true,
|
|
559
|
+
"observations": ["Errors occur during high traffic", "Checkout page affected", "Intermittent pattern"]
|
|
560
|
+
}
|
|
561
|
+
}
|
|
479
562
|
|
|
480
|
-
//
|
|
481
|
-
|
|
563
|
+
// Step 2: Generate hypothesis
|
|
564
|
+
{
|
|
565
|
+
"tool": "deepthinking_core",
|
|
566
|
+
"arguments": {
|
|
567
|
+
"sessionId": "session-from-step-1",
|
|
568
|
+
"mode": "abductive",
|
|
569
|
+
"thought": "Hypothesis: Database connection pool exhaustion under load",
|
|
570
|
+
"thoughtNumber": 2,
|
|
571
|
+
"totalThoughts": 4,
|
|
572
|
+
"nextThoughtNeeded": true,
|
|
573
|
+
"hypotheses": [{
|
|
574
|
+
"id": "h1",
|
|
575
|
+
"explanation": "Connection pool exhausted",
|
|
576
|
+
"assumptions": ["Fixed pool size", "No connection recycling"],
|
|
577
|
+
"predictions": ["Errors correlate with traffic spikes"],
|
|
578
|
+
"score": 0.8
|
|
579
|
+
}]
|
|
580
|
+
}
|
|
581
|
+
}
|
|
482
582
|
```
|
|
483
583
|
|
|
484
|
-
|
|
584
|
+
### Example 2: Impact Analysis with Causal Reasoning
|
|
485
585
|
|
|
486
|
-
|
|
586
|
+
```json
|
|
587
|
+
{
|
|
588
|
+
"tool": "deepthinking_causal",
|
|
589
|
+
"arguments": {
|
|
590
|
+
"mode": "causal",
|
|
591
|
+
"thought": "Analyzing impact of increasing API rate limits on system behavior",
|
|
592
|
+
"thoughtNumber": 1,
|
|
593
|
+
"totalThoughts": 3,
|
|
594
|
+
"nextThoughtNeeded": true,
|
|
595
|
+
"causalGraph": {
|
|
596
|
+
"nodes": [
|
|
597
|
+
{"id": "rate_limit", "name": "Rate Limit", "type": "cause", "description": "API rate limit setting"},
|
|
598
|
+
{"id": "server_load", "name": "Server Load", "type": "mediator", "description": "CPU/Memory usage"},
|
|
599
|
+
{"id": "response_time", "name": "Response Time", "type": "effect", "description": "API latency"},
|
|
600
|
+
{"id": "satisfaction", "name": "User Satisfaction", "type": "effect", "description": "User experience"}
|
|
601
|
+
],
|
|
602
|
+
"edges": [
|
|
603
|
+
{"from": "rate_limit", "to": "server_load", "strength": 0.9, "confidence": 0.85},
|
|
604
|
+
{"from": "server_load", "to": "response_time", "strength": 0.85, "confidence": 0.9},
|
|
605
|
+
{"from": "response_time", "to": "satisfaction", "strength": -0.7, "confidence": 0.8}
|
|
606
|
+
]
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
```
|
|
487
611
|
|
|
488
|
-
|
|
612
|
+
### Example 3: Strategic Analysis with Game Theory
|
|
489
613
|
|
|
490
|
-
|
|
614
|
+
```json
|
|
615
|
+
{
|
|
616
|
+
"tool": "deepthinking_strategic",
|
|
617
|
+
"arguments": {
|
|
618
|
+
"mode": "gametheory",
|
|
619
|
+
"thought": "Analyzing pricing strategy in competitive market using game theory",
|
|
620
|
+
"thoughtNumber": 1,
|
|
621
|
+
"totalThoughts": 3,
|
|
622
|
+
"nextThoughtNeeded": true,
|
|
623
|
+
"game": {
|
|
624
|
+
"type": "strategic",
|
|
625
|
+
"players": ["Company A", "Company B"],
|
|
626
|
+
"strategies": {
|
|
627
|
+
"Company A": ["premium", "competitive", "discount"],
|
|
628
|
+
"Company B": ["premium", "competitive", "discount"]
|
|
629
|
+
},
|
|
630
|
+
"payoffMatrix": [
|
|
631
|
+
[{"A": 10, "B": 10}, {"A": 5, "B": 15}, {"A": 2, "B": 12}],
|
|
632
|
+
[{"A": 15, "B": 5}, {"A": 8, "B": 8}, {"A": 4, "B": 10}],
|
|
633
|
+
[{"A": 12, "B": 2}, {"A": 10, "B": 4}, {"A": 6, "B": 6}]
|
|
634
|
+
]
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
```
|
|
491
639
|
|
|
492
|
-
|
|
493
|
-
- `mode` (string): Reasoning mode to use
|
|
494
|
-
- `problem` (string): Problem description
|
|
495
|
-
- `context?` (object): Additional context
|
|
640
|
+
## Production Features
|
|
496
641
|
|
|
497
|
-
**
|
|
642
|
+
> **Note**: DeepThinking MCP is an MCP server, not a library. These features are accessed through MCP tools and internal architecture. The examples below describe the internal capabilities.
|
|
498
643
|
|
|
499
|
-
|
|
644
|
+
### Proof Decomposition (v7.0.0)
|
|
500
645
|
|
|
501
|
-
|
|
646
|
+
Advanced mathematical reasoning with proof analysis:
|
|
502
647
|
|
|
503
|
-
**
|
|
504
|
-
-
|
|
505
|
-
-
|
|
648
|
+
- **ProofDecomposer**: Break proofs into atomic statements with dependency graphs
|
|
649
|
+
- **GapAnalyzer**: Detect missing steps, unjustified leaps, implicit assumptions
|
|
650
|
+
- **AssumptionTracker**: Trace conclusions to their supporting assumptions
|
|
651
|
+
- **InconsistencyDetector**: Find circular dependencies and contradictions
|
|
652
|
+
- **Native SVG Export**: Generate proof visualizations without external tools
|
|
506
653
|
|
|
507
|
-
|
|
654
|
+
### Search Engine
|
|
508
655
|
|
|
509
|
-
|
|
656
|
+
Full-text search with faceted filtering and relevance ranking. Used internally to search across reasoning sessions by mode, tags, date ranges, and content.
|
|
510
657
|
|
|
511
|
-
|
|
658
|
+
### Template System
|
|
512
659
|
|
|
513
|
-
|
|
514
|
-
- `sessionId` (string): Session identifier
|
|
515
|
-
- `format` ('markdown' | 'latex' | 'json' | 'mermaid' | 'dot' | 'ascii'): Export format
|
|
660
|
+
Pre-built templates for common reasoning patterns, accessible through session creation.
|
|
516
661
|
|
|
517
|
-
|
|
662
|
+
### Batch Processing
|
|
518
663
|
|
|
519
|
-
|
|
664
|
+
Process multiple sessions concurrently with 8 operation types:
|
|
520
665
|
|
|
521
|
-
|
|
666
|
+
- **export** - Batch export sessions to various formats
|
|
667
|
+
- **import** - Batch import sessions from files
|
|
668
|
+
- **analyze** - Batch taxonomy/quality/pattern analysis
|
|
669
|
+
- **validate** - Batch session validation
|
|
670
|
+
- **transform** - Batch mode switching, merging, splitting
|
|
671
|
+
- **index** - Batch search/analytics indexing
|
|
672
|
+
- **backup** - Batch backup with compression
|
|
673
|
+
- **cleanup** - Batch cleanup of old/incomplete sessions
|
|
522
674
|
|
|
523
|
-
|
|
675
|
+
### Backup & Restore
|
|
524
676
|
|
|
525
|
-
|
|
526
|
-
- `problem` (string): Problem description
|
|
527
|
-
- `characteristics?` (object): Problem characteristics
|
|
677
|
+
Automated backup with compression and local storage, with support for multiple providers (Local, S3, GCS, Azure).
|
|
528
678
|
|
|
529
|
-
|
|
679
|
+
### Session Comparison
|
|
530
680
|
|
|
531
|
-
|
|
681
|
+
Compare reasoning sessions to analyze differences and similarities with quantitative metrics.
|
|
532
682
|
|
|
533
|
-
|
|
683
|
+
### Security & Validation
|
|
534
684
|
|
|
535
|
-
|
|
536
|
-
- `sessionId` (string): Session identifier
|
|
685
|
+
Enterprise-grade security features built into the MCP server:
|
|
537
686
|
|
|
538
|
-
**
|
|
687
|
+
- **Input Validation** - Zod schemas validate all 33 mode inputs
|
|
688
|
+
- **Rate Limiting** - Sliding window rate limiter for API protection
|
|
689
|
+
- **Path Sanitization** - Prevents directory traversal attacks
|
|
690
|
+
- **PII Redaction** - GDPR-compliant log sanitization
|
|
539
691
|
|
|
540
|
-
|
|
692
|
+
### Taxonomy Classifier
|
|
541
693
|
|
|
542
|
-
|
|
694
|
+
Intelligent classification of reasoning tasks using 69 reasoning types across 12 categories. Use the `recommend_mode` action in `deepthinking_session` to get mode recommendations based on problem characteristics.
|
|
543
695
|
|
|
544
|
-
|
|
696
|
+
## API Documentation
|
|
545
697
|
|
|
546
|
-
|
|
698
|
+
### MCP Tool Interface
|
|
547
699
|
|
|
548
|
-
|
|
549
|
-
taxonomy/
|
|
550
|
-
├── reasoning-types.ts # 100+ reasoning type definitions
|
|
551
|
-
├── navigator.ts # Query and exploration
|
|
552
|
-
├── suggestion-engine.ts # Mode recommendations
|
|
553
|
-
└── adaptive-selector.ts # Dynamic mode selection
|
|
554
|
-
```
|
|
700
|
+
All reasoning is done through MCP tools. Each tool accepts arguments and returns JSON responses.
|
|
555
701
|
|
|
556
|
-
|
|
702
|
+
#### Common Parameters (all thinking tools)
|
|
557
703
|
|
|
558
|
-
|
|
704
|
+
| Parameter | Type | Required | Description |
|
|
705
|
+
|-----------|------|----------|-------------|
|
|
706
|
+
| `sessionId` | string | No | Session ID (auto-created if omitted) |
|
|
707
|
+
| `thought` | string | Yes | The reasoning content |
|
|
708
|
+
| `thoughtNumber` | integer | Yes | Current thought number (1-based) |
|
|
709
|
+
| `totalThoughts` | integer | Yes | Estimated total thoughts |
|
|
710
|
+
| `nextThoughtNeeded` | boolean | Yes | Whether more reasoning needed |
|
|
711
|
+
| `mode` | string | Yes | The reasoning mode |
|
|
559
712
|
|
|
560
|
-
|
|
561
|
-
exports/
|
|
562
|
-
├── latex/ # LaTeX document generation
|
|
563
|
-
├── markdown/ # Markdown formatting
|
|
564
|
-
├── mermaid/ # Mermaid diagrams
|
|
565
|
-
├── dot/ # Graphviz DOT graphs
|
|
566
|
-
└── ascii/ # ASCII art visualizations
|
|
567
|
-
```
|
|
713
|
+
#### Session Actions (`deepthinking_session`)
|
|
568
714
|
|
|
569
|
-
|
|
715
|
+
| Action | Parameters | Description |
|
|
716
|
+
|--------|------------|-------------|
|
|
717
|
+
| `summarize` | `sessionId` | Generate session summary |
|
|
718
|
+
| `export` | `sessionId`, `exportFormat` | Export to format (json, markdown, latex, html, jupyter, mermaid, dot, ascii, svg) |
|
|
719
|
+
| `get_session` | `sessionId` | Get session details |
|
|
720
|
+
| `switch_mode` | `sessionId`, `newMode` | Switch reasoning mode |
|
|
721
|
+
| `recommend_mode` | `problemType` or `problemCharacteristics` | Get mode recommendations |
|
|
570
722
|
|
|
571
|
-
|
|
723
|
+
#### Example Response
|
|
572
724
|
|
|
725
|
+
```json
|
|
726
|
+
{
|
|
727
|
+
"sessionId": "session-abc123",
|
|
728
|
+
"thoughtId": "thought-xyz789",
|
|
729
|
+
"thoughtNumber": 1,
|
|
730
|
+
"mode": "sequential",
|
|
731
|
+
"nextThoughtNeeded": true,
|
|
732
|
+
"sessionComplete": false,
|
|
733
|
+
"totalThoughts": 3
|
|
734
|
+
}
|
|
573
735
|
```
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
736
|
+
|
|
737
|
+
For architecture details, see [docs/architecture/](docs/architecture/).
|
|
738
|
+
|
|
739
|
+
## Project Stats
|
|
740
|
+
|
|
741
|
+
| Metric | Value |
|
|
742
|
+
|--------|-------|
|
|
743
|
+
| TypeScript Files | 183 |
|
|
744
|
+
| Lines of Code | ~62,000 |
|
|
745
|
+
| Test Files | 40 |
|
|
746
|
+
| Passing Tests | 792+ |
|
|
747
|
+
| Thinking Modes | 33 (29 with thought types) |
|
|
748
|
+
| MCP Tools | 10 focused + 1 legacy |
|
|
749
|
+
| Export Formats | 11 (including native SVG) |
|
|
750
|
+
| Visual Formats | 11 (mermaid, dot, ascii, svg, etc.) |
|
|
751
|
+
| Reasoning Types | 69 (110 planned) |
|
|
752
|
+
| Modules | 16 |
|
|
753
|
+
| Total Exports | 970 |
|
|
754
|
+
|
|
755
|
+
## Architecture
|
|
756
|
+
|
|
757
|
+
The codebase is organized into 16 modules with clean separation of concerns. See [docs/architecture/DEPENDENCY_GRAPH.md](docs/architecture/DEPENDENCY_GRAPH.md) for the complete dependency graph.
|
|
758
|
+
|
|
759
|
+
### Core Structure
|
|
760
|
+
|
|
761
|
+
```
|
|
762
|
+
src/
|
|
763
|
+
├── index.ts # MCP server entry point (tool handlers)
|
|
764
|
+
├── types/ # Type definitions including 33 mode types
|
|
765
|
+
│ ├── core.ts # ThinkingMode enum, Thought union type
|
|
766
|
+
│ └── modes/ # One file per reasoning mode (23 files)
|
|
767
|
+
├── services/ # Business logic layer
|
|
768
|
+
│ ├── ThoughtFactory.ts # Thought creation and validation
|
|
769
|
+
│ ├── ExportService.ts # Multi-format export handling
|
|
770
|
+
│ └── ModeRouter.ts # Mode switching and recommendations
|
|
771
|
+
├── session/ # SessionManager, persistence, storage
|
|
772
|
+
├── modes/ # Advanced reasoning implementations (7 files)
|
|
773
|
+
├── proof/ # Proof decomposition system (v7.0.0)
|
|
774
|
+
│ ├── decomposer.ts # ProofDecomposer class
|
|
775
|
+
│ ├── gap-analyzer.ts # GapAnalyzer class
|
|
776
|
+
│ └── assumption-tracker.ts # AssumptionTracker class
|
|
777
|
+
├── reasoning/ # Reasoning engines (v7.0.0)
|
|
778
|
+
│ └── inconsistency-detector.ts # InconsistencyDetector class
|
|
779
|
+
└── tools/ # MCP tool definitions and schemas
|
|
780
|
+
```
|
|
781
|
+
|
|
782
|
+
### Feature Modules
|
|
783
|
+
|
|
784
|
+
```
|
|
785
|
+
src/
|
|
786
|
+
├── taxonomy/ # 69 reasoning types, classifier, suggestion engine
|
|
787
|
+
│ ├── reasoning-types.ts # Full taxonomy definitions
|
|
788
|
+
│ ├── classifier.ts # Task classification
|
|
789
|
+
│ └── suggestion-engine.ts # Mode recommendations
|
|
790
|
+
├── export/ # Visual and document exporters
|
|
791
|
+
│ ├── visual/ # 21 mode-specific visual exporters + native SVG
|
|
792
|
+
│ │ ├── proof-decomposition.ts # Proof visualization (v7.0.0)
|
|
793
|
+
│ │ └── [19 mode exporters] # Mermaid, DOT, ASCII, SVG
|
|
794
|
+
│ └── latex.ts # LaTeX document generation
|
|
795
|
+
├── search/ # Full-text search with faceted filtering
|
|
796
|
+
├── batch/ # Batch processing (8 operations)
|
|
797
|
+
├── backup/ # Backup manager with provider abstraction
|
|
798
|
+
├── cache/ # LRU/LFU/FIFO caching strategies
|
|
799
|
+
├── rate-limit/ # Sliding window rate limiter
|
|
800
|
+
├── validation/ # Zod schemas (25+ mode validators)
|
|
801
|
+
├── comparison/ # Session comparison & diff generation
|
|
802
|
+
├── templates/ # Session templates with usage tracking
|
|
803
|
+
├── analytics/ # Analytics engine and dashboard
|
|
804
|
+
├── webhooks/ # Event-driven webhook system
|
|
805
|
+
├── collaboration/ # Annotations and conflict resolution
|
|
806
|
+
└── ml/ # Pattern recognition & recommendations
|
|
584
807
|
```
|
|
585
808
|
|
|
586
809
|
### Security Features
|
|
587
810
|
|
|
588
|
-
|
|
811
|
+
Security is built into multiple modules:
|
|
589
812
|
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
├── log-redaction/ # PII redaction for GDPR compliance
|
|
596
|
-
└── error-handling/ # Standardized error hierarchy with context
|
|
597
|
-
```
|
|
813
|
+
- **validation/** - Input validation with Zod schemas for all 33 modes
|
|
814
|
+
- **utils/sanitization.ts** - Path sanitization & traversal prevention
|
|
815
|
+
- **utils/log-sanitizer.ts** - PII redaction for GDPR compliance
|
|
816
|
+
- **rate-limit/** - Per-key rate limiting with sliding windows
|
|
817
|
+
- **utils/errors.ts** - Standardized error hierarchy with context
|
|
598
818
|
|
|
599
819
|
## Contributing
|
|
600
820
|
|
|
601
|
-
We welcome contributions! Please
|
|
821
|
+
We welcome contributions! Please open an issue or pull request on [GitHub](https://github.com/danielsimonjr/deepthinking-mcp).
|
|
602
822
|
|
|
603
823
|
### Adding New Reasoning Modes
|
|
604
824
|
|
|
@@ -627,7 +847,7 @@ cat docs/ADDING_NEW_MODE.md
|
|
|
627
847
|
|
|
628
848
|
```bash
|
|
629
849
|
# Clone repository
|
|
630
|
-
git clone https://github.com/
|
|
850
|
+
git clone https://github.com/danielsimonjr/deepthinking-mcp.git
|
|
631
851
|
cd deepthinking-mcp
|
|
632
852
|
|
|
633
853
|
# Install dependencies
|
|
@@ -669,9 +889,8 @@ MIT License - see [LICENSE](LICENSE) file for details.
|
|
|
669
889
|
## Support
|
|
670
890
|
|
|
671
891
|
- 📚 [Documentation](docs/)
|
|
672
|
-
- 🐛 [Issue Tracker](https://github.com/
|
|
673
|
-
- 💬 [Discussions](https://github.com/
|
|
674
|
-
- 📧 Email: support@example.com
|
|
892
|
+
- 🐛 [Issue Tracker](https://github.com/danielsimonjr/deepthinking-mcp/issues)
|
|
893
|
+
- 💬 [Discussions](https://github.com/danielsimonjr/deepthinking-mcp/discussions)
|
|
675
894
|
|
|
676
895
|
---
|
|
677
896
|
|