Cortex MCP — Multi-Level Reasoning Server

io.github.j0hanz由 GitHub 帳號 j0hanz 發布v1.11.0更新於 Oct 24, 2026

Multi-level reasoning MCP server with configurable depth levels

已驗證STDIO僅桌面知識與記憶AI 與機器學習

概覽

AI 產生的概覽

本機 stdio 伺服器,為助理提供具狀態、可設定深度的多步推理工具,並保留可檢視的會話軌跡。

可以做什麼
  • 以 basic、normal、high 或 expert 深度執行並延續有步數上限的推理會話,可逐步進行或批次完成
  • 依步驟記錄結構化的觀察、假設與評估,回滾到較早步驟,或提前給出結論結束會話
  • 以資源形式讀取作用中會話清單、單一會話的 JSON 檢視、完整 markdown 軌跡與單一思考
  • 使用內建提示依指定深度開始推理、繼續會話、重試失敗任務或取得說明
適用情境
適合希望助理以明確、有上限的步驟推演難題,並留下可檢視或稽核軌跡,而非一次給出推理的情境。
執行需求
需要 Node.js 24 或更新版本,透過 npx 在本機執行此 npm 套件,以及支援 stdio 傳輸的 MCP 用戶端。Docker 僅用於容器映像,為選用。不需帳號、API 金鑰或標頭;選用環境變數可調整會話有效期、會話數量、權杖上限與軌跡遮蔽。
安裝前請注意
推理工具並非唯讀且不具冪等性:它會建立並修改記憶體中的會話,回滾會捨棄後續思考。會話在程序重啟後遺失,預設 30 分鐘後過期。除非啟用軌跡遮蔽,思考文字會原樣保存,請勿寫入機密資訊。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Cortex MCP — Multi-Level Reasoning Server,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

Cortex MCP

[npm version] [License]

[Install in VS Code] [Install in VS Code Insiders] [Install in Visual Studio]

[Add to LM Studio] [Install in Cursor] [Install in Goose]

Multi-level reasoning MCP server with configurable depth levels, session-based state management, structured thought input, and real-time trace resources.

Overview

Cortex MCP is a stdio-only MCP server for stateful, depth-controlled reasoning. The runtime entrypoint in src/index.ts connects createServer() to StdioServerTransport, and the server surface in src/server.ts enables tools, prompts, completions, logging, and subscribable resources around a single session-based reasoning engine.

The live MCP surface confirmed by Inspector is 1 tool, 6 concrete resources, 4 resource templates, and 7 prompts. Sessions are stored in memory, exposed as MCP resources, and cleared on process restart.

Key Features

  • reasoning_think supports step-by-step sessions, run_to_completion batches, rollback, early conclusion, and structured observation / hypothesis / evaluation input.
  • Four depth levels are built into the engine: basic, normal, high, and expert, each with bounded thought ranges and token budgets.
  • Prompt helpers expose reasoning.basic, reasoning.normal, reasoning.high, reasoning.expert, reasoning.continue, reasoning.retry, and get-help.
  • Resource endpoints expose internal docs plus live session lists, per-session JSON views, full markdown traces, and individual thought documents.
  • Completions are wired for levels, session IDs, and thought names through completable() and resource-template completion hooks.

Requirements

  • Node.js >=24 for local npx or npm usage.
  • An MCP client that supports stdio transport.
  • Optional: Docker if you want to build or run the container image defined by Dockerfile.

Quick Start

Use this standard MCP client configuration:

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

Client Configuration

Install in VS Code

[Install in VS Code]

Add to .vscode/mcp.json:

json
{  "servers": {    "cortex-mcp": {      "command": "npx",      "args": ["-y", "@j0hanz/cortex-mcp@latest"]    }  }}

Or install via CLI:

sh
code --add-mcp '{"name":"cortex-mcp","command":"npx","args":["-y","@j0hanz/cortex-mcp@latest"]}'

For more info, see VS Code MCP docs.

Install in VS Code Insiders

[Install in VS Code Insiders]

Add to .vscode/mcp.json:

json
{  "servers": {    "cortex-mcp": {      "command": "npx",      "args": ["-y", "@j0hanz/cortex-mcp@latest"]    }  }}

Or install via CLI:

sh
code-insiders --add-mcp '{"name":"cortex-mcp","command":"npx","args":["-y","@j0hanz/cortex-mcp@latest"]}'

For more info, see VS Code Insiders MCP docs.

Install in Cursor

[Install in Cursor]

Add to ~/.cursor/mcp.json:

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

For more info, see Cursor MCP docs.

Install in Visual Studio

[Install in Visual Studio]

