knowledge-rag 3.4.2__tar.gz → 3.4.3__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: knowledge-rag
3
- Version: 3.4.2
3
+ Version: 3.4.3
4
4
  Summary: Local RAG System for Claude Code — Hybrid search + Cross-encoder Reranking + 12 MCP Tools. Zero external servers.
5
5
  Project-URL: Homepage, https://github.com/lyonzin/knowledge-rag
6
6
  Project-URL: Repository, https://github.com/lyonzin/knowledge-rag
@@ -38,7 +38,7 @@ Description-Content-Type: text/markdown
38
38
 
39
39
  <div align="center">
40
40
 
41
- ![Version](https://img.shields.io/badge/version-3.4.2-blue.svg)
41
+ ![Version](https://img.shields.io/badge/version-3.4.3-blue.svg)
42
42
  ![Python](https://img.shields.io/badge/python-3.11%20%7C%203.12-green.svg)
43
43
  ![License](https://img.shields.io/badge/license-MIT-yellow.svg)
44
44
  ![Platform](https://img.shields.io/badge/platform-Windows%20%7C%20Linux%20%7C%20macOS-lightgrey.svg)
@@ -61,7 +61,7 @@ Your documents become instantly searchable inside Claude Code — with reranking
61
61
 
62
62
  **12 MCP Tools** | **Hybrid Search + Cross-Encoder Reranking** | **Markdown-Aware Chunking** | **100% Local, Zero Cloud**
63
63
 
64
- [What's New](#whats-new-in-v342) | [Installation](#installation) | [Configuration](#configuration) | [API Reference](#api-reference) | [Architecture](#architecture)
64
+ [What's New](#whats-new-in-v343) | [Installation](#installation) | [Configuration](#configuration) | [API Reference](#api-reference) | [Architecture](#architecture)
65
65
 
66
66
  </div>
67
67
 
@@ -108,9 +108,9 @@ After the initial rebuild, startup and queries are faster than v2.x because ther
108
108
 
109
109
  ---
110
110
 
111
- ## What's New in v3.4.2
111
+ ## What's New in v3.4.3
112
112
 
113
- **MCP connection fix** — Stdout redirect now happens at module load (before any import), preventing `[INFO]` messages from corrupting the MCP stdio JSON-RPC stream. This was the root cause of "Failed to connect" on fresh installs.
113
+ **MCP connection fix (correct)** — Stdout redirect now uses save/restore pattern: `__init__.py` saves real stdout and redirects print() to stderr during module load (protecting against `[INFO]` pollution from config/embedding imports), then `server.py main()` restores the original stdout right before `mcp.run()` so JSON-RPC responses flow correctly. v3.4.2 broke the response channel with a global redirect.
114
114
 
115
115
  **Reliable pip install** (v3.4.1) — Auto-detects project directory from venv location. No `cwd`/`cd /d` workarounds needed.
116
116
 
@@ -1238,9 +1238,13 @@ With ~200 documents, expect ~300-500MB RAM. The embedding model (~50MB) and rera
1238
1238
 
1239
1239
  ## Changelog
1240
1240
 
1241
- ### v3.4.2 (2026-04-16)
1241
+ ### v3.4.3 (2026-04-16)
1242
1242
 
1243
- - **FIX**: Stdout redirect moved to module-level (before imports) fixes "Failed to connect" MCP error caused by `[INFO]` messages polluting the JSON-RPC stdio stream during server initialization
1243
+ - **FIX**: Correct stdout protection via save/restore pattern`__init__.py` saves original stdout and redirects to stderr during init, `server.py main()` restores it before `mcp.run()`. v3.4.2's global redirect broke MCP JSON-RPC response channel.
1244
+
1245
+ ### v3.4.2 (2026-04-16) — BROKEN, use v3.4.3
1246
+
1247
+ - **FIX**: Stdout redirect moved to module-level (before imports) — fixes "Failed to connect" MCP error caused by `[INFO]` messages polluting the JSON-RPC stdio stream during server initialization. **BUG**: Global redirect also blocked JSON-RPC responses.
1244
1248
 
1245
1249
  ### v3.4.1 (2026-04-16)
1246
1250
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  <div align="center">
4
4
 
5
- ![Version](https://img.shields.io/badge/version-3.4.2-blue.svg)
5
+ ![Version](https://img.shields.io/badge/version-3.4.3-blue.svg)
6
6
  ![Python](https://img.shields.io/badge/python-3.11%20%7C%203.12-green.svg)
7
7
  ![License](https://img.shields.io/badge/license-MIT-yellow.svg)
8
8
  ![Platform](https://img.shields.io/badge/platform-Windows%20%7C%20Linux%20%7C%20macOS-lightgrey.svg)
@@ -25,7 +25,7 @@ Your documents become instantly searchable inside Claude Code — with reranking
25
25
 
26
26
  **12 MCP Tools** | **Hybrid Search + Cross-Encoder Reranking** | **Markdown-Aware Chunking** | **100% Local, Zero Cloud**
27
27
 
28
- [What's New](#whats-new-in-v342) | [Installation](#installation) | [Configuration](#configuration) | [API Reference](#api-reference) | [Architecture](#architecture)
28
+ [What's New](#whats-new-in-v343) | [Installation](#installation) | [Configuration](#configuration) | [API Reference](#api-reference) | [Architecture](#architecture)
29
29
 
30
30
  </div>
31
31
 
@@ -72,9 +72,9 @@ After the initial rebuild, startup and queries are faster than v2.x because ther
72
72
 
73
73
  ---
74
74
 
75
- ## What's New in v3.4.2
75
+ ## What's New in v3.4.3
76
76
 
77
- **MCP connection fix** — Stdout redirect now happens at module load (before any import), preventing `[INFO]` messages from corrupting the MCP stdio JSON-RPC stream. This was the root cause of "Failed to connect" on fresh installs.
77
+ **MCP connection fix (correct)** — Stdout redirect now uses save/restore pattern: `__init__.py` saves real stdout and redirects print() to stderr during module load (protecting against `[INFO]` pollution from config/embedding imports), then `server.py main()` restores the original stdout right before `mcp.run()` so JSON-RPC responses flow correctly. v3.4.2 broke the response channel with a global redirect.
78
78
 
79
79
  **Reliable pip install** (v3.4.1) — Auto-detects project directory from venv location. No `cwd`/`cd /d` workarounds needed.
80
80
 
@@ -1202,9 +1202,13 @@ With ~200 documents, expect ~300-500MB RAM. The embedding model (~50MB) and rera
1202
1202
 
1203
1203
  ## Changelog
1204
1204
 
1205
- ### v3.4.2 (2026-04-16)
1205
+ ### v3.4.3 (2026-04-16)
1206
1206
 
1207
- - **FIX**: Stdout redirect moved to module-level (before imports) fixes "Failed to connect" MCP error caused by `[INFO]` messages polluting the JSON-RPC stdio stream during server initialization
1207
+ - **FIX**: Correct stdout protection via save/restore pattern`__init__.py` saves original stdout and redirects to stderr during init, `server.py main()` restores it before `mcp.run()`. v3.4.2's global redirect broke MCP JSON-RPC response channel.
1208
+
1209
+ ### v3.4.2 (2026-04-16) — BROKEN, use v3.4.3
1210
+
1211
+ - **FIX**: Stdout redirect moved to module-level (before imports) — fixes "Failed to connect" MCP error caused by `[INFO]` messages polluting the JSON-RPC stdio stream during server initialization. **BUG**: Global redirect also blocked JSON-RPC responses.
1208
1212
 
1209
1213
  ### v3.4.1 (2026-04-16)
1210
1214
 
@@ -0,0 +1,17 @@
1
+ """Knowledge RAG MCP Server - Local Retrieval-Augmented Generation System"""
2
+
3
+ import sys # noqa: I001
4
+
5
+ # MCP stdio uses stdout for JSON-RPC. print() on stdout corrupts the stream.
6
+ # Save the real stdout for MCP, redirect print() to stderr during init.
7
+ # server.py main() restores _original_stdout before mcp.run().
8
+ _original_stdout = sys.stdout
9
+ sys.stdout = sys.stderr
10
+
11
+ __version__ = "3.4.3"
12
+ __author__ = "Ailton Rocha (Lyon.)"
13
+
14
+ from .config import Config # noqa: E402
15
+ from .ingestion import Document, DocumentParser # noqa: E402
16
+
17
+ __all__ = ["Config", "DocumentParser", "Document"]
@@ -19,20 +19,14 @@ Features:
19
19
  - CRUD operations via MCP tools (add, update, remove docs)
20
20
 
21
21
  Autor: Lyon (Ailton Rocha)
22
- Versao: 3.4.2
22
+ Versao: 3.4.3
23
23
  Data: 2026-04-16
24
24
  """
25
25
 
26
- import sys
27
-
28
- # Redirect stdout to stderr IMMEDIATELY — before any import can print().
29
- # MCP stdio uses stdout for JSON-RPC; stray print() corrupts the stream.
30
- # This must happen before importing config, chromadb, fastembed, etc.
31
- sys.stdout = sys.stderr
32
-
33
26
  import hashlib
34
27
  import json
35
28
  import re
29
+ import sys
36
30
  import threading
37
31
  import time
38
32
  from collections import OrderedDict
@@ -1878,8 +1872,6 @@ def _handle_init():
1878
1872
 
1879
1873
  def main():
1880
1874
  """Run the MCP server"""
1881
- import sys
1882
-
1883
1875
  if len(sys.argv) > 1 and sys.argv[1] == "init":
1884
1876
  _handle_init()
1885
1877
  return
@@ -1917,6 +1909,10 @@ def main():
1917
1909
  print(f"[WARN] Failed to start file watcher: {e}")
1918
1910
  print("[WARN] Auto-reindexing disabled. Use reindex_documents tool manually.")
1919
1911
 
1912
+ # Restore real stdout for MCP JSON-RPC, keep print() going to stderr
1913
+ from . import _original_stdout
1914
+
1915
+ sys.stdout = _original_stdout
1920
1916
  mcp.run()
1921
1917
 
1922
1918
 
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "knowledge-rag"
7
- version = "3.4.2"
7
+ version = "3.4.3"
8
8
  description = "Local RAG System for Claude Code — Hybrid search + Cross-encoder Reranking + 12 MCP Tools. Zero external servers."
9
9
  readme = "README.md"
10
10
  license = {text = "MIT"}
@@ -1,9 +0,0 @@
1
- """Knowledge RAG MCP Server - Local Retrieval-Augmented Generation System"""
2
-
3
- __version__ = "3.4.2"
4
- __author__ = "Ailton Rocha (Lyon.)"
5
-
6
- from .config import Config
7
- from .ingestion import Document, DocumentParser
8
-
9
- __all__ = ["Config", "DocumentParser", "Document"]
File without changes
File without changes