ims-mcp 1.0.5__py3-none-any.whl → 1.0.7__py3-none-any.whl
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.
- ims_mcp/__init__.py +1 -1
- ims_mcp/server.py +30 -15
- {ims_mcp-1.0.5.dist-info → ims_mcp-1.0.7.dist-info}/METADATA +1 -1
- ims_mcp-1.0.7.dist-info/RECORD +9 -0
- ims_mcp-1.0.5.dist-info/RECORD +0 -9
- {ims_mcp-1.0.5.dist-info → ims_mcp-1.0.7.dist-info}/WHEEL +0 -0
- {ims_mcp-1.0.5.dist-info → ims_mcp-1.0.7.dist-info}/entry_points.txt +0 -0
- {ims_mcp-1.0.5.dist-info → ims_mcp-1.0.7.dist-info}/licenses/LICENSE +0 -0
- {ims_mcp-1.0.5.dist-info → ims_mcp-1.0.7.dist-info}/top_level.txt +0 -0
ims_mcp/__init__.py
CHANGED
ims_mcp/server.py
CHANGED
|
@@ -40,21 +40,6 @@ def get_authenticated_client() -> R2RClient:
|
|
|
40
40
|
if _authenticated_client is not None:
|
|
41
41
|
return _authenticated_client
|
|
42
42
|
|
|
43
|
-
# Log startup info (only on first call)
|
|
44
|
-
from ims_mcp import __version__
|
|
45
|
-
base_url = os.getenv('R2R_API_BASE') or os.getenv('R2R_BASE_URL') or 'http://localhost:7272'
|
|
46
|
-
collection = os.getenv('R2R_COLLECTION', 'default')
|
|
47
|
-
api_key = os.getenv('R2R_API_KEY', '')
|
|
48
|
-
email = os.getenv('R2R_EMAIL', '')
|
|
49
|
-
password = os.getenv('R2R_PASSWORD', '')
|
|
50
|
-
|
|
51
|
-
print(f"[ims-mcp v{__version__}]", file=sys.stderr)
|
|
52
|
-
print(f" server={base_url}", file=sys.stderr)
|
|
53
|
-
print(f" collection={collection}", file=sys.stderr)
|
|
54
|
-
print(f" api_key={api_key[:3] + '...' if api_key else 'none'}", file=sys.stderr)
|
|
55
|
-
print(f" email={email if email else 'none'}", file=sys.stderr)
|
|
56
|
-
print(f" password={password[:3] + '...' if password else 'none'}", file=sys.stderr)
|
|
57
|
-
|
|
58
43
|
# Create new client
|
|
59
44
|
client = R2RClient()
|
|
60
45
|
|
|
@@ -183,6 +168,21 @@ def format_search_results_for_llm(results) -> str:
|
|
|
183
168
|
return result
|
|
184
169
|
|
|
185
170
|
|
|
171
|
+
# Log configuration at startup
|
|
172
|
+
from ims_mcp import __version__
|
|
173
|
+
base_url = os.getenv('R2R_API_BASE') or os.getenv('R2R_BASE_URL') or 'http://localhost:7272'
|
|
174
|
+
collection = os.getenv('R2R_COLLECTION', 'default')
|
|
175
|
+
api_key = os.getenv('R2R_API_KEY', '')
|
|
176
|
+
email = os.getenv('R2R_EMAIL', '')
|
|
177
|
+
password = os.getenv('R2R_PASSWORD', '')
|
|
178
|
+
|
|
179
|
+
print(f"[ims-mcp v{__version__}]", file=sys.stderr)
|
|
180
|
+
print(f" server={base_url}", file=sys.stderr)
|
|
181
|
+
print(f" collection={collection}", file=sys.stderr)
|
|
182
|
+
print(f" api_key={api_key[:3] + '...' if api_key else 'none'}", file=sys.stderr)
|
|
183
|
+
print(f" email={email if email else 'none'}", file=sys.stderr)
|
|
184
|
+
print(f" password={password[:3] + '...' if password else 'none'}", file=sys.stderr)
|
|
185
|
+
|
|
186
186
|
# Create a FastMCP server
|
|
187
187
|
try:
|
|
188
188
|
from mcp.server.fastmcp import FastMCP
|
|
@@ -538,6 +538,12 @@ async def get_document(
|
|
|
538
538
|
|
|
539
539
|
# Found exactly one match
|
|
540
540
|
document_id = matching_docs[0][0]
|
|
541
|
+
except R2RException as e:
|
|
542
|
+
# Re-raise authentication errors so the decorator can handle them
|
|
543
|
+
if hasattr(e, 'status_code') and e.status_code in [401, 403]:
|
|
544
|
+
raise
|
|
545
|
+
# For other R2RExceptions, return error message
|
|
546
|
+
return f"Error searching for document by title: {str(e)}"
|
|
541
547
|
except Exception as e:
|
|
542
548
|
return f"Error searching for document by title: {str(e)}"
|
|
543
549
|
|
|
@@ -555,6 +561,15 @@ async def get_document(
|
|
|
555
561
|
|
|
556
562
|
return "\n".join(output_lines)
|
|
557
563
|
|
|
564
|
+
except R2RException as e:
|
|
565
|
+
# Re-raise authentication errors so the decorator can handle them
|
|
566
|
+
if hasattr(e, 'status_code') and e.status_code in [401, 403]:
|
|
567
|
+
raise
|
|
568
|
+
# For other R2RExceptions, return error message
|
|
569
|
+
error_msg = str(e)
|
|
570
|
+
if "not found" in error_msg.lower():
|
|
571
|
+
return f"Error: Document with ID '{document_id}' not found"
|
|
572
|
+
return f"Error downloading document: {error_msg}"
|
|
558
573
|
except Exception as e:
|
|
559
574
|
error_msg = str(e)
|
|
560
575
|
if "not found" in error_msg.lower():
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
ims_mcp/__init__.py,sha256=o_RrLOP0hJRrbvkyuKpyz9kC4jm5lPcwRR4NjmxcORI,631
|
|
2
|
+
ims_mcp/__main__.py,sha256=z4P1aCVfOgS3cTM2wgJd2pxjMmKCkGkiqYDRGgrspxw,191
|
|
3
|
+
ims_mcp/server.py,sha256=eeK8zHsykZ5CrEmBYJbrgeUGD7qPwM45UUJuUzEfWgQ,23718
|
|
4
|
+
ims_mcp-1.0.7.dist-info/licenses/LICENSE,sha256=4d1dlH04mbnN3ya4lybcVOUwljRHGy-aSc9MYqGYW44,2534
|
|
5
|
+
ims_mcp-1.0.7.dist-info/METADATA,sha256=KhE61BJdQOizhWr9J96h95ViBPRpDz6lkpOazN0xQhE,9295
|
|
6
|
+
ims_mcp-1.0.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
7
|
+
ims_mcp-1.0.7.dist-info/entry_points.txt,sha256=xCH9I8g1pTTEqrfjnE-ANHaZo4W6EBJVy0Lg5z8SaIQ,48
|
|
8
|
+
ims_mcp-1.0.7.dist-info/top_level.txt,sha256=wEXA33qFr_eov3S1PY2OF6EQBA2rtAWB_ZNJOzNNQuM,8
|
|
9
|
+
ims_mcp-1.0.7.dist-info/RECORD,,
|
ims_mcp-1.0.5.dist-info/RECORD
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
ims_mcp/__init__.py,sha256=jqYWnp0t_xvHX7m0FMHJNOO_3KongXmW-1zwKArilc8,631
|
|
2
|
-
ims_mcp/__main__.py,sha256=z4P1aCVfOgS3cTM2wgJd2pxjMmKCkGkiqYDRGgrspxw,191
|
|
3
|
-
ims_mcp/server.py,sha256=lHdhhVeohXMX9KhqX4mYlHmdOkEH-Ee_k3e7Rg2uNBY,22999
|
|
4
|
-
ims_mcp-1.0.5.dist-info/licenses/LICENSE,sha256=4d1dlH04mbnN3ya4lybcVOUwljRHGy-aSc9MYqGYW44,2534
|
|
5
|
-
ims_mcp-1.0.5.dist-info/METADATA,sha256=GYmWYRXsTNf6ZPq0a6_l7epsERXVLfxuQB3uESR9GL4,9295
|
|
6
|
-
ims_mcp-1.0.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
7
|
-
ims_mcp-1.0.5.dist-info/entry_points.txt,sha256=xCH9I8g1pTTEqrfjnE-ANHaZo4W6EBJVy0Lg5z8SaIQ,48
|
|
8
|
-
ims_mcp-1.0.5.dist-info/top_level.txt,sha256=wEXA33qFr_eov3S1PY2OF6EQBA2rtAWB_ZNJOzNNQuM,8
|
|
9
|
-
ims_mcp-1.0.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|