context-mcp-server 1.0.5 → 1.0.7

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.
@@ -29,11 +29,10 @@ function resolveCwd(args, state) {
29
29
  // Auto-detect project root on first use if not already configured.
30
30
  if (!state.projectRootPath) {
31
31
  const detected = autoDetectRoot(args.cwd ? pathResolve(args.cwd) : process.cwd());
32
- if (detected) state.projectRootPath = detected;
32
+ state.projectRootPath = detected || process.cwd();
33
33
  }
34
- const raw = args.cwd ? pathResolve(args.cwd) : (state.projectRootPath || process.cwd());
35
- if (state.projectRootPath) return guardPath(raw, state.projectRootPath);
36
- return raw;
34
+ const raw = args.cwd ? pathResolve(args.cwd) : state.projectRootPath;
35
+ return guardPath(raw, state.projectRootPath);
37
36
  }
38
37
 
39
38
  const ROOT_NOTE = ' All paths must be within the project root (sandboxed — access outside root is denied).';
package/uv.lock CHANGED
@@ -168,7 +168,7 @@ wheels = [
168
168
 
169
169
  [[package]]
170
170
  name = "codegraph-mcp"
171
- version = "1.0.4"
171
+ version = "1.0.6"
172
172
  source = { editable = "." }
173
173
  dependencies = [
174
174
  { name = "mcp" },
@@ -1,8 +0,0 @@
1
- """
2
- audio_extractor.py — audio files are not supported without faster-whisper.
3
- Stub kept so imports don't break.
4
- """
5
-
6
-
7
- def transcribe(_path: str) -> str:
8
- return ""
@@ -1,34 +0,0 @@
1
- """
2
- doc_extractor.py — extract plain text from doc and PDF files.
3
- PDF extraction uses pymupdf if installed; falls back to label-only otherwise.
4
- """
5
-
6
- from pathlib import Path
7
-
8
-
9
- def extract_text(path: str) -> str:
10
- """Return text content of a doc/PDF file. Truncated at DOC_MAX_CHARS."""
11
- from ..config import DOC_MAX_CHARS
12
- if path.lower().endswith(".pdf"):
13
- return _extract_pdf(path, DOC_MAX_CHARS)
14
- try:
15
- return Path(path).read_text(encoding="utf-8", errors="replace")[:DOC_MAX_CHARS]
16
- except OSError:
17
- return ""
18
-
19
-
20
- def _extract_pdf(path: str, max_chars: int) -> str:
21
- try:
22
- import pymupdf # optional dep
23
- doc = pymupdf.open(path)
24
- parts = []
25
- for page in doc:
26
- parts.append(page.get_text())
27
- if sum(len(p) for p in parts) >= max_chars:
28
- break
29
- doc.close()
30
- return "".join(parts)[:max_chars]
31
- except ImportError:
32
- return f"[PDF: {Path(path).name} — install pymupdf to extract text]"
33
- except Exception:
34
- return ""
@@ -1,26 +0,0 @@
1
- """
2
- image_extractor.py — encode images as base64 for AI vision.
3
- No external deps — stdlib only.
4
- """
5
-
6
- import base64
7
- import mimetypes
8
- from pathlib import Path
9
-
10
-
11
- def extract_image_b64(path: str) -> dict | None:
12
- """Return {"data": base64_str, "media_type": "image/png"} or None on failure."""
13
- try:
14
- data = Path(path).read_bytes()
15
- media_type = mimetypes.guess_type(path)[0] or "image/png"
16
- return {"data": base64.b64encode(data).decode(), "media_type": media_type}
17
- except OSError:
18
- return None
19
-
20
-
21
- def extract_svg_text(path: str) -> str:
22
- """Return SVG file as plain text (SVGs are XML — readable as-is)."""
23
- try:
24
- return Path(path).read_text(encoding="utf-8", errors="replace")[:4000]
25
- except OSError:
26
- return ""