gthinking 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server.d.ts +3 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +113 -0
- package/dist/server.js.map +1 -0
- package/package.json +8 -3
- package/server.ts +115 -0
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../server.ts"],"names":[],"mappings":""}
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
|
|
5
|
+
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
6
|
+
const zod_1 = require("zod");
|
|
7
|
+
const engine_1 = require("./engine");
|
|
8
|
+
const server = new mcp_js_1.McpServer({
|
|
9
|
+
name: "gthinking",
|
|
10
|
+
version: "1.0.0",
|
|
11
|
+
});
|
|
12
|
+
// Register the main thinking tool
|
|
13
|
+
server.registerTool("think", {
|
|
14
|
+
title: "Sequential Thinking",
|
|
15
|
+
description: "A comprehensive intelligent thinking framework for complex problem solving, research, and analysis.",
|
|
16
|
+
inputSchema: {
|
|
17
|
+
query: zod_1.z.string().describe("The query or problem to think about"),
|
|
18
|
+
context: zod_1.z.string().optional().describe("Additional context for the thinking process"),
|
|
19
|
+
depth: zod_1.z.enum(["surface", "moderate", "deep"]).optional().default("moderate").describe("Depth of analysis"),
|
|
20
|
+
complexity: zod_1.z.enum(["simple", "moderate", "complex"]).optional().default("moderate").describe("Reasoning complexity"),
|
|
21
|
+
},
|
|
22
|
+
}, async (args) => {
|
|
23
|
+
try {
|
|
24
|
+
const response = await engine_1.thinkingEngine.think({
|
|
25
|
+
id: `mcp_${Date.now()}`,
|
|
26
|
+
query: args.query,
|
|
27
|
+
context: args.context,
|
|
28
|
+
config: {
|
|
29
|
+
analysisDepth: args.depth,
|
|
30
|
+
reasoningComplexity: args.complexity,
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
return {
|
|
34
|
+
content: [{
|
|
35
|
+
type: "text",
|
|
36
|
+
text: response.finalAnswer
|
|
37
|
+
}]
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
return {
|
|
42
|
+
content: [{
|
|
43
|
+
type: "text",
|
|
44
|
+
text: `Error: ${error instanceof Error ? error.message : String(error)}`
|
|
45
|
+
}],
|
|
46
|
+
isError: true
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
// Register quick search tool
|
|
51
|
+
server.registerTool("quick_search", {
|
|
52
|
+
title: "Quick Search",
|
|
53
|
+
description: "Fast search and synthesis for current events or quick facts.",
|
|
54
|
+
inputSchema: {
|
|
55
|
+
query: zod_1.z.string().describe("The search query"),
|
|
56
|
+
},
|
|
57
|
+
}, async (args) => {
|
|
58
|
+
try {
|
|
59
|
+
const response = await engine_1.thinkingEngine.quickSearch(args.query);
|
|
60
|
+
return {
|
|
61
|
+
content: [{
|
|
62
|
+
type: "text",
|
|
63
|
+
text: response.finalAnswer
|
|
64
|
+
}]
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
return {
|
|
69
|
+
content: [{
|
|
70
|
+
type: "text",
|
|
71
|
+
text: `Error: ${error instanceof Error ? error.message : String(error)}`
|
|
72
|
+
}],
|
|
73
|
+
isError: true
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
// Register creative solve tool
|
|
78
|
+
server.registerTool("creative_solve", {
|
|
79
|
+
title: "Creative Solve",
|
|
80
|
+
description: "Use creative thinking techniques (SCAMPER, Brainstorming, etc.) to solve a problem.",
|
|
81
|
+
inputSchema: {
|
|
82
|
+
problem: zod_1.z.string().describe("The problem to solve creatively"),
|
|
83
|
+
},
|
|
84
|
+
}, async (args) => {
|
|
85
|
+
try {
|
|
86
|
+
const response = await engine_1.thinkingEngine.creativeSolve(args.problem);
|
|
87
|
+
return {
|
|
88
|
+
content: [{
|
|
89
|
+
type: "text",
|
|
90
|
+
text: response.finalAnswer
|
|
91
|
+
}]
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
catch (error) {
|
|
95
|
+
return {
|
|
96
|
+
content: [{
|
|
97
|
+
type: "text",
|
|
98
|
+
text: `Error: ${error instanceof Error ? error.message : String(error)}`
|
|
99
|
+
}],
|
|
100
|
+
isError: true
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
async function runServer() {
|
|
105
|
+
const transport = new stdio_js_1.StdioServerTransport();
|
|
106
|
+
await server.connect(transport);
|
|
107
|
+
console.error("GThinking MCP Server running on stdio");
|
|
108
|
+
}
|
|
109
|
+
runServer().catch((error) => {
|
|
110
|
+
console.error("Fatal error running server:", error);
|
|
111
|
+
process.exit(1);
|
|
112
|
+
});
|
|
113
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../server.ts"],"names":[],"mappings":";;;AACA,oEAAoE;AACpE,wEAAiF;AACjF,6BAAwB;AACxB,qCAA0C;AAG1C,MAAM,MAAM,GAAG,IAAI,kBAAS,CAAC;IAC3B,IAAI,EAAE,WAAW;IACjB,OAAO,EAAE,OAAO;CACjB,CAAC,CAAC;AAEH,kCAAkC;AAClC,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE;IAC3B,KAAK,EAAE,qBAAqB;IAC5B,WAAW,EAAE,qGAAqG;IAClH,WAAW,EAAE;QACX,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qCAAqC,CAAC;QACjE,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC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J,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE,CAAC;oBACR,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,UAAU,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;iBACzE,CAAC;YACF,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,KAAK,UAAU,SAAS;IACtB,MAAM,SAAS,GAAG,IAAI,+BAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,uCAAuC,CAAC,CAAC;AACzD,CAAC;AAED,SAAS,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IAC1B,OAAO,CAAC,KAAK,CAAC,6BAA6B,EAAE,KAAK,CAAC,CAAC;IACpD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gthinking",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "A comprehensive intelligent sequential thinking framework for complex problem solving",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"gthinking": "dist/server.js"
|
|
8
|
+
},
|
|
6
9
|
"types": "dist/index.d.ts",
|
|
7
10
|
"scripts": {
|
|
8
|
-
"build": "tsc",
|
|
11
|
+
"build": "tsc && chmod +x dist/server.js",
|
|
9
12
|
"dev": "ts-node examples.ts",
|
|
10
13
|
"test": "jest",
|
|
11
14
|
"lint": "eslint . --ext .ts",
|
|
@@ -26,7 +29,9 @@
|
|
|
26
29
|
"author": "Sequential Thinking Team",
|
|
27
30
|
"license": "MIT",
|
|
28
31
|
"dependencies": {
|
|
29
|
-
"
|
|
32
|
+
"@modelcontextprotocol/sdk": "^1.25.3",
|
|
33
|
+
"events": "^3.3.0",
|
|
34
|
+
"zod": "^4.3.6"
|
|
30
35
|
},
|
|
31
36
|
"devDependencies": {
|
|
32
37
|
"@types/node": "^20.0.0",
|
package/server.ts
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import { thinkingEngine } from './engine';
|
|
6
|
+
import { ThinkingStage } from './types';
|
|
7
|
+
|
|
8
|
+
const server = new McpServer({
|
|
9
|
+
name: "gthinking",
|
|
10
|
+
version: "1.0.0",
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
// Register the main thinking tool
|
|
14
|
+
server.registerTool("think", {
|
|
15
|
+
title: "Sequential Thinking",
|
|
16
|
+
description: "A comprehensive intelligent thinking framework for complex problem solving, research, and analysis.",
|
|
17
|
+
inputSchema: {
|
|
18
|
+
query: z.string().describe("The query or problem to think about"),
|
|
19
|
+
context: z.string().optional().describe("Additional context for the thinking process"),
|
|
20
|
+
depth: z.enum(["surface", "moderate", "deep"]).optional().default("moderate").describe("Depth of analysis"),
|
|
21
|
+
complexity: z.enum(["simple", "moderate", "complex"]).optional().default("moderate").describe("Reasoning complexity"),
|
|
22
|
+
},
|
|
23
|
+
}, async (args) => {
|
|
24
|
+
try {
|
|
25
|
+
const response = await thinkingEngine.think({
|
|
26
|
+
id: `mcp_${Date.now()}`,
|
|
27
|
+
query: args.query,
|
|
28
|
+
context: args.context,
|
|
29
|
+
config: {
|
|
30
|
+
analysisDepth: args.depth as any,
|
|
31
|
+
reasoningComplexity: args.complexity as any,
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
return {
|
|
36
|
+
content: [{
|
|
37
|
+
type: "text",
|
|
38
|
+
text: response.finalAnswer
|
|
39
|
+
}]
|
|
40
|
+
};
|
|
41
|
+
} catch (error) {
|
|
42
|
+
return {
|
|
43
|
+
content: [{
|
|
44
|
+
type: "text",
|
|
45
|
+
text: `Error: ${error instanceof Error ? error.message : String(error)}`
|
|
46
|
+
}],
|
|
47
|
+
isError: true
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
// Register quick search tool
|
|
53
|
+
server.registerTool("quick_search", {
|
|
54
|
+
title: "Quick Search",
|
|
55
|
+
description: "Fast search and synthesis for current events or quick facts.",
|
|
56
|
+
inputSchema: {
|
|
57
|
+
query: z.string().describe("The search query"),
|
|
58
|
+
},
|
|
59
|
+
}, async (args) => {
|
|
60
|
+
try {
|
|
61
|
+
const response = await thinkingEngine.quickSearch(args.query);
|
|
62
|
+
return {
|
|
63
|
+
content: [{
|
|
64
|
+
type: "text",
|
|
65
|
+
text: response.finalAnswer
|
|
66
|
+
}]
|
|
67
|
+
};
|
|
68
|
+
} catch (error) {
|
|
69
|
+
return {
|
|
70
|
+
content: [{
|
|
71
|
+
type: "text",
|
|
72
|
+
text: `Error: ${error instanceof Error ? error.message : String(error)}`
|
|
73
|
+
}],
|
|
74
|
+
isError: true
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
// Register creative solve tool
|
|
80
|
+
server.registerTool("creative_solve", {
|
|
81
|
+
title: "Creative Solve",
|
|
82
|
+
description: "Use creative thinking techniques (SCAMPER, Brainstorming, etc.) to solve a problem.",
|
|
83
|
+
inputSchema: {
|
|
84
|
+
problem: z.string().describe("The problem to solve creatively"),
|
|
85
|
+
},
|
|
86
|
+
}, async (args) => {
|
|
87
|
+
try {
|
|
88
|
+
const response = await thinkingEngine.creativeSolve(args.problem);
|
|
89
|
+
return {
|
|
90
|
+
content: [{
|
|
91
|
+
type: "text",
|
|
92
|
+
text: response.finalAnswer
|
|
93
|
+
}]
|
|
94
|
+
};
|
|
95
|
+
} catch (error) {
|
|
96
|
+
return {
|
|
97
|
+
content: [{
|
|
98
|
+
type: "text",
|
|
99
|
+
text: `Error: ${error instanceof Error ? error.message : String(error)}`
|
|
100
|
+
}],
|
|
101
|
+
isError: true
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
async function runServer() {
|
|
107
|
+
const transport = new StdioServerTransport();
|
|
108
|
+
await server.connect(transport);
|
|
109
|
+
console.error("GThinking MCP Server running on stdio");
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
runServer().catch((error) => {
|
|
113
|
+
console.error("Fatal error running server:", error);
|
|
114
|
+
process.exit(1);
|
|
115
|
+
});
|