#
tokens: 3581/50000 7/7 files
lines: on (toggle) GitHub
raw markdown copy reset
# Directory Structure

```
├── .gitignore
├── Dockerfile
├── package.json
├── Readme.md
├── smithery.yaml
├── src
│   └── server.ts
└── tsconfig.json
```

# Files

--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------

```
 1 | # Dependencies
 2 | node_modules/
 3 | npm-debug.log
 4 | yarn-debug.log
 5 | yarn-error.log
 6 | package-lock.json
 7 | 
 8 | # Build outputs
 9 | dist/
10 | build/
11 | *.tsbuildinfo
12 | 
13 | # Environment variables
14 | .env
15 | .env.*
16 | !.env.example
17 | 
18 | # IDE specific files
19 | .idea/
20 | .vscode/
21 | *.swp
22 | *.swo
23 | 
24 | # OS specific files
25 | .DS_Store
26 | Thumbs.db
27 | 
28 | # Logs
29 | logs/
30 | *.log
31 | npm-debug.log*
32 | yarn-debug.log*
33 | yarn-error.log*
34 | 
35 | # Coverage directory used by tools like istanbul
36 | coverage/
37 | 
38 | # Optional npm cache directory
39 | .npm/
40 | 
41 | # Optional eslint cache
42 | .eslintcache 
```

--------------------------------------------------------------------------------
/Readme.md:
--------------------------------------------------------------------------------

