@gotza02/sequential-thinking 2026.1.25 → 2026.1.27
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 +32 -0
- package/dist/index.js +81 -1
- package/dist/lib.js +11 -1
- package/package.json +6 -1
package/README.md
CHANGED
|
@@ -49,6 +49,9 @@ The core engine for structured problem-solving. It forces a step-by-step analysi
|
|
|
49
49
|
|
|
50
50
|
**Best Practice:** Use this for ANY non-trivial task. Don't just answer; think first.
|
|
51
51
|
|
|
52
|
+
#### `clear_thought_history`
|
|
53
|
+
Clears the stored thinking history. Use this to start fresh or free up context.
|
|
54
|
+
|
|
52
55
|
### 🌐 External Knowledge
|
|
53
56
|
|
|
54
57
|
#### `web_search`
|
|
@@ -70,6 +73,12 @@ Performs a direct HTTP request to a URL. Useful for getting raw HTML, JSON, or t
|
|
|
70
73
|
- `headers`: JSON object for headers (e.g., `{"Authorization": "Bearer..."}`).
|
|
71
74
|
- `body`: Request body for POST/PUT.
|
|
72
75
|
|
|
76
|
+
#### `read_webpage`
|
|
77
|
+
Reads a webpage and converts it to clean Markdown, removing ads and navigation. Great for reading articles or documentation to save tokens.
|
|
78
|
+
|
|
79
|
+
**Inputs:**
|
|
80
|
+
- `url` (string, required): The URL to read.
|
|
81
|
+
|
|
73
82
|
### 🏗 Codebase Intelligence
|
|
74
83
|
|
|
75
84
|
#### `build_project_graph`
|
|
@@ -90,6 +99,13 @@ Zoom in on a specific file to see its context.
|
|
|
90
99
|
- `imports`: What this file needs.
|
|
91
100
|
- `importedBy`: Who relies on this file.
|
|
92
101
|
|
|
102
|
+
#### `search_code`
|
|
103
|
+
Searches for a text pattern across all code files in the project. Useful for finding usage examples or specific logic.
|
|
104
|
+
|
|
105
|
+
**Inputs:**
|
|
106
|
+
- `pattern` (string, required): Text to search for.
|
|
107
|
+
- `path` (string, optional): Root directory (defaults to `.`).
|
|
108
|
+
|
|
93
109
|
### 🛠 System Operations
|
|
94
110
|
|
|
95
111
|
#### `read_file`
|
|
@@ -148,6 +164,11 @@ The Sequential Thinking tool is designed for:
|
|
|
148
164
|
|
|
149
165
|
## Configuration
|
|
150
166
|
|
|
167
|
+
### Environment Variables
|
|
168
|
+
- `THOUGHT_DELAY_MS`: (Optional) Milliseconds to wait before processing each thought. Default: `0`.
|
|
169
|
+
- `DISABLE_THOUGHT_LOGGING`: (Optional) Set to `true` to hide colored logs.
|
|
170
|
+
- `THOUGHTS_STORAGE_PATH`: (Optional) Path to history file. Default: `thoughts_history.json`.
|
|
171
|
+
|
|
151
172
|
### Usage with Claude Desktop
|
|
152
173
|
|
|
153
174
|
Add this to your `claude_desktop_config.json`. You can configure API keys directly here:
|
|
@@ -193,6 +214,17 @@ npm run build
|
|
|
193
214
|
npm test
|
|
194
215
|
```
|
|
195
216
|
|
|
217
|
+
## Recent Updates (v2026.1.27)
|
|
218
|
+
- **New Tools**:
|
|
219
|
+
- `read_webpage`: Convert webpages to Markdown for efficient reading.
|
|
220
|
+
- `search_code`: Recursive text search in code files.
|
|
221
|
+
- `clear_thought_history`: Reset the thinking process.
|
|
222
|
+
|
|
223
|
+
## Recent Updates (v2026.1.26)
|
|
224
|
+
|
|
225
|
+
- **Rate Limiting**:
|
|
226
|
+
- Added `THOUGHT_DELAY_MS` environment variable to introduce a delay between thought steps. This helps prevent request flooding and rate limit issues.
|
|
227
|
+
|
|
196
228
|
## Recent Updates (v2026.1.24)
|
|
197
229
|
|
|
198
230
|
- **Bug Fixes**:
|
package/dist/index.js
CHANGED
|
@@ -7,12 +7,16 @@ import * as fs from 'fs/promises';
|
|
|
7
7
|
import { exec } from 'child_process';
|
|
8
8
|
import { promisify } from 'util';
|
|
9
9
|
import { ProjectKnowledgeGraph } from './graph.js';
|
|
10
|
+
import * as path from 'path';
|
|
11
|
+
import { JSDOM } from 'jsdom';
|
|
12
|
+
import { Readability } from '@mozilla/readability';
|
|
13
|
+
import TurndownService from 'turndown';
|
|
10
14
|
const execAsync = promisify(exec);
|
|
11
15
|
const server = new McpServer({
|
|
12
16
|
name: "sequential-thinking-server",
|
|
13
17
|
version: "2026.1.18",
|
|
14
18
|
});
|
|
15
|
-
const thinkingServer = new SequentialThinkingServer(process.env.THOUGHTS_STORAGE_PATH || 'thoughts_history.json');
|
|
19
|
+
const thinkingServer = new SequentialThinkingServer(process.env.THOUGHTS_STORAGE_PATH || 'thoughts_history.json', parseInt(process.env.THOUGHT_DELAY_MS || '0', 10));
|
|
16
20
|
const knowledgeGraph = new ProjectKnowledgeGraph();
|
|
17
21
|
// --- Sequential Thinking Tool ---
|
|
18
22
|
server.tool("sequentialthinking", `A detailed tool for dynamic and reflective problem-solving through thoughts.
|
|
@@ -314,6 +318,82 @@ async function runServer() {
|
|
|
314
318
|
await server.connect(transport);
|
|
315
319
|
console.error("Sequential Thinking MCP Server (Extended) running on stdio");
|
|
316
320
|
}
|
|
321
|
+
// --- New Tools v2026.1.27 ---
|
|
322
|
+
// 9. read_webpage
|
|
323
|
+
server.tool("read_webpage", "Read a webpage and convert it to clean Markdown (removes ads, navs, etc.).", {
|
|
324
|
+
url: z.string().url().describe("The URL to read")
|
|
325
|
+
}, async ({ url }) => {
|
|
326
|
+
try {
|
|
327
|
+
const response = await fetch(url);
|
|
328
|
+
const html = await response.text();
|
|
329
|
+
const doc = new JSDOM(html, { url });
|
|
330
|
+
const reader = new Readability(doc.window.document);
|
|
331
|
+
const article = reader.parse();
|
|
332
|
+
if (!article)
|
|
333
|
+
throw new Error("Could not parse article content");
|
|
334
|
+
const turndownService = new TurndownService();
|
|
335
|
+
const markdown = turndownService.turndown(article.content || "");
|
|
336
|
+
return {
|
|
337
|
+
content: [{
|
|
338
|
+
type: "text",
|
|
339
|
+
text: `Title: ${article.title}\n\n${markdown}`
|
|
340
|
+
}]
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
catch (error) {
|
|
344
|
+
return {
|
|
345
|
+
content: [{ type: "text", text: `Read Error: ${error instanceof Error ? error.message : String(error)}` }],
|
|
346
|
+
isError: true
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
});
|
|
350
|
+
// 10. search_code
|
|
351
|
+
server.tool("search_code", "Search for a text pattern in project files (excludes node_modules, etc.).", {
|
|
352
|
+
pattern: z.string().describe("The text to search for"),
|
|
353
|
+
path: z.string().optional().default('.').describe("Root directory to search")
|
|
354
|
+
}, async ({ pattern, path: searchPath }) => {
|
|
355
|
+
try {
|
|
356
|
+
async function searchDir(dir) {
|
|
357
|
+
const results = [];
|
|
358
|
+
const entries = await fs.readdir(dir, { withFileTypes: true });
|
|
359
|
+
for (const entry of entries) {
|
|
360
|
+
const fullPath = path.join(dir, entry.name);
|
|
361
|
+
if (entry.isDirectory()) {
|
|
362
|
+
if (['node_modules', '.git', 'dist', 'coverage', '.gemini'].includes(entry.name))
|
|
363
|
+
continue;
|
|
364
|
+
results.push(...await searchDir(fullPath));
|
|
365
|
+
}
|
|
366
|
+
else if (/\.(ts|js|json|md|txt|html|css|py|java|c|cpp|h|rs|go)$/.test(entry.name)) {
|
|
367
|
+
const content = await fs.readFile(fullPath, 'utf-8');
|
|
368
|
+
if (content.includes(pattern)) {
|
|
369
|
+
results.push(fullPath);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
return results;
|
|
374
|
+
}
|
|
375
|
+
const matches = await searchDir(path.resolve(searchPath || '.'));
|
|
376
|
+
return {
|
|
377
|
+
content: [{
|
|
378
|
+
type: "text",
|
|
379
|
+
text: matches.length > 0 ? `Found "${pattern}" in:\n${matches.join('\n')}` : `No matches found for "${pattern}"`
|
|
380
|
+
}]
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
catch (error) {
|
|
384
|
+
return {
|
|
385
|
+
content: [{ type: "text", text: `Search Error: ${error instanceof Error ? error.message : String(error)}` }],
|
|
386
|
+
isError: true
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
});
|
|
390
|
+
// 11. clear_thought_history
|
|
391
|
+
server.tool("clear_thought_history", "Clear the sequential thinking history.", {}, async () => {
|
|
392
|
+
await thinkingServer.clearHistory();
|
|
393
|
+
return {
|
|
394
|
+
content: [{ type: "text", text: "Thought history cleared." }]
|
|
395
|
+
};
|
|
396
|
+
});
|
|
317
397
|
runServer().catch((error) => {
|
|
318
398
|
console.error("Fatal error running server:", error);
|
|
319
399
|
process.exit(1);
|
package/dist/lib.js
CHANGED
|
@@ -7,9 +7,11 @@ export class SequentialThinkingServer {
|
|
|
7
7
|
branches = {};
|
|
8
8
|
disableThoughtLogging;
|
|
9
9
|
storagePath;
|
|
10
|
-
|
|
10
|
+
delayMs;
|
|
11
|
+
constructor(storagePath = 'thoughts_history.json', delayMs = 0) {
|
|
11
12
|
this.disableThoughtLogging = (process.env.DISABLE_THOUGHT_LOGGING || "").toLowerCase() === "true";
|
|
12
13
|
this.storagePath = path.resolve(storagePath);
|
|
14
|
+
this.delayMs = delayMs;
|
|
13
15
|
this.loadHistory();
|
|
14
16
|
}
|
|
15
17
|
loadHistory() {
|
|
@@ -36,6 +38,11 @@ export class SequentialThinkingServer {
|
|
|
36
38
|
console.error(`Error saving history to ${this.storagePath}:`, error);
|
|
37
39
|
}
|
|
38
40
|
}
|
|
41
|
+
async clearHistory() {
|
|
42
|
+
this.thoughtHistory = [];
|
|
43
|
+
this.branches = {};
|
|
44
|
+
await this.saveHistory();
|
|
45
|
+
}
|
|
39
46
|
addToMemory(input) {
|
|
40
47
|
if (input.thoughtNumber > input.totalThoughts) {
|
|
41
48
|
input.totalThoughts = input.thoughtNumber;
|
|
@@ -97,6 +104,9 @@ export class SequentialThinkingServer {
|
|
|
97
104
|
}
|
|
98
105
|
async processThought(input) {
|
|
99
106
|
try {
|
|
107
|
+
if (this.delayMs > 0) {
|
|
108
|
+
await new Promise(resolve => setTimeout(resolve, this.delayMs));
|
|
109
|
+
}
|
|
100
110
|
this.addToMemory(input);
|
|
101
111
|
await this.saveHistory();
|
|
102
112
|
if (!this.disableThoughtLogging) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gotza02/sequential-thinking",
|
|
3
|
-
"version": "2026.1.
|
|
3
|
+
"version": "2026.1.27",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -29,12 +29,17 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@modelcontextprotocol/sdk": "^1.24.0",
|
|
32
|
+
"@mozilla/readability": "^0.6.0",
|
|
32
33
|
"chalk": "^5.3.0",
|
|
34
|
+
"jsdom": "^27.4.0",
|
|
35
|
+
"turndown": "^7.2.2",
|
|
33
36
|
"typescript": "^5.3.3",
|
|
34
37
|
"yargs": "^17.7.2"
|
|
35
38
|
},
|
|
36
39
|
"devDependencies": {
|
|
40
|
+
"@types/jsdom": "^27.0.0",
|
|
37
41
|
"@types/node": "^22",
|
|
42
|
+
"@types/turndown": "^5.0.6",
|
|
38
43
|
"@types/yargs": "^17.0.32",
|
|
39
44
|
"@vitest/coverage-v8": "^2.1.8",
|
|
40
45
|
"shx": "^0.3.4",
|