Add to mcp.json (VS integrated):

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

For more info, see Visual Studio MCP docs.

Install in Goose

[Install in Goose]

Add to Goose extension registry:

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

For more info, see Goose MCP docs.

Install in LM Studio

[Add to LM Studio]

Add to LM Studio MCP config:

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

For more info, see LM Studio MCP docs.

Install in Claude Desktop

Add to claude_desktop_config.json:

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

For more info, see Claude Desktop MCP docs.

Install in Claude Code

Add to Claude Code CLI:

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

Or install via CLI:

sh
claude mcp add cortex-mcp -- npx -y @j0hanz/cortex-mcp@latest

For more info, see Claude Code MCP docs.

Install in Windsurf

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

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

For more info, see Windsurf MCP docs.

Install in Amp

Add to Amp MCP config:

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

Or install via CLI:

sh
amp mcp add cortex-mcp -- npx -y @j0hanz/cortex-mcp@latest

For more info, see Amp MCP docs.

Install in Cline

Add to cline_mcp_settings.json:

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

For more info, see Cline MCP docs.

Install in Codex CLI

Add to ~/.codex/config.yaml or codex CLI:

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

For more info, see Codex CLI MCP docs.

Install in GitHub Copilot

Add to .vscode/mcp.json:

json
{  "servers": {    "cortex-mcp": {      "command": "npx",      "args": ["-y", "@j0hanz/cortex-mcp@latest"]    }  }}

For more info, see GitHub Copilot MCP docs.

Install in Warp

Add to Warp MCP config:

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

For more info, see Warp MCP docs.

Install in Kiro

Add to .kiro/settings/mcp.json:

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

For more info, see Kiro MCP docs.

Install in Gemini CLI

Add to ~/.gemini/settings.json:

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

For more info, see Gemini CLI MCP docs.

Install in Zed

Add to ~/.config/zed/settings.json:

json
{  "context_servers": {    "cortex-mcp": {      "settings": {        "command": "npx",        "args": ["-y", "@j0hanz/cortex-mcp@latest"]      }    }  }}

For more info, see Zed MCP docs.

Install in Augment

Add to VS Code settings.json:

Add to your VS Code settings.json under augment.advanced.

json
{  "augment.advanced": {    "mcpServers": [      {        "id": "cortex-mcp",        "command": "npx",        "args": ["-y", "@j0hanz/cortex-mcp@latest"]      }    ]  }}

For more info, see Augment MCP docs.

Install in Roo Code

Add to Roo Code MCP settings:

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

For more info, see Roo Code MCP docs.

Install in Kilo Code

Add to Kilo Code MCP settings:

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

For more info, see Kilo Code MCP docs.

Use Cases

Start bounded reasoning at the right depth

Use reasoning.basic, reasoning.normal, reasoning.high, or reasoning.expert when the client wants a prompt-first entrypoint, or call reasoning_think directly with query, level, and the first thought. Each response returns the current session state plus a summary string that tells the client how to continue.

Relevant tool: reasoning_think
Related prompts: reasoning.basic, reasoning.normal, reasoning.high, reasoning.expert

Continue, retry, or batch an active session

Reuse sessionId to continue a prior trace, switch to runMode="run_to_completion" when you already have the remaining thought inputs, or use the continuation and retry prompts to generate the next call payload. The handler also supports rollbackToStep and isConclusion for revising or ending a trace early.

Relevant tool: reasoning_think
Related prompts: reasoning.continue, reasoning.retry

Inspect live traces without re-running the tool

Read reasoning://sessions for the active session list, reasoning://sessions/{sessionId} for the JSON detail view, reasoning://sessions/{sessionId}/trace for the markdown transcript, or reasoning://sessions/{sessionId}/thoughts/{thoughtName} for a single thought. This lets a client present progress or audit a session independently from the next tool call.

Relevant resources: reasoning://sessions, reasoning://sessions/{sessionId}, reasoning://sessions/{sessionId}/trace, reasoning://sessions/{sessionId}/thoughts/{thoughtName}

Architecture

text
[MCP Client]    |    | stdio    v[src/index.ts]    createServer()    -> new StdioServerTransport()    -> server.connect(transport)    |    v[src/server.ts]    McpServer("cortex-mcp")    capabilities:      - tools      - prompts      - completions      - logging      - resources { subscribe: true, listChanged: true }    |    +--> tools/call    |     -> reasoning_think    |     -> src/tools/reasoning-think.ts    |     -> ReasoningThinkInputSchema / ReasoningThinkToolOutputSchema    |     -> src/engine/reasoner.ts    |     -> SessionStore    |    +--> prompts/get    |     -> src/prompts/index.ts    |    +--> resources/read    |     -> src/resources/index.ts    |     -> internal://* and reasoning://sessions/*    |    +--> notifications          -> logging messages          -> resources/list_changed          -> resources/updated          -> notifications/progress

