Provides examples for interacting with the Sequential Thinking Tool API, demonstrating how to create sessions and post thoughts using curl commands.
Built as a Node.js backend service, providing the runtime environment for the Sequential Thinking Tool API.
Utilizes npm for package management and running predefined scripts for development and server execution.
Sequential Thinking Tool API
A Node.js/TypeScript backend for managing sequential thinking sessions and thoughts, supporting three robust interfaces for agent and human use:
- STDIO (MCP Tool): For local tool/agent/CLI integration using the Model Context Protocol (MCP) over stdin/stdout.
- SSE (Server-Sent Events): For streaming tool use in LLMs, agents, or web clients—enabling real-time, stepwise output.
- REST API: For standard HTTP request/response workflows.
Input validation is handled with Zod, and the app is ready for containerized deployment (e.g., Render).
Table of Contents
Installation
- Clone the repository:
- Install dependencies:
Running the Server
Using ts-node (development)
Using npm script (if available)
Using compiled JavaScript
Using Docker
The server will start on port 3000
by default, or the port specified in your PORT
environment variable. For Render or cloud deployment, ensure the PORT
env is set or inherited.
Interfaces & Usage
STDIO (MCP Tool)
For local agent/LLM/CLI integration using Model Context Protocol over stdin/stdout. Start the server in MCP mode:
- The process will accept MCP-compliant JSON messages on stdin and emit responses on stdout.
- Example (JSON-RPC):
- Streamed or batched responses will be sent back as JSON.
SSE (Streaming Tool/LLM)
For LLMs, agents, or web clients that require real-time, incremental output.
- POST a thought to
/api/sessions/:sessionId/thoughts
. - GET
/api/sessions/:sessionId/thoughts/stream
to receive a live stream of steps/thoughts as they are generated. - Each SSE event is a JSON object:
- Example (JavaScript):
- Useful for LLM tool wrappers, browser clients, or any agent needing streaming output.
REST API
Standard HTTP request/response endpoints for synchronous workflows.
1. Create Session with First Thought
- Endpoint:
POST /api/sessions
- Description: Creates a new session and stores the provided thought as the first thought in that session. Returns the new session ID and processed thought info.
- Request Body:
- Response:
2. Post Additional Thought
- Endpoint:
POST /api/sessions/:sessionId/thoughts
- Description: Adds a thought to the specified session. Input is validated using Zod.
- Request Body:
- Response:
Validation
All POST requests to /thoughts
are validated using Zod. Invalid requests will return a 400 status and a list of validation errors.
User Flow: Session Created on First Thought
- User sends their first thought to
/api/sessions
- The server creates a new session and stores the first thought.
- Returns the new
sessionId
and processed thought info.
Example curl:
Example response:
- User sends additional thoughts to
/api/sessions/:sessionId/thoughts
- The server adds the thought to the existing session.
Example curl:
Example response:
Example Error Response (invalid input)
Development
- TypeScript configuration is in
tsconfig.json
. - Zod schemas are in
src/types.ts
. - Validation middleware is in
src/api/validationMiddleware.ts
. - Main server logic is in
src/api/httpServer.ts
. - MCP/STDIO logic is in
src/mcp/mcpServer.ts
. - Dockerfile is provided for containerized deployments.
License
MIT
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
A Node.js/TypeScript backend for managing sequential thinking sessions, allowing users to create sessions and post thoughts in a structured sequence with support for real-time updates via Server-Sent Events.
Related MCP Servers
- -securityFlicense-qualityThis TypeScript-based server implements a simple notes system, allowing users to create and manage text notes and generate summaries, showcasing core MCP concepts.Last updated -27TypeScript
- AsecurityFlicenseAqualityA TypeScript Model Context Protocol server that integrates with Google Tasks API, allowing users to create, list, update, delete, and toggle completion status of tasks.Last updated -43JavaScript
- AsecurityAlicenseAqualityNode.js server implementing Model Context Protocol that enables interaction with TaskWarrior through natural language to view, filter, add, and complete tasks.Last updated -3131JavaScriptMIT License
- -securityFlicense-qualityA Node.js and TypeScript server project that provides a simple starter example with Express.js web server, supporting hot-reload, testing, and modular structure.Last updated -TypeScript