```markdown
  1 | # Think Tool MCP Server
  2 | 
  3 | [![smithery badge](https://smithery.ai/badge/@PhillipRt/think-mcp-server)](https://smithery.ai/server/@PhillipRt/think-mcp-server)
  4 | 
  5 | **Official implementation of Anthropic's "think" tool as an MCP server** - Dramatically improve Claude's reasoning capabilities with structured thinking.
  6 | 
  7 | ## What is the Think Tool?
  8 | 
  9 | This MCP server implements the exact "think" tool that Anthropic introduced in their [engineering blog post](https://www.anthropic.com/engineering/claude-think-tool). The Think Tool provides Claude with a dedicated space for structured reasoning during complex problem-solving tasks, enabling more thoughtful, accurate, and reliable responses.
 10 | 
 11 | ## Proven Performance Benefits
 12 | 
 13 | Anthropic's research demonstrates remarkable improvements when using the "think" tool:
 14 | 
 15 | - **54% improvement** in complex customer service tasks
 16 | - **Significantly better adherence** to detailed policies and guidelines
 17 | - **Enhanced consistency** across multiple trials of the same task
 18 | - **Improved performance** on software engineering benchmarks
 19 | - **Minimal implementation overhead** compared to other enhancement techniques
 20 | 
 21 | The "think" tool excels where other approaches fall short:
 22 | - **Better than extended thinking** for cases requiring complex tool chains
 23 | - **More effective than baseline prompting** for policy-heavy scenarios
 24 | - **Especially powerful** when paired with optimized prompting
 25 | 
 26 | ## Quick Install
 27 | 
 28 | ### For Claude Desktop
 29 | 
 30 | ```bash
 31 | npx -y @smithery/cli@latest install @PhillipRt/think-mcp-server --client claude --config "{}"
 32 | ```
 33 | 
 34 | ### For Cursor
 35 | 
 36 | ```bash
 37 | npx -y @smithery/cli@latest install @PhillipRt/think-mcp-server --client cursor --config "{}"
 38 | ```
 39 | 
 40 | ## How It Works
 41 | 
 42 | The "think" tool implements the exact mechanism described in Anthropic's engineering blog. Unlike extended thinking (which happens before Claude starts responding), the "think" tool allows Claude to pause and reflect during its response generation.
 43 | 
 44 | **Key mechanism:** The tool doesn't perform any external actions or retrieve new information - it simply provides Claude with a dedicated scratchpad to work through reasoning step-by-step, which dramatically improves performance on complex tasks.
 45 | 
 46 | When Claude uses the "think" tool:
 47 | 1. It **pauses to organize thoughts** before continuing a complex reasoning chain
 48 | 2. It **creates a structured approach** to multi-step problems
 49 | 3. It **verifies policy compliance** more thoroughly and consistently
 50 | 4. It **carefully analyzes tool outputs** before deciding next steps
 51 | 5. It **maintains better context awareness** across long interactions
 52 | 
 53 | ### When to Use the Think Tool
 54 | 
 55 | The "think" tool is especially valuable when:
 56 | 
 57 | 1. **Working with other MCP tools** - Great for analyzing outputs from databases, filesystems, or APIs
 58 | 2. **Following complex policies** - Perfect for customer service, legal, or compliance scenarios
 59 | 3. **Making sequential decisions** - Ideal for workflows where later steps depend on earlier ones
 60 | 4. **Processing web search results** - Helps Claude synthesize information from multiple sources
 61 | 5. **Solving coding challenges** - Improves success rates on software engineering tasks
 62 | 
 63 | ## System Prompt for Optimal Results
 64 | 
 65 | Anthropic's research shows that **combining the "think" tool with optimized prompting delivers the strongest performance improvements**. For best results, add the following optimized system prompt to your Claude interaction:
 66 | 
 67 | ### For Claude Desktop (Custom Instructions)
 68 | 
 69 | 1. Go to Settings > Custom Instructions
 70 | 2. Add the following system prompt:
 71 | 
 72 | ```
 73 | You have access to a "think" tool that provides a dedicated space for structured reasoning. Using this tool significantly improves your performance on complex tasks.
 74 | 
 75 | ## When to use the think tool
 76 | 
 77 | Before taking any action or responding to the user after receiving tool results, use the think tool as a scratchpad to:
 78 | - List the specific rules that apply to the current request
 79 | - Check if all required information is collected
 80 | - Verify that the planned action complies with all policies
 81 | - Iterate over tool results for correctness
 82 | - Analyze complex information from web searches or other tools
 83 | - Plan multi-step approaches before executing them
 84 | 
 85 | ## How to use the think tool effectively
 86 | 
 87 | When using the think tool:
 88 | 1. Break down complex problems into clearly defined steps
 89 | 2. Identify key facts, constraints, and requirements
 90 | 3. Check for gaps in information and plan how to fill them
 91 | 4. Evaluate multiple approaches before choosing one
 92 | 5. Verify your reasoning for logical errors or biases
 93 | 
 94 | Remember that using the think tool has been shown to improve your performance by up to 54% on complex tasks, especially when working with multiple tools or following detailed policies.
 95 | ```
 96 | 
 97 | ### For Cursor (Global Rules)
 98 | 
 99 | To add the Think Tool as a Cursor Rule:
100 | 
101 | 1. Open Cursor Settings
102 | 2. Navigate to General > Rules for AI
103 | 3. Add a new rule with the following content:
104 | 
105 | ```
106 | After any context change (viewing new files, running commands, or receiving tool outputs), use the "mcp_think" tool to organize your reasoning before responding.
107 | 
108 | Specifically, always use the think tool when:
109 | - After examining file contents or project structure
110 | - After running terminal commands or analyzing their outputs
111 | - After receiving search results or API responses
112 | - Before making code suggestions or explaining complex concepts
113 | - When transitioning between different parts of a task
114 | 
115 | When using the think tool:
116 | - List the specific rules or constraints that apply to the current task
117 | - Check if all required information is collected
118 | - Verify that your planned approach is correct
119 | - Break down complex problems into clearly defined steps
120 | - Analyze outputs from other tools thoroughly
121 | - Plan multi-step approaches before executing them
122 | 
123 | The think tool has been proven to improve performance by up to 54% on complex tasks, especially when working with multiple tools or following detailed policies.
124 | ```
125 | 
126 | ## Manual Installation
127 | 
128 | If you prefer to run the server locally:
129 | 
130 | 1. **Clone the repository**:
131 |    ```bash
132 |    git clone https://github.com/PhillipRt/think-mcp-server.git
133 |    cd think-mcp-server
134 |    ```
135 | 
136 | 2. **Install dependencies**:
137 |    ```bash
138 |    npm install
139 |    ```
140 | 
141 | 3. **Build and run**:
142 |    ```bash
143 |    npm run build
144 |    npm start
145 |    ```
146 | 
147 | 4. **Configure Claude Desktop manually**:
148 |    - Find or create the configuration file:
149 |      - macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
150 |      - Windows: `%APPDATA%\Claude\claude_desktop_config.json`
151 |    - Add your server configuration:
152 | 
153 |    ```json
154 |    {
155 |      "mcpServers": {
156 |        "think-tool": {
157 |          "command": "node",
158 |          "args": ["path/to/think-mcp-server/dist/server.js"]
159 |        }
160 |      }
161 |    }
162 |    ```
163 | 
164 | ## License
165 | 
166 | [MIT License](LICENSE)
```

--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------

```json
 1 | {
 2 |   "compilerOptions": {
 3 |     "target": "ES2020",
 4 |     "module": "NodeNext",
 5 |     "moduleResolution": "NodeNext",
 6 |     "esModuleInterop": true,
 7 |     "outDir": "dist",
 8 |     "strict": true,
 9 |     "skipLibCheck": true,
10 |     "forceConsistentCasingInFileNames": true
11 |   },
12 |   "include": ["src/**/*"],
13 |   "exclude": ["node_modules"]
14 | }
```

