Agent Mcp Tot — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited Agent Mcp Tot (MCP Server) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
Tree of Thoughts (ToT) is a powerful reasoning framework that enables AI models to explore multiple solution paths systematically. Think of it as a decision tree for thoughts—your AI can generate different approaches, evaluate them, backtrack when stuck, and focus on the most promising paths. Perfect for complex problem-solving, strategic planning, and multi-step reasoning tasks.
Whether you're solving puzzles, planning projects, or exploring creative alternatives, ToT provides structured exploration with evaluation scores, pruning strategies, and persistent storage for tracking reasoning over time.
npm install
npm run buildAdd to your MCP client configuration (e.g., mcp.json):
{
"mcpServers": {
"tot": {
"command": "node",
"args": ["/path/to/ToT-mcp/dist/index.js"],
"env": {
"TOT_STORAGE_PATH": "/path/to/ToT-mcp/tot-storage.json",
"TOT_OUTPUT_DIR": "/path/to/ToT-mcp/output"
}
}
}
}Create a tree to solve a problem:
{
"goal": "Solve the 24 game with numbers [3, 8, 8, 8]",
"rootContent": "Start with the numbers 3, 8, 8, 8",
"maxDepth": 5
}Add child thoughts with different approaches:
{
"treeId": "tree-123",
"parentId": "thought-456",
"content": "Try multiplying 8 * 8 = 64, then 64 / 8 = 8, then 8 * 3 = 24"
}Evaluate thoughts to guide exploration:
{
"treeId": "tree-123",
"thoughtId": "thought-789",
"score": 0.95,
"reasoning": "This approach successfully reaches the target of 24"
}The server supports optional LLM integration for automated thought generation. To configure an LLM provider, modify the server instantiation in src/index.ts:
const llmProvider = {
generateThoughts: async (prompt: string, count: number, context?: string): Promise<string[]> => {
// Your LLM implementation here
return Array.from({ length: count }, (_, i) => `Generated thought ${i + 1}`);
}
};
const config = {
llmProvider,
strictLLM: false // Set to true to throw errors when LLM is not configured
};
const server = new ToTMCPServer(config);Strict Mode: When strictLLM is set to true, the server will throw an error if generate_children is called without an LLM provider configured. This prevents accidental use of placeholder thoughts in production environments.
#### Using with LLM Providers
The ToT service includes LLM provider implementations in the src/llm-providers/ directory:
Mock LLM Provider - A simple mock implementation for testing:
import { MockLLMProvider } from './src/llm-providers/mock-llm-provider.js';
const llmProvider = new MockLLMProvider([
'Consider exploring the most promising path first',
'Try a different approach by breaking down the problem',
'Evaluate the trade-offs between different solutions'
]);
const config = { llmProvider, strictLLM: false };
const service = new ToTService('./tot-storage.json', config);Grok LLM Provider - Implementation using xAI's Grok API:
import { GrokLLMProvider } from './src/llm-providers/grok-llm-provider.js';
const apiKey = process.env.GROK_API_KEY;
const llmProvider = new GrokLLMProvider(apiKey);
const config = { llmProvider, strictLLM: true };
const service = new ToTService('./tot-storage.json', config);Ollama LLM Provider - Local LLM support using Ollama:
import { OllamaLLMProvider } from './src/llm-providers/ollama-llm-provider.js';
const ollamaBaseUrl = process.env.OLLAMA_BASE_URL || 'http://localhost:11434';
const ollamaModel = process.env.OLLAMA_MODEL || 'llama2';
const llmProvider = new OllamaLLMProvider(ollamaBaseUrl, ollamaModel);
const config = { llmProvider, strictLLM: true };
const service = new ToTService('./tot-storage.json', config);To use Ollama:
ollama pull llama2 (or any other model)LLM_PROVIDER_TYPE=ollamaOLLAMA_BASE_URL=http://localhost:11434 (optional, default)OLLAMA_MODEL=llama2 (optional, default)See src/llm-providers/grok-llm-provider.ts and src/llm-providers/ollama-llm-provider.ts for full implementations. Remember to never hardcode API keys - use environment variables or secure configuration management.
#### Generate and Evaluate in One Step
The generateChildrenAndEvaluate method combines thought generation with automatic evaluation:
// Generate children with a default score of 50
const children = await service.generateChildrenAndEvaluate({
treeId: 'tree-123',
parentId: 'thought-456',
numChildren: 3
}, 50);
// Generate children and use LLM as judge for evaluation
const childrenWithJudge = await service.generateChildrenAndEvaluate({
treeId: 'tree-123',
parentId: 'thought-456',
numChildren: 3
}, undefined, true);This method requires an LLM provider to be configured.
create_treeCreate a new Tree of Thoughts with a root thought and goal.
Parameters:
goal (string, required): The goal or problem this tree is solvingrootContent (string, required): The content of the root thoughtmaxDepth (number, optional): Maximum depth of the tree (default: 10)metadata (object, optional): Optional metadata for the treeget_treeGet a tree by ID.
Parameters:
treeId (string, required): The ID of the tree to retrievelist_treesList all trees.
delete_treeDelete a tree by ID.
Parameters:
treeId (string, required): The ID of the tree to deleteclear_treeClear a specific tree by ID.
Parameters:
treeId (string, required): The ID of the tree to clearadd_childAdd a child thought to an existing thought.
Parameters:
treeId (string, required): The ID of the treeparentId (string, required): The ID of the parent thoughtcontent (string, required): The content of the child thoughtmetadata (object, optional): Optional metadata for the thoughtevaluate_thoughtEvaluate a thought with a score.
Parameters:
treeId (string, required): The ID of the treethoughtId (string, required): The ID of the thought to evaluatescore (number, required): The evaluation score (e.g., 0-1 or 0-100)reasoning (string, optional): Optional reasoning for the evaluationselect_thoughtMark a thought as selected for further exploration.
Parameters:
treeId (string, required): The ID of the treethoughtId (string, required): The ID of the thought to selectbacktrackBacktrack from a thought, marking all descendants as pruned.
Parameters:
treeId (string, required): The ID of the treethoughtId (string, required): The ID of the thought to backtrack fromprune_treePrune thoughts below a certain evaluation threshold.
Parameters:
treeId (string, required): The ID of the treethreshold (number, required): The evaluation threshold (thoughts below this will be pruned)move_subtreeMove a subtree to a new parent within the same tree. Performs cycle detection, depth validation, and supports dry-run mode for safe preview.
Parameters:
treeId (string, required): The ID of the treesubtreeRootId (string, required): The ID of the subtree root to movenewParentId (string, required): The ID of the new parent thoughtdryRun (boolean, optional): If true, preview the move without making changes (default: false)Returns:
valid (boolean): Whether the move is validerrors (array): List of validation errorsmovedCount (number): Number of thoughts that would be movednewSubtreeRootDepth (number): New depth of the subtree root after movewarnings (array): List of warnings and recommendationsaffectedThoughtIds (array): IDs of all thoughts in the subtreeImportant Notes:
create_tree to create a new tree instead)dryRun: true to preview the move before executingmove_task which is for execution workflow managementget_thoughtGet a specific thought by ID.
Parameters:
treeId (string, required): The ID of the treethoughtId (string, required): The ID of the thought to retrieveget_tree_structureGet the hierarchical structure of a tree.
Parameters:
treeId (string, required): The ID of the treeget_best_thoughtsGet the best evaluated thoughts in a tree.
Parameters:
treeId (string, required): The ID of the treelimit (number, optional): Maximum number of thoughts to return (default: 5)get_tree_statsGet statistics about a tree.
Parameters:
treeId (string, required): The ID of the treeReturns:
totalThoughts: Total number of thoughts in the treeevaluatedThoughts: Number of evaluated thoughtsselectedThoughts: Number of selected thoughtsprunedThoughts: Number of pruned thoughtsmaxDepthReached: Maximum depth reached in the treeaverageEvaluation: Average evaluation scoreclear_treeClear a specific tree by ID.
Parameters:
treeId (string, required): The ID of the tree to clearclear_strategyClear a specific strategy by ID.
Parameters:
strategyId (string, required): The ID of the strategy to clearclear_everythingClear all trees and strategies.
save_stateManually save the current state to storage.
get_versionGet the version information of this ToT MCP server.
explore_with_strategyExplore a thought tree using a systematic branching strategy.
Parameters:
treeId (string, required): The ID of the tree to explorestrategy (string, required): The branching strategy to use (bfs, dfs, beam, or best_first)maxThoughts (number, optional): Maximum number of thoughts to explore (default: 100)beamWidth (number, optional): Beam width for beam search strategy (default: 3)stopCriteria (object, optional): Optional stop criteriaminEvaluation (number): Stop when a thought reaches this evaluation scoremaxDepth (number): Stop when reaching this depthtargetThoughtCount (number): Stop when exploring this many thoughtsReturns:
thoughtsExplored: Number of thoughts exploredthoughtsCreated: Number of thoughts created during explorationmaxDepthReached: Maximum depth reachedbestThoughtId: ID of the best thought foundbestEvaluation: Evaluation score of the best thoughtstoppedReason: Reason why exploration stoppedHere's a typical workflow for solving a problem using ToT:
{
id: string;
content: string;
parentId: string | null;
children: string[];
evaluation: number | null;
state: 'pending' | 'evaluated' | 'selected' | 'pruned';
depth: number;
createdAt: string;
metadata?: Record<string, any>;
}{
id: string;
rootId: string;
thoughts: Map<string, Thought>;
goal: string;
createdAt: string;
updatedAt: string;
maxDepth: number;
metadata?: Record<string, any>;
}Thought trees are persisted to tot-storage.json in JSON format. The storage mechanism uses:
Logs of tool calls are stored in the output directory with daily rotation.
MIT
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.