Request Lifecycle

text
[Client] -- initialize --> [Server][Server] -- serverInfo + capabilities --> [Client][Client] -- notifications/initialized --> [Server][Client] -- tools/call {name: "reasoning_think", arguments} --> [Handler][Handler] -- validate args --> [Reasoner + SessionStore][Reasoner] -- progress/resource events --> [Server notifications][Handler] -- structuredContent + optional trace resource --> [Client]

MCP Surface

Tools

reasoning_think

Stateful reasoning tool for creating and continuing multi-step sessions. It supports one-step interactive calls, run_to_completion batches, structured observation/hypothesis/evaluation input, rollback, and early conclusion while returning structured session state.

ParameterTypeRequiredDescription
querystringnoQuestion or problem to analyze.
levelstringnoDepth level. Required for new sessions. basic (1–3 steps, 2K budget), normal (4–8 steps, 8K budget), high (10–15 steps, 32K budget), expert (20–25 steps, 128K budget).
targetThoughtsintegernoExact step count. Must fit level range.
sessionIdstringnoSession ID to continue.
runModestringno"step" (default) or "run_to_completion".
thoughtanynoReasoning text. Stored verbatim. String for step mode, string[] for batch.
isConclusionbooleannoEnd session early at final answer.
rollbackToStepintegerno0-based index to rollback to. Discards later thoughts.
stepSummarystringnoOne-sentence step summary.
observationstringnoKnown facts at this step.
hypothesisstringnoProposed next idea.
evaluationstringnoCritique of hypothesis.
Data Flow
text
1. [Client] -- tools/call {name: "reasoning_think", arguments} --> [Server]   Transport: stdio2. [Server] -- dispatch("reasoning_think") --> [Handler: src/tools/reasoning-think.ts]3. [Handler] -- validate(ReasoningThinkInputSchema) --> [src/engine/reasoner.ts]4. [Reasoner] -- create/update session --> [src/engine/session-store.ts]5. [Handler] -- structuredContent + optional embedded trace resource --> [Client]

Resources

ResourceURI or TemplateMIME TypeDescription
server-instructionsinternal://instructionstext/markdownUsage instructions for the MCP server.
server-configinternal://server-configapplication/jsonRuntime limits and level configurations for the reasoning server.
tool-cataloginternal://tool-catalogtext/markdownTool reference: models, params, outputs, data flow.
tool-infointernal://tool-info/{toolName}text/markdownPer-tool contract details.
tool-info-reasoning_thinkinternal://tool-info/reasoning_thinktext/markdownContract details for reasoning_think.
workflowsinternal://workflowstext/markdownRecommended workflows and tool sequences.
reasoning.sessionsreasoning://sessionsapplication/jsonList of active reasoning sessions with summaries. Updated in real-time as sessions progress.
reasoning.sessionreasoning://sessions/{sessionId}application/jsonDetailed view of a single reasoning session, including all thoughts and metadata.
reasoning.tracereasoning://sessions/{sessionId}/tracetext/markdownMarkdown trace of a reasoning session (full content).
reasoning.thoughtreasoning://sessions/{sessionId}/thoughts/{thoughtName}text/markdownMarkdown content of a single thought (for example Thought-1).

Prompts

PromptArgumentsDescription
get-helpnoneReturn server usage instructions.
reasoning.basicquery required, targetThoughts optionalBasic-depth reasoning (1-3 thoughts).
reasoning.normalquery required, targetThoughts optionalNormal-depth reasoning (4-8 thoughts).
reasoning.highquery required, targetThoughts optionalHigh-depth reasoning (10-15 thoughts).
reasoning.expertquery required, targetThoughts optionalExpert-depth reasoning (20-25 thoughts).
reasoning.continuesessionId required, query optional, level optionalContinue an existing session. Optional follow-up query.
reasoning.retryquery required, level required, targetThoughts optionalRetry a failed reasoning task with modified parameters.

MCP Capabilities

CapabilityStatusEvidence
toolsconfirmedsrc/server.ts:203-205, src/tools/reasoning-think.ts:479
promptsconfirmedsrc/server.ts:205, src/prompts/index.ts:201
completionsconfirmedsrc/server.ts:207, src/prompts/index.ts:249, src/resources/index.ts:375
loggingconfirmedsrc/server.ts:204, src/server.ts:98
resources.subscribeconfirmedsrc/server.ts:208, src/server.ts:121
resources.listChangedconfirmedsrc/server.ts:208, src/server.ts:114
progress notificationsconfirmedsrc/lib/mcp.ts:71, src/tools/reasoning-think.ts:424