--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------

```json
 1 | {
 2 |   "name": "think-mcp-server",
 3 |   "version": "1.0.0",
 4 |   "type": "module",
 5 |   "main": "dist/server.js",
 6 |   "scripts": {
 7 |     "build": "tsc",
 8 |     "start": "node dist/server.js",
 9 |     "dev": "node --loader ts-node/esm src/server.ts",
10 |     "inspect": "npx fastmcp inspect src/server.ts"
11 |   },
12 |   "keywords": ["mcp", "ai", "claude", "think-tool"],
13 |   "author": "",
14 |   "license": "ISC",
15 |   "description": "An MCP server that provides a 'think' tool for structured reasoning",
16 |   "dependencies": {
17 |     "@types/node": "^22.13.17",
18 |     "fastmcp": "^1.21.0",
19 |     "ts-node": "^10.9.2",
20 |     "typescript": "^5.8.2",
21 |     "zod": "^3.24.2"
22 |   },
23 |   "devDependencies": {
24 |     "nodemon": "^3.1.9"
25 |   }
26 | }
```

--------------------------------------------------------------------------------
/smithery.yaml:
--------------------------------------------------------------------------------

```yaml
 1 | # Smithery configuration file: https://smithery.ai/docs/config#smitheryyaml
 2 | name: "@PhillipRt/think-mcp-server"
 3 | description: "A structured reasoning tool for AI assistants that provides a dedicated space for complex thinking and analysis"
 4 | version: "1.0.1"
 5 | 
 6 | startCommand:
 7 |   type: stdio
 8 |   configSchema:
 9 |     type: "object"
10 |     title: "Think Tool Configuration"
11 |     description: "Configuration options for the Think Tool MCP server"
12 |     properties: {}
13 |     required: []
14 |   commandFunction: |-
15 |     (config) => ({
16 |       command: 'node',
17 |       args: ['dist/server.js'],
18 |       env: {
19 |         NODE_ENV: 'production'
20 |       }
21 |     })
22 | 
23 | clients:
24 |   - claude
25 |   - cursor
26 |   - windsurf
27 |   - cline
```

--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------

```dockerfile
 1 | FROM node:18-alpine AS builder
 2 | WORKDIR /app
 3 | 
 4 | # Copy package files
 5 | COPY package*.json tsconfig.json ./
 6 | 
 7 | # Install dependencies with caching
 8 | RUN --mount=type=cache,target=/root/.npm npm install
 9 | 
10 | # Copy source code
11 | COPY . .
12 | 
13 | # Build the application
14 | RUN npm run build
15 | 
16 | FROM node:18-alpine AS release
17 | WORKDIR /app
18 | 
19 | # Copy only the necessary files from builder
20 | COPY --from=builder /app/dist /app/dist
21 | COPY --from=builder /app/package*.json ./
22 | 
23 | # Set production environment
24 | ENV NODE_ENV=production
25 | 
26 | # Install only production dependencies
27 | RUN npm ci --ignore-scripts --omit=dev
28 | 
29 | # Set executable permissions
30 | RUN chmod +x dist/server.js
31 | 
32 | # Set the user to non-root
33 | USER node
34 | 
35 | # Use ENTRYPOINT instead of CMD for better compatibility
36 | ENTRYPOINT ["node", "dist/server.js"]
```

--------------------------------------------------------------------------------
/src/server.ts:
--------------------------------------------------------------------------------

```typescript
 1 | import { FastMCP, UserError } from "fastmcp";
 2 | import { z } from "zod";
 3 | 
 4 | // Create a new MCP server
 5 | const server = new FastMCP({
 6 |   name: "Think Tool Server",
 7 |   version: "1.0.0",
 8 | });
 9 | 
10 | // Add the "think" tool
11 | server.addTool({
12 |   name: "think",
13 |   description: "Use the tool to think about something. It will not obtain new information or change the database, but just append the thought to the log. Use it when complex reasoning or some cache memory is needed.",
14 |   parameters: z.object({
15 |     thought: z.string().describe("A thought to think about.")
16 |   }),
17 |   execute: async (args, { log }) => {
18 |     // Log the thought (this will be visible in the server logs but not to the user)
19 |     log.info("Thinking process", { thought: args.thought });
20 |     
21 |     // Simply return the thought itself, as per Anthropic's blog post
22 |     return args.thought;
23 |   },
24 | });
25 | 
26 | // Start the server with stdio transport
27 | server.start({
28 |   transportType: "stdio",
29 | });
30 | 
31 | // Use console.error instead of console.log - this writes to stderr which won't interfere with the protocol
32 | console.error("Think Tool Server is running...");
```