Stateless command execution and process management MCP server for Claude
ProcExecMCP enables Claude (acting in an architectural role) to search code content, execute commands, monitor processes, and terminate processes. The server exposes 4 MCP tools using FastMCP with Python 3.11+, psutil for cross-platform process management, and system ripgrep for file content search.
- π search_file_contents: Search for patterns in file contents using ripgrep
- β‘ execute_command: Execute commands safely with timeout and output limits
- π list_processes: List running processes with filtering and sorting
- π kill_process: Terminate processes by PID
- β
No shell injection (no
shell=True) - β Mandatory timeouts on all operations
- β Resource limits prevent memory exhaustion
- β Path validation prevents traversal attacks
- β Sanitized error messages
For comprehensive security documentation, see SECURITY_ARCHITECTURE.md.
- Python 3.11+
- uv package manager (installation guide)
- ripgrep (rg) binary (installation guide)
- Claude Desktop or Claude for Windows
# Clone repository
git clone <repository-url> ProcExecMCP
cd ProcExecMCP
# Install with uv
uv sync# Check if ripgrep is installed
rg --versionIf not installed:
- Windows:
winget install BurntSushi.ripgrep.MSVC - macOS:
brew install ripgrep - Linux:
sudo apt install ripgrep
Edit your Claude Desktop configuration file:
- Windows:
%APPDATA%\Claude\claude_desktop_config.json - macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json
Add ProcExecMCP to mcpServers:
{
"mcpServers": {
"procexec": {
"command": "uv",
"args": [
"--directory",
"/absolute/path/to/ProcExecMCP",
"run",
"procexec"
],
"env": {
"PROCEXEC_TIMEOUT": "30000",
"PROCEXEC_MAX_OUTPUT": "10485760",
"PROCEXEC_ENABLE_KILL": "true",
"PROCEXEC_RIPGREP_PATH": "/path/to/rg"
}
}
}
}Windows Example:
{
"mcpServers": {
"procexec": {
"command": "C:\\Users\\YourName\\.local\\bin\\uv.exe",
"args": [
"--directory",
"D:\\dev\\ProcExecMCP",
"run",
"procexec"
],
"env": {
"PROCEXEC_RIPGREP_PATH": "C:\\Program Files\\ripgrep\\rg.exe"
}
}
}
}Close and reopen Claude Desktop to load the new MCP server.
In Claude, try:
What MCP tools do you have available?
You should see all 4 ProcExecMCP tools listed.
- PROCEXEC_TIMEOUT: Command timeout in milliseconds (default: 30000, range: 1000-300000)
- PROCEXEC_MAX_OUTPUT: Maximum output size in bytes (default: 10485760 = 10MB)
- PROCEXEC_BLOCKED_PATHS: Comma-separated list of paths to block access
- PROCEXEC_ENABLE_KILL: Enable process termination tool (default: "true")
- PROCEXEC_RIPGREP_PATH: Full path to ripgrep binary (use if not in PATH)
- Blocked Paths: Configure
PROCEXEC_BLOCKED_PATHSto protect sensitive directories - Process Termination: Disable with
PROCEXEC_ENABLE_KILL="false"if not needed - Timeouts: Set appropriate limits to prevent runaway commands
- Privileges: Avoid running Claude Desktop with elevated privileges unless necessary
Search for all TODO comments in my Python project at /path/to/project
Run 'pylint src/' in my project directory and show the results
List all Python processes sorted by memory usage
Terminate process 1234 gracefully
# All tests
uv run pytest
# With coverage
uv run pytest --cov=src/procexec --cov-report=html
# Security tests only
uv run pytest tests/security/ -v# Start server (for MCP Inspector or debugging)
uv run procexec
# Or as module
uv run python -m procexec- Quick Start: See above
- Detailed Usage: USING.md
- Security Architecture: SECURITY_ARCHITECTURE.md
- API Documentation:
docs/directory (Doxygen generated) - Troubleshooting: BUGS.md
- Contributing: CONTRIBUTING.md
Ensure ripgrep is installed and in PATH, or set PROCEXEC_RIPGREP_PATH environment variable.
Increase timeout via PROCEXEC_TIMEOUT environment variable (milliseconds).
Check file/directory permissions or configure PROCEXEC_BLOCKED_PATHS.
For more troubleshooting guidance, see BUGS.md.
This project is licensed under the GNU General Public License version 3 (GPLv3). See COPYING.md for the full license text.
Contributions are welcome! Please read CONTRIBUTING.md for guidelines.
- Issues: GitHub Issues
- Security: See SECURITY.md for responsible disclosure
- Documentation: See
docs/for API reference