New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@j0hanz/thinkseq-mcp

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@j0hanz/thinkseq-mcp

An thinking and reasoning engine for the Model Context Protocol (MCP).

latest
Source
npmnpm
Version
2.2.0
Version published
Maintainers
1
Created
Source

ThinkSeq MCP Server

npm version License: MIT Node.js TypeScript MCP SDK

Install in VS Code Install in VS Code Insiders

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.

Overview

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.

Key Features

  • Sequential thinking steps — Record atomic reasoning steps (up to 8,000 characters each) in order
  • Destructive revision (rewind) — Revise any active thought; the target and all later thoughts are superseded, continuing from the corrected step
  • Session isolation — Multiple independent thought histories via session IDs with pinned LRU eviction (default: 50 sessions)
  • Progress tracking — Automatic progress (0–1) and isComplete signals returned with every response

Tech Stack

ComponentTechnology
RuntimeNode.js ≥ 24
LanguageTypeScript 5.9+
MCP SDK@modelcontextprotocol/sdk ^1.26.0
Validationzod ^4.3.6
Test frameworkNative Node.js Test Runner (node:test)
Package managernpm

Architecture

  • CLI parses arguments (--max-thoughts, --max-memory-mb, etc.)
  • run() resolves dependencies and reads package.json for server identity
  • McpServer is created with embedded instructions, the thinkseq tool, internal://instructions resource, and get-help prompt
  • StdioServerTransport connects the server (stdio only)
  • Stdio guards are installed: initialization enforcement, invalid message rejection, parse error responder
  • Shutdown handlers listen for SIGTERM/SIGINT and gracefully close server, engine, and transport within a configurable timeout

Repository Structure

thinkseq-mcp/
├── src/
│   ├── appConfig/        # Environment, run dependencies, shutdown, types
│   ├── engine/           # Revision logic, thought queries, thought store
│   ├── lib/              # CLI, context, diagnostics, errors, MCP logging, stdio guards
│   ├── schemas/          # Zod input/output schemas
│   ├── tools/            # MCP tool registration (thinkseq)
│   ├── app.ts            # Core application wiring and lifecycle
│   ├── engine.ts         # ThinkingEngine class (session management, processing)
│   ├── engineConfig.ts   # Engine constants and defaults
│   ├── index.ts          # Entry point (CLI → run)
│   └── instructions.md   # Server instructions (bundled as resource/prompt)
├── tests/                # Unit and integration tests
├── scripts/
│   └── tasks.mjs         # Custom build/test task runner
├── assets/
│   └── logo.svg          # Server icon
├── package.json
└── tsconfig.json

Requirements

  • Node.js ≥ 24
  • npm (included with Node.js)

Quickstart

npx -y @j0hanz/thinkseq-mcp@latest

Add to your MCP client configuration:

{
  "mcpServers": {
    "thinkseq": {
      "command": "npx",
      "args": ["-y", "@j0hanz/thinkseq-mcp@latest"]
    }
  }
}

Installation

npx -y @j0hanz/thinkseq-mcp@latest

Global Install

npm install -g @j0hanz/thinkseq-mcp
thinkseq

From Source

git clone https://github.com/j0hanz/thinkseq-mcp-server.git
cd thinkseq-mcp-server
npm install
npm run build
npm start

Configuration

CLI Arguments

FlagTypeDescription
--max-thoughts <number>numberMax thoughts to keep in memory
--max-memory-mb <number>numberMax memory (MB) for stored thoughts
--shutdown-timeout-ms <number>numberGraceful shutdown timeout (ms)
--package-read-timeout-ms <number>numberPackage.json read timeout (ms)
-h, --helpflagShow help text

Engine Defaults

ParameterDefaultMax
Max thoughts per session50010,000
Max memory100 MB
Thought overhead estimate200 B
Max sessions (LRU)5010,000
Default total thoughts325
Default shutdown timeout5,000 ms
Package read timeout2,000 ms

Environment Variables

VariableDefaultDescription
THINKSEQ_INCLUDE_TEXT_CONTENTtrueSet to 0, false, no, or off to omit JSON string content from responses

Usage

stdio (default and only transport)

# Direct
npx -y @j0hanz/thinkseq-mcp@latest

# With options
npx -y @j0hanz/thinkseq-mcp@latest --max-thoughts 1000 --max-memory-mb 200

MCP Surface

Tools

thinkseq

Record a concise thinking step. Supports sequential appending and destructive revision of prior steps.

Parameters:

NameTypeRequiredDefaultDescription
thoughtstringYesYour current thinking step (1–8,000 characters)
sessionIdstringNo"default"Session identifier to isolate thought histories (1–200 chars)
totalThoughtsnumberNo3Estimated total thoughts (1–25)
revisesThoughtnumberNoRevise a previous thought by number (≥ 1). Original is preserved for audit

Returns (structured output):

{
  "ok": true,
  "result": {
    "thoughtNumber": 1,
    "totalThoughts": 3,
    "progress": 0.333,
    "isComplete": false,
    "thoughtHistoryLength": 1,
    "hasRevisions": false,
    "activePathLength": 1,
    "revisableThoughts": [1],
    "revisableThoughtsTotal": 1,
    "context": {
      "recentThoughts": [
        {
          "stepIndex": 1,
          "number": 1,
          "preview": "First step of reasoning..."
        }
      ]
    }
  }
}

