dicom-mcp 1.2.0 → 1.2.1

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
@@ -5,6 +5,15 @@
5
5
  格式遵循 [Keep a Changelog](https://keepachangelog.com/),
6
6
  版本号遵循 [Semantic Versioning](https://semver.org/)。
7
7
 
8
+ ## [1.2.1] - 2025-01-13
9
+
10
+ ### 改进
11
+
12
+ - **增强的路径解析**: 改进 dicom_download 查找逻辑
13
+ - 支持本地开发、NPM 包和 PyPI 安装等多种部署方式
14
+ - 添加诊断日志,显示查找的路径和找到的位置
15
+ - 优化查找顺序,确保 multi_download.py 存在
16
+
8
17
  ## [1.2.0] - 2025-01-13
9
18
 
10
19
  ### 新功能
@@ -13,31 +13,49 @@ from dataclasses import dataclass
13
13
  from mcp.server.fastmcp import FastMCP
14
14
  from pydantic import BaseModel, Field
15
15
 
16
- # Resolve path to dicom_download - supports two deployment methods:
16
+ # Resolve path to dicom_download - supports multiple deployment methods:
17
17
  # 1. Local development: git clone后,dicom_download 在 dicom_mcp 的上级目录
18
- # 2. Installed package: 从 PyPI/npm 安装时,dicom_download 作为依赖已安装
18
+ # 2. NPM package: npx安装时,dicom_download 在node_modules同级
19
+ # 3. Installed package: 从 PyPI 安装时,dicom_download 作为依赖已安装
19
20
  def _resolve_dicom_download_path() -> Path:
20
21
  """Resolve path to dicom_download module."""
21
- # Method 1: Local development (git clone)
22
- local_dev_path = Path(__file__).parent.parent.parent / "dicom_download"
23
- if local_dev_path.exists():
22
+ current_dir = Path(__file__).parent
23
+
24
+ # Method 1: Local development - check parent directory
25
+ local_dev_path = current_dir.parent.parent / "dicom_download"
26
+ if local_dev_path.exists() and (local_dev_path / "multi_download.py").exists():
27
+ print(f"[dicom-mcp] Found dicom_download at: {local_dev_path}", file=sys.stderr)
24
28
  return local_dev_path
25
29
 
26
- # Method 2: Check site-packages or installation location
30
+ # Method 2: NPM package - check in the same package directory
31
+ npm_pkg_path = current_dir.parent / "dicom_download"
32
+ if npm_pkg_path.exists() and (npm_pkg_path / "multi_download.py").exists():
33
+ print(f"[dicom-mcp] Found dicom_download at: {npm_pkg_path}", file=sys.stderr)
34
+ return npm_pkg_path
35
+
36
+ # Method 3: Check site-packages or installation location
27
37
  try:
28
38
  import dicom_download as dd_module
29
39
  if dd_module.__file__:
30
- return Path(dd_module.__file__).parent
40
+ dd_path = Path(dd_module.__file__).parent
41
+ if (dd_path / "multi_download.py").exists():
42
+ print(f"[dicom-mcp] Found dicom_download at: {dd_path}", file=sys.stderr)
43
+ return dd_path
31
44
  except ImportError:
32
45
  pass
33
46
 
34
- # Method 3: Try to find in Python path
47
+ # Method 4: Try to find in Python path
35
48
  for path_item in sys.path:
36
49
  candidate = Path(path_item) / "dicom_download"
37
- if candidate.exists():
50
+ if candidate.exists() and (candidate / "multi_download.py").exists():
51
+ print(f"[dicom-mcp] Found dicom_download at: {candidate}", file=sys.stderr)
38
52
  return candidate
39
53
 
40
- # Fallback to local dev path even if not exists
54
+ # Fallback - return the most likely path with diagnostic message
55
+ print(f"[dicom-mcp] WARNING: Could not find dicom_download. Tried paths:", file=sys.stderr)
56
+ print(f" 1. {local_dev_path}", file=sys.stderr)
57
+ print(f" 2. {npm_pkg_path}", file=sys.stderr)
58
+ print(f" 3. Python path entries", file=sys.stderr)
41
59
  return local_dev_path
42
60
 
43
61
  DICOM_DOWNLOAD_PATH = _resolve_dicom_download_path()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dicom-mcp",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "MCP server for DICOM image downloading from multiple medical imaging sources",
5
5
  "main": "lib/index.js",
6
6
  "type": "module",