@gotza02/sequential-thinking 2026.2.13 → 2026.2.14
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 +74 -234
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,255 +1,76 @@
|
|
|
1
|
-
# Sequential Thinking MCP
|
|
1
|
+
# Sequential Thinking MCP (Extended) 🧠
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Advanced MCP Server enabling AI to act as a Software Engineer with Deep Thinking, Codebase Graph Analysis, and Persistent Memory.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## ✨ Key Features
|
|
6
|
+
- **Deep Thinking:** Step-by-step reasoning with auto-correction (Loop Breaker).
|
|
7
|
+
- **Code Intelligence:** Dependency graph mapping (`build_project_graph`) & surgical code editing.
|
|
8
|
+
- **Memory:** Long-term project notes, reusable code database, and thought history.
|
|
9
|
+
- **Research:** Integrated Web search (Brave/Exa) & webpage reading.
|
|
6
10
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
## 🌟 จุดเด่นของเวอร์ชัน Extended
|
|
12
|
-
|
|
13
|
-
1. **Deepest Thinking Protocol**: บังคับให้ AI วิเคราะห์ปัญหาแบบเป็นลำดับขั้นตอน (Step-by-step) พร้อมการแตกกิ่งความคิด (Branching) และการทบทวนตัวเอง (Reflexion) เพื่อหาทางเลือกที่ดีที่สุด
|
|
14
|
-
2. **Codebase Intelligence**: ระบบ `ProjectKnowledgeGraph` ที่ใช้ TypeScript Compiler API และ Regex (สำหรับ Python/Go) ในการสแกนความสัมพันธ์ระหว่างไฟล์และ Exported Symbols
|
|
15
|
-
3. **Code Database (CodeStore)**: ระบบจัดเก็บ Snippets และ Architectural Patterns ลงในไฟล์ JSON ถาวร ช่วยให้ AI "จดจำ" วิธีแก้ปัญหาและนำกลับมาใช้ใหม่ได้
|
|
16
|
-
4. **Deep Coding Workflow**: เครื่องมือใหม่สำหรับการแก้ไขโค้ดที่ต้องผ่านการวิเคราะห์บริบท (Context Document) และการวางแผนที่ผ่านการตรวจสอบเหตุผลแล้วเท่านั้น
|
|
17
|
-
5. **Smart Notes**: ระบบบันทึกที่มี **Priority Level** และ **Expiration Date** ช่วยจัดลำดับความสำคัญของงานได้ดียิ่งขึ้น พร้อมฟีเจอร์ **Auto-Repair** กู้คืนไฟล์อัตโนมัติหากข้อมูลเสียหาย
|
|
18
|
-
6. **Security Sandbox**: ระบบป้องกันความปลอดภัยขั้นสูง บล็อกการเข้าถึง Local/Private Network (ครอบคลุม IPv4/IPv6) ป้องกันการโจมตีแบบ SSRF
|
|
19
|
-
|
|
20
|
-
---
|
|
21
|
-
|
|
22
|
-
## 🚀 อัปเดตล่าสุด (Latest Enhancements)
|
|
23
|
-
* **Performance Boost**: ระบบ `build_project_graph` ทำงานแบบ Parallel เร็วขึ้นกว่าเดิม 3 เท่าตัวในโปรเจกต์ขนาดใหญ่
|
|
24
|
-
* **Deep Language Parsing**: ปรับปรุงการวิเคราะห์ภาษา **Python** และ **Go** ให้แม่นยำขึ้น รองรับ Relative Imports และ Exported Types
|
|
25
|
-
* **Rich Web Content**: เครื่องมือ `read_webpage` สามารถแปลง HTML Tables เป็น Markdown Tables ที่สวยงามได้แล้ว
|
|
26
|
-
* **Autonomous Recovery**: ระบบจัดการความคิด (`lib.ts`) มาพร้อม Mutex ป้องกัน Race Condition และระบบกู้คืนข้อมูลอัตโนมัติหากไฟล์ JSON เสียหาย
|
|
27
|
-
|
|
28
|
-
---
|
|
29
|
-
|
|
30
|
-
## 🔑 Environment Variables (การตั้งค่าตัวแปร)
|
|
31
|
-
|
|
32
|
-
| Variable Name | Description | Required? |
|
|
33
|
-
|--------------|-------------|-----------|
|
|
34
|
-
| `BRAVE_API_KEY` | สำหรับค้นหาผ่าน Brave Search | ❌ (Optional) |
|
|
35
|
-
| `EXA_API_KEY` | สำหรับค้นหาผ่าน Exa.ai (แนะนำมากสำหรับงาน Deep Research) | ❌ (Optional) |
|
|
36
|
-
| `GOOGLE_SEARCH_API_KEY` | Google Custom Search API Key | ❌ (Optional) |
|
|
37
|
-
| `GOOGLE_SEARCH_CX` | Google Custom Search Engine ID (CX) | ❌ (Optional) |
|
|
38
|
-
| `THOUGHTS_STORAGE_PATH` | ไฟล์เก็บประวัติความคิดเพื่อใช้ต่อเนื่อง | `thoughts_history.json` |
|
|
39
|
-
| `NOTES_STORAGE_PATH` | ไฟล์เก็บความจำระยะยาว (กฎโปรเจกต์, ความชอบ) | `project_notes.json` |
|
|
40
|
-
| `CODE_DB_PATH` | ไฟล์เก็บฐานข้อมูลความรู้โค้ด (Snippets/Patterns) | `code_database.json` |
|
|
41
|
-
| `THOUGHT_DELAY_MS` | เวลาหน่วงระหว่างคิด (เพื่อความสมจริงและการจัดการ Rate Limit) | `0` |
|
|
42
|
-
| `LOG_LEVEL` | ระดับการแสดงผล Log (debug, info, warn, error) | `info` |
|
|
43
|
-
|
|
44
|
-
---
|
|
45
|
-
|
|
46
|
-
## 🛠️ รายการเครื่องมือ (Tools Capability)
|
|
47
|
-
|
|
48
|
-
### 🧠 1. Cognitive & Deepest Thinking
|
|
49
|
-
* **`sequentialthinking`**: (ปรับปรุงใหม่!) บังคับใช้หลักการ **Deepest Thinking** รองรับการทำ Analysis, Reflexion, Evaluation และ Selection ในทุกการแก้ปัญหา
|
|
50
|
-
* **`summarize_history`**: สรุปประวัติความคิดที่ยาวเหยียดเพื่อประหยัดพื้นที่บริบท
|
|
51
|
-
* **`clear_thought_history`**: ล้างสมองเพื่อเริ่มงานชิ้นใหม่
|
|
52
|
-
|
|
53
|
-
### 💻 2. Deep Coding & Codebase Context
|
|
54
|
-
* **`deep_code_analyze`**: 🌟 **(ใหม่)** สร้าง Codebase Context Document รวบรวมเนื้อหาไฟล์, Symbols และความสัมพันธ์ (Import/Export) เพื่อให้ AI "เรียนรู้" ก่อนแก้โค้ด
|
|
55
|
-
* **`deep_code_edit`**: 🌟 **(ใหม่)** แก้ไขโค้ดแบบ Surgical Edit โดยต้องระบุ `reasoning` (เหตุผลเชิงลึก) ที่ผ่านการคิดวิเคราะห์มาแล้ว
|
|
56
|
-
* **`build_project_graph`**: สแกนโปรเจกต์เพื่อสร้างแผนผังความสัมพันธ์ทั้งหมด (รองรับ TS, JS, PY, GO)
|
|
57
|
-
* **`get_file_relationships`**: ตรวจสอบว่าไฟล์เป้าหมายกระทบกับส่วนไหนของระบบบ้าง
|
|
58
|
-
* **`search_code`**: ค้นหา Code Pattern ทั้งโปรเจกต์แบบชาญฉลาด
|
|
59
|
-
|
|
60
|
-
### 📚 3. Knowledge & Memory (CodeStore)
|
|
61
|
-
* **`add_code_snippet`**: 🌟 **(ใหม่)** บันทึก Snippet โค้ดที่ใช้งานบ่อยลงฐานข้อมูล
|
|
62
|
-
* **`search_code_db`**: 🌟 **(ใหม่)** ค้นหาความรู้เดิมจากฐานข้อมูล (ช่วยลดเวลาในการเริ่มงานใหม่)
|
|
63
|
-
* **`learn_architecture_pattern`**: 🌟 **(ใหม่)** บันทึกรูปแบบโครงสร้างของระบบ
|
|
64
|
-
* **`manage_notes`**: (ปรับปรุงใหม่!) จัดการบันทึกพร้อมระบุ **Priority** และ **Expiration**
|
|
65
|
-
|
|
66
|
-
### 🌐 4. External Research
|
|
67
|
-
* **`web_search`**: ค้นหาข้อมูลล่าสุดจากโลกภายนอก (Brave/Exa/Google)
|
|
68
|
-
* **`read_webpage`**: อ่านเนื้อหาเว็บแปลงเป็น Markdown ที่สะอาดและเข้าใจง่าย
|
|
69
|
-
* **`fetch`**: ดึงข้อมูล Raw จาก API ต่างๆ
|
|
70
|
-
|
|
71
|
-
### 📁 5. System & Persistence
|
|
72
|
-
* **`read_file` / `write_file` / `edit_file`**: จัดการไฟล์ในระบบ
|
|
73
|
-
* **`shell_execute`**: รันคำสั่ง Terminal (มีระบบป้องกันคำสั่งอันตราย เช่น `rm -rf /`)
|
|
74
|
-
|
|
75
|
-
---
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
## 🚀 การติดตั้ง (Installation)
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
คุณสามารถเลือกติดตั้งได้ 3 รูปแบบตามความสะดวกดังนี้:
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
### 1. แบบ npx (ไม่ต้องติดตั้งลงเครื่องถาวร)
|
|
88
|
-
|
|
89
|
-
วิธีที่ง่ายที่สุดและแนะนำสำหรับ AI Client ส่วนใหญ่:
|
|
11
|
+
## 🚀 Quick Setup
|
|
90
12
|
|
|
13
|
+
### 1. Installation
|
|
14
|
+
**Option A: Run Temporarily (Recommended for testing)**
|
|
91
15
|
```bash
|
|
92
|
-
|
|
93
16
|
npx -y @gotza02/sequential-thinking
|
|
94
|
-
|
|
95
17
|
```
|
|
96
18
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
### 2. แบบ npm (ติดตั้งลงเครื่อง)
|
|
100
|
-
|
|
101
|
-
เหมาะสำหรับผู้ที่ต้องการความเสถียรหรือใช้งานในสภาพแวดล้อมที่ไม่มีอินเทอร์เน็ตตลอดเวลา:
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
* **Global Installation (แนะนำ):**
|
|
106
|
-
|
|
107
|
-
```bash
|
|
108
|
-
|
|
109
|
-
npm install -g @gotza02/sequential-thinking
|
|
110
|
-
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
* **Local Installation (ในโปรเจกต์):
|
|
114
|
-
|
|
115
|
-
```bash
|
|
116
|
-
|
|
117
|
-
npm install @gotza02/sequential-thinking
|
|
118
|
-
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
### 3. แบบจาก Source Code (Developer)
|
|
124
|
-
|
|
19
|
+
**Option B: Install Globally**
|
|
125
20
|
```bash
|
|
126
|
-
|
|
127
|
-
git clone https://github.com/gotza02/sequential-thinking.git && cd sequential-thinking && npm install && npm run build
|
|
128
|
-
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
---
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
## 🔍 วิธีค้นหา Path ที่ถูกต้อง (Path Discovery)
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
หากคุณติดตั้งผ่าน `npm` และต้องการทราบว่าไฟล์ `index.js` อยู่ที่ไหนเพื่อนำไปใส่ใน AI Client:
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
* **กรณีติดตั้ง Global:**
|
|
146
|
-
|
|
147
|
-
```bash
|
|
148
|
-
|
|
149
|
-
# สำหรับ Linux/Android (Termux)
|
|
150
|
-
|
|
151
|
-
echo "$(npm config get prefix)/lib/node_modules/@gotza02/sequential-thinking/dist/index.js"
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
# สำหรับ Windows (PowerShell)
|
|
156
|
-
|
|
157
|
-
echo "$env:APPDATA\npm\node_modules\@gotza02\sequential-thinking\dist\index.js"
|
|
158
|
-
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
* **กรณีติดตั้ง Local:**
|
|
162
|
-
|
|
163
|
-
```bash
|
|
164
|
-
|
|
165
|
-
echo "$(pwd)/node_modules/@gotza02/sequential-thinking/dist/index.js"
|
|
166
|
-
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
---
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
## ⚙️ การตั้งค่าใน AI Client (Configuration Examples)
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
### 1. การใช้ npx (ง่ายที่สุด)
|
|
180
|
-
|
|
181
|
-
เหมาะสำหรับ **Gemini CLI** หรือ **Claude Desktop** ที่เชื่อมต่ออินเทอร์เน็ตได้:
|
|
182
|
-
|
|
183
|
-
```json
|
|
184
|
-
|
|
185
|
-
{
|
|
186
|
-
|
|
187
|
-
"command": "npx",
|
|
188
|
-
|
|
189
|
-
"args": ["-y", "@gotza02/sequential-thinking"]
|
|
190
|
-
|
|
191
|
-
}
|
|
192
|
-
|
|
21
|
+
npm install -g @gotza02/sequential-thinking
|
|
193
22
|
```
|
|
194
23
|
|
|
24
|
+
### 2. Configuration (Gemini/Claude)
|
|
25
|
+
Add this to your MCP settings (`~/.gemini/settings.json` or `claude_desktop_config.json`).
|
|
195
26
|
|
|
196
|
-
|
|
197
|
-
### 2. การใช้ npm/Node (เสถียรกว่า)
|
|
198
|
-
|
|
199
|
-
ต้องระบุ Path ที่หาได้จากขั้นตอน **Path Discovery** ด้านบน:
|
|
200
|
-
|
|
27
|
+
**For npx usage:**
|
|
201
28
|
```json
|
|
202
|
-
|
|
203
29
|
{
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
30
|
+
"mcpServers": {
|
|
31
|
+
"smartagent": {
|
|
32
|
+
"command": "npx",
|
|
33
|
+
"args": ["-y", "@gotza02/sequential-thinking"],
|
|
34
|
+
"env": { "THOUGHTS_STORAGE_PATH": "thoughts.json" }
|
|
35
|
+
}
|
|
36
|
+
}
|
|
209
37
|
}
|
|
210
|
-
|
|
211
38
|
```
|
|
212
39
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
#### ตัวอย่างไฟล์ Config (Gemini CLI: `~/.gemini/settings.json`)
|
|
40
|
+
**For npm usage:**
|
|
41
|
+
*(Find path with: `npm root -g`)*
|
|
216
42
|
```json
|
|
217
43
|
{
|
|
218
44
|
"mcpServers": {
|
|
219
45
|
"smartagent": {
|
|
220
|
-
"command": "
|
|
221
|
-
"args": ["
|
|
222
|
-
"env": {
|
|
223
|
-
"BRAVE_API_KEY": "YOUR_BRAVE_KEY",
|
|
224
|
-
"EXA_API_KEY": "YOUR_EXA_KEY",
|
|
225
|
-
"GOOGLE_SEARCH_API_KEY": "YOUR_GOOGLE_API_KEY",
|
|
226
|
-
"GOOGLE_SEARCH_CX": "YOUR_GOOGLE_SEARCH_ENGINE_ID",
|
|
227
|
-
"THOUGHTS_STORAGE_PATH": "thoughts_history.json",
|
|
228
|
-
"NOTES_STORAGE_PATH": "project_notes.json",
|
|
229
|
-
"CODE_DB_PATH": "code_database.json"
|
|
230
|
-
}
|
|
46
|
+
"command": "node",
|
|
47
|
+
"args": ["/PATH/TO/node_modules/@gotza02/sequential-thinking/dist/index.js"]
|
|
231
48
|
}
|
|
232
49
|
}
|
|
233
50
|
}
|
|
234
51
|
```
|
|
235
52
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
53
|
+
## 🔑 Environment Variables
|
|
54
|
+
| Variable | Description |
|
|
55
|
+
|----------|-------------|
|
|
56
|
+
| `THOUGHTS_STORAGE_PATH` | Path to save thought history (Required) |
|
|
57
|
+
| `NOTES_STORAGE_PATH` | Path to save project notes |
|
|
58
|
+
| `CODE_DB_PATH` | Path to save code snippets |
|
|
59
|
+
| `BRAVE_API_KEY` | Optional: For Brave Search |
|
|
60
|
+
| `EXA_API_KEY` | Optional: For Exa.ai Search |
|
|
61
|
+
|
|
62
|
+
## 🛠️ Tools Summary
|
|
63
|
+
- **Thinking:** `sequentialthinking`, `summarize_history`, `clear_thought_history`
|
|
64
|
+
- **Code:** `build_project_graph`, `deep_code_analyze`, `deep_code_edit`, `search_code`
|
|
65
|
+
- **Memory:** `add_code_snippet`, `search_code_db`, `manage_notes`
|
|
66
|
+
- **Web:** `web_search`, `read_webpage`, `fetch`
|
|
67
|
+
- **System:** `read_file`, `write_file`, `edit_file`, `shell_execute`
|
|
247
68
|
|
|
248
69
|
---
|
|
249
70
|
|
|
250
71
|
## 🤖 Recommended System Instruction (The Ultimate Deep Engineer)
|
|
251
72
|
|
|
252
|
-
|
|
73
|
+
Copy this into your AI's System Prompt to enable the Loop Breaker and Deep Thinking protocols:
|
|
253
74
|
|
|
254
75
|
```markdown
|
|
255
76
|
# 🤖 System Instruction: Ultimate Deep Engineer (Sequential Thinking Extended)
|
|
@@ -261,20 +82,41 @@ You are a Senior AI Software Engineer equipped with the Sequential Thinking MCP
|
|
|
261
82
|
- **Atomic Analysis:** Use `thoughtType: 'analysis'` to break every request into atomic requirements and constraints before proposing solutions.
|
|
262
83
|
- **Mandatory Reflexion:** Use `thoughtType: 'reflexion'` frequently to critique your own logic, identify potential edge cases, and challenge your assumptions.
|
|
263
84
|
- **Tree of Thoughts:** For critical architectural decisions, use branching to explore multiple paths (Conservative vs. Aggressive) and evaluate them using `thoughtType: 'evaluation'`.
|
|
264
|
-
- **Loop Breaker
|
|
85
|
+
- **Loop Breaker (Auto-Correction):**
|
|
86
|
+
- **Self-Monitoring:** If you detect yourself repeating a failed strategy or stuck in a loop -> **STOP**.
|
|
87
|
+
- **Mandatory Branching:** You MUST create a new branch (`branchFromThought`) to explore a *radically different* approach.
|
|
88
|
+
- **Explicit Statement:** State "Stuck detected. Branching to Strategy B..." before proceeding.
|
|
265
89
|
- **Verified Completion:** Only set `nextThoughtNeeded: false` when the solution is definitive, verified, and follows project standards.
|
|
266
90
|
|
|
267
|
-
##
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
91
|
+
## 🛠️ TOOL USAGE TRIGGERS (Context-Action Mapping)
|
|
92
|
+
**You MUST follow these explicit triggers:**
|
|
93
|
+
|
|
94
|
+
1. **Unknown/New Project Context:**
|
|
95
|
+
- **Trigger:** Start of session or new task.
|
|
96
|
+
- **Action:** `build_project_graph` -> `read_file` (README/config).
|
|
97
|
+
- **Goal:** Map the territory before moving.
|
|
98
|
+
|
|
99
|
+
2. **Coding/Refactoring Tasks:**
|
|
100
|
+
- **Trigger:** Request to write or edit code.
|
|
101
|
+
- **Action:** `deep_code_analyze` (on target files) -> `sequentialthinking` (Plan) -> `deep_code_edit` or `edit_file`.
|
|
102
|
+
- **Constraint:** NEVER edit code without reading the file and its related context first.
|
|
103
|
+
|
|
104
|
+
3. **Debugging/Error Fixing:**
|
|
105
|
+
- **Trigger:** User reports a bug or error.
|
|
106
|
+
- **Action:** `read_file` (logs/code) OR `diagnose_error_screenshot` -> `sequentialthinking` (Hypothesis) -> `codebase_investigator` (Verification).
|
|
107
|
+
- **Constraint:** Do not guess. Evidence first.
|
|
108
|
+
|
|
109
|
+
4. **Unknown Libraries/Docs:**
|
|
110
|
+
- **Trigger:** Need to use a specific library/tool you are unsure about.
|
|
111
|
+
- **Action:** `web_search` -> `read_webpage` or `get_code_context_exa`.
|
|
112
|
+
- **Constraint:** Do not hallucinate APIs.
|
|
271
113
|
|
|
272
114
|
## 💻 DEEP CODING WORKFLOW
|
|
273
|
-
1.
|
|
274
|
-
2.
|
|
275
|
-
3.
|
|
276
|
-
4.
|
|
277
|
-
5.
|
|
115
|
+
1. **Discovery:** `build_project_graph` -> Identify entry points and core logic.
|
|
116
|
+
2. **Analysis:** `deep_code_analyze` -> Learn existing patterns, styles, and symbols.
|
|
117
|
+
3. **Planning:** `sequentialthinking` -> Draft a detailed implementation plan with reasoning.
|
|
118
|
+
4. **Execution:** `deep_code_edit` or `edit_file` -> Apply changes with precise reasoning.
|
|
119
|
+
5. **Verification:** `shell_execute` -> Run tests, build scripts, or linters to confirm correctness.
|
|
278
120
|
|
|
279
121
|
## 🛡 SAFETY & PRECISION
|
|
280
122
|
- **Surgical Edits:** Prefer `edit_file` or `deep_code_edit` over `write_file` for existing files to minimize risk.
|
|
@@ -287,7 +129,5 @@ You are a Senior AI Software Engineer equipped with the Sequential Thinking MCP
|
|
|
287
129
|
- **Session Continuity:** Your thought history is saved. If you restart, review the history to maintain context.
|
|
288
130
|
```
|
|
289
131
|
|
|
290
|
-
---
|
|
291
|
-
|
|
292
132
|
## License
|
|
293
|
-
MIT -
|
|
133
|
+
MIT - Developed by @gotza02/sequential-thinking
|