Skip to content

Commit 2833e07

Browse files
authored
feat: add think MCP server (#11)
A no-op tool that forces the model to think about a message. Takes a message string input and echoes it back, useful for debugging or forcing explicit reasoning steps in the model.
1 parent 9ba1b15 commit 2833e07

3 files changed

Lines changed: 96 additions & 0 deletions

File tree

.github/workflows/image.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ jobs:
2727
- mcp: wait
2828
dockerfile: ./Dockerfile
2929
context: ./
30+
- mcp: think
31+
dockerfile: ./Dockerfile
32+
context: ./
3033
- mcp: memory
3134
dockerfile: ./Dockerfile
3235
context: ./

README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,56 @@ mcp:
101101
}
102102
```
103103

104+
105+
### 🧠 Think Server
106+
107+
A no-op tool that forces the model to think about a message. Useful for debugging or forcing explicit reasoning steps in the model.
108+
109+
**Features:**
110+
- Simple message input that gets echoed back
111+
- Forces the model to explicitly process and think about the message
112+
- Input validation (non-empty message)
113+
- JSON schema validation for inputs/outputs
114+
115+
**Tool:**
116+
- `think` - Think about a given message
117+
118+
**Input Format:**
119+
```json
120+
{
121+
"message": "What is the capital of France?"
122+
}
123+
```
124+
125+
**Output Format:**
126+
```json
127+
{
128+
"result": "Thinking about: What is the capital of France?"
129+
}
130+
```
131+
132+
**Docker Image:**
133+
```bash
134+
docker run ghcr.io/mudler/mcps/think:latest
135+
```
136+
137+
**LocalAI configuration (to add to the model config):**
138+
```yaml
139+
mcp:
140+
stdio: |
141+
{
142+
"mcpServers": {
143+
"think": {
144+
"command": "docker",
145+
"args": [
146+
"run", "-i", "--rm",
147+
"ghcr.io/mudler/mcps/think:master"
148+
]
149+
}
150+
}
151+
}
152+
```
153+
104154
### ⏱️ Wait Server
105155

106156
A simple wait/sleep server that allows AI models to autonomously wait for a specified duration. Useful for waiting for asynchronous operations to complete.

think/main.go

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package main
2+
3+
import (
4+
"context"
5+
"fmt"
6+
"log"
7+
8+
"github.com/modelcontextprotocol/go-sdk/mcp"
9+
)
10+
11+
type Input struct {
12+
Message string `json:"message" jsonschema:"the message to think about - the model should process and analyze this message"`
13+
}
14+
15+
type Output struct {
16+
Result string `json:"result" jsonschema:"the result of thinking about the message"`
17+
}
18+
19+
func Think(ctx context.Context, req *mcp.CallToolRequest, input Input) (
20+
*mcp.CallToolResult,
21+
Output,
22+
error,
23+
) {
24+
// Validate input
25+
if input.Message == "" {
26+
return nil, Output{}, fmt.Errorf("message cannot be empty")
27+
}
28+
29+
// Simple no-op: just echo back the message
30+
// This forces the model to think by processing and echoing the message
31+
result := fmt.Sprintf("Thinking about: %s", input.Message)
32+
33+
return nil, Output{Result: result}, nil
34+
}
35+
36+
func main() {
37+
// Create a server with a single tool.
38+
server := mcp.NewServer(&mcp.Implementation{Name: "think", Version: "v1.0.0"}, nil)
39+
mcp.AddTool(server, &mcp.Tool{Name: "think", Description: "A no-op tool that forces the model to think about a message"}, Think)
40+
if err := server.Run(context.Background(), &mcp.StdioTransport{}); err != nil {
41+
log.Fatal(err)
42+
}
43+
}

0 commit comments

Comments
 (0)