Revision example:

{
  "thought": "Better approach: use caching instead",
  "revisesThought": 2
}

Returns additional revisionInfo in context:

{
  "context": {
    "recentThoughts": [...],
    "revisionInfo": {
      "revises": 2,
      "supersedes": [2, 3],
      "supersedesTotal": 2
    }
  }
}

Error codes:

CodeDescription
E_THINKGeneral processing error
E_REVISION_MISSINGrevisesThought required but not provided
E_REVISION_TARGET_NOT_FOUNDTarget thought number does not exist
E_REVISION_TARGET_SUPERSEDEDTarget thought was already superseded

Resources

URIMIME TypeDescription
internal://instructionstext/markdownServer usage instructions

Prompts

NameDescription
get-helpGet usage instructions for this server

Client Configuration Examples

VS Code / VS Code Insiders

Add to your VS Code MCP settings (.vscode/mcp.json or User Settings):

{
  "mcpServers": {
    "thinkseq": {
      "command": "npx",
      "args": ["-y", "@j0hanz/thinkseq-mcp@latest"]
    }
  }
}
Claude Desktop

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "thinkseq": {
      "command": "npx",
      "args": ["-y", "@j0hanz/thinkseq-mcp@latest"]
    }
  }
}
Cursor

Add to Cursor MCP settings:

{
  "mcpServers": {
    "thinkseq": {
      "command": "npx",
      "args": ["-y", "@j0hanz/thinkseq-mcp@latest"]
    }
  }
}

Or use the deeplink:

cursor://anysphere.cursor-deeplink/mcp/install?name=thinkseq&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBqMGhhbnovdGhpbmtzZXEtbWNwQGxhdGVzdCJdfQ==
Windsurf

Add to ~/.codeium/windsurf/mcp_config.json:

{
  "mcpServers": {
    "thinkseq": {
      "command": "npx",
      "args": ["-y", "@j0hanz/thinkseq-mcp@latest"]
    }
  }
}

Security

stdio Transport

  • stdout protection: console.log and console.warn are bridged to MCP logging messages to prevent polluting the JSON-RPC stdio channel.
  • Initialization enforcement: The server rejects any request before a valid initialize handshake and requires notifications/initialized before accepting tool calls.
  • Invalid message rejection: Non-object and batch JSON-RPC messages are rejected with proper error codes.
  • Parse error handling: Malformed JSON on stdin receives a JSON-RPC Parse Error response.

Process Safety

  • Unhandled rejections and uncaught exceptions are caught and result in a clean process exit.
  • Graceful shutdown on SIGTERM/SIGINT with configurable timeout (default: 5 seconds).

Development Workflow

Install Dependencies

npm install

Scripts

ScriptCommandPurpose
devtsc --watch --preserveWatchOutputWatch mode TypeScript compilation
dev:runnode --env-file=.env --watch dist/index.jsRun built server with auto-reload
buildnode scripts/tasks.mjs buildFull build pipeline (clean → compile → validate → assets → chmod)
startnode dist/index.jsRun the built server
testnode scripts/tasks.mjs testRun all tests (builds first)
test:coveragenode scripts/tasks.mjs test --coverageRun tests with coverage
type-checknode scripts/tasks.mjs type-checkTypeScript type checking
linteslint .Run ESLint
lint:fixeslint . --fixAuto-fix lint issues
formatprettier --write .Format code with Prettier
cleannode scripts/tasks.mjs cleanRemove dist and build info files
inspectornpx @modelcontextprotocol/inspectorLaunch MCP Inspector for debugging
knipknipDetect unused exports/dependencies

Build and Release

The build pipeline (npm run build) executes:

  • Clean — Remove dist/ and .tsbuildinfo files
  • Compile — TypeScript compilation via tsconfig.build.json
  • Validate — Ensure src/instructions.md exists
  • Copy assets — Bundle instructions.md and assets/ (including logo.svg) into dist/
  • Make executable — Set dist/index.js to mode 755

Publishing

Publishing is automated via GitHub Actions (.github/workflows/publish.yml):

  • Triggered on GitHub release publication
  • Pipeline: lint → type-check → test → coverage → build → npm publish --access public
  • Uses npm Trusted Publishing (OIDC) for authentication

Troubleshooting

MCP Inspector

Use the MCP Inspector to debug and test the server interactively:

npx @modelcontextprotocol/inspector

Common Issues

IssueSolution
Server not respondingEnsure Node.js ≥ 24 is installed; check node --version
initialize must be first requestClient must send initialize before any other request
notifications/initialized must follow initializeClient must send notifications/initialized after successful initialize
Thoughts disappearingCheck --max-thoughts and --max-memory-mb limits; old thoughts are pruned when limits are reached
Session not foundSessions are in-memory only; they reset on server restart. Max 50 sessions by default (LRU eviction)

stdout/stderr Guidance

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.

License

MIT

Keywords

mcp

FAQs

Package last updated on 09 Feb 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts