@monoes/monomindcli 2.5.5 → 2.5.6
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/bin/cli.js +16 -6
- package/bin/mcp-server.js +17 -8
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -84,17 +84,27 @@ if (isMCPMode) {
|
|
|
84
84
|
|
|
85
85
|
for (const line of lines) {
|
|
86
86
|
if (line.trim()) {
|
|
87
|
+
let parsed;
|
|
87
88
|
try {
|
|
88
|
-
|
|
89
|
-
|
|
89
|
+
parsed = JSON.parse(line);
|
|
90
|
+
} catch {
|
|
91
|
+
console.log(JSON.stringify({
|
|
92
|
+
jsonrpc: '2.0',
|
|
93
|
+
id: null,
|
|
94
|
+
error: { code: -32700, message: 'Parse error' },
|
|
95
|
+
}));
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
try {
|
|
99
|
+
const response = await handleMessage(parsed);
|
|
90
100
|
if (response) {
|
|
91
101
|
console.log(JSON.stringify(response));
|
|
92
102
|
}
|
|
93
103
|
} catch (error) {
|
|
94
104
|
console.log(JSON.stringify({
|
|
95
105
|
jsonrpc: '2.0',
|
|
96
|
-
id: null,
|
|
97
|
-
error: { code: -
|
|
106
|
+
id: parsed.id ?? null,
|
|
107
|
+
error: { code: -32603, message: error instanceof Error ? error.message : 'Internal error' },
|
|
98
108
|
}));
|
|
99
109
|
}
|
|
100
110
|
}
|
|
@@ -132,7 +142,7 @@ if (isMCPMode) {
|
|
|
132
142
|
};
|
|
133
143
|
|
|
134
144
|
case 'tools/list': {
|
|
135
|
-
const tools = listMCPTools();
|
|
145
|
+
const tools = await listMCPTools();
|
|
136
146
|
return {
|
|
137
147
|
jsonrpc: '2.0',
|
|
138
148
|
id: message.id,
|
|
@@ -150,7 +160,7 @@ if (isMCPMode) {
|
|
|
150
160
|
const toolName = params.name;
|
|
151
161
|
const toolParams = params.arguments || {};
|
|
152
162
|
|
|
153
|
-
if (!hasTool(toolName)) {
|
|
163
|
+
if (!await hasTool(toolName)) {
|
|
154
164
|
return {
|
|
155
165
|
jsonrpc: '2.0',
|
|
156
166
|
id: message.id,
|
package/bin/mcp-server.js
CHANGED
|
@@ -41,22 +41,31 @@ process.stdin.on('data', async (chunk) => {
|
|
|
41
41
|
|
|
42
42
|
for (const line of lines) {
|
|
43
43
|
if (line.trim()) {
|
|
44
|
+
let parsed;
|
|
44
45
|
try {
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
parsed = JSON.parse(line);
|
|
47
|
+
} catch {
|
|
48
|
+
console.log(JSON.stringify({
|
|
49
|
+
jsonrpc: '2.0',
|
|
50
|
+
id: null,
|
|
51
|
+
error: { code: -32700, message: 'Parse error' },
|
|
52
|
+
}));
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
const response = await handleMessage(parsed);
|
|
47
57
|
if (response) {
|
|
48
58
|
console.log(JSON.stringify(response));
|
|
49
59
|
}
|
|
50
60
|
} catch (error) {
|
|
51
61
|
console.error(
|
|
52
|
-
`[${new Date().toISOString()}] ERROR [monomind-mcp]
|
|
62
|
+
`[${new Date().toISOString()}] ERROR [monomind-mcp] handler error:`,
|
|
53
63
|
error instanceof Error ? error.message : String(error)
|
|
54
64
|
);
|
|
55
|
-
// Send parse error response
|
|
56
65
|
console.log(JSON.stringify({
|
|
57
66
|
jsonrpc: '2.0',
|
|
58
|
-
id: null,
|
|
59
|
-
error: { code: -
|
|
67
|
+
id: parsed.id ?? null,
|
|
68
|
+
error: { code: -32603, message: error instanceof Error ? error.message : 'Internal error' },
|
|
60
69
|
}));
|
|
61
70
|
}
|
|
62
71
|
}
|
|
@@ -122,7 +131,7 @@ async function handleMessage(message) {
|
|
|
122
131
|
}
|
|
123
132
|
|
|
124
133
|
case 'tools/list': {
|
|
125
|
-
const tools = listMCPTools();
|
|
134
|
+
const tools = await listMCPTools();
|
|
126
135
|
return {
|
|
127
136
|
jsonrpc: '2.0',
|
|
128
137
|
id: message.id,
|
|
@@ -140,7 +149,7 @@ async function handleMessage(message) {
|
|
|
140
149
|
const toolName = params.name;
|
|
141
150
|
const toolParams = params.arguments || {};
|
|
142
151
|
|
|
143
|
-
if (!hasTool(toolName)) {
|
|
152
|
+
if (!await hasTool(toolName)) {
|
|
144
153
|
return {
|
|
145
154
|
jsonrpc: '2.0',
|
|
146
155
|
id: message.id,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monoes/monomindcli",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "CLI engine for Monomind \u2014 an open-source MCP server that extends Claude Code with a codebase knowledge graph (tree-sitter + SQLite), persistent memory, multi-agent task coordination, and session hooks. MIT licensed, fully local.",
|
|
6
6
|
"main": "dist/src/index.js",
|