ims-mcp 1.0.0__tar.gz → 1.0.2__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.
- {ims_mcp-1.0.0 → ims_mcp-1.0.2}/PKG-INFO +29 -1
- {ims_mcp-1.0.0 → ims_mcp-1.0.2}/README.md +28 -0
- {ims_mcp-1.0.0 → ims_mcp-1.0.2}/ims_mcp/__init__.py +1 -1
- {ims_mcp-1.0.0 → ims_mcp-1.0.2}/ims_mcp/server.py +50 -6
- {ims_mcp-1.0.0 → ims_mcp-1.0.2}/ims_mcp.egg-info/PKG-INFO +29 -1
- {ims_mcp-1.0.0 → ims_mcp-1.0.2}/pyproject.toml +1 -1
- {ims_mcp-1.0.0 → ims_mcp-1.0.2}/LICENSE +0 -0
- {ims_mcp-1.0.0 → ims_mcp-1.0.2}/ims_mcp/__main__.py +0 -0
- {ims_mcp-1.0.0 → ims_mcp-1.0.2}/ims_mcp.egg-info/SOURCES.txt +0 -0
- {ims_mcp-1.0.0 → ims_mcp-1.0.2}/ims_mcp.egg-info/dependency_links.txt +0 -0
- {ims_mcp-1.0.0 → ims_mcp-1.0.2}/ims_mcp.egg-info/entry_points.txt +0 -0
- {ims_mcp-1.0.0 → ims_mcp-1.0.2}/ims_mcp.egg-info/requires.txt +0 -0
- {ims_mcp-1.0.0 → ims_mcp-1.0.2}/ims_mcp.egg-info/top_level.txt +0 -0
- {ims_mcp-1.0.0 → ims_mcp-1.0.2}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ims-mcp
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.2
|
|
4
4
|
Summary: Model Context Protocol server for IMS (Instruction Management Systems)
|
|
5
5
|
Author: Igor Solomatov
|
|
6
6
|
License-Expression: MIT
|
|
@@ -82,6 +82,13 @@ The server automatically reads configuration from environment variables:
|
|
|
82
82
|
| `R2R_API_BASE` or `R2R_BASE_URL` | IMS server URL | `http://localhost:7272` |
|
|
83
83
|
| `R2R_COLLECTION` | Collection name for queries | Server default |
|
|
84
84
|
| `R2R_API_KEY` | API key for authentication | None |
|
|
85
|
+
| `R2R_EMAIL` | Email for authentication (requires R2R_PASSWORD) | None |
|
|
86
|
+
| `R2R_PASSWORD` | Password for authentication (requires R2R_EMAIL) | None |
|
|
87
|
+
|
|
88
|
+
**Authentication Priority:**
|
|
89
|
+
1. If `R2R_API_KEY` is set, it will be used
|
|
90
|
+
2. If `R2R_EMAIL` and `R2R_PASSWORD` are set, they will be used to login and obtain an access token
|
|
91
|
+
3. If neither is set, the client will attempt unauthenticated access (works for local servers)
|
|
85
92
|
|
|
86
93
|
**Note:** Environment variables use `R2R_` prefix for compatibility with the underlying R2R SDK.
|
|
87
94
|
|
|
@@ -89,6 +96,8 @@ The server automatically reads configuration from environment variables:
|
|
|
89
96
|
|
|
90
97
|
### Cursor IDE
|
|
91
98
|
|
|
99
|
+
**Local server (no authentication):**
|
|
100
|
+
|
|
92
101
|
Add to `.cursor/mcp.json`:
|
|
93
102
|
|
|
94
103
|
```json
|
|
@@ -106,6 +115,25 @@ Add to `.cursor/mcp.json`:
|
|
|
106
115
|
}
|
|
107
116
|
```
|
|
108
117
|
|
|
118
|
+
**Remote server (with email/password authentication):**
|
|
119
|
+
|
|
120
|
+
```json
|
|
121
|
+
{
|
|
122
|
+
"mcpServers": {
|
|
123
|
+
"KnowledgeBase": {
|
|
124
|
+
"command": "uvx",
|
|
125
|
+
"args": ["ims-mcp"],
|
|
126
|
+
"env": {
|
|
127
|
+
"R2R_API_BASE": "https://your-server.example.com/",
|
|
128
|
+
"R2R_COLLECTION": "your-collection",
|
|
129
|
+
"R2R_EMAIL": "your-email@example.com",
|
|
130
|
+
"R2R_PASSWORD": "your-password"
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
109
137
|
### Claude Desktop
|
|
110
138
|
|
|
111
139
|
Add to Claude Desktop configuration (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):
|
|
@@ -55,6 +55,13 @@ The server automatically reads configuration from environment variables:
|
|
|
55
55
|
| `R2R_API_BASE` or `R2R_BASE_URL` | IMS server URL | `http://localhost:7272` |
|
|
56
56
|
| `R2R_COLLECTION` | Collection name for queries | Server default |
|
|
57
57
|
| `R2R_API_KEY` | API key for authentication | None |
|
|
58
|
+
| `R2R_EMAIL` | Email for authentication (requires R2R_PASSWORD) | None |
|
|
59
|
+
| `R2R_PASSWORD` | Password for authentication (requires R2R_EMAIL) | None |
|
|
60
|
+
|
|
61
|
+
**Authentication Priority:**
|
|
62
|
+
1. If `R2R_API_KEY` is set, it will be used
|
|
63
|
+
2. If `R2R_EMAIL` and `R2R_PASSWORD` are set, they will be used to login and obtain an access token
|
|
64
|
+
3. If neither is set, the client will attempt unauthenticated access (works for local servers)
|
|
58
65
|
|
|
59
66
|
**Note:** Environment variables use `R2R_` prefix for compatibility with the underlying R2R SDK.
|
|
60
67
|
|
|
@@ -62,6 +69,8 @@ The server automatically reads configuration from environment variables:
|
|
|
62
69
|
|
|
63
70
|
### Cursor IDE
|
|
64
71
|
|
|
72
|
+
**Local server (no authentication):**
|
|
73
|
+
|
|
65
74
|
Add to `.cursor/mcp.json`:
|
|
66
75
|
|
|
67
76
|
```json
|
|
@@ -79,6 +88,25 @@ Add to `.cursor/mcp.json`:
|
|
|
79
88
|
}
|
|
80
89
|
```
|
|
81
90
|
|
|
91
|
+
**Remote server (with email/password authentication):**
|
|
92
|
+
|
|
93
|
+
```json
|
|
94
|
+
{
|
|
95
|
+
"mcpServers": {
|
|
96
|
+
"KnowledgeBase": {
|
|
97
|
+
"command": "uvx",
|
|
98
|
+
"args": ["ims-mcp"],
|
|
99
|
+
"env": {
|
|
100
|
+
"R2R_API_BASE": "https://your-server.example.com/",
|
|
101
|
+
"R2R_COLLECTION": "your-collection",
|
|
102
|
+
"R2R_EMAIL": "your-email@example.com",
|
|
103
|
+
"R2R_PASSWORD": "your-password"
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
82
110
|
### Claude Desktop
|
|
83
111
|
|
|
84
112
|
Add to Claude Desktop configuration (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):
|
|
@@ -7,14 +7,58 @@ Environment Variables:
|
|
|
7
7
|
R2R_API_BASE or R2R_BASE_URL: R2R server URL (default: http://localhost:7272)
|
|
8
8
|
R2R_COLLECTION: Collection name for queries (optional, uses server default)
|
|
9
9
|
R2R_API_KEY: API key for authentication (optional)
|
|
10
|
+
R2R_EMAIL: Email for authentication (optional, requires R2R_PASSWORD)
|
|
11
|
+
R2R_PASSWORD: Password for authentication (optional, requires R2R_EMAIL)
|
|
10
12
|
|
|
11
13
|
The R2RClient automatically reads these environment variables, so no manual
|
|
12
14
|
configuration is needed when running via uvx or other launchers.
|
|
13
15
|
"""
|
|
14
16
|
|
|
17
|
+
import os
|
|
15
18
|
import uuid
|
|
16
19
|
from r2r import R2RClient
|
|
17
20
|
|
|
21
|
+
# Global client instance with authentication
|
|
22
|
+
_authenticated_client = None
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def get_authenticated_client() -> R2RClient:
|
|
26
|
+
"""Get or create an authenticated R2R client.
|
|
27
|
+
|
|
28
|
+
This function handles authentication using either:
|
|
29
|
+
1. API key (R2R_API_KEY) - preferred method
|
|
30
|
+
2. Email/password (R2R_EMAIL + R2R_PASSWORD) - fallback method
|
|
31
|
+
|
|
32
|
+
Returns:
|
|
33
|
+
Authenticated R2RClient instance
|
|
34
|
+
"""
|
|
35
|
+
global _authenticated_client
|
|
36
|
+
|
|
37
|
+
# If client already exists and is authenticated, reuse it
|
|
38
|
+
if _authenticated_client is not None:
|
|
39
|
+
return _authenticated_client
|
|
40
|
+
|
|
41
|
+
# Create new client
|
|
42
|
+
client = R2RClient()
|
|
43
|
+
|
|
44
|
+
# Check for email/password authentication
|
|
45
|
+
email = os.getenv("R2R_EMAIL")
|
|
46
|
+
password = os.getenv("R2R_PASSWORD")
|
|
47
|
+
|
|
48
|
+
if email and password:
|
|
49
|
+
try:
|
|
50
|
+
# Login to get access token
|
|
51
|
+
result = client.users.login(email=email, password=password)
|
|
52
|
+
# Set the access token for subsequent requests
|
|
53
|
+
client.access_token = result.results.access_token.token
|
|
54
|
+
except Exception as e:
|
|
55
|
+
# If login fails, continue without authentication (might work for local servers)
|
|
56
|
+
pass
|
|
57
|
+
|
|
58
|
+
# Cache the client for reuse
|
|
59
|
+
_authenticated_client = client
|
|
60
|
+
return client
|
|
61
|
+
|
|
18
62
|
|
|
19
63
|
def id_to_shorthand(id: str) -> str:
|
|
20
64
|
"""Convert a full ID to shortened version for display."""
|
|
@@ -127,7 +171,7 @@ async def search(
|
|
|
127
171
|
Returns:
|
|
128
172
|
Formatted search results from the knowledge base
|
|
129
173
|
"""
|
|
130
|
-
client =
|
|
174
|
+
client = get_authenticated_client()
|
|
131
175
|
|
|
132
176
|
# Only build search_settings if user provided any parameters
|
|
133
177
|
# This preserves original behavior: search("query") → search(query=query) with NO search_settings
|
|
@@ -178,7 +222,7 @@ async def rag(
|
|
|
178
222
|
Returns:
|
|
179
223
|
Generated answer from RAG
|
|
180
224
|
"""
|
|
181
|
-
client =
|
|
225
|
+
client = get_authenticated_client()
|
|
182
226
|
|
|
183
227
|
# Only build configs if user provided parameters
|
|
184
228
|
# This preserves original behavior: rag("query") → rag(query=query) with NO configs
|
|
@@ -228,7 +272,7 @@ async def put_document(
|
|
|
228
272
|
Returns:
|
|
229
273
|
Status message with document_id and operation type
|
|
230
274
|
"""
|
|
231
|
-
client =
|
|
275
|
+
client = get_authenticated_client()
|
|
232
276
|
|
|
233
277
|
# Build metadata with title
|
|
234
278
|
final_metadata = {"title": title}
|
|
@@ -299,7 +343,7 @@ async def list_documents(
|
|
|
299
343
|
Returns:
|
|
300
344
|
Formatted list of documents
|
|
301
345
|
"""
|
|
302
|
-
client =
|
|
346
|
+
client = get_authenticated_client()
|
|
303
347
|
|
|
304
348
|
# Build kwargs for list call
|
|
305
349
|
kwargs = {"offset": int(offset), "limit": min(int(limit), 100)} # Convert to int, cap at 100
|
|
@@ -394,7 +438,7 @@ async def get_document(
|
|
|
394
438
|
Returns:
|
|
395
439
|
Formatted document details
|
|
396
440
|
"""
|
|
397
|
-
client =
|
|
441
|
+
client = get_authenticated_client()
|
|
398
442
|
|
|
399
443
|
# Validate that at least one parameter is provided
|
|
400
444
|
if not document_id and not title:
|
|
@@ -480,7 +524,7 @@ async def delete_document(document_id: str) -> str:
|
|
|
480
524
|
Returns:
|
|
481
525
|
Status message confirming deletion or describing error
|
|
482
526
|
"""
|
|
483
|
-
client =
|
|
527
|
+
client = get_authenticated_client()
|
|
484
528
|
|
|
485
529
|
try:
|
|
486
530
|
# Delete the document
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ims-mcp
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.2
|
|
4
4
|
Summary: Model Context Protocol server for IMS (Instruction Management Systems)
|
|
5
5
|
Author: Igor Solomatov
|
|
6
6
|
License-Expression: MIT
|
|
@@ -82,6 +82,13 @@ The server automatically reads configuration from environment variables:
|
|
|
82
82
|
| `R2R_API_BASE` or `R2R_BASE_URL` | IMS server URL | `http://localhost:7272` |
|
|
83
83
|
| `R2R_COLLECTION` | Collection name for queries | Server default |
|
|
84
84
|
| `R2R_API_KEY` | API key for authentication | None |
|
|
85
|
+
| `R2R_EMAIL` | Email for authentication (requires R2R_PASSWORD) | None |
|
|
86
|
+
| `R2R_PASSWORD` | Password for authentication (requires R2R_EMAIL) | None |
|
|
87
|
+
|
|
88
|
+
**Authentication Priority:**
|
|
89
|
+
1. If `R2R_API_KEY` is set, it will be used
|
|
90
|
+
2. If `R2R_EMAIL` and `R2R_PASSWORD` are set, they will be used to login and obtain an access token
|
|
91
|
+
3. If neither is set, the client will attempt unauthenticated access (works for local servers)
|
|
85
92
|
|
|
86
93
|
**Note:** Environment variables use `R2R_` prefix for compatibility with the underlying R2R SDK.
|
|
87
94
|
|
|
@@ -89,6 +96,8 @@ The server automatically reads configuration from environment variables:
|
|
|
89
96
|
|
|
90
97
|
### Cursor IDE
|
|
91
98
|
|
|
99
|
+
**Local server (no authentication):**
|
|
100
|
+
|
|
92
101
|
Add to `.cursor/mcp.json`:
|
|
93
102
|
|
|
94
103
|
```json
|
|
@@ -106,6 +115,25 @@ Add to `.cursor/mcp.json`:
|
|
|
106
115
|
}
|
|
107
116
|
```
|
|
108
117
|
|
|
118
|
+
**Remote server (with email/password authentication):**
|
|
119
|
+
|
|
120
|
+
```json
|
|
121
|
+
{
|
|
122
|
+
"mcpServers": {
|
|
123
|
+
"KnowledgeBase": {
|
|
124
|
+
"command": "uvx",
|
|
125
|
+
"args": ["ims-mcp"],
|
|
126
|
+
"env": {
|
|
127
|
+
"R2R_API_BASE": "https://your-server.example.com/",
|
|
128
|
+
"R2R_COLLECTION": "your-collection",
|
|
129
|
+
"R2R_EMAIL": "your-email@example.com",
|
|
130
|
+
"R2R_PASSWORD": "your-password"
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
109
137
|
### Claude Desktop
|
|
110
138
|
|
|
111
139
|
Add to Claude Desktop configuration (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|