agent_mcp_thoughtflow
This server lets you manage structured tasks, workflows, and strategies while performing Tree of Thoughts reasoning and bridging reasoning into executable tasks with provenance.
Task Management: Create, get, list, update, delete tasks; manage dependencies, parent/child hierarchies, and move tasks.
Workflow Orchestration: Create, get, list, delete workflows; add/remove tasks; start, advance, get, list, and delete workflow runs.
Strategy Organization: Create, get, list strategies; add/remove trees and workflows to/from strategies.
Tree of Thoughts Reasoning: Create trees, add ideas, get thoughts, evaluate with multi-criteria scores, verify, select, backtrack, prune, and clear all trees.
LLM Integration: Generate child thoughts using configured LLM providers (Grok, Ollama, etc.).
Cognitive Bridging: Promote thoughts/subtrees to tasks, spawn reasoning trees from tasks, link thoughts to tasks, and retrieve cognitive provenance chains.
State & Administration: Clear all data, reload state, clear state, and deduplicate strategies/trees/strategies-and-trees.
Hierarchy Support: Get subtasks of a parent task and move tasks to new parents or order.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@agent_mcp_thoughtflow Reason about database scaling and convert top thought into tasks"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
agent_mcp_thoughtflow
Unified Cognitive Scaffold MCP Server — Bridging Deep Reasoning and Reliable Execution for LLM Agents
Overview
agent_mcp_thoughtflow is a production-ready Model Context Protocol (MCP) server that unifies structured task execution with systematic reasoning.
Modern LLM agents are excellent at planning (using techniques like Tree of Thoughts) but frequently fail at execution — they explore ideas, then jump straight into implementation while skipping proper task tracking, dependency management, and auditability.
This server solves that gap by providing a single, cohesive cognitive scaffold where:
Strategy — Top-level organizer that groups related reasoning trees and execution workflows
Tree of Thoughts handles divergent exploration and evaluation
Task Orchestrator handles convergent execution with dependencies and workflows
Cognitive Bridge Layer enables seamless, bidirectional conversion between thoughts and executable tasks
The result: agents can think deeply, commit reasoning to structured work, execute reliably, and — when blocked — spawn new reasoning trees from existing tasks.
Related MCP server: Deliberate Reasoning Engine
The Core Problem It Solves
Many agents follow this broken pattern:
Use ToT / reasoning tools to explore approaches
Directly implement changes without creating tracked tasks
Lose provenance, auditability, and the ability to resume or delegate work
agent_mcp_thoughtflow makes the correct workflow the easiest path:
Think → Promote to Tasks → Execute with Tracking → (If blocked) Spawn new reasoning from task
Key Features
Cognitive Bridge Layer (The Killer Feature)
All of these are actions on the single consolidated bridge tool (e.g. bridge with action: "promote_to_tasks"):
promote_to_tasks— Convert a thought (or entire subtree) into executable tasks with full provenance metadataspawn_tot_from_task— When a task is blocked, spawn a fresh Tree of Thoughts from it for deeper analysislink_to_task— Create soft bidirectional links between thoughts and tasks for "inspired by" or "related to" relationshipsget_provenance— Trace the complete reasoning → execution chain
All bridge operations automatically maintain metadata.cognitive and create auditable cognitiveLinks.
Task Orchestrator
Rich task model with hard/soft dependencies
Hierarchical tasks (
parentTaskId+order)Workflow creation and execution engine with automatic dependency resolution
The
workflow_runtool'sstart+advanceactions for controlled executionstart(andadvance) returnreadyTasksfor just-in-time task dispatchingFirst-class verification fields —
verified,verifiedAt,verificationNotes,verificationMethodfor tracking verification status
Tree of Thoughts
Full hierarchical thought trees with depth control
Multi-criteria evaluation (
score,creativity,risk, custom criteria)Pruning, backtracking, verification, and selection
Strategy grouping for organizing related reasoning sessions
First-class verification fields —
verified,verifiedAt,verificationNotes,verificationMethodfor tracking verification status
Strategy Model (Top-Level Organizer)
Strategy groups related Trees of Thoughts and Workflows into cohesive units
Each Strategy can own multiple
treeIdsandworkflowIdsEnables organizing complex projects by linking reasoning and execution
Managed via the
strategytool'sadd_tree/add_workflow/remove_tree/remove_workflowactions
Visualization & Introspection
VisualizationService provides ASCII/SVG rendering and cognitive stats (tree ASCII, tree-with-links, workflow SVG, strategy SVG, cognitive stats). These are not exposed as MCP tools — they back the Web UI Dashboard below; use them programmatically if embedding the server.
Architecture & Extensibility
Clean service-oriented design with
BaseServiceDependency injection between services
Pluggable LLM providers (Grok, Ollama, Mock)
JSON storage (SQLite planned)
Centralized
ToolRegistryfor maintainable tool definitions
Installation
npm install agent_mcp_thoughtflowOr run directly with npx:
npx agent_mcp_thoughtflowQuick Start
1. Start the Server
npx agent_mcp_thoughtflowThe server uses JSON file storage by default (./thoughtflow-state.json).
2. Basic Hybrid Workflow Example
// 1. Create a reasoning tree
tree({
"action": "create",
"goal": "Design a robust caching strategy for our API",
"rootContent": "Start with a simple in-memory cache"
})
// 2. Explore and evaluate thoughts (thought action="compare_options" or "add_ideas", then "evaluate", then "select")...
// 3. Promote the best approach to tasks
bridge({
"action": "promote_to_tasks",
"treeId": "...",
"thoughtId": "...",
"includeDescendants": true,
"workflowId": "optional-existing-workflow"
})
// 4. Start executing the workflow
workflow_run({ "action": "start", "workflowId": "..." })
// 5. If a task gets blocked, spawn new reasoning
bridge({
"action": "spawn_tot_from_task",
"taskId": "...",
"goal": "Investigate why the cache invalidation is failing",
"rootContent": "The cache is not being invalidated on write operations"
})3. Quick Plan (One-Call Setup)
For new projects, use the bridge tool's quick_plan action to create strategy + workflow + tasks + root thought in a single call:
bridge({
"action": "quick_plan",
"goal": "Implement user authentication system",
"tasks": [
{ "name": "Design auth schema", "description": "Define user, session, and token tables" },
{ "name": "Implement password hashing", "dependencies": ["task-1"] },
{ "name": "Create login endpoint", "dependencies": ["task-2"] },
{ "name": "Add JWT token generation", "dependencies": ["task-3"] },
{ "name": "Implement logout logic", "dependencies": ["task-4"] }
],
"strategyName": "auth-system",
"workflowName": "auth-implementation"
})
// Returns:
// {
// strategyId: "auth-system",
// workflowId: "auth-implementation",
// taskIds: ["task-1", "task-2", "task-3", "task-4", "task-5"],
// treeId: "...",
// rootThoughtId: "..."
// }This reduces 4-5 tool calls to 1, making onboarding friction-free.
Web UI Dashboard
The Thoughtflow Dashboard provides a comprehensive web interface for inspecting cognitive provenance, including:
Strategy Overview — View all strategies with their associated trees and workflows
Task Management — Monitor task status, dependencies, and execution progress
Tree of Thoughts Visualization — Explore thought trees with evaluation scores and states
Workflow Tracking — Track workflow execution status and completion
Cognitive Links — Inspect bidirectional links between thoughts and tasks
Real-time Updates — Auto-refresh capability with change indicators
Starting the Dashboard
# Build the project first (if not already built)
npm run build
# Start the dashboard server
npm run dashboardThe dashboard server will start on port 3000 (or the next available port if 3000 is in use). You'll see output like:
Thoughtflow Dashboard server running at http://localhost:3000
Dashboard: http://localhost:3000/dashboard
API: http://localhost:3000/api/state
State Info: http://localhost:3000/api/state/infoAccessing the Dashboard
Open your browser and navigate to:
Dashboard:
http://localhost:3000/dashboard
Dashboard Features
Strategy Filtering — Click on a strategy to filter trees, workflows, and tasks by that strategy
Show/Hide Deleted Items — Toggle the checkbox to view soft-deleted items
Auto-Refresh — Enable/disable automatic data refresh (default: ON)
Manual Refresh — Click the Refresh button to manually update data
Collapsible Trees — Expand/collapse thought trees to explore reasoning branches
Status Indicators — Color-coded status indicators for tasks, thoughts, and workflows
API Endpoints
The dashboard server provides the following API endpoints:
GET /api/state— Returns the complete Thoughtflow state (strategies, tasks, trees, workflows, cognitive links)GET /api/state/info— Returns state metadata (exists, lastModified, size)
Tool Reference
The server exposes 8 consolidated MCP tools, each taking an action parameter that selects the operation — there is no per-operation tool (no create_task, get_tree, etc. as separate tools). This keeps the tool list small while still exposing every operation.
Tool | Actions |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Bridge Layer Tool (bridge)
Action | Purpose |
| Convert reasoning into tracked executable work |
| Spawn fresh reasoning from a blocked task |
| Create soft bidirectional links for "inspired by" or "related to" relationships |
| Trace full reasoning → execution history |
| Atomically mark task completed and evaluate/verify linked thoughts |
| Single call to create strategy + workflow + tasks + root thought |
| Scan completed tasks and evaluate pending linked thoughts |
| Cleanup: remove duplicate strategies and trees |
Note: bridge action="promote_to_tasks" supports skipEvaluationGate: true for simple workflows that don't need the evaluate+select cycle. The system uses debounce mechanisms to prevent race conditions during heavy LLM usage.
Task Orchestrator Tools (task, workflow, workflow_run, strategy)
Category | Tool + actions |
Tasks |
|
Workflows |
|
Execution |
|
Hierarchy |
|
Strategies |
|
Soft-Delete |
|
Note: Single-item task creation is not available — task action="create" always takes a tasks array (batch), even for one task. It supports positional references (task-1, task-2) for dependencies and parent-child relationships within the batch, and returns an idMap for mapping positional refs to real IDs.
Tree of Thoughts Tools (tree, thought, strategy)
Category | Tool + actions |
Trees |
|
Thoughts |
|
Strategies |
|
Note: Single-item idea creation is not available — thought action="add_ideas" always takes an ideas array (batch), and action="compare_options" always takes an options array. Both support positional references (e.g. idea-1, idea-2) for parentId within the batch, use fuzzy matching for robustness, and return an idMap for mapping positional refs to real IDs.
Soft-Delete & Recovery
All delete operations use soft-delete by default — entities are marked as deleted but preserved for recovery. Purge/restore live on the separate admin tool, not on the entity's own tool.
includeDeletedparameter:task/workflow/tree/strategyget/listactions support an optionalincludeDeleted: trueparameter to view soft-deleted items.adminaction="restore_deleted": Restore a soft-deleted entity back to active state. RequiresentityType('task', 'workflow', 'tree', 'strategy', 'link') andid.adminaction="purge_deleted": Permanently remove soft-deleted items (cannot be undone). Supports filtering byentityTypeandolderThanDaysfor safe cleanup.
Example workflow:
// 1. Delete a task
task({ "action": "delete", "id": "task-123" })
// 2. List active tasks (deleted task hidden)
task({ "action": "list" }) // → task-123 not visible
// 3. List with deleted included
task({ "action": "list", "includeDeleted": true }) // → task-123 visible with isDeleted flag
// 4. Restore if needed
admin({ "action": "restore_deleted", "entityType": "task", "id": "task-123" })
// 5. Permanently purge old deleted items (e.g., older than 30 days)
admin({ "action": "purge_deleted", "entityType": "task", "olderThanDays": 30 })State Size & Deduplication
Cognitive links can accumulate over time. The system includes built-in deduplication actions to manage state size:
bridgeaction="dedup_strategies_and_trees" — Removes duplicate strategies and trees by normalized name/goalstrategyaction="deduplicate" — Removes duplicate strategies onlytreeaction="deduplicate" — Removes duplicate trees only
For production workloads with heavy cognitive link usage, monitor state file size and run deduplication periodically.
Visualization (not MCP tools)
VisualizationService provides these as programmatic methods, used by the Web UI Dashboard — they are not callable as MCP tools:
visualizeTreeAsciivisualizeTreeWithLinksvisualizeWorkflowSvgvisualizeStrategySvggetCognitiveStats
Recommended Agent Workflow
The intended usage pattern for LLM agents:
Explore — Use
treeaction="create" +thoughtaction="add_ideas"/"compare_options" + action="evaluate" to explore solution spaceCommit — Use
bridgeaction="promote_to_tasks" on the most promising branchExecute — Use
workflow_runaction="start" + action="advance" (response includesreadyTasks)Reflect — If blocked, use
bridgeaction="spawn_tot_from_task" on the stuck taskAudit — Use
bridgeaction="get_provenance" when traceability is required
This pattern turns ad-hoc reasoning into auditable, resumable, delegable work.
Relationship Model
The system uses a strict hierarchical relationship model for organizing cognitive work:
Strategy (Top-Level Organizer - Mandatory Owner)
├── workflowIds: string[] → Workflows (each workflow belongs to exactly ONE strategy)
├── treeIds: string[] → Trees of Thoughts (reasoning, optional strategy association)
└── metadata: Record<string, any>
Workflow (Execution Container - Mandatory Owner)
├── strategyId: string → Strategy (mandatory, exactly one)
├── taskIds: string[] → Tasks (each task belongs to exactly ONE workflow)
└── metadata: Record<string, any>
Task (Executable Unit - Mandatory Owner)
├── workflowId: string → Workflow (mandatory, exactly one)
├── strategyId: string → Strategy (denormalized from workflow for convenience)
├── parentTaskId?: string → Subtask parent (must be in same workflow)
├── dependencies: string[] → Task dependencies (must be in same workflow)
└── metadata: Record<string, any>
Idea (Thought) ↔ Task (Soft Bidirectional Links)
├── Thought.metadata.cognitive.linkedTaskIds
├── Task.metadata.cognitive.linkedThoughtIds
├── syncStatus: 'synced' | 'outdated' | 'conflict'
└── provenanceChain: ProvenanceEntry[]Key Relationships & Invariants
Strategy → Workflows: Strict ownership — each workflow belongs to exactly one strategy
Workflow → Tasks: Strict ownership — each task belongs to exactly one workflow
Task → Strategy: Denormalized from workflow for convenience, automatically kept in sync
Subtasks: Must have parent in the same workflow (enforced by
parentTaskIdvalidation)Dependencies: Must reference tasks in the same workflow (enforced by validation)
Idea ↔ Task: Soft bidirectional links enable "inspired by" or "related to" relationships without full promotion
Promotion: Full conversion from thought subtree to executable tasks with provenance tracking (requires
workflowId)Spawning: Create new reasoning trees from blocked tasks for deeper analysis
Creation Flow (Strict Hierarchy)
All creation flows must follow the hierarchy:
strategyaction="create" — Create or get strategy (idempotent by normalized name)workflowaction="create" withstrategyId— Create workflow with mandatorystrategyIdtaskaction="create" withworkflowId— Create task(s) with mandatoryworkflowId(automatically inheritsstrategyId)
The system enforces these invariants at every operation to prevent data inconsistency.
Architecture
┌─────────────────────────────────────────────────────────────┐
│ Thoughtflow MCP Server │
├─────────────────────────────────────────────────────────────┤
│ CognitiveBridgeService ←→ TaskOrchestratorService │
│ ↑ ↑ │
│ │ │ │
│ ToTService Workflow Execution Engine │
│ │ │ │
│ └──────────┬───────────────┘ │
│ │ │
│ VisualizationService │
└─────────────────────────────────────────────────────────────┘All services extend BaseService for unified state management, auto-save, and shutdown behavior.
Storage
Default: JSON file (
thoughtflow-state.json)Future: SQLite support (planned in v1.1)
The storage layer is abstracted via IStorageAdapter, making it easy to add new backends.
LLM Provider Support
The ToT system supports multiple LLM backends:
Grok (
GrokLLMProvider) — Recommended for high-quality structured evaluationOllama (
OllamaLLMProvider) — Local/private modelsMock (
MockLLMProvider) — Testing and development
Development
# Install dependencies
npm install
# Run in development mode
npm run dev
# Build
npm run buildRoadmap
SQLite storage adapter
Richer workflow visualization and Gantt-style views
Built-in retry policies and task timeout handling
Multi-agent collaboration primitives
Web UI for inspecting cognitive provenance
Contributing
Contributions are welcome! Please open an issue first to discuss major changes.
Focus areas:
Improving the Bridge Layer ergonomics
Additional visualization formats
Performance on large thought trees / workflows
License
MIT © 2026
Acknowledgments
This project was born from the observation that reasoning without execution tracking is incomplete, and execution without reasoning provenance is fragile.
agent_mcp_thoughtflow exists to make the full cognitive loop first-class in agent systems.
Built with ❤️ for agents that need to think and ship.
Configuration (env)
Variable | Default | Purpose |
|
|
|
| server cwd name | Strategy used when |
|
| Rolling state-file snapshots ( |
Housekeeping
npm run maintain -- --drypreviews,npm run maintainapplies (backs up first) a repair pass over the state file; the server runs the same pass on startup and viaadminactionmaintain.taskactionstale/bulk_updatecloses work leftin_progress;archivehides old completed tasks.
Available Tools
46 toolsadd_ideaC
Add a child thought to an existing thought
Inputs: treeId (required), content (required), parentId (required), metadata.
add_tree_to_strategyD
Add a tree to a strategy
Inputs: treeId (required), strategyId (required).
add_workflow_to_strategyB
Add a workflow to a strategy
Inputs: strategyId (required), workflowId (required).
advance_workflow_runB
Advance a workflow run after task completion
Inputs: runId (required).
backtrackA
Backtrack from a thought, marking all descendants as pruned
Inputs: treeId (required), thoughtId (required).
clear_allB
Clear all data (tasks, workflows, strategies, trees)
Inputs: no named parameters.
clear_all_treesD
Clear all trees
Inputs: no named parameters.
clear_stateA
Clear all state from storage and memory. This deletes the state file and resets all services to empty state. Useful for starting fresh without restarting the server.
Inputs: no named parameters.
create_strategyB
Create a strategy for organizing related workflows
Inputs: name (required), metadata, description.
create_taskB
Create a new task with optional dependencies and metadata
Inputs: name (required), order, metadata, description, +2 more.
create_treeC
Create a new Tree of Thoughts for systematic reasoning
Inputs: goal (required), rootContent (required), maxDepth, metadata, +1 more.
create_workflowB
Create a workflow with a set of tasks
Inputs: name (required), taskIds (required), metadata, description.
deduplicate_strategiesA
Deduplicate strategies by normalized name. Keeps the first occurrence of each unique normalized name and removes duplicates.
Inputs: no named parameters.
deduplicate_strategies_and_treesA
Deduplicate strategies and trees by their normalized name/goal. This cleans up duplicate entries that may have been created before the deduplication logic was added. Keeps the first occurrence of each unique normalized name/goal and removes duplicates.
Inputs: no named parameters.
deduplicate_treesA
Deduplicate trees by normalized goal. Keeps the first occurrence of each unique normalized goal and removes duplicates.
Inputs: no named parameters.
delete_taskC
Delete a task
Inputs: id (required).
delete_treeC
Delete a tree
Inputs: id (required).
delete_workflowC
Delete a workflow
Inputs: id (required).
delete_workflow_runC
Delete a workflow run
Inputs: runId (required).
evaluate_thoughtC
Evaluate a thought with a score (0-100) and optional multi-criteria fields
Inputs: score (required), treeId (required), thoughtId (required), risk, +3 more.
generate_children_with_llmA
Generate child thoughts using the configured LLM provider (Grok, Ollama, etc.). This triggers actual API calls to the LLM service.
Inputs: treeId (required), parentId (required), numChildren, temperature.
get_cognitive_provenanceB
Get cognitive provenance chain for a task or thought
Inputs: id (required), type (required), maxDepth.
get_strategyC
Get a strategy by ID
Inputs: id (required).
get_subtasksB
Get all subtasks of a parent task
Inputs: parentTaskId (required).
get_taskB
Get a task by ID
Inputs: id (required).
get_thoughtC
Get a thought by ID
Inputs: treeId (required), thoughtId (required).
get_treeB
Get a tree by ID
Inputs: id (required).
get_workflowB
Get a workflow by ID
Inputs: id (required).
get_workflow_runB
Get a workflow run by ID
Inputs: runId (required).
link_thought_to_taskA
Create a soft bidirectional link between a thought and a task for provenance tracking
Inputs: taskId (required), treeId (required), thoughtId (required), reason.
list_strategiesB
List all strategies
Inputs: no named parameters.
list_tasksA
List all tasks, optionally filtered by status
Inputs: status.
list_treesB
List all trees
Inputs: no named parameters.
list_workflow_runsC
List all workflow runs
Inputs: no named parameters.
list_workflowsB
List all workflows
Inputs: no named parameters.
move_taskB
Move a task to a new parent or change its order
Inputs: taskId (required), order, newParentTaskId.
promote_thought_to_tasksC
Promote a thought (or subtree) to executable tasks
Inputs: treeId (required), thoughtId (required), workflowId, taskNamePrefix, +2 more.
prune_treeC
Prune thoughts below a certain evaluation threshold
Inputs: treeId (required), threshold (required), riskThreshold.
reload_stateA
Reload state from storage and share it across all services. Useful after manually deleting or editing the state file.
Inputs: no named parameters.
remove_tree_from_strategyC
Remove a tree from a strategy
Inputs: treeId (required), strategyId (required).
remove_workflow_from_strategyC
Remove a workflow from a strategy
Inputs: strategyId (required), workflowId (required).
select_thoughtC
Mark a thought as selected for further exploration
Inputs: treeId (required), thoughtId (required).
spawn_tot_from_taskC
Spawn a Tree of Thoughts from a task for reasoning
Inputs: taskId (required), goal, treeId, maxDepth, +1 more.
start_workflow_executionC
Start execution of a workflow
Inputs: workflowId (required).
update_taskC
Update a task
Inputs: id (required), name, status, metadata, +2 more.
verify_thoughtB
Mark a thought as verified after confirming its findings
Inputs: treeId (required), thoughtId (required), verificationNotes.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 46 tools
There are several tools with overlapping purposes, such as the three deduplicate tools (deduplicate_strategies, deduplicate_trees, deduplicate_strategies_and_trees) and the three clear tools (clear_all, clear_all_trees, clear_state). While the descriptions help differentiate them, an agent might still struggle to select the correct one, especially when clear_all and clear_state appear to have similar effects. Overall, most tools are distinct, but these overlapping groups reduce clarity.
All tool names follow a consistent verb_first snake_case pattern. For example, add_idea, create_task, list_trees, delete_workflow_run. Even longer names like add_tree_to_strategy and generate_children_with_llm adhere to this pattern. There are no mixed conventions or confusing abbreviations.
With 46 tools, this server has a very large tool surface. The server aims to manage multiple domains (thoughts, tasks, workflows, strategies, trees), but the count is well above the recommended range (typically 3-15). Many tools could potentially be consolidated or removed without loss of functionality.
The tool set covers core CRUD operations for most entities but has notable gaps. For example, there are no tools to update or delete strategies, update or delete workflows (only delete_workflow exists but no update_workflow), or update thought content. Additionally, there is no tool to update a tree. These gaps may force agents to work around missing functionality.
Maintenance
Related MCP Connectors
Persistent memory, knowledge graph, task management and more for AI agents via MCP.
Goal and task planning MCP for Codex and AI agents, with evidence-backed completion.
Task management your AI agents can actually run. One line becomes a context-ready task over MCP.
LLM Orchestration Agent (Mcp)
Related MCP Servers
- AlicenseBqualityNot gradedmaintenanceMCP server for structured reasoning with cognitive trap detection, verification, and context compression541 npm1-
- AlicenseNot gradedqualityBmaintenanceAn MCP server that structures AI reasoning as directed acyclic graphs of semantic thoughts, enabling explicit dependencies, assumption tracking, and cascade invalidation for transparent decision-making.7 npm5MIT
- AlicenseAqualityBmaintenanceA reasoning orchestration MCP server that enables tree-of-thoughts thinking, multi-phase planning, and multi-agent evaluation for complex problem-solving.658 npm3MIT
- AlicenseNot gradedqualityCmaintenanceA cognitive optimization engine exposed as an MCP server that amplifies LLM reasoning through self-consistency sampling, MCTS, Dung argumentation, symbolic verification, and measured confidence.MIT