- 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)
84 lines
1.9 KiB
Markdown
84 lines
1.9 KiB
Markdown
# 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.
|