-
Notifications
You must be signed in to change notification settings - Fork 0
Troubleshooting
Symptom: Engine start timeout or matlab.engine not found
Solutions:
-
Verify MATLAB Engine API is installed:
python -c "import matlab.engine; print('OK')" -
Install the Engine API:
cd /Applications/MATLAB_R2024a.app/extern/engines/python # macOS pip install .
-
Check MATLAB version: Must be 2020b or later.
-
Check PATH: MATLAB must be on your system PATH, or set
matlab_rootin config:pool: matlab_root: "/Applications/MATLAB_R2024a.app"
-
Increase timeout: If MATLAB is slow to start:
pool: engine_start_timeout: 300 # 5 minutes
Symptom: Warning about max engines on macOS
Explanation: MATLAB on macOS has a limit of ~4 concurrent engine instances. The server warns but respects your configured max_engines.
Solution: Set max_engines: 4 on macOS:
pool:
max_engines: 4Symptom: Client can't connect to http://localhost:8765/sse
Solutions:
-
Check the server is running:
matlab-mcp --transport sse - Check port: Default is 8765, verify in config
-
Check host binding: Use
0.0.0.0for remote access,127.0.0.1for local only - Firewall: Ensure port 8765 is open
Symptom: BlockedFunctionError: Function 'system' is blocked
Explanation: The security validator blocks dangerous functions by default.
Solutions:
-
Use MATLAB-native alternatives instead of
system():- File operations:
dir,mkdir,copyfile,movefile - Environment:
getenv
- File operations:
-
Disable blocklist (not recommended for shared servers):
security: blocked_functions_enabled: false
-
Remove specific functions from blocklist:
security: blocked_functions: - "unix" - "dos" # system removed from list
Symptom: Job never completes, progress stops updating
Solutions:
-
Cancel the job: Ask your agent to call
cancel_jobwith the job ID -
Check max execution time:
execution: max_execution_time: 86400 # 24h hard limit
-
Check MATLAB code: Is there an infinite loop? Add progress reporting to debug:
mcp_progress(__mcp_job_id__, i/n*100, sprintf('Iteration %d', i));
Symptom: No interactive plot returned, only text output
Explanation: The Plotly converter (mcp_extract_props.m) supports common plot types. Some complex or custom plot types may not convert.
Solutions:
- Check supported types: line, scatter, bar, histogram, surface, image
- Simplify the plot: Complex multi-axis or custom graphics may not convert
- Static fallback: A PNG image is always generated even if Plotly conversion fails
-
Disable Plotly: Fall back to static images only:
output: plotly_conversion: false
Symptom: Output is cut off or saved to file
Explanation: Results exceeding max_inline_text_length (50,000 chars) or large_result_threshold (10,000 elements) are saved to file instead of returned inline.
Solutions:
-
Increase limits:
output: max_inline_text_length: 100000 large_result_threshold: 50000
-
Use
list_files+get_job_resultto access the full output file
Enable debug logging to see detailed server activity:
server:
log_level: "debug"
log_file: "./logs/server.log"Or via environment variable:
export MATLAB_MCP_SERVER_LOG_LEVEL=debugCheck the log file at ./logs/server.log for detailed error information.