@j0hanz/thinkseq-mcp 2.0.0 → 2.2.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 +320 -227
- package/dist/app.js +25 -6
- package/dist/appConfig/env.d.ts +3 -0
- package/dist/appConfig/env.js +9 -0
- package/dist/appConfig/runDependencies.d.ts +4 -4
- package/dist/appConfig/runDependencies.js +45 -32
- package/dist/appConfig/shutdown.js +8 -5
- package/dist/assets/logo.svg +4029 -0
- package/dist/engine/revision.js +14 -26
- package/dist/engine/thoughtQueries.js +20 -13
- package/dist/engine/thoughtStore.d.ts +1 -1
- package/dist/engine/thoughtStore.js +107 -102
- package/dist/engine.js +84 -62
- package/dist/index.js +1 -0
- package/dist/instructions.md +38 -30
- package/dist/lib/context.js +11 -3
- package/dist/lib/diagnostics.d.ts +4 -1
- package/dist/lib/diagnostics.js +1 -1
- package/dist/lib/errors.d.ts +1 -4
- package/dist/lib/errors.js +6 -5
- package/dist/lib/mcpLogging.js +25 -9
- package/dist/lib/stdioGuards.js +72 -24
- package/dist/lib/types.d.ts +3 -1
- package/dist/tools/thinkseq.d.ts +1 -1
- package/dist/tools/thinkseq.js +23 -24
- package/package.json +25 -17
- package/dist/tsconfig.tsbuildinfo +0 -1
package/README.md
CHANGED
|
@@ -1,85 +1,92 @@
|
|
|
1
1
|
# ThinkSeq MCP Server
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@j0hanz/thinkseq-mcp) [](https://opensource.org/licenses/MIT) [](https://nodejs.org) [](https://www.typescriptlang.org) [](https://modelcontextprotocol.io)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[](https://insiders.vscode.dev/redirect?url=vscode%3Amcp%2Finstall%3F%7B%22name%22%3A%22thinkseq%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40j0hanz%2Fthinkseq-mcp%40latest%22%5D%7D) [](https://insiders.vscode.dev/redirect?url=vscode-insiders%3Amcp%2Finstall%3F%7B%22name%22%3A%22thinkseq%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40j0hanz%2Fthinkseq-mcp%40latest%22%5D%7D)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
A thinking and reasoning engine for the Model Context Protocol (MCP). Enables AI assistants to capture structured, sequential reasoning chains with full revision (destructive rewind) support, session isolation, and progress tracking.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
[](https://insiders.vscode.dev/redirect/mcp/install?name=thinkseq&inputs=%5B%5D&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40j0hanz%2Fthinkseq-mcp%40latest%22%5D%7D) [](https://insiders.vscode.dev/redirect/mcp/install?name=thinkseq&inputs=%5B%5D&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40j0hanz%2Fthinkseq-mcp%40latest%22%5D%7D&quality=insiders)
|
|
12
|
-
|
|
13
|
-
[](https://cursor.com/install-mcp?name=thinkseq&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBqMGhhbnovdGhpbmtzZXEtbWNwQGxhdGVzdCJdfQ==)
|
|
9
|
+
---
|
|
14
10
|
|
|
15
11
|
## Overview
|
|
16
12
|
|
|
17
|
-
ThinkSeq exposes a single
|
|
13
|
+
ThinkSeq provides an MCP server that exposes a single `thinkseq` tool for recording concise thinking steps. Each step is stored in-memory within isolated sessions, and the engine supports revising earlier steps — superseding the target and all subsequent active thoughts while preserving the full audit trail. The server communicates exclusively over **stdio** transport.
|
|
18
14
|
|
|
19
|
-
|
|
15
|
+
---
|
|
20
16
|
|
|
21
|
-
|
|
22
|
-
npx -y @j0hanz/thinkseq-mcp@latest
|
|
23
|
-
```
|
|
17
|
+
## Key Features
|
|
24
18
|
|
|
25
|
-
|
|
19
|
+
- **Sequential thinking steps** — Record atomic reasoning steps (up to 8,000 characters each) in order
|
|
20
|
+
- **Destructive revision (rewind)** — Revise any active thought; the target and all later thoughts are superseded, continuing from the corrected step
|
|
21
|
+
- **Session isolation** — Multiple independent thought histories via session IDs with pinned LRU eviction (default: 50 sessions)
|
|
22
|
+
- **Progress tracking** — Automatic `progress` (0–1) and `isComplete` signals returned with every response
|
|
26
23
|
|
|
27
|
-
|
|
28
|
-
thinkseq --max-thoughts 500 --max-memory-mb 100
|
|
29
|
-
```
|
|
24
|
+
---
|
|
30
25
|
|
|
31
|
-
|
|
26
|
+
## Tech Stack
|
|
32
27
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
28
|
+
| Component | Technology |
|
|
29
|
+
| --------------- | ---------------------------------------- |
|
|
30
|
+
| Runtime | Node.js ≥ 24 |
|
|
31
|
+
| Language | TypeScript 5.9+ |
|
|
32
|
+
| MCP SDK | `@modelcontextprotocol/sdk` ^1.26.0 |
|
|
33
|
+
| Validation | `zod` ^4.3.6 |
|
|
34
|
+
| Test framework | Native Node.js Test Runner (`node:test`) |
|
|
35
|
+
| Package manager | npm |
|
|
38
36
|
|
|
39
|
-
|
|
37
|
+
---
|
|
40
38
|
|
|
41
|
-
|
|
42
|
-
- `maxMemoryBytes` default: 100 MB (derived from `--max-memory-mb`).
|
|
43
|
-
- `packageReadTimeoutMs` default: 2000 ms.
|
|
44
|
-
- `shutdownTimeoutMs` default: 5000 ms.
|
|
39
|
+
## Architecture
|
|
45
40
|
|
|
46
|
-
|
|
41
|
+
1. **CLI** parses arguments (`--max-thoughts`, `--max-memory-mb`, etc.)
|
|
42
|
+
2. **`run()`** resolves dependencies and reads `package.json` for server identity
|
|
43
|
+
3. **McpServer** is created with embedded instructions, the `thinkseq` tool, `internal://instructions` resource, and `get-help` prompt
|
|
44
|
+
4. **StdioServerTransport** connects the server (stdio only)
|
|
45
|
+
5. **Stdio guards** are installed: initialization enforcement, invalid message rejection, parse error responder
|
|
46
|
+
6. **Shutdown handlers** listen for `SIGTERM`/`SIGINT` and gracefully close server, engine, and transport within a configurable timeout
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Repository Structure
|
|
49
51
|
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
52
|
+
```
|
|
53
|
+
thinkseq-mcp/
|
|
54
|
+
├── src/
|
|
55
|
+
│ ├── appConfig/ # Environment, run dependencies, shutdown, types
|
|
56
|
+
│ ├── engine/ # Revision logic, thought queries, thought store
|
|
57
|
+
│ ├── lib/ # CLI, context, diagnostics, errors, MCP logging, stdio guards
|
|
58
|
+
│ ├── schemas/ # Zod input/output schemas
|
|
59
|
+
│ ├── tools/ # MCP tool registration (thinkseq)
|
|
60
|
+
│ ├── app.ts # Core application wiring and lifecycle
|
|
61
|
+
│ ├── engine.ts # ThinkingEngine class (session management, processing)
|
|
62
|
+
│ ├── engineConfig.ts # Engine constants and defaults
|
|
63
|
+
│ ├── index.ts # Entry point (CLI → run)
|
|
64
|
+
│ └── instructions.md # Server instructions (bundled as resource/prompt)
|
|
65
|
+
├── tests/ # Unit and integration tests
|
|
66
|
+
├── scripts/
|
|
67
|
+
│ └── tasks.mjs # Custom build/test task runner
|
|
68
|
+
├── assets/
|
|
69
|
+
│ └── logo.svg # Server icon
|
|
70
|
+
├── package.json
|
|
71
|
+
└── tsconfig.json
|
|
59
72
|
```
|
|
60
73
|
|
|
61
|
-
|
|
62
|
-
<summary><b>VS Code</b></summary>
|
|
74
|
+
---
|
|
63
75
|
|
|
64
|
-
|
|
76
|
+
## Requirements
|
|
65
77
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
"mcpServers": {
|
|
69
|
-
"thinkseq": {
|
|
70
|
-
"command": "npx",
|
|
71
|
-
"args": ["-y", "@j0hanz/thinkseq-mcp@latest"]
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
```
|
|
78
|
+
- **Node.js** ≥ 24
|
|
79
|
+
- **npm** (included with Node.js)
|
|
76
80
|
|
|
77
|
-
|
|
81
|
+
---
|
|
78
82
|
|
|
79
|
-
|
|
80
|
-
<summary><b>Claude Desktop</b></summary>
|
|
83
|
+
## Quickstart
|
|
81
84
|
|
|
82
|
-
|
|
85
|
+
```bash
|
|
86
|
+
npx -y @j0hanz/thinkseq-mcp@latest
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Add to your MCP client configuration:
|
|
83
90
|
|
|
84
91
|
```json
|
|
85
92
|
{
|
|
@@ -92,111 +99,99 @@ Add to your `claude_desktop_config.json`:
|
|
|
92
99
|
}
|
|
93
100
|
```
|
|
94
101
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
<details>
|
|
98
|
-
<summary><b>Cursor</b></summary>
|
|
102
|
+
---
|
|
99
103
|
|
|
100
|
-
|
|
101
|
-
2. Click **Add New MCP Server**.
|
|
102
|
-
3. Fill in the details:
|
|
103
|
-
- **Name:** `thinkseq`
|
|
104
|
-
- **Type:** `command`
|
|
105
|
-
- **Command:** `npx -y @j0hanz/thinkseq-mcp@latest`
|
|
104
|
+
## Installation
|
|
106
105
|
|
|
107
|
-
|
|
106
|
+
### NPX (recommended)
|
|
108
107
|
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
```bash
|
|
109
|
+
npx -y @j0hanz/thinkseq-mcp@latest
|
|
110
|
+
```
|
|
111
111
|
|
|
112
|
-
|
|
112
|
+
### Global Install
|
|
113
113
|
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
"thinkseq": {
|
|
118
|
-
"command": "npx",
|
|
119
|
-
"args": ["-y", "@j0hanz/thinkseq-mcp@latest"]
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
114
|
+
```bash
|
|
115
|
+
npm install -g @j0hanz/thinkseq-mcp
|
|
116
|
+
thinkseq
|
|
123
117
|
```
|
|
124
118
|
|
|
125
|
-
|
|
119
|
+
### From Source
|
|
126
120
|
|
|
127
|
-
|
|
121
|
+
```bash
|
|
122
|
+
git clone https://github.com/j0hanz/thinkseq-mcp-server.git
|
|
123
|
+
cd thinkseq-mcp-server
|
|
124
|
+
npm install
|
|
125
|
+
npm run build
|
|
126
|
+
npm start
|
|
127
|
+
```
|
|
128
128
|
|
|
129
|
-
|
|
129
|
+
---
|
|
130
130
|
|
|
131
|
-
|
|
131
|
+
## Configuration
|
|
132
132
|
|
|
133
|
-
|
|
134
|
-
| :--------------- | :----- | :------: | :----------------------------------------------------------------- |
|
|
135
|
-
| `thought` | string | yes | Current thinking step (1-8000 chars). |
|
|
136
|
-
| `sessionId` | string | no | Optional session identifier to isolate thought histories. |
|
|
137
|
-
| `totalThoughts` | number | no | Estimated total thoughts (1-25, default: 3). |
|
|
138
|
-
| `revisesThought` | number | no | Revise a previous thought by number. Original preserved for audit. |
|
|
133
|
+
### CLI Arguments
|
|
139
134
|
|
|
140
|
-
|
|
135
|
+
| Flag | Type | Description |
|
|
136
|
+
| ------------------------------------ | ------ | ----------------------------------- |
|
|
137
|
+
| `--max-thoughts <number>` | number | Max thoughts to keep in memory |
|
|
138
|
+
| `--max-memory-mb <number>` | number | Max memory (MB) for stored thoughts |
|
|
139
|
+
| `--shutdown-timeout-ms <number>` | number | Graceful shutdown timeout (ms) |
|
|
140
|
+
| `--package-read-timeout-ms <number>` | number | Package.json read timeout (ms) |
|
|
141
|
+
| `-h`, `--help` | flag | Show help text |
|
|
141
142
|
|
|
142
|
-
|
|
143
|
+
### Engine Defaults
|
|
143
144
|
|
|
144
|
-
|
|
145
|
+
| Parameter | Default | Max |
|
|
146
|
+
| ------------------------- | -------- | ------ |
|
|
147
|
+
| Max thoughts per session | 500 | 10,000 |
|
|
148
|
+
| Max memory | 100 MB | — |
|
|
149
|
+
| Thought overhead estimate | 200 B | — |
|
|
150
|
+
| Max sessions (LRU) | 50 | 10,000 |
|
|
151
|
+
| Default total thoughts | 3 | 25 |
|
|
152
|
+
| Default shutdown timeout | 5,000 ms | — |
|
|
153
|
+
| Package read timeout | 2,000 ms | — |
|
|
145
154
|
|
|
146
|
-
|
|
147
|
-
| :------- | :------ | :----------------------------------- |
|
|
148
|
-
| `ok` | boolean | `true` on success, `false` on error. |
|
|
149
|
-
| `result` | object | Present when `ok` is true. |
|
|
150
|
-
| `error` | object | Present when `ok` is false. |
|
|
155
|
+
### Environment Variables
|
|
151
156
|
|
|
152
|
-
|
|
157
|
+
| Variable | Default | Description |
|
|
158
|
+
| ------------------------------- | ------- | ------------------------------------------------------------------------------ |
|
|
159
|
+
| `THINKSEQ_INCLUDE_TEXT_CONTENT` | `true` | Set to `0`, `false`, `no`, or `off` to omit JSON string content from responses |
|
|
153
160
|
|
|
154
|
-
|
|
155
|
-
| :--------------------- | :------- | :--------------------------------------------------- |
|
|
156
|
-
| `thoughtNumber` | number | Auto-incremented thought number. |
|
|
157
|
-
| `totalThoughts` | number | Effective total thoughts (at least `thoughtNumber`). |
|
|
158
|
-
| `progress` | number | `thoughtNumber / totalThoughts` (0 to 1). |
|
|
159
|
-
| `isComplete` | boolean | `true` when `thoughtNumber >= totalThoughts`. |
|
|
160
|
-
| `thoughtHistoryLength` | number | Stored thought count after pruning. |
|
|
161
|
-
| `hasRevisions` | boolean | `true` if any thought has been revised. |
|
|
162
|
-
| `activePathLength` | number | Count of non-superseded thoughts. |
|
|
163
|
-
| `revisableThoughts` | number[] | Thought numbers available for revision. |
|
|
164
|
-
| `context` | object | Recent context summary (see below). |
|
|
161
|
+
---
|
|
165
162
|
|
|
166
|
-
|
|
163
|
+
## Usage
|
|
167
164
|
|
|
168
|
-
|
|
169
|
-
| :--------------- | :----- | :---------------------------------------------------------------------- |
|
|
170
|
-
| `recentThoughts` | array | Up to the last 5 active thoughts with `stepIndex`, `number`, `preview`. |
|
|
171
|
-
| `revisionInfo` | object | Present when revising: `revises` (number) and `supersedes` (number[]). |
|
|
165
|
+
### stdio (default and only transport)
|
|
172
166
|
|
|
173
|
-
|
|
167
|
+
```bash
|
|
168
|
+
# Direct
|
|
169
|
+
npx -y @j0hanz/thinkseq-mcp@latest
|
|
174
170
|
|
|
175
|
-
|
|
176
|
-
-
|
|
177
|
-
|
|
171
|
+
# With options
|
|
172
|
+
npx -y @j0hanz/thinkseq-mcp@latest --max-thoughts 1000 --max-memory-mb 200
|
|
173
|
+
```
|
|
178
174
|
|
|
179
|
-
|
|
175
|
+
---
|
|
180
176
|
|
|
181
|
-
|
|
182
|
-
| :----------------------------- | :---------------------------------------------- |
|
|
183
|
-
| `E_REVISION_TARGET_NOT_FOUND` | The requested thought number does not exist. |
|
|
184
|
-
| `E_REVISION_TARGET_SUPERSEDED` | The requested thought was already superseded. |
|
|
185
|
-
| `E_THINK` | Unexpected tool failure while processing input. |
|
|
177
|
+
## MCP Surface
|
|
186
178
|
|
|
187
|
-
###
|
|
179
|
+
### Tools
|
|
188
180
|
|
|
189
|
-
|
|
181
|
+
#### `thinkseq`
|
|
190
182
|
|
|
191
|
-
|
|
183
|
+
Record a concise thinking step. Supports sequential appending and destructive revision of prior steps.
|
|
192
184
|
|
|
193
|
-
|
|
194
|
-
{
|
|
195
|
-
"thought": "3 steps: parse -> validate -> transform"
|
|
196
|
-
}
|
|
197
|
-
```
|
|
185
|
+
**Parameters:**
|
|
198
186
|
|
|
199
|
-
|
|
187
|
+
| Name | Type | Required | Default | Description |
|
|
188
|
+
| ---------------- | ------ | -------- | ----------- | -------------------------------------------------------------------------- |
|
|
189
|
+
| `thought` | string | Yes | — | Your current thinking step (1–8,000 characters) |
|
|
190
|
+
| `sessionId` | string | No | `"default"` | Session identifier to isolate thought histories (1–200 chars) |
|
|
191
|
+
| `totalThoughts` | number | No | `3` | Estimated total thoughts (1–25) |
|
|
192
|
+
| `revisesThought` | number | No | — | Revise a previous thought by number (≥ 1). Original is preserved for audit |
|
|
193
|
+
|
|
194
|
+
**Returns** (structured output):
|
|
200
195
|
|
|
201
196
|
```json
|
|
202
197
|
{
|
|
@@ -204,18 +199,19 @@ Output (success):
|
|
|
204
199
|
"result": {
|
|
205
200
|
"thoughtNumber": 1,
|
|
206
201
|
"totalThoughts": 3,
|
|
207
|
-
"progress": 0.
|
|
202
|
+
"progress": 0.333,
|
|
208
203
|
"isComplete": false,
|
|
209
204
|
"thoughtHistoryLength": 1,
|
|
210
205
|
"hasRevisions": false,
|
|
211
206
|
"activePathLength": 1,
|
|
212
207
|
"revisableThoughts": [1],
|
|
208
|
+
"revisableThoughtsTotal": 1,
|
|
213
209
|
"context": {
|
|
214
210
|
"recentThoughts": [
|
|
215
211
|
{
|
|
216
212
|
"stepIndex": 1,
|
|
217
213
|
"number": 1,
|
|
218
|
-
"preview": "
|
|
214
|
+
"preview": "First step of reasoning..."
|
|
219
215
|
}
|
|
220
216
|
]
|
|
221
217
|
}
|
|
@@ -223,128 +219,225 @@ Output (success):
|
|
|
223
219
|
}
|
|
224
220
|
```
|
|
225
221
|
|
|
226
|
-
**
|
|
222
|
+
**Revision example:**
|
|
227
223
|
|
|
228
|
-
|
|
224
|
+
```json
|
|
225
|
+
{
|
|
226
|
+
"thought": "Better approach: use caching instead",
|
|
227
|
+
"revisesThought": 2
|
|
228
|
+
}
|
|
229
|
+
```
|
|
229
230
|
|
|
230
|
-
|
|
231
|
+
Returns additional `revisionInfo` in `context`:
|
|
231
232
|
|
|
232
233
|
```json
|
|
233
234
|
{
|
|
234
|
-
"
|
|
235
|
-
|
|
235
|
+
"context": {
|
|
236
|
+
"recentThoughts": [...],
|
|
237
|
+
"revisionInfo": {
|
|
238
|
+
"revises": 2,
|
|
239
|
+
"supersedes": [2, 3],
|
|
240
|
+
"supersedesTotal": 2
|
|
241
|
+
}
|
|
242
|
+
}
|
|
236
243
|
}
|
|
237
244
|
```
|
|
238
245
|
|
|
239
|
-
|
|
246
|
+
**Error codes:**
|
|
247
|
+
|
|
248
|
+
| Code | Description |
|
|
249
|
+
| ------------------------------ | ------------------------------------------ |
|
|
250
|
+
| `E_THINK` | General processing error |
|
|
251
|
+
| `E_REVISION_MISSING` | `revisesThought` required but not provided |
|
|
252
|
+
| `E_REVISION_TARGET_NOT_FOUND` | Target thought number does not exist |
|
|
253
|
+
| `E_REVISION_TARGET_SUPERSEDED` | Target thought was already superseded |
|
|
254
|
+
|
|
255
|
+
### Resources
|
|
256
|
+
|
|
257
|
+
| URI | MIME Type | Description |
|
|
258
|
+
| ------------------------- | --------------- | ------------------------- |
|
|
259
|
+
| `internal://instructions` | `text/markdown` | Server usage instructions |
|
|
260
|
+
|
|
261
|
+
### Prompts
|
|
262
|
+
|
|
263
|
+
| Name | Description |
|
|
264
|
+
| ---------- | -------------------------------------- |
|
|
265
|
+
| `get-help` | Get usage instructions for this server |
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
## Client Configuration Examples
|
|
270
|
+
|
|
271
|
+
<details>
|
|
272
|
+
<summary>VS Code / VS Code Insiders</summary>
|
|
273
|
+
|
|
274
|
+
Add to your VS Code MCP settings (`.vscode/mcp.json` or User Settings):
|
|
240
275
|
|
|
241
276
|
```json
|
|
242
277
|
{
|
|
243
|
-
"
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
"progress": 0.6666666666666666,
|
|
248
|
-
"isComplete": false,
|
|
249
|
-
"thoughtHistoryLength": 2,
|
|
250
|
-
"hasRevisions": true,
|
|
251
|
-
"activePathLength": 1,
|
|
252
|
-
"revisableThoughts": [2],
|
|
253
|
-
"context": {
|
|
254
|
-
"recentThoughts": [
|
|
255
|
-
{
|
|
256
|
-
"stepIndex": 1,
|
|
257
|
-
"number": 2,
|
|
258
|
-
"preview": "Better approach: validate first, then parse"
|
|
259
|
-
}
|
|
260
|
-
],
|
|
261
|
-
"revisionInfo": {
|
|
262
|
-
"revises": 1,
|
|
263
|
-
"supersedes": [1]
|
|
264
|
-
}
|
|
278
|
+
"mcpServers": {
|
|
279
|
+
"thinkseq": {
|
|
280
|
+
"command": "npx",
|
|
281
|
+
"args": ["-y", "@j0hanz/thinkseq-mcp@latest"]
|
|
265
282
|
}
|
|
266
283
|
}
|
|
267
284
|
}
|
|
268
285
|
```
|
|
269
286
|
|
|
270
|
-
|
|
287
|
+
</details>
|
|
271
288
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
- `totalThoughts` defaults to 3, must be in 1-25, and is adjusted up to at least `thoughtNumber`.
|
|
275
|
-
- The engine stores thoughts in memory and prunes when limits are exceeded:
|
|
276
|
-
- `maxThoughts` default: 500 (cap 10000). When exceeded, prunes the oldest 10% (minimum excess).
|
|
277
|
-
- `maxMemoryBytes` default: 100 MB. When exceeded and history is large, prunes roughly 20% of history.
|
|
278
|
-
- `estimatedThoughtOverheadBytes` default: 200.
|
|
289
|
+
<details>
|
|
290
|
+
<summary>Claude Desktop</summary>
|
|
279
291
|
|
|
280
|
-
|
|
292
|
+
Add to `claude_desktop_config.json`:
|
|
281
293
|
|
|
282
|
-
|
|
294
|
+
```json
|
|
295
|
+
{
|
|
296
|
+
"mcpServers": {
|
|
297
|
+
"thinkseq": {
|
|
298
|
+
"command": "npx",
|
|
299
|
+
"args": ["-y", "@j0hanz/thinkseq-mcp@latest"]
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
```
|
|
283
304
|
|
|
284
|
-
|
|
285
|
-
- `thinkseq:lifecycle` for `lifecycle.started` and `lifecycle.shutdown`.
|
|
305
|
+
</details>
|
|
286
306
|
|
|
287
|
-
|
|
307
|
+
<details>
|
|
308
|
+
<summary>Cursor</summary>
|
|
288
309
|
|
|
289
|
-
|
|
310
|
+
Add to Cursor MCP settings:
|
|
290
311
|
|
|
291
|
-
|
|
312
|
+
```json
|
|
313
|
+
{
|
|
314
|
+
"mcpServers": {
|
|
315
|
+
"thinkseq": {
|
|
316
|
+
"command": "npx",
|
|
317
|
+
"args": ["-y", "@j0hanz/thinkseq-mcp@latest"]
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
```
|
|
292
322
|
|
|
293
|
-
|
|
323
|
+
Or use the deeplink:
|
|
294
324
|
|
|
295
|
-
|
|
325
|
+
```
|
|
326
|
+
cursor://anysphere.cursor-deeplink/mcp/install?name=thinkseq&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBqMGhhbnovdGhpbmtzZXEtbWNwQGxhdGVzdCJdfQ==
|
|
327
|
+
```
|
|
296
328
|
|
|
297
|
-
|
|
329
|
+
</details>
|
|
330
|
+
|
|
331
|
+
<details>
|
|
332
|
+
<summary>Windsurf</summary>
|
|
298
333
|
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
- `
|
|
321
|
-
- `
|
|
322
|
-
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
docs/ # Assets (logo)
|
|
339
|
-
dist/ # Build output
|
|
340
|
-
scripts/ # Quality gates and metrics helpers
|
|
341
|
-
metrics/ # Generated metrics outputs
|
|
334
|
+
Add to `~/.codeium/windsurf/mcp_config.json`:
|
|
335
|
+
|
|
336
|
+
```json
|
|
337
|
+
{
|
|
338
|
+
"mcpServers": {
|
|
339
|
+
"thinkseq": {
|
|
340
|
+
"command": "npx",
|
|
341
|
+
"args": ["-y", "@j0hanz/thinkseq-mcp@latest"]
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
</details>
|
|
348
|
+
|
|
349
|
+
---
|
|
350
|
+
|
|
351
|
+
## Security
|
|
352
|
+
|
|
353
|
+
### stdio Transport
|
|
354
|
+
|
|
355
|
+
- **stdout protection:** `console.log` and `console.warn` are bridged to MCP logging messages to prevent polluting the JSON-RPC stdio channel.
|
|
356
|
+
- **Initialization enforcement:** The server rejects any request before a valid `initialize` handshake and requires `notifications/initialized` before accepting tool calls.
|
|
357
|
+
- **Invalid message rejection:** Non-object and batch JSON-RPC messages are rejected with proper error codes.
|
|
358
|
+
- **Parse error handling:** Malformed JSON on stdin receives a JSON-RPC Parse Error response.
|
|
359
|
+
|
|
360
|
+
### Process Safety
|
|
361
|
+
|
|
362
|
+
- Unhandled rejections and uncaught exceptions are caught and result in a clean process exit.
|
|
363
|
+
- Graceful shutdown on `SIGTERM`/`SIGINT` with configurable timeout (default: 5 seconds).
|
|
364
|
+
|
|
365
|
+
---
|
|
366
|
+
|
|
367
|
+
## Development Workflow
|
|
368
|
+
|
|
369
|
+
### Install Dependencies
|
|
370
|
+
|
|
371
|
+
```bash
|
|
372
|
+
npm install
|
|
342
373
|
```
|
|
343
374
|
|
|
375
|
+
### Scripts
|
|
376
|
+
|
|
377
|
+
| Script | Command | Purpose |
|
|
378
|
+
| --------------- | -------------------------------------------- | ----------------------------------------------------------------- |
|
|
379
|
+
| `dev` | `tsc --watch --preserveWatchOutput` | Watch mode TypeScript compilation |
|
|
380
|
+
| `dev:run` | `node --env-file=.env --watch dist/index.js` | Run built server with auto-reload |
|
|
381
|
+
| `build` | `node scripts/tasks.mjs build` | Full build pipeline (clean → compile → validate → assets → chmod) |
|
|
382
|
+
| `start` | `node dist/index.js` | Run the built server |
|
|
383
|
+
| `test` | `node scripts/tasks.mjs test` | Run all tests (builds first) |
|
|
384
|
+
| `test:coverage` | `node scripts/tasks.mjs test --coverage` | Run tests with coverage |
|
|
385
|
+
| `type-check` | `node scripts/tasks.mjs type-check` | TypeScript type checking |
|
|
386
|
+
| `lint` | `eslint .` | Run ESLint |
|
|
387
|
+
| `lint:fix` | `eslint . --fix` | Auto-fix lint issues |
|
|
388
|
+
| `format` | `prettier --write .` | Format code with Prettier |
|
|
389
|
+
| `clean` | `node scripts/tasks.mjs clean` | Remove dist and build info files |
|
|
390
|
+
| `inspector` | `npx @modelcontextprotocol/inspector` | Launch MCP Inspector for debugging |
|
|
391
|
+
| `knip` | `knip` | Detect unused exports/dependencies |
|
|
392
|
+
|
|
393
|
+
---
|
|
394
|
+
|
|
395
|
+
## Build and Release
|
|
396
|
+
|
|
397
|
+
The build pipeline (`npm run build`) executes:
|
|
398
|
+
|
|
399
|
+
1. **Clean** — Remove `dist/` and `.tsbuildinfo` files
|
|
400
|
+
2. **Compile** — TypeScript compilation via `tsconfig.build.json`
|
|
401
|
+
3. **Validate** — Ensure `src/instructions.md` exists
|
|
402
|
+
4. **Copy assets** — Bundle `instructions.md` and `assets/` (including `logo.svg`) into `dist/`
|
|
403
|
+
5. **Make executable** — Set `dist/index.js` to mode `755`
|
|
404
|
+
|
|
405
|
+
### Publishing
|
|
406
|
+
|
|
407
|
+
Publishing is automated via GitHub Actions (`.github/workflows/publish.yml`):
|
|
408
|
+
|
|
409
|
+
- Triggered on GitHub release publication
|
|
410
|
+
- Pipeline: lint → type-check → test → coverage → build → `npm publish --access public`
|
|
411
|
+
- Uses npm Trusted Publishing (OIDC) for authentication
|
|
412
|
+
|
|
413
|
+
---
|
|
414
|
+
|
|
344
415
|
## Troubleshooting
|
|
345
416
|
|
|
346
|
-
|
|
417
|
+
### MCP Inspector
|
|
418
|
+
|
|
419
|
+
Use the MCP Inspector to debug and test the server interactively:
|
|
420
|
+
|
|
421
|
+
```bash
|
|
422
|
+
npx @modelcontextprotocol/inspector
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
### Common Issues
|
|
426
|
+
|
|
427
|
+
| Issue | Solution |
|
|
428
|
+
| -------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
|
|
429
|
+
| Server not responding | Ensure Node.js ≥ 24 is installed; check `node --version` |
|
|
430
|
+
| `initialize must be first request` | Client must send `initialize` before any other request |
|
|
431
|
+
| `notifications/initialized must follow initialize` | Client must send `notifications/initialized` after successful `initialize` |
|
|
432
|
+
| Thoughts disappearing | Check `--max-thoughts` and `--max-memory-mb` limits; old thoughts are pruned when limits are reached |
|
|
433
|
+
| Session not found | Sessions are in-memory only; they reset on server restart. Max 50 sessions by default (LRU eviction) |
|
|
434
|
+
|
|
435
|
+
### stdout/stderr Guidance
|
|
436
|
+
|
|
437
|
+
When running as a stdio MCP server, **never write directly to stdout** from custom code — this would corrupt the JSON-RPC protocol. The server automatically bridges `console.log`/`console.warn` to MCP logging. Use `console.error` for debug output that bypasses MCP.
|
|
438
|
+
|
|
439
|
+
---
|
|
347
440
|
|
|
348
|
-
##
|
|
441
|
+
## License
|
|
349
442
|
|
|
350
|
-
|
|
443
|
+
[MIT](https://opensource.org/licenses/MIT)
|