Tool Annotations

AnnotationValueEvidence
readOnlyHintfalsesrc/tools/reasoning-think.ts:500
destructiveHintfalsesrc/tools/reasoning-think.ts:502
openWorldHintfalsesrc/tools/reasoning-think.ts:503
idempotentHintfalsesrc/tools/reasoning-think.ts:501

Structured Output

  • reasoning_think declares outputSchema and returns structuredContent, with an embedded trace resource when the trace is small enough. Evidence: src/tools/reasoning-think.ts:498, src/lib/mcp.ts:97-114.

Configuration

VariableDefaultRequiredEvidence
CORTEX_SESSION_TTL_MS1800000 (30 minutes)nosrc/engine/reasoner.ts:22, src/engine/session-store.ts:19
CORTEX_MAX_SESSIONS100nosrc/engine/reasoner.ts:23, src/engine/session-store.ts:20
CORTEX_MAX_TOTAL_TOKENS2000000nosrc/engine/reasoner.ts:24, src/engine/session-store.ts:21
CORTEX_MAX_ACTIVE_REASONING_TASKS32nosrc/engine/config.ts:41-44
CORTEX_REDACT_TRACE_CONTENTfalsenosrc/engine/config.ts:21

[!NOTE] The source does not define any HTTP host/port configuration. The only other environment-related signal is NODE_ENV=production in the Docker image and --env-file=.env in the local dev:run script.

Security

ControlStatusEvidence
input validationconfirmedsrc/schemas/inputs.ts:13, src/schemas/outputs.ts:46, src/prompts/index.ts:207
stdout-safe logging fallbackconfirmedsrc/server.ts:98, src/server.ts:145
main-thread-only runtimeconfirmedsrc/index.ts:15-25
non-root container userconfirmedDockerfile:37

[!NOTE] No auth, OAuth, HTTP origin checks, or rate-limiting controls are implemented in the current source because the server only exposes stdio transport.

Development

ScriptCommandPurpose
devtsc --watch --preserveWatchOutputWatch and compile source during development.
dev:runnode --env-file=.env --watch dist/index.jsRun the built server in watch mode with an optional local .env file.
buildnode scripts/tasks.mjs buildClean dist, compile TypeScript, copy assets, and make the entrypoint executable.
linteslint .Run ESLint across the repository.
type-checknode scripts/tasks.mjs type-checkRun source and test TypeScript checks concurrently.
testnode scripts/tasks.mjs testRun the TypeScript test suites with the configured loader.
test:distnode scripts/tasks.mjs test:distRebuild first, then run tests against the built output.
test:fastnode --test --import tsx/esm src/__tests__/**/*.test.ts node-tests/**/*.test.tsRun the fast direct test command without the task wrapper.
formatprettier --write .Format the repository.
inspectornpm run build && npx -y @modelcontextprotocol/inspector node dist/index.jsBuild the server and open it in the MCP Inspector.
prepublishOnlynpm run lint && npm run type-check && npm run buildEnforce release checks before publishing.

Additional helper scripts for diagnostics, coverage, asset copying, and knip are defined in package.json.

Build and Release

  • .github/workflows/release.yml bumps package.json and server.json, then runs npm run lint, npm run type-check, npm run test, and npm run build before tagging and creating a GitHub release.
  • The same workflow publishes the package to npm with Trusted Publishing, publishes to the MCP Registry with mcp-publisher, and pushes a multi-arch Docker image to ghcr.io.
  • Dockerfile uses a multi-stage Node 24 Alpine build, prunes dev dependencies, and runs the released container as the mcp user.

Troubleshooting

  • Sessions are in memory and expire after 30 minutes by default. If you receive E_SESSION_NOT_FOUND, start a new session or increase CORTEX_SESSION_TTL_MS.
  • runMode="run_to_completion" requires enough thought entries to cover the remaining steps. If you want the server to return after each step, keep the default step mode.
  • For stdio transport, do not add custom stdout logging around the server process. This server routes logs through MCP logging and falls back to stderr on failures.

Credits

DependencyRegistry
@modelcontextprotocol/sdknpm
zodnpm

Contributing and License

  • License: MIT
  • Contributions are welcome via pull requests.

來源:README.md,提交 c1171fd

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v1.11.0最新Sep 16, 2026

評分

已滿足適用檢查項的 40%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分

    請在儲存庫或註冊中心條目中宣告授權條款。