knowmind 0.1.21 → 0.1.22

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/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Knowmind CLI — Änderungen
2
2
 
3
+ ## 0.1.22 (2026-06-11)
4
+
5
+ **Discovery-Modus ohne Token (Introspection-fähig)**
6
+ - Ist KEIN Token konfiguriert, beantwortet `knowmind mcp` jetzt `initialize`,
7
+ `tools/list` und `prompts/list` über die ÖFFENTLICHE Server-Discovery
8
+ (`GET /api/mcp/v1` — liefert Name, Version und alle Tool-Definitionen ohne
9
+ Auth). Vorher schlugen ohne Token ALLE Requests inkl. `initialize` mit
10
+ `-32001` fehl — Verzeichnis-Crawler (z. B. Glama) konnten den Server nicht
11
+ inspizieren.
12
+ - `tools/call` verlangt weiterhin einen Token und verweist klar auf
13
+ `knowmind login`. Ein konfigurierter, aber ungültiger Token führt unverändert
14
+ zum harten Verbindungsfehler (kein falsches „connected ✓").
15
+ - Neu: `Dockerfile` im Repo (node:20-alpine, `knowmind mcp` als Entrypoint) —
16
+ für Container-basierte Inspection/Nutzung.
17
+
3
18
  ## 0.1.21 (2026-06-10)
4
19
 
5
20
  **Bugfix: `knowmind init`-Recall-Hook funktioniert jetzt auf Windows**
package/package.json CHANGED
@@ -1,61 +1,61 @@
1
- {
2
- "name": "knowmind",
3
- "version": "0.1.21",
4
- "mcpName": "io.github.Schubeler-Consulting/knowmind",
5
- "description": "Knowmind — das Agentengehirn aus Deutschland: CLI + MCP-Server (Langzeitgedächtnis & Wissensgraph für Ihre KI, Server in Deutschland).",
6
- "type": "module",
7
- "license": "Apache-2.0",
8
- "homepage": "https://knowmind.de",
9
- "repository": {
10
- "type": "git",
11
- "url": "git+https://github.com/Schubeler-Consulting/knowmind.git"
12
- },
13
- "bugs": {
14
- "url": "https://knowmind.de/support",
15
- "email": "info@schuebeler-consulting.de"
16
- },
17
- "author": {
18
- "name": "Knowmind",
19
- "email": "info@schuebeler-consulting.de",
20
- "url": "https://knowmind.de"
21
- },
22
- "engines": {
23
- "node": ">=20"
24
- },
25
- "bin": {
26
- "knowmind": "bin/knowmind.js"
27
- },
28
- "files": [
29
- "bin",
30
- "src",
31
- "!src/*.test.js",
32
- "README.md",
33
- "CHANGELOG.md",
34
- "LICENSE"
35
- ],
36
- "scripts": {
37
- "test": "node --test src/*.test.js"
38
- },
39
- "dependencies": {
40
- "@huggingface/transformers": "^3.5.0"
41
- },
42
- "overrides": {
43
- "global-agent": "^4.1.3"
44
- },
45
- "keywords": [
46
- "knowmind",
47
- "mcp",
48
- "model-context-protocol",
49
- "knowledge-graph",
50
- "recall",
51
- "memory",
52
- "rag",
53
- "claude",
54
- "openai",
55
- "anthropic",
56
- "ai"
57
- ],
58
- "publishConfig": {
59
- "access": "public"
60
- }
61
- }
1
+ {
2
+ "name": "knowmind",
3
+ "version": "0.1.22",
4
+ "mcpName": "io.github.Schubeler-Consulting/knowmind",
5
+ "description": "Knowmind — das Agentengehirn aus Deutschland: CLI + MCP-Server (Langzeitgedächtnis & Wissensgraph für Ihre KI, Server in Deutschland).",
6
+ "type": "module",
7
+ "license": "Apache-2.0",
8
+ "homepage": "https://knowmind.de",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/Schubeler-Consulting/knowmind.git"
12
+ },
13
+ "bugs": {
14
+ "url": "https://knowmind.de/support",
15
+ "email": "info@schuebeler-consulting.de"
16
+ },
17
+ "author": {
18
+ "name": "Knowmind",
19
+ "email": "info@schuebeler-consulting.de",
20
+ "url": "https://knowmind.de"
21
+ },
22
+ "engines": {
23
+ "node": ">=20"
24
+ },
25
+ "bin": {
26
+ "knowmind": "bin/knowmind.js"
27
+ },
28
+ "files": [
29
+ "bin",
30
+ "src",
31
+ "!src/*.test.js",
32
+ "README.md",
33
+ "CHANGELOG.md",
34
+ "LICENSE"
35
+ ],
36
+ "scripts": {
37
+ "test": "node --test src/*.test.js"
38
+ },
39
+ "dependencies": {
40
+ "@huggingface/transformers": "^3.5.0"
41
+ },
42
+ "overrides": {
43
+ "global-agent": "^4.1.3"
44
+ },
45
+ "keywords": [
46
+ "knowmind",
47
+ "mcp",
48
+ "model-context-protocol",
49
+ "knowledge-graph",
50
+ "recall",
51
+ "memory",
52
+ "rag",
53
+ "claude",
54
+ "openai",
55
+ "anthropic",
56
+ "ai"
57
+ ],
58
+ "publishConfig": {
59
+ "access": "public"
60
+ }
61
+ }
package/src/mcp-stdio.js CHANGED
@@ -19,6 +19,15 @@
19
19
  * tatsächlichen serverInfo/capabilities den Client erreichen. Bei Server-
