castrel-proxy 0.1.0__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/.gitignore +144 -0
- castrel_proxy-0.1.0/CHANGELOG.md +33 -0
- castrel_proxy-0.1.0/LICENSE +21 -0
- castrel_proxy-0.1.0/PKG-INFO +302 -0
- castrel_proxy-0.1.0/README.md +242 -0
- castrel_proxy-0.1.0/pyproject.toml +118 -0
- castrel_proxy-0.1.0/src/castrel_proxy/__init__.py +22 -0
- castrel_proxy-0.1.0/src/castrel_proxy/cli/__init__.py +5 -0
- castrel_proxy-0.1.0/src/castrel_proxy/cli/commands.py +608 -0
- castrel_proxy-0.1.0/src/castrel_proxy/core/__init__.py +18 -0
- castrel_proxy-0.1.0/src/castrel_proxy/core/client_id.py +94 -0
- castrel_proxy-0.1.0/src/castrel_proxy/core/config.py +158 -0
- castrel_proxy-0.1.0/src/castrel_proxy/core/daemon.py +206 -0
- castrel_proxy-0.1.0/src/castrel_proxy/core/executor.py +166 -0
- castrel_proxy-0.1.0/src/castrel_proxy/data/__init__.py +1 -0
- castrel_proxy-0.1.0/src/castrel_proxy/data/default_whitelist.txt +229 -0
- castrel_proxy-0.1.0/src/castrel_proxy/mcp/__init__.py +8 -0
- castrel_proxy-0.1.0/src/castrel_proxy/mcp/manager.py +278 -0
- castrel_proxy-0.1.0/src/castrel_proxy/network/__init__.py +13 -0
- castrel_proxy-0.1.0/src/castrel_proxy/network/api_client.py +284 -0
- castrel_proxy-0.1.0/src/castrel_proxy/network/websocket_client.py +1148 -0
- castrel_proxy-0.1.0/src/castrel_proxy/operations/__init__.py +17 -0
- castrel_proxy-0.1.0/src/castrel_proxy/operations/document.py +343 -0
- castrel_proxy-0.1.0/src/castrel_proxy/security/__init__.py +17 -0
- castrel_proxy-0.1.0/src/castrel_proxy/security/whitelist.py +403 -0
- castrel_proxy-0.1.0/tests/__init__.py +1 -0
- castrel_proxy-0.1.0/tests/test_core.py +31 -0
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
pip-wheel-metadata/
|
|
24
|
+
share/python-wheels/
|
|
25
|
+
*.egg-info/
|
|
26
|
+
.installed.cfg
|
|
27
|
+
*.egg
|
|
28
|
+
MANIFEST
|
|
29
|
+
|
|
30
|
+
# PyInstaller
|
|
31
|
+
*.manifest
|
|
32
|
+
*.spec
|
|
33
|
+
|
|
34
|
+
# Installer logs
|
|
35
|
+
pip-log.txt
|
|
36
|
+
pip-delete-this-directory.txt
|
|
37
|
+
|
|
38
|
+
# Unit test / coverage reports
|
|
39
|
+
htmlcov/
|
|
40
|
+
.tox/
|
|
41
|
+
.nox/
|
|
42
|
+
.coverage
|
|
43
|
+
.coverage.*
|
|
44
|
+
.cache
|
|
45
|
+
nosetests.xml
|
|
46
|
+
coverage.xml
|
|
47
|
+
*.cover
|
|
48
|
+
*.py,cover
|
|
49
|
+
.hypothesis/
|
|
50
|
+
.pytest_cache/
|
|
51
|
+
|
|
52
|
+
# Translations
|
|
53
|
+
*.mo
|
|
54
|
+
*.pot
|
|
55
|
+
|
|
56
|
+
# Django stuff:
|
|
57
|
+
*.log
|
|
58
|
+
local_settings.py
|
|
59
|
+
db.sqlite3
|
|
60
|
+
db.sqlite3-journal
|
|
61
|
+
|
|
62
|
+
# Flask stuff:
|
|
63
|
+
instance/
|
|
64
|
+
.webassets-cache
|
|
65
|
+
|
|
66
|
+
# Scrapy stuff:
|
|
67
|
+
.scrapy
|
|
68
|
+
|
|
69
|
+
# Sphinx documentation
|
|
70
|
+
docs/_build/
|
|
71
|
+
|
|
72
|
+
# PyBuilder
|
|
73
|
+
target/
|
|
74
|
+
|
|
75
|
+
# Jupyter Notebook
|
|
76
|
+
.ipynb_checkpoints
|
|
77
|
+
|
|
78
|
+
# IPython
|
|
79
|
+
profile_default/
|
|
80
|
+
ipython_config.py
|
|
81
|
+
|
|
82
|
+
# pyenv
|
|
83
|
+
.python-version
|
|
84
|
+
|
|
85
|
+
# pipenv
|
|
86
|
+
Pipfile.lock
|
|
87
|
+
|
|
88
|
+
# PEP 582
|
|
89
|
+
__pypackages__/
|
|
90
|
+
|
|
91
|
+
# Celery stuff
|
|
92
|
+
celerybeat-schedule
|
|
93
|
+
celerybeat.pid
|
|
94
|
+
|
|
95
|
+
# SageMath parsed files
|
|
96
|
+
*.sage.py
|
|
97
|
+
|
|
98
|
+
# Environments
|
|
99
|
+
.env
|
|
100
|
+
.venv
|
|
101
|
+
env/
|
|
102
|
+
venv/
|
|
103
|
+
ENV/
|
|
104
|
+
env.bak/
|
|
105
|
+
venv.bak/
|
|
106
|
+
|
|
107
|
+
# Spyder project settings
|
|
108
|
+
.spyderproject
|
|
109
|
+
.spyproject
|
|
110
|
+
|
|
111
|
+
# Rope project settings
|
|
112
|
+
.ropeproject
|
|
113
|
+
|
|
114
|
+
# mkdocs documentation
|
|
115
|
+
/site
|
|
116
|
+
|
|
117
|
+
# mypy
|
|
118
|
+
.mypy_cache/
|
|
119
|
+
.dmypy.json
|
|
120
|
+
dmypy.json
|
|
121
|
+
|
|
122
|
+
# Pyre type checker
|
|
123
|
+
.pyre/
|
|
124
|
+
|
|
125
|
+
# IDE
|
|
126
|
+
.vscode/
|
|
127
|
+
.idea/
|
|
128
|
+
*.swp
|
|
129
|
+
*.swo
|
|
130
|
+
*~
|
|
131
|
+
.DS_Store
|
|
132
|
+
|
|
133
|
+
# Project specific
|
|
134
|
+
*.egg-info/
|
|
135
|
+
.eggs/
|
|
136
|
+
dist/
|
|
137
|
+
build/
|
|
138
|
+
|
|
139
|
+
# Configuration files (user-specific)
|
|
140
|
+
config.yaml
|
|
141
|
+
mcp.json
|
|
142
|
+
|
|
143
|
+
# Logs
|
|
144
|
+
*.log
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **Background daemon mode**: Bridge can now run as a background process (Unix/macOS only)
|
|
12
|
+
- Automatic PID file management at `~/.castrel/castrel-proxy.pid`
|
|
13
|
+
- Log output redirected to `~/.castrel/castrel-proxy.log`
|
|
14
|
+
- Graceful shutdown handling (SIGTERM, SIGINT)
|
|
15
|
+
- Process status checking and management
|
|
16
|
+
- **Enhanced `stop` command**: Now properly stops background daemon processes
|
|
17
|
+
- **Enhanced `status` command**: Shows actual running status with PID information
|
|
18
|
+
- **Enhanced `logs` command**:
|
|
19
|
+
- View last N lines of logs with `--lines`
|
|
20
|
+
- Follow logs in real-time with `--follow`
|
|
21
|
+
- Reads from daemon log file
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
- **Breaking**: `castrel-proxy start` now defaults to background mode instead of foreground mode
|
|
25
|
+
- Use `--foreground` or `-f` flag to run in foreground mode
|
|
26
|
+
- Background mode only supported on Unix/macOS (not Windows)
|
|
27
|
+
- Example: `castrel-proxy start --foreground` to run in foreground
|
|
28
|
+
- Logging in daemon mode redirects to file instead of stdout/stderr
|
|
29
|
+
|
|
30
|
+
### Fixed
|
|
31
|
+
- Enhanced MCP configuration validation to exit immediately on invalid configuration
|
|
32
|
+
- Added strict validation for required `transport` field in MCP server configuration
|
|
33
|
+
- Improved error messages for MCP configuration errors
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Cloudwise
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: castrel-proxy
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A lightweight remote command execution bridge client with MCP integration
|
|
5
|
+
Project-URL: Homepage, https://github.com/castrel-ai/castrel-bridge-proxy
|
|
6
|
+
Project-URL: Documentation, https://github.com/castrel-ai/castrel-bridge-proxy#readme
|
|
7
|
+
Project-URL: Repository, https://github.com/castrel-ai/castrel-bridge-proxy
|
|
8
|
+
Project-URL: Issues, https://github.com/castrel-ai/castrel-bridge-proxy/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/castrel-ai/castrel-bridge-proxy/blob/main/CHANGELOG.md
|
|
10
|
+
Author: Castrel Team
|
|
11
|
+
License: MIT License
|
|
12
|
+
|
|
13
|
+
Copyright (c) 2025 Cloudwise
|
|
14
|
+
|
|
15
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
16
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
17
|
+
in the Software without restriction, including without limitation the rights
|
|
18
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
19
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
20
|
+
furnished to do so, subject to the following conditions:
|
|
21
|
+
|
|
22
|
+
The above copyright notice and this permission notice shall be included in all
|
|
23
|
+
copies or substantial portions of the Software.
|
|
24
|
+
|
|
25
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
26
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
27
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
28
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
29
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
30
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
31
|
+
SOFTWARE.
|
|
32
|
+
License-File: LICENSE
|
|
33
|
+
Keywords: bridge,mcp,proxy,remote-execution,websocket
|
|
34
|
+
Classifier: Development Status :: 3 - Alpha
|
|
35
|
+
Classifier: Intended Audience :: Developers
|
|
36
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
37
|
+
Classifier: Operating System :: OS Independent
|
|
38
|
+
Classifier: Programming Language :: Python :: 3
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
40
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
41
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
42
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
43
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
44
|
+
Classifier: Topic :: System :: Networking
|
|
45
|
+
Requires-Python: >=3.10
|
|
46
|
+
Requires-Dist: aiohttp>=3.9.0
|
|
47
|
+
Requires-Dist: langchain-mcp-adapters>=0.2.1
|
|
48
|
+
Requires-Dist: mcp>=1.0.0
|
|
49
|
+
Requires-Dist: pyyaml>=6.0.1
|
|
50
|
+
Requires-Dist: typer>=0.20.1
|
|
51
|
+
Provides-Extra: dev
|
|
52
|
+
Requires-Dist: black>=23.0.0; extra == 'dev'
|
|
53
|
+
Requires-Dist: flake8>=6.0.0; extra == 'dev'
|
|
54
|
+
Requires-Dist: isort>=5.12.0; extra == 'dev'
|
|
55
|
+
Requires-Dist: mypy>=1.0.0; extra == 'dev'
|
|
56
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
|
|
57
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
|
|
58
|
+
Requires-Dist: pytest>=7.0.0; extra == 'dev'
|
|
59
|
+
Description-Content-Type: text/markdown
|
|
60
|
+
|
|
61
|
+
# Castrel Bridge Proxy
|
|
62
|
+
|
|
63
|
+
[](https://github.com/castrel-ai/castrel-bridge-proxy/actions)
|
|
64
|
+
[](https://opensource.org/licenses/MIT)
|
|
65
|
+
[](https://pypi.org/project/castrel-proxy/)
|
|
66
|
+
|
|
67
|
+
A lightweight remote command execution bridge client that connects to a server via WebSocket to receive and execute commands, with MCP (Model Context Protocol) integration.
|
|
68
|
+
|
|
69
|
+
## ✨ Features
|
|
70
|
+
|
|
71
|
+
- ✅ **Secure Pairing**: Pair with server using verification codes
|
|
72
|
+
- ✅ **Persistent Configuration**: Configuration saved in `~/.castrel/config.yaml`
|
|
73
|
+
- ✅ **Unique Identifier**: Generate stable client ID based on machine characteristics
|
|
74
|
+
- ✅ **WebSocket Connection**: Real-time bidirectional communication
|
|
75
|
+
- ✅ **Command Execution**: Execute shell commands with whitelist security
|
|
76
|
+
- ✅ **Document Operations**: Read, write, and edit files remotely
|
|
77
|
+
- ✅ **Auto Reconnect**: Automatically reconnect when connection is lost
|
|
78
|
+
- ✅ **Timeout Control**: Command execution timeout protection
|
|
79
|
+
- ✅ **MCP Integration**: Connect to local MCP services and sync tools information
|
|
80
|
+
|
|
81
|
+
## 📦 Installation
|
|
82
|
+
|
|
83
|
+
### Via pip
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
pip install castrel-proxy
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### From source
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
git clone https://github.com/castrel-ai/castrel-bridge-proxy.git
|
|
93
|
+
cd castrel-bridge-proxy
|
|
94
|
+
pip install -e .
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## 🚀 Quick Start
|
|
98
|
+
|
|
99
|
+
### 1. Pair with Server
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
castrel-proxy pair <verification_code> <server_url>
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Example:
|
|
106
|
+
```bash
|
|
107
|
+
castrel-proxy pair eyJ0cyI6MTczNTA4ODQwMCwid2lkIjoiZGVmYXVsdCIsInJhbmQiOiIxMjM0NTYifQ https://server.example.com
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### 2. Start Bridge Service
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
# Run in background (default)
|
|
114
|
+
castrel-proxy start
|
|
115
|
+
|
|
116
|
+
# Run in foreground
|
|
117
|
+
castrel-proxy start --foreground
|
|
118
|
+
|
|
119
|
+
# Press Ctrl+C to stop (foreground mode only)
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### 3. Stop Bridge Service
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
# Stop background daemon
|
|
126
|
+
castrel-proxy stop
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### 4. Check Status
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
castrel-proxy status
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### 5. View Logs
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
# View last 50 lines (default)
|
|
139
|
+
castrel-proxy logs
|
|
140
|
+
|
|
141
|
+
# View last 100 lines
|
|
142
|
+
castrel-proxy logs -n 100
|
|
143
|
+
|
|
144
|
+
# Follow logs in real-time
|
|
145
|
+
castrel-proxy logs -f
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## 📖 Documentation
|
|
149
|
+
|
|
150
|
+
- [Installation Guide](docs/installation.md)
|
|
151
|
+
- [Configuration Guide](docs/configuration.md)
|
|
152
|
+
- [Daemon Mode Guide](docs/daemon-mode.md)
|
|
153
|
+
- [MCP Integration](docs/mcp-integration.md)
|
|
154
|
+
- [API Reference](docs/api-reference.md)
|
|
155
|
+
- [Protocol Specification](docs/protocol.md)
|
|
156
|
+
- [Migration Guide](MIGRATION_GUIDE.md)
|
|
157
|
+
|
|
158
|
+
## 🔧 Configuration
|
|
159
|
+
|
|
160
|
+
### Bridge Configuration (`~/.castrel/config.yaml`)
|
|
161
|
+
|
|
162
|
+
Pairing information is saved automatically:
|
|
163
|
+
|
|
164
|
+
```yaml
|
|
165
|
+
server_url: "https://server.example.com"
|
|
166
|
+
verification_code: "ABC123"
|
|
167
|
+
client_id: "a1b2c3d4e5f6"
|
|
168
|
+
workspace_id: "default"
|
|
169
|
+
paired_at: "2025-12-22T10:30:00Z"
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### MCP Configuration (`~/.castrel/mcp.json`)
|
|
173
|
+
|
|
174
|
+
Configure MCP services (optional):
|
|
175
|
+
|
|
176
|
+
```json
|
|
177
|
+
{
|
|
178
|
+
"mcpServers": {
|
|
179
|
+
"filesystem": {
|
|
180
|
+
"transport": "stdio",
|
|
181
|
+
"command": "npx",
|
|
182
|
+
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/dir"],
|
|
183
|
+
"env": {}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
See `examples/mcp.json.example` for more examples.
|
|
190
|
+
|
|
191
|
+
### Command Whitelist (`~/.castrel/whitelist.conf`)
|
|
192
|
+
|
|
193
|
+
Configure allowed commands for security:
|
|
194
|
+
|
|
195
|
+
```
|
|
196
|
+
# Add commands one per line
|
|
197
|
+
ls
|
|
198
|
+
cat
|
|
199
|
+
git
|
|
200
|
+
python
|
|
201
|
+
# etc.
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
## 🏗️ Architecture
|
|
205
|
+
|
|
206
|
+
```
|
|
207
|
+
┌─────────────────────────────────────────────────┐
|
|
208
|
+
│ Bridge Client (Local) │
|
|
209
|
+
│ │
|
|
210
|
+
│ ┌──────────────────────────────────────────┐ │
|
|
211
|
+
│ │ CLI Commands │ │
|
|
212
|
+
│ └──────────────────────────────────────────┘ │
|
|
213
|
+
│ │ │
|
|
214
|
+
│ ┌─────────────┼─────────────┐ │
|
|
215
|
+
│ │ │ │ │
|
|
216
|
+
│ ┌───▼────┐ ┌────▼─────┐ ┌───▼─────┐ │
|
|
217
|
+
│ │ Core │ │ MCP │ │ Network │ │
|
|
218
|
+
│ │ Config │ │ Manager │ │ Client │ │
|
|
219
|
+
│ └────────┘ └──────────┘ └──────────┘ │
|
|
220
|
+
│ │ │ │
|
|
221
|
+
│ ┌─────▼─────┐ │ │
|
|
222
|
+
│ │ MCP │ │ │
|
|
223
|
+
│ │ Servers │ │ │
|
|
224
|
+
│ └───────────┘ ┌────▼─────┐ │
|
|
225
|
+
│ │ Command │ │
|
|
226
|
+
│ │ Executor │ │
|
|
227
|
+
│ └──────────┘ │
|
|
228
|
+
└─────────────────────────────────────────────────┘
|
|
229
|
+
│
|
|
230
|
+
│ WebSocket
|
|
231
|
+
▼
|
|
232
|
+
┌─────────────────────────────────────────────────┐
|
|
233
|
+
│ Bridge Server (Remote) │
|
|
234
|
+
│ /api/v1/bridge/ws?client_id=xxx&code=yyy │
|
|
235
|
+
└─────────────────────────────────────────────────┘
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
## 🛠️ Development
|
|
239
|
+
|
|
240
|
+
### Setup Development Environment
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
# Clone repository
|
|
244
|
+
git clone https://github.com/castrel-ai/castrel-bridge-proxy.git
|
|
245
|
+
cd castrel-bridge-proxy
|
|
246
|
+
|
|
247
|
+
# Create virtual environment
|
|
248
|
+
python -m venv venv
|
|
249
|
+
source venv/bin/activate # On Windows: venv\Scripts\activate
|
|
250
|
+
|
|
251
|
+
# Install dependencies
|
|
252
|
+
pip install -e ".[dev]"
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
### Run Tests
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
# Run all tests
|
|
259
|
+
pytest
|
|
260
|
+
|
|
261
|
+
# Run with coverage
|
|
262
|
+
pytest --cov=castrel_proxy
|
|
263
|
+
|
|
264
|
+
# Run specific test file
|
|
265
|
+
pytest tests/test_core.py
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
### Code Quality
|
|
269
|
+
|
|
270
|
+
```bash
|
|
271
|
+
# Format code
|
|
272
|
+
black src/
|
|
273
|
+
|
|
274
|
+
# Lint code
|
|
275
|
+
flake8 src/
|
|
276
|
+
|
|
277
|
+
# Type checking
|
|
278
|
+
mypy src/
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
## 🤝 Contributing
|
|
282
|
+
|
|
283
|
+
Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
284
|
+
|
|
285
|
+
## 📝 License
|
|
286
|
+
|
|
287
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
288
|
+
|
|
289
|
+
## 🔒 Security
|
|
290
|
+
|
|
291
|
+
For security concerns, please see [SECURITY.md](SECURITY.md) or contact security@example.com.
|
|
292
|
+
|
|
293
|
+
## 📮 Contact
|
|
294
|
+
|
|
295
|
+
- Issues: [GitHub Issues](https://github.com/castrel-ai/castrel-bridge-proxy/issues)
|
|
296
|
+
- Discussions: [GitHub Discussions](https://github.com/castrel-ai/castrel-bridge-proxy/discussions)
|
|
297
|
+
|
|
298
|
+
## 🙏 Acknowledgments
|
|
299
|
+
|
|
300
|
+
- Built with [Typer](https://typer.tiangolo.com/) for CLI
|
|
301
|
+
- Uses [aiohttp](https://docs.aiohttp.org/) for async WebSocket communication
|
|
302
|
+
- Integrates with [MCP](https://modelcontextprotocol.io/) for tool protocols
|