Sequential Thinking Tool API

by bta4935
Integrations
  • 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.

순차적 사고 도구 API

Zod를 통한 강력한 입력 검증과 간단한 메모리 내 세션 저장소를 특징으로 하는 순차적 사고 세션과 생각을 관리하기 위한 Node.js/TypeScript 백엔드입니다.

목차


설치

  1. 저장소를 복제합니다.지엑스피1
  2. 종속성 설치:
    npm install

서버 실행

ts-node 사용(개발)

npx ts-node src/api/httpServer.ts

npm 스크립트 사용(사용 가능한 경우)

npm run dev

컴파일된 JavaScript 사용

npx tsc node dist/api/httpServer.js

서버는 기본적으로 포트 3000 에서 시작하거나 PORT 환경 변수에 지정된 포트에서 시작합니다.


API 엔드포인트

1. 첫 번째 생각으로 세션 만들기

  • 엔드포인트: POST /api/sessions
  • 설명: 새 세션을 생성하고 제공된 생각을 해당 세션의 첫 번째 생각으로 저장합니다. 새 세션 ID와 처리된 생각 정보를 반환합니다.
  • 요청 본문:
    { "thought": "string (required)", "thoughtNumber": 1, "totalThoughts": 3, "nextThoughtNeeded": true, "isRevision": false, // optional "revisesThought": 2, // optional "branchFromThought": 1, // optional "branchId": "string", // optional "needsMoreThoughts": false // optional }
  • 응답:
    { "sessionId": "<uuid>", "thoughtNumber": 1, "totalThoughts": 3, "nextThoughtNeeded": true, "branches": [], "thoughtHistoryLength": 1, "processedThought": "This is my first thought." }

2. 추가 생각 게시

  • 엔드포인트: POST /api/sessions/:sessionId/thoughts
  • 설명: 지정된 세션에 생각을 추가합니다. 입력은 Zod를 사용하여 검증됩니다.
  • 요청 본문:
    { "thought": "string (required)", "thoughtNumber": 2, "totalThoughts": 3, "nextThoughtNeeded": true, "isRevision": false, // optional "revisesThought": 1, // optional "branchFromThought": 1, // optional "branchId": "string", // optional "needsMoreThoughts": false // optional }
  • 응답:
    { "thoughtNumber": 2, "totalThoughts": 3, "nextThoughtNeeded": true, "branches": [], "thoughtHistoryLength": 2, "processedThought": "This is my second thought." }

MCP SSE(서버에서 보낸 이벤트)

개요

MCP SSE 엔드포인트는 SSE(Server-Sent Events)를 사용하여 서버 이벤트를 클라이언트로 실시간 단방향 스트리밍할 수 있도록 합니다. 이는 서버를 폴링하지 않고도 세션 또는 사고 처리에 대한 업데이트를 실시간으로 수신하려는 클라이언트에게 유용합니다.

엔드포인트

  • GET /api/mcp/sse
  • 설명: 지속적인 SSE 연결을 설정합니다. 서버는 이벤트가 발생하면 클라이언트에 이벤트를 푸시합니다.
  • 응답:
    • 콘텐츠 유형: text/event-stream
    • 이벤트는 data: 로 시작하는 줄로 전송되며, 그 뒤에 JSON으로 인코딩된 이벤트 객체가 옵니다.

curl 명령 예시

curl -N http://localhost:3000/api/mcp/sse

이벤트 응답 예시

data: {"event":"thoughtProcessed","sessionId":"...","thoughtNumber":1,"message":"Thought processed successfully."}

사용 참고 사항

  • 이벤트 수신을 계속하려면 연결을 열어 두세요.
  • 각 이벤트는 JSON 객체입니다. 클라이언트 측에 이벤트가 도착하면 처리하세요.
  • 특정 세션에 대한 이벤트를 수신해야 하는 경우 구현에서 지원하는 쿼리 매개변수를 포함합니다(예: /api/mcp/sse?sessionId=... ).

확인

/thoughts 에 대한 모든 POST 요청은 Zod를 사용하여 검증됩니다. 잘못된 요청은 400 상태 코드와 검증 오류 목록을 반환합니다.


사용자 흐름: 첫 번째 생각으로 세션 생성됨

  1. 사용자는 첫 번째 생각을 /api/sessions 로 보냅니다.
    • 서버는 새로운 세션을 생성하고 첫 번째 생각을 저장합니다.
    • 새로운 sessionId 와 처리된 생각 정보를 반환합니다.

    컬의 예:

    curl -X POST http://localhost:3000/api/sessions \ -H "Content-Type: application/json" \ -d '{ "thought": "This is my first thought.", "thoughtNumber": 1, "totalThoughts": 3, "nextThoughtNeeded": true }'

    응답 예시:

    { "sessionId": "abc123", "thoughtNumber": 1, "totalThoughts": 3, "nextThoughtNeeded": true, "branches": [], "thoughtHistoryLength": 1, "processedThought": "This is my first thought." }
  2. 사용자는 /api/sessions/:sessionId/thoughts 에 추가적인 생각을 보냅니다.
    • 서버는 기존 세션에 생각을 추가합니다.

    컬의 예:

    curl -X POST http://localhost:3000/api/sessions/abc123/thoughts \ -H "Content-Type: application/json" \ -d '{ "thought": "This is my second thought.", "thoughtNumber": 2, "totalThoughts": 3, "nextThoughtNeeded": true }'

    응답 예시:

    { "thoughtNumber": 2, "totalThoughts": 3, "nextThoughtNeeded": true, "branches": [], "thoughtHistoryLength": 2, "processedThought": "This is my second thought." }

오류 응답 예시(잘못된 입력)

{ "errors": [ { "path": ["thought"], "message": "Thought cannot be empty" } ] }

개발

  • TypeScript 구성은 tsconfig.json 에 있습니다.
  • Zod 스키마는 src/types.ts 에 있습니다.
  • 검증 미들웨어는 src/api/validationMiddleware.ts 에 있습니다.
  • 메인 서버 로직은 src/api/httpServer.ts 에 있습니다.

특허

MIT

-
security - not tested
F
license - not found
-
quality - not tested

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.

순차적 사고 세션을 관리하기 위한 Node.js/TypeScript 백엔드로, 사용자가 세션을 생성하고 구조화된 순서로 생각을 게시할 수 있으며, Server-Sent Events를 통한 실시간 업데이트가 지원됩니다.

  1. 목차
    1. 설치
      1. 서버 실행
        1. ts-node 사용(개발)
        2. npm 스크립트 사용(사용 가능한 경우)
        3. 컴파일된 JavaScript 사용
      2. API 엔드포인트
        1. 첫 번째 생각으로 세션 만들기
        2. 추가 생각 게시
      3. MCP SSE(서버에서 보낸 이벤트)
        1. 개요
        2. 엔드포인트
        3. curl 명령 예시
        4. 이벤트 응답 예시
        5. 사용 참고 사항
      4. 확인
        1. 사용자 흐름: 첫 번째 생각으로 세션 생성됨
          1. 오류 응답 예시(잘못된 입력)
        2. 개발
          1. 특허

            Related MCP Servers

            • -
              security
              F
              license
              -
              quality
              This 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 -
              2
              7
              TypeScript
              • Apple
            • A
              security
              F
              license
              A
              quality
              A 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 -
              4
              3
              JavaScript
            • A
              security
              A
              license
              A
              quality
              Node.js server implementing Model Context Protocol that enables interaction with TaskWarrior through natural language to view, filter, add, and complete tasks.
              Last updated -
              3
              13
              1
              JavaScript
              MIT License
            • -
              security
              F
              license
              -
              quality
              A 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

            View all related MCP servers

            MCP directory API

            We provide all the information about MCP servers via our MCP API.

            curl -X GET 'https://glama.ai/api/mcp/v1/servers/bta4935/SQ-MCP'

            If you have feedback or need assistance with the MCP directory API, please join our Discord server