Requirements: Python 3.10+ (MCP SDK requires Python 3.10+)
# Install the MCP SDK (requires Python 3.10+)
python3.10 -m pip install git+https://github.com/modelcontextprotocol/python-sdk.git
# Install this package
python3.10 -m pip install -e ".[dev]" # Optional: dev dependencies
# Optional: git hooks
pre-commit installNote: If your default python3 is 3.8 or 3.9, use python3.10 explicitly for MCP SDK installation.
Uses existing lab testing framework:
- Device config:
{LAB_TESTING_ROOT}/config/lab_devices.json - VPN config: Auto-detected (see VPN Setup Guide)
LAB_TESTING_ROOT: Path to lab testing framework (default:/data_drive/esl/ai-lab-testing)VPN_CONFIG_PATH: Path to WireGuard config file (optional, auto-detected if not set)FOUNDRIES_VPN_CONFIG_PATH: Path to Foundries VPN config file (optional, auto-detected if not set)TARGET_NETWORK: Target network for lab testing operations (default:192.168.2.0/24)MCP_DEV_MODE: Enable development mode with auto-reload (set to1,true, oryesto enable)
The target network determines which network is used for lab testing operations. It can be configured in three ways (priority order):
-
Environment Variable: Set
TARGET_NETWORKenvironment variableexport TARGET_NETWORK=192.168.2.0/24 -
Config File: Add to
lab_devices.json:{ "lab_infrastructure": { "network_access": { "target_network": "192.168.2.0/24", "lab_networks": ["192.168.2.0/24"] } } } -
Default:
192.168.2.0/24(if not configured)
The lab_networks list can contain multiple networks for scanning, but target_network specifies the primary network for lab operations.
The server automatically searches for WireGuard configs in:
VPN_CONFIG_PATHenvironment variable (if set){LAB_TESTING_ROOT}/secrets/wg0.conf(orwireguard.conf,vpn.conf)~/.config/wireguard/*.conf/etc/wireguard/*.conf
No VPN? See VPN Setup Guide for setup instructions, or use the MCP tools:
vpn_setup_instructions- Get setup helpcreate_vpn_config_template- Create a config templatecheck_wireguard_installed- Check if WireGuard is installed
Foundries VPN? See Foundries VPN Setup Guide for Foundries VPN setup. Foundries VPN configs are searched in:
FOUNDRIES_VPN_CONFIG_PATHenvironment variable (if set){LAB_TESTING_ROOT}/secrets/foundries-vpn.conforfoundries.conf~/.config/wireguard/foundries.conf/etc/wireguard/foundries.conf
Add to ~/.cursor/mcp.json:
{
"mcpServers": {
"ai-lab-testing": {
"command": "python3.10",
"args": ["/absolute/path/to/lab_testing/server.py"],
"env": {
"LAB_TESTING_ROOT": "/data_drive/esl/ai-lab-testing",
"MCP_DEV_MODE": "1"
}
}
}
}Important: Use python3.10 (or python3.11+) since MCP SDK requires Python 3.10+.
Or use installed package: "command": "python3.10", "args": ["-m", "lab_testing.server"]
During development, you can enable auto-reload so that code changes are picked up automatically without restarting Cursor. This is especially useful when modifying tool handlers or network mapping code.
To enable: Add "MCP_DEV_MODE": "1" to the env section in your MCP configuration (as shown above).
How it works:
- The server checks for file changes before each tool call
- Modified Python modules are automatically reloaded using
importlib.reload() - No need to restart Cursor after making code changes
- Reloaded modules are logged for debugging
Note: Auto-reload only works for modules in the lab_testing package. Changes to server.py itself still require a restart.
Restart Cursor after initial setup.
Note: Some tools (like create_network_map) may take longer than 30 seconds if they perform network scans. Cursor has a default 30-second timeout for MCP tool calls.
Solutions:
- Use Quick Mode: For
create_network_map, setquick_mode: trueto skip network scanning and only show configured devices (completes in <5 seconds). - Optimized Scanning: The network scanner has been optimized with faster ping timeouts (0.5s) and increased parallelism (100 workers) to reduce scan time.
- Client Timeout: Currently, there's no way to configure the MCP client timeout in Cursor's
mcp.json. The timeout is hardcoded in the Cursor client. If you need full network scans, consider running the tool directly via Python or use quick mode for faster results.
python3 test_server.py