20
20
  * Fehler/Offline fällt der Proxy auf einen lokalen Default zurück.
21
21
  *
22
+ * Seit 0.1.22 gibt es einen DISCOVERY-MODUS: Ist KEIN Token konfiguriert,
23
+ * beantwortet der Proxy `initialize`, `tools/list` und `prompts/list` über die
24
+ * ÖFFENTLICHE Server-Discovery (GET {apiUrl}/api/mcp/v1 — liefert Name, Version
25
+ * und alle Tool-Definitionen ohne Auth). Damit funktioniert Introspection
26
+ * (z. B. Verzeichnis-Crawler wie Glama) ohne Account; erst `tools/call`
27
+ * verlangt einen Token und verweist klar auf `knowmind login`. Ein
28
+ * konfigurierter, aber UNGÜLTIGER Token führt weiterhin zum harten
29
+ * Verbindungsfehler, damit MCP-Clients nicht fälschlich „connected" anzeigen.
30
+ *
22
31
  * Protokoll: stdio mit zeilenweise JSON (NDJSON-Style). Jedes Frame ist ein
23
32
  * vollständiges JSON-RPC-Objekt.
24
33
  */
@@ -75,6 +84,20 @@ function write(obj) {
75
84
  process.stdout.write(JSON.stringify(obj) + "\n");
76
85
  }
77
86
 
87
+ /**
88
+ * Öffentliche Server-Discovery (kein Auth nötig): GET {apiUrl}/api/mcp/v1
89
+ * liefert { name, version, protocolVersion, tools: [...] }. Grundlage des
90
+ * Discovery-Modus ohne Token.
91
+ */
92
+ async function fetchPublicDiscovery() {
93
+ const { apiUrl } = loadConfig();
94
+ const r = await fetch(`${apiUrl}/api/mcp/v1`, {
95
+ headers: { accept: "application/json" },
96
+ });
97
+ if (!r.ok) throw new Error(`Knowmind-Server: HTTP ${r.status}`);
98
+ return await r.json();
99
+ }
100
+
78
101
  /**
79
102
  * Probiert den konfigurierten Token gegen den Server. Liefert
80
103
  * { ok: true } oder { ok: false, reason: "..." }. Wird in der
@@ -142,10 +165,30 @@ async function probeAuth() {
142
165
  }
143
166
 
144
167
  export async function runStdioServer() {
145
- // Auth einmal am Start prüfen. Das Ergebnis cachen — der MCP-Client
146
- // soll sofort beim initialize wissen, ob die Verbindung wirklich steht.
147
- const auth = await probeAuth();
148
- if (!auth.ok) {
168
+ // Kein Token konfiguriert → Discovery-Modus: initialize/tools/list laufen
169
+ // über die öffentliche Server-Discovery, tools/call verlangt Login.
170
+ let discoveryMode = false;
171
+ try {
172
+ discoveryMode = !loadConfig().token;
173
+ } catch {
174
+ discoveryMode = true;
175
+ }
176
+
177
+ // Auth einmal am Start prüfen (nur wenn ein Token vorhanden ist). Das
178
+ // Ergebnis cachen — der MCP-Client soll sofort beim initialize wissen,
179
+ // ob die Verbindung wirklich steht.
180
+ const auth = discoveryMode
181
+ ? {
182
+ ok: false,
183
+ reason:
184
+ "Kein Knowmind-Token konfiguriert. Bitte `knowmind login` im Terminal ausführen.",
185
+ }
186
+ : await probeAuth();
187
+ if (discoveryMode) {
188
+ process.stderr.write(
189
+ "[knowmind] Kein Token — Discovery-Modus: initialize/tools/list öffentlich, tools/call erfordert `knowmind login`.\n",
190
+ );
191
+ } else if (!auth.ok) {
149
192
  process.stderr.write(`[knowmind] AUTH-FEHLER: ${auth.reason}\n`);
150
193
  }
151
194
 
@@ -169,6 +212,65 @@ export async function runStdioServer() {
169
212
  const isNotification = req.id === undefined && typeof req.method === "string" && req.method.startsWith("notifications/");
170
213
  if (isNotification) continue;
171
214
 
215
+ if (discoveryMode) {
216
+ if (req.method === "ping") {
217
+ write({ jsonrpc: "2.0", id: req.id ?? null, result: {} });
218
+ continue;
219
+ }
220
+ if (req.method === "initialize") {
221
+ // serverInfo/protocolVersion möglichst aus der öffentlichen
222
+ // Discovery übernehmen; bei Fehler lokaler Default.
223
+ const initResult = localInitializeResult();
224
+ try {
225
+ const pub = await fetchPublicDiscovery();
226
+ if (pub && typeof pub === "object") {
227
+ if (typeof pub.protocolVersion === "string")
228
+ initResult.protocolVersion = pub.protocolVersion;
229
+ initResult.serverInfo = {
230
+ name: "knowmind",
231
+ version:
232
+ typeof pub.version === "string" ? pub.version : VERSION,
233
+ };
234
+ }
235
+ } catch {
236
+ // offline → lokaler Default reicht für initialize.
237
+ }
238
+ write({ jsonrpc: "2.0", id: req.id ?? null, result: initResult });
239
+ continue;
240
+ }
241
+ if (req.method === "tools/list") {
242
+ try {
243
+ const pub = await fetchPublicDiscovery();
244
+ const tools = Array.isArray(pub?.tools) ? pub.tools : [];
245
+ write({ jsonrpc: "2.0", id: req.id ?? null, result: { tools } });
246
+ } catch (e) {
247
+ write({
248
+ jsonrpc: "2.0",
249
+ id: req.id ?? null,
250
+ error: {
251
+ code: -32000,
252
+ message: `Knowmind-Discovery nicht erreichbar: ${e instanceof Error ? e.message : String(e)}`,
253
+ },
254
+ });
255
+ }
256
+ continue;
257
+ }
258
+ if (req.method === "prompts/list") {
259
+ write({ jsonrpc: "2.0", id: req.id ?? null, result: { prompts: [] } });
260
+ continue;
261
+ }
262
+ // tools/call & Co. brauchen einen Token → klare Fehlermeldung.
263
+ write({
264
+ jsonrpc: "2.0",
265
+ id: req.id ?? null,
266
+ error: {
267
+ code: -32001,
268
+ message: `Knowmind: ${auth.reason}`,
269
+ },
270
+ });
271
+ continue;
272
+ }
273
+
172
274
  if (!auth.ok && req.method !== "ping") {
173
275
  // Initialize (und alles weitere) FEHLSCHLAGEN lassen, damit der
174
276
  // MCP-Client „connected" nicht fälschlich anzeigt. Claude Code,