TH

Think Node MCP Server Integrating Think-Tools

Integrate think-tools into a Node MCP server to boost any agent's reasoning capabilities using Anthropic's approach.

Quick Install
npx -y @abhinav-mangla/think-tool-mcp

Overview

This Node-based MCP (Model Context Protocol) server integrates the think-tools toolkit pattern into an MCP-compatible interface. It adapts the Anthropic-style “think” workflow so agents can call external tools deterministically and receive structured tool outputs inside the model context. The server acts as a bridge between agents (or LLM orchestration layers) and a registry of tools, exposing a simple HTTP MCP API to orchestrate tool selection, execution, and result formatting.

For developers building tool-enabled agents, the Think Node MCP server simplifies integration by centralizing tool configuration, enforcing a predictable request/response shape, and providing runtime hooks to add or customize tools. This makes it easier to build multi-step reasoning agents that need reliable tool executions (search, computation, file access, etc.) while keeping the model-facing interface consistent with MCP semantics.

Features

  • MCP-compatible HTTP endpoints for tool invocation and context enrichment
  • Pluggable tool registry: add custom tools implemented in JavaScript/TypeScript
  • Execution sandboxing and standardized result wrappers for predictable downstream parsing
  • Health and tooling introspection endpoints for runtime management
  • Minimal configuration and local development support (Node.js + npm)

Installation / Configuration

Quick start — clone and run:

git clone https://github.com/abhinav-mangla/think-tool-mcp.git
cd think-tool-mcp
npm install
npm run start

Environment variables (example):

# TCP port for the MCP server
MCP_PORT=3000

# Path to a JSON/JS file that exports tool registry
TOOL_REGISTRY_PATH=./tools/index.js

# Optional: toggle verbose logging
LOG_LEVEL=info

Sample tool registry file (tools/index.js):

// tools/index.js
module.exports = {
  tools: [
    {
      name: 'calculator',
      description: 'Evaluate arithmetic expressions safely',
      run: async ({ input }) => {
        // implement a safe evaluator or call a math library
        const result = evaluateMath(input);
        return { output: String(result) };
      }
    },
    {
      name: 'search',
      description: 'Query a web search API and return top results',
      run: async ({ query }) => {
        const hits = await searchService.search(query);
        return { items: hits };
      }
    }
  ]
};

Start the server with the registry:

TOOL_REGISTRY_PATH=./tools/index.js MCP_PORT=3000 npm run start

API Endpoints

EndpointMethodPurpose
/healthGETServer health check
/toolsGETList available tools and metadata
/mcpPOSTPrimary MCP endpoint: supply model context and request tool runs

Example curl request to /mcp:

curl -X POST http://localhost:3000/mcp \
  -H "Content-Type: application/json" \
  -d '{
    "session_id": "agent-123",
    "query": "Calculate 17 * 23 and show steps",
    "context": {}
  }'

The server responds with structured JSON detailing selected tools, the execution results, and any context updates suitable for inclusion in model prompts.

Available Tools / Resources

The repository ships with example tools and extension points:

  • Calculator — safe arithmetic evaluation and step-by-step breakdowns
  • Search — wrapper around a configured search API (example adapter included)
  • File Reader — read and return contents from permitted paths (can be sandboxed)
  • JSON Transformer — apply deterministic transformations to structured data
  • Custom adapter hooks — start/stop hooks, logging, and serialization helpers

You can extend or replace any tool by exporting new entries in the registry file. Each tool must implement a run({ …args }) async function and return a JSON-serializable result.

Use Cases

  • Augment LLM agents with deterministic computation: route math and unit conversions to the calculator tool to avoid hallucinated results.

    • Example: Agent submits “What is 17*23?” to /mcp. The server calls the calculator tool and returns the numeric result plus step trace for the model to cite.
  • Add reliable retrieval to reasoning loops: integrate a search tool to fetch citations or short summaries that the model can reference.

    • Example: Agent requests background on a technical topic; the MCP server returns top-k search snippets formatted for the model to incorporate.
  • Multi-step workflows and tool chaining: use the MCP server to orchestrate tool sequences (e.g., search → parse → transform → summarize) while maintaining a single protocol for agents.

    • Example: Agent asks for a table of recent results — server runs search, normalizes JSON via transformer, and produces a summary output.
  • Local developer testing and tool debugging: query /tools to inspect available tools and run sample inputs without contacting any external LLM provider.

Tips for Developers

  • Keep tool outputs small and deterministic: format results as compact JSON to make them easy to include in model contexts.
  • Sandbox or validate inputs for tools that access external resources (file system, network) to avoid security risks.
  • Use the provided logging hooks to see how agents choose and chain tools during testing.
  • Start with the example registry and incrementally add tools to match your agent’s reasoning requirements.

For full code, examples, and advanced configuration, see the project repository: https://github.com/abhinav-mangla/think-tool-mcp

Tags:ai-ml