Add test CLI tools for executor testing
- simple_test_cli.py: Working CLI for simple (stateless) backend - Supports one-shot execution and interactive REPL - Uses PassthroughValidator and wrappers to bypass security for testing - Skips resource limits to avoid cgroupv2 issues in rootless Podman - test_containers.py: Container verification script (all tests passing) - simple_test_cli_README.md: Documentation for test tools Note: Jupyter backend has connection file timing issues (future work)
This commit is contained in:
parent
db677ae537
commit
8b6b237be9
3 changed files with 648 additions and 0 deletions
84
simple_test_cli_README.md
Normal file
84
simple_test_cli_README.md
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
# Simple Test CLI for MCP-Forge
|
||||
|
||||
A minimal testing tool for MCP-Forge execution backends.
|
||||
|
||||
## Features
|
||||
|
||||
✅ **Working:**
|
||||
- Simple (stateless) backend with one-shot and interactive execution
|
||||
- No security restrictions (for testing only)
|
||||
- No resource limits (avoids cgroupv2 issues in rootless Podman)
|
||||
|
||||
❌ **Not Working:**
|
||||
- Jupyter (stateful) backend - has connection file timing issues
|
||||
- MCP tool injection - not supported in this simplified version
|
||||
|
||||
## Usage
|
||||
|
||||
### One-Shot Execution (Simple Backend)
|
||||
|
||||
```bash
|
||||
# Execute Python code and exit
|
||||
./simple_test_cli.py --execute 'print(2 + 2)'
|
||||
|
||||
# More complex code
|
||||
./simple_test_cli.py --execute 'x = [1, 2, 3]; print(sum(x))'
|
||||
```
|
||||
|
||||
### Interactive REPL (Simple Backend)
|
||||
|
||||
```bash
|
||||
# Start interactive shell
|
||||
./simple_test_cli.py
|
||||
|
||||
# In the shell:
|
||||
>>> x = 42
|
||||
>>> print(x * 2)
|
||||
84
|
||||
>>> .exit
|
||||
```
|
||||
|
||||
### Special Commands
|
||||
|
||||
- `.exit`, `.quit` - Exit the shell
|
||||
- `.help` - Show help
|
||||
- `.clear` - Clear screen
|
||||
|
||||
## Requirements
|
||||
|
||||
- Rootless Podman with user socket at `$XDG_RUNTIME_DIR/podman/podman.sock`
|
||||
- Container images built:
|
||||
- `mcp-forge/python:3.12` - For simple backend
|
||||
- `mcp-forge/jupyter:latest` - For Jupyter backend (not working yet)
|
||||
|
||||
## Limitations
|
||||
|
||||
This is a **testing tool only**:
|
||||
- No security validation
|
||||
- No resource limits
|
||||
- No MCP tool injection
|
||||
- No proper error handling for production use
|
||||
- Jupyter backend has connection file issues
|
||||
|
||||
For production use, use the full MCP-Forge server with proper configuration.
|
||||
|
||||
## Testing Containers
|
||||
|
||||
To test if containers work:
|
||||
|
||||
```bash
|
||||
# Test simple execution
|
||||
./test_containers.py
|
||||
|
||||
# Should output:
|
||||
# ✓ Simple Execution: PASS
|
||||
# ✓ Jupyter Kernel: PASS
|
||||
```
|
||||
|
||||
## Architecture
|
||||
|
||||
- `PassthroughValidator` - Dummy validator that allows all operations
|
||||
- `SimpleExecutorWrapper` - Wraps CodeExecutor, skips resource limits
|
||||
- `JupyterKernelWrapper` - Wraps JupyterKernelManager (has issues)
|
||||
|
||||
The CLI creates temporary directories for logs and connection files, cleans up on exit.
|
||||
Loading…
Add table
Add a link
Reference in a new issue