TypeScriptADK-TS

MCP Sequential Thinking

Step-by-step reasoning for complex problem solving using Anthropic's sequential thinking MCP server

  • Name: MCP Sequential Thinking
  • Package: @modelcontextprotocol/server-sequential-thinking
  • Provider: Anthropic

Overview

MCP Sequential Thinking is a third-party MCP server from Anthropic. It exposes a single tool that lets agents work through problems step by step, revise earlier thoughts, and branch into alternative reasoning paths before settling on an answer.

When to use it

Works well for multi-step problems: math, logic, code debugging, planning. Less useful for simple lookups or single-step tasks.

Usage with ADK TypeScript

import { McpSequentialThinking } from "@iqai/adk";

const toolset = McpSequentialThinking();

const tools = await toolset.getTools();
import { McpToolset } from "@iqai/adk";

const toolset = new McpToolset({
  name: "Sequential Thinking MCP Client",
  description: "Client for structured step-by-step reasoning",
  transport: {
    mode: "stdio",
    command: "npx",
    args: ["-y", "@modelcontextprotocol/server-sequential-thinking"],
    env: {
      PATH: process.env.PATH || "",
    },
  },
});

const tools = await toolset.getTools();

If you want to use this MCP with Claude Desktop, add this to your Claude Desktop configuration file:

MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json

Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "sequential-thinking": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-sequential-thinking"]
    }
  }
}

Environment Variables

VariableTypeDescription
DISABLE_THOUGHT_LOGGINGOptionalSet to true to suppress thought step logging

Configuration Options

All MCP servers support these configuration options:

OptionTypeDescription
envobjectEnvironment variables (see table above)
debugbooleanEnable debug logging
descriptionstringCustom description
retryOptions.maxRetriesnumberMax retry attempts (default: 2)
retryOptions.initialDelaynumberInitial retry delay in ms (default: 200)
samplingHandlerSamplingHandlerHandler for MCP sampling requests

Available Tools

sequentialthinking
thought:stringnextThoughtNeeded:booleanthoughtNumber:integertotalThoughts:integerisRevision:booleanrevisesThought:integerbranchFromThought:integerbranchId:stringneedsMoreThoughts:boolean

Description

A detailed tool for dynamic and reflective problem-solving through thoughts. This tool helps analyze problems through a flexible thinking process that can adapt and evolve. Each thought can build on, question, or revise previous insights as understanding deepens.

Complete Example

import { McpSequentialThinking, LlmAgent } from "@iqai/adk";

async function main() {
  // Initialize sequential thinking toolset
  const thinkingToolset = McpSequentialThinking({
    debug: true,
  });

  try {
    const tools = await thinkingToolset.getTools();

    const agent = new LlmAgent({
      name: "reasoning_agent",
      model: "gemini-2.5-flash",
      description: "An agent that reasons through problems step by step",
      instruction: `For complex problems, use sequential thinking to work through
        each step before giving an answer. Revise your thinking if you find errors.`,
      tools,
    });

    const response = await agent.ask(
      "A farmer has 17 sheep. All but 9 die. How many sheep are left?",
    );
    console.log(response);
  } finally {
    await thinkingToolset.close();
  }
}

main();

Use Cases

  • Math problems: Work through calculations with explicit intermediate steps
  • Code debugging: Trace through logic step by step to find bugs
  • Planning: Think through constraints and dependencies before committing to a plan
  • Decision making: Weigh options and revise as new information comes in
  • Logic problems: Catch and fix errors mid-reasoning before giving a final answer

Best Practices

  • Pick the right tasks: Simple queries don't need sequential thinking; the extra round-trips add latency for no gain
  • Pair with other tools: Sequential thinking works well alongside domain-specific MCP tools
  • Cleanup: Always call toolset.close() when done

Troubleshooting

IssueSolution
Reasoning loopsAdd instructions to limit maximum thought steps
Verbose thought logsSet DISABLE_THOUGHT_LOGGING=true in env vars
Connection timeoutCheck if npm/npx is installed and in PATH
Slow responsesExpected for complex reasoning; increase request timeout