castrel-proxy 0.1.0__tar.gz → 0.1.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.
- {castrel_proxy-0.1.0 → castrel_proxy-0.1.2}/PKG-INFO +16 -20
- {castrel_proxy-0.1.0 → castrel_proxy-0.1.2}/README.md +10 -14
- {castrel_proxy-0.1.0 → castrel_proxy-0.1.2}/pyproject.toml +6 -6
- {castrel_proxy-0.1.0 → castrel_proxy-0.1.2}/src/castrel_proxy/mcp/manager.py +39 -36
- {castrel_proxy-0.1.0 → castrel_proxy-0.1.2}/.gitignore +0 -0
- {castrel_proxy-0.1.0 → castrel_proxy-0.1.2}/CHANGELOG.md +0 -0
- {castrel_proxy-0.1.0 → castrel_proxy-0.1.2}/LICENSE +0 -0
- {castrel_proxy-0.1.0 → castrel_proxy-0.1.2}/src/castrel_proxy/__init__.py +0 -0
- {castrel_proxy-0.1.0 → castrel_proxy-0.1.2}/src/castrel_proxy/cli/__init__.py +0 -0
- {castrel_proxy-0.1.0 → castrel_proxy-0.1.2}/src/castrel_proxy/cli/commands.py +0 -0
- {castrel_proxy-0.1.0 → castrel_proxy-0.1.2}/src/castrel_proxy/core/__init__.py +0 -0
- {castrel_proxy-0.1.0 → castrel_proxy-0.1.2}/src/castrel_proxy/core/client_id.py +0 -0
- {castrel_proxy-0.1.0 → castrel_proxy-0.1.2}/src/castrel_proxy/core/config.py +0 -0
- {castrel_proxy-0.1.0 → castrel_proxy-0.1.2}/src/castrel_proxy/core/daemon.py +0 -0
- {castrel_proxy-0.1.0 → castrel_proxy-0.1.2}/src/castrel_proxy/core/executor.py +0 -0
- {castrel_proxy-0.1.0 → castrel_proxy-0.1.2}/src/castrel_proxy/data/__init__.py +0 -0
- {castrel_proxy-0.1.0 → castrel_proxy-0.1.2}/src/castrel_proxy/data/default_whitelist.txt +0 -0
- {castrel_proxy-0.1.0 → castrel_proxy-0.1.2}/src/castrel_proxy/mcp/__init__.py +0 -0
- {castrel_proxy-0.1.0 → castrel_proxy-0.1.2}/src/castrel_proxy/network/__init__.py +0 -0
- {castrel_proxy-0.1.0 → castrel_proxy-0.1.2}/src/castrel_proxy/network/api_client.py +0 -0
- {castrel_proxy-0.1.0 → castrel_proxy-0.1.2}/src/castrel_proxy/network/websocket_client.py +0 -0
- {castrel_proxy-0.1.0 → castrel_proxy-0.1.2}/src/castrel_proxy/operations/__init__.py +0 -0
- {castrel_proxy-0.1.0 → castrel_proxy-0.1.2}/src/castrel_proxy/operations/document.py +0 -0
- {castrel_proxy-0.1.0 → castrel_proxy-0.1.2}/src/castrel_proxy/security/__init__.py +0 -0
- {castrel_proxy-0.1.0 → castrel_proxy-0.1.2}/src/castrel_proxy/security/whitelist.py +0 -0
- {castrel_proxy-0.1.0 → castrel_proxy-0.1.2}/tests/__init__.py +0 -0
- {castrel_proxy-0.1.0 → castrel_proxy-0.1.2}/tests/test_core.py +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: castrel-proxy
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: A lightweight remote command execution bridge client with MCP integration
|
|
5
|
-
Project-URL: Homepage, https://github.com/castrel-ai/castrel-
|
|
6
|
-
Project-URL: Documentation, https://github.com/castrel-ai/castrel-
|
|
7
|
-
Project-URL: Repository, https://github.com/castrel-ai/castrel-
|
|
8
|
-
Project-URL: Issues, https://github.com/castrel-ai/castrel-
|
|
9
|
-
Project-URL: Changelog, https://github.com/castrel-ai/castrel-
|
|
5
|
+
Project-URL: Homepage, https://github.com/castrel-ai/castrel-proxy
|
|
6
|
+
Project-URL: Documentation, https://github.com/castrel-ai/castrel-proxy#readme
|
|
7
|
+
Project-URL: Repository, https://github.com/castrel-ai/castrel-proxy
|
|
8
|
+
Project-URL: Issues, https://github.com/castrel-ai/castrel-proxy/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/castrel-ai/castrel-proxy/blob/main/CHANGELOG.md
|
|
10
10
|
Author: Castrel Team
|
|
11
11
|
License: MIT License
|
|
12
12
|
|
|
@@ -58,9 +58,9 @@ Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
|
|
|
58
58
|
Requires-Dist: pytest>=7.0.0; extra == 'dev'
|
|
59
59
|
Description-Content-Type: text/markdown
|
|
60
60
|
|
|
61
|
-
# Castrel
|
|
61
|
+
# Castrel Proxy
|
|
62
62
|
|
|
63
|
-
[](https://github.com/castrel-ai/castrel-proxy/actions)
|
|
64
64
|
[](https://opensource.org/licenses/MIT)
|
|
65
65
|
[](https://pypi.org/project/castrel-proxy/)
|
|
66
66
|
|
|
@@ -89,8 +89,8 @@ pip install castrel-proxy
|
|
|
89
89
|
### From source
|
|
90
90
|
|
|
91
91
|
```bash
|
|
92
|
-
git clone https://github.com/castrel-ai/castrel-
|
|
93
|
-
cd castrel-
|
|
92
|
+
git clone https://github.com/castrel-ai/castrel-proxy.git
|
|
93
|
+
cd castrel-proxy
|
|
94
94
|
pip install -e .
|
|
95
95
|
```
|
|
96
96
|
|
|
@@ -241,15 +241,11 @@ python
|
|
|
241
241
|
|
|
242
242
|
```bash
|
|
243
243
|
# Clone repository
|
|
244
|
-
git clone https://github.com/castrel-ai/castrel-
|
|
245
|
-
cd castrel-
|
|
244
|
+
git clone https://github.com/castrel-ai/castrel-proxy.git
|
|
245
|
+
cd castrel-proxy
|
|
246
246
|
|
|
247
|
-
#
|
|
248
|
-
|
|
249
|
-
source venv/bin/activate # On Windows: venv\Scripts\activate
|
|
250
|
-
|
|
251
|
-
# Install dependencies
|
|
252
|
-
pip install -e ".[dev]"
|
|
247
|
+
# Install dependencies and sync environment
|
|
248
|
+
uv sync
|
|
253
249
|
```
|
|
254
250
|
|
|
255
251
|
### Run Tests
|
|
@@ -292,8 +288,8 @@ For security concerns, please see [SECURITY.md](SECURITY.md) or contact security
|
|
|
292
288
|
|
|
293
289
|
## 📮 Contact
|
|
294
290
|
|
|
295
|
-
- Issues: [GitHub Issues](https://github.com/castrel-ai/castrel-
|
|
296
|
-
- Discussions: [GitHub Discussions](https://github.com/castrel-ai/castrel-
|
|
291
|
+
- Issues: [GitHub Issues](https://github.com/castrel-ai/castrel-proxy/issues)
|
|
292
|
+
- Discussions: [GitHub Discussions](https://github.com/castrel-ai/castrel-proxy/discussions)
|
|
297
293
|
|
|
298
294
|
## 🙏 Acknowledgments
|
|
299
295
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# Castrel
|
|
1
|
+
# Castrel Proxy
|
|
2
2
|
|
|
3
|
-
[](https://github.com/castrel-ai/castrel-proxy/actions)
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
5
5
|
[](https://pypi.org/project/castrel-proxy/)
|
|
6
6
|
|
|
@@ -29,8 +29,8 @@ pip install castrel-proxy
|
|
|
29
29
|
### From source
|
|
30
30
|
|
|
31
31
|
```bash
|
|
32
|
-
git clone https://github.com/castrel-ai/castrel-
|
|
33
|
-
cd castrel-
|
|
32
|
+
git clone https://github.com/castrel-ai/castrel-proxy.git
|
|
33
|
+
cd castrel-proxy
|
|
34
34
|
pip install -e .
|
|
35
35
|
```
|
|
36
36
|
|
|
@@ -181,15 +181,11 @@ python
|
|
|
181
181
|
|
|
182
182
|
```bash
|
|
183
183
|
# Clone repository
|
|
184
|
-
git clone https://github.com/castrel-ai/castrel-
|
|
185
|
-
cd castrel-
|
|
184
|
+
git clone https://github.com/castrel-ai/castrel-proxy.git
|
|
185
|
+
cd castrel-proxy
|
|
186
186
|
|
|
187
|
-
#
|
|
188
|
-
|
|
189
|
-
source venv/bin/activate # On Windows: venv\Scripts\activate
|
|
190
|
-
|
|
191
|
-
# Install dependencies
|
|
192
|
-
pip install -e ".[dev]"
|
|
187
|
+
# Install dependencies and sync environment
|
|
188
|
+
uv sync
|
|
193
189
|
```
|
|
194
190
|
|
|
195
191
|
### Run Tests
|
|
@@ -232,8 +228,8 @@ For security concerns, please see [SECURITY.md](SECURITY.md) or contact security
|
|
|
232
228
|
|
|
233
229
|
## 📮 Contact
|
|
234
230
|
|
|
235
|
-
- Issues: [GitHub Issues](https://github.com/castrel-ai/castrel-
|
|
236
|
-
- Discussions: [GitHub Discussions](https://github.com/castrel-ai/castrel-
|
|
231
|
+
- Issues: [GitHub Issues](https://github.com/castrel-ai/castrel-proxy/issues)
|
|
232
|
+
- Discussions: [GitHub Discussions](https://github.com/castrel-ai/castrel-proxy/discussions)
|
|
237
233
|
|
|
238
234
|
## 🙏 Acknowledgments
|
|
239
235
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "castrel-proxy"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.2"
|
|
4
4
|
description = "A lightweight remote command execution bridge client with MCP integration"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.10"
|
|
@@ -42,11 +42,11 @@ dev = [
|
|
|
42
42
|
]
|
|
43
43
|
|
|
44
44
|
[project.urls]
|
|
45
|
-
Homepage = "https://github.com/castrel-ai/castrel-
|
|
46
|
-
Documentation = "https://github.com/castrel-ai/castrel-
|
|
47
|
-
Repository = "https://github.com/castrel-ai/castrel-
|
|
48
|
-
Issues = "https://github.com/castrel-ai/castrel-
|
|
49
|
-
Changelog = "https://github.com/castrel-ai/castrel-
|
|
45
|
+
Homepage = "https://github.com/castrel-ai/castrel-proxy"
|
|
46
|
+
Documentation = "https://github.com/castrel-ai/castrel-proxy#readme"
|
|
47
|
+
Repository = "https://github.com/castrel-ai/castrel-proxy"
|
|
48
|
+
Issues = "https://github.com/castrel-ai/castrel-proxy/issues"
|
|
49
|
+
Changelog = "https://github.com/castrel-ai/castrel-proxy/blob/main/CHANGELOG.md"
|
|
50
50
|
|
|
51
51
|
[project.scripts]
|
|
52
52
|
castrel-proxy = "castrel_proxy.cli.commands:run"
|
|
@@ -69,18 +69,22 @@ def convert_config_to_langchain_format(config_data: dict) -> dict:
|
|
|
69
69
|
"url": server_config.get("url"),
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
elif transport
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
f"
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
72
|
+
elif transport == "sse":
|
|
73
|
+
# sse type: use url
|
|
74
|
+
if not server_config.get("url"):
|
|
75
|
+
error_msg = f"Configuration error for server '{name}': Missing 'url' for sse transport"
|
|
76
|
+
logger.error(error_msg)
|
|
77
|
+
raise ValueError(error_msg)
|
|
78
|
+
|
|
79
|
+
langchain_config[name] = {
|
|
80
|
+
"transport": "sse",
|
|
81
|
+
"url": server_config.get("url"),
|
|
82
|
+
}
|
|
79
83
|
|
|
80
84
|
else:
|
|
81
85
|
error_msg = (
|
|
82
86
|
f"Configuration error for server '{name}': Unknown transport type '{transport}'. "
|
|
83
|
-
f"Supported transports: 'stdio', 'http'"
|
|
87
|
+
f"Supported transports: 'stdio', 'http', 'sse'"
|
|
84
88
|
)
|
|
85
89
|
logger.error(error_msg)
|
|
86
90
|
raise ValueError(error_msg)
|
|
@@ -209,21 +213,18 @@ class MCPManager:
|
|
|
209
213
|
Get tools from all MCP services
|
|
210
214
|
|
|
211
215
|
Returns:
|
|
212
|
-
Dict[str, List[Dict]]: All tools list
|
|
213
|
-
|
|
214
|
-
Raises:
|
|
215
|
-
SystemExit: When MCP client is not initialized or tools retrieval fails
|
|
216
|
+
Dict[str, List[Dict]]: All tools list (may be partial if some servers fail)
|
|
216
217
|
"""
|
|
217
218
|
if not self.client:
|
|
218
219
|
logger.error("MCP client not initialized")
|
|
219
|
-
|
|
220
|
-
sys.exit(1)
|
|
220
|
+
return {}
|
|
221
221
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
222
|
+
result = {}
|
|
223
|
+
total_count = 0
|
|
224
|
+
failed_servers = []
|
|
225
|
+
|
|
226
|
+
for server_name in self.server_configs:
|
|
227
|
+
try:
|
|
227
228
|
tools = await self.client.get_tools(server_name=server_name)
|
|
228
229
|
# Convert to required format
|
|
229
230
|
formatted_tools = []
|
|
@@ -236,27 +237,29 @@ class MCPManager:
|
|
|
236
237
|
"mcp_server": getattr(tool, "server_name", "unknown"),
|
|
237
238
|
}
|
|
238
239
|
formatted_tools.append(tool_info)
|
|
239
|
-
|
|
240
|
+
total_count += len(formatted_tools)
|
|
240
241
|
result[server_name] = formatted_tools
|
|
242
|
+
logger.info(f"Retrieved {len(formatted_tools)} tool(s) from '{server_name}'")
|
|
241
243
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
244
|
+
except Exception as e:
|
|
245
|
+
failed_servers.append(server_name)
|
|
246
|
+
# Log error but continue with other servers
|
|
247
|
+
if "Configuration error" in str(e) or "Missing 'transport' key" in str(e):
|
|
248
|
+
logger.error(f"Configuration error for server '{server_name}': {e}")
|
|
249
|
+
else:
|
|
250
|
+
logger.error(f"Failed to get tools from server '{server_name}': {e}")
|
|
251
|
+
|
|
252
|
+
if failed_servers:
|
|
253
|
+
logger.warning(
|
|
254
|
+
f"Failed to retrieve tools from {len(failed_servers)} server(s): {', '.join(failed_servers)}"
|
|
255
|
+
)
|
|
246
256
|
|
|
247
|
-
|
|
248
|
-
|
|
257
|
+
if total_count == 0:
|
|
258
|
+
logger.warning("No tools retrieved from any MCP server")
|
|
259
|
+
else:
|
|
260
|
+
logger.info(f"Retrieved {total_count} tool(s) from {len(result)} server(s)")
|
|
249
261
|
|
|
250
|
-
|
|
251
|
-
# Check if it's a configuration error
|
|
252
|
-
if "Configuration error" in str(e) or "Missing 'transport' key" in str(e):
|
|
253
|
-
logger.error(f"Configuration error while getting MCP tools: {e}")
|
|
254
|
-
logger.error("Exiting due to invalid MCP configuration")
|
|
255
|
-
sys.exit(1)
|
|
256
|
-
else:
|
|
257
|
-
logger.error(f"Failed to get MCP tools: {e}")
|
|
258
|
-
logger.error("Exiting due to MCP tools retrieval failure")
|
|
259
|
-
sys.exit(1)
|
|
262
|
+
return result
|
|
260
263
|
|
|
261
264
|
async def disconnect_all(self):
|
|
262
265
|
"""Disconnect all MCP connections"""
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|