{
  "markdown": "# Console Automation MCP Server\n\nModel Context Protocol (MCP) server for controlled interaction with local console applications and remote SSH sessions, including output monitoring, error detection, and long-running workflows.\n\n[![Version](https://img.shields.io/badge/version-1.1.1-blue.svg)](https://github.com/ooples/mcp-console-automation)\n[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)\n[![Node](https://img.shields.io/badge/node-%3E%3D18.0.0-brightgreen.svg)](https://nodejs.org)\n\n## Security status\n\nThis server can execute arbitrary commands and open remote SSH sessions. Treat it like a privileged terminal, not a low-risk documentation connector:\n\n- keep MCP tool approvals enabled for command/session mutations;\n- prefer SSH keys or environment-variable credential references over inline secrets;\n- use a restricted deployment account and a separate production approval step;\n- leave `MCP_DEBUG_LOG` and `MCP_LOG_DIR` unset unless diagnostics are explicitly required;\n- leave session persistence disabled unless recovery metadata is explicitly required;\n- install cloud, container, and serial integrations only when needed.\n\n## Features\n\n### 🚀 Core Capabilities\n\n- **Full Terminal Control**: Create and manage up to 50 concurrent console sessions\n- **Multi-Protocol Support**: Local shells (cmd, PowerShell, pwsh, bash, zsh, sh) and remote SSH connections\n- **Interactive Input**: Send text input and special key sequences (Enter, Tab, Ctrl+C, etc.)\n- **Real-time Output Monitoring**: Capture, filter, and analyze console output with advanced search\n- **Streaming Support**: Efficient streaming for long-running processes with pattern matching\n- **Automatic Error Detection**: Built-in patterns to detect errors, exceptions, and stack traces across languages\n- **Cross-platform**: Works on Windows, macOS, and Linux without native dependencies\n\n### 🔐 SSH & Remote Connections\n\n- **Full SSH Support**: Password and key-based authentication with passphrase support\n- **SSH Options**: Custom ports, connection timeouts, keep-alive settings\n- **Connection Profiles**: Save reusable SSH metadata and environment-variable credential references\n- **Cloud Platform Support**: Azure, AWS, GCP, Kubernetes connections via saved profiles\n- **Container Support**: Docker and WSL integration for containerized workflows\n\n### ✅ Test Automation Framework\n\n- **Automated Test Cases**: Built-in assertion tools for console output validation\n- **Output Assertions**: Verify output contains, matches regex, or equals expected values\n- **Exit Code Validation**: Assert command exit codes for success/failure detection\n- **Error-Free Validation**: Automatically check for errors in command output\n- **State Snapshots**: Save and compare session states before/after operations\n- **Test Workflows**: Chain assertions for comprehensive testing scenarios\n\n### 🔄 Background Job Execution\n\n- **Async Command Execution**: Run long-running commands in background with full output capture\n- **Priority Queue System**: Prioritize jobs (1-10 scale) for optimal resource utilization\n- **Job Monitoring**: Track status, progress, and completion of background jobs\n- **Job Control**: Cancel, pause, or resume background operations\n- **Result Retrieval**: Get complete output and exit codes from completed jobs\n- **Resource Management**: Automatic cleanup of completed jobs with configurable retention\n\n### 📊 Enterprise Monitoring & Alerts\n\n- **System-Wide Metrics**: CPU, memory, disk, and network usage tracking\n- **Session Metrics**: Per-session performance monitoring and resource consumption\n- **Real-time Dashboards**: Live monitoring data with customizable views\n- **Alert System**: Performance, error, security, and anomaly alerts with severity levels\n- **Custom Monitoring**: Configure monitoring intervals, metrics, and thresholds per session\n- **Diagnostics**: Built-in error analysis and session health validation\n\n### 📁 Profile Management\n\n- **Connection Profiles**: Save SSH, Docker, WSL, and cloud platform connections\n- **Application Profiles**: Store common command configurations (Node.js, Python, .NET, Java, Go, Rust)\n- **Quick Connect**: Instantly connect using saved profiles with override support\n- **Environment Variables**: Store environment configurations per profile\n- **Working Directory Management**: Set default directories for each profile\n\n### 🔍 Advanced Output Processing\n\n- **Regex Filtering**: Search output with regular expressions (case-sensitive/insensitive)\n- **Multi-Pattern Search**: Combine multiple patterns with AND/OR logic\n- **Pagination**: Get specific line ranges, head, or tail of output\n- **Time-based Filtering**: Filter output by timestamp (absolute or relative: '5m', '1h', '2d')\n- **Output Streaming**: Real-time output capture for long-running processes\n- **Buffer Management**: Clear output buffers to reduce memory usage\n\n## Quick Installation\n\n### Windows\n```powershell\ngit clone https://github.com/ooples/mcp-console-automation.git\ncd mcp-console-automation\n.\\install.ps1 -Target codex\n```\n\n### macOS/Linux\n```bash\ngit clone https://github.com/ooples/mcp-console-automation.git\ncd mcp-console-automation\nchmod +x install.sh\n./install.sh --target codex\n```\n\n### Manual Installation\n```bash\ngit clone https://github.com/ooples/mcp-console-automation.git\ncd mcp-console-automation\nnpm ci\nnpm run build\ncodex mcp add console-automation --env LOG_LEVEL=warn -- node \"$PWD/dist/mcp/server.js\"\n```\n\n## Configuration\n\nCodex stores MCP configuration in `~/.codex/config.toml`. The installers use `codex mcp add` and safely replace an existing `console-automation` registration. Restart Codex after installation and use `/mcp` to verify the connection.\n\nFor another MCP client, generate a new JSON configuration without overwriting an existing file:\n\n```powershell\n.\\install.ps1 -Target custom -CustomPath C:\\path\\to\\new-mcp-config.json\n```\n\nThe npm package has not been published, so `npx console-automation-mcp` and `@mcp/console-automation` are not valid installation paths.\n\n### Saved SSH credentials\n\n`console_save_profile` rejects inline passwords, private-key material, and passphrases. Use `passwordEnvVar`, `privateKeyEnvVar` or `privateKeyPath`, and `passphraseEnvVar`. Profile-list responses never return credential values, and configuration files are created with owner-only permissions where the operating system supports POSIX modes.\n\n### Session persistence\n\nSession persistence is disabled by default because session recovery data can include commands, paths, and environment values. To opt in, set `MCP_SESSION_PERSISTENCE=true`. The default file is `~/.console-automation-mcp/sessions.json`; override it with `MCP_SESSION_PERSISTENCE_PATH`. Persisted command/environment recovery data remains disabled unless enabled through the programmatic `SessionManager` configuration.\n\nThe production installers remove development and optional protocol packages. Local consoles and SSH remain available. Install only the peer packages required for Docker, cloud, Kubernetes, serial, or other optional adapters.\n\n## Available Tools (40 Total)\n\nThis MCP server provides **40 comprehensive tools** organized into 6 categories:\n\n### 📚 Complete Documentation\n\n- **[Complete Tools Reference](docs/TOOLS.md)** - Detailed documentation for all 40 tools\n- **[Practical Examples](docs/EXAMPLES.md)** - Real-world usage examples and patterns\n- **[Publishing Guide](PUBLISHING.md)** - How to list this server in registries\n\n### Tool Categories\n\n#### 🖥️ Session Management (9 tools)\n- `console_create_session` - Create local or SSH console sessions\n- `console_send_input` - Send text input to sessions\n- `console_send_key` - Send special keys (Enter, Ctrl+C, etc.)\n- `console_get_output` - Get filtered/paginated output with advanced search\n- `console_get_stream` - Stream output from long-running processes\n- `console_wait_for_output` - Wait for specific patterns\n- `console_stop_session` - Stop sessions\n- `console_list_sessions` - List all active sessions\n- `console_cleanup_sessions` - Clean up inactive sessions\n\n#### ⚡ Command Execution (6 tools)\n- `console_execute_command` - Execute commands with output capture\n- `console_detect_errors` - Analyze output for errors\n- `console_get_resource_usage` - Get system resource stats\n- `console_clear_output` - Clear output buffers\n- `console_get_session_state` - Get session execution state\n- `console_get_command_history` - View command history\n\n#### 📊 Monitoring & Alerts (6 tools)\n- `console_get_system_metrics` - Comprehensive system metrics\n- `console_get_session_metrics` - Session-specific metrics\n- `console_get_alerts` - Active monitoring alerts\n- `console_get_monitoring_dashboard` - Real-time dashboard data\n- `console_start_monitoring` - Start custom monitoring\n- `console_stop_monitoring` - Stop monitoring\n\n#### 📁 Profile Management (4 tools)\n- `console_save_profile` - Save SSH/app connection profiles\n- `console_list_profiles` - List saved profiles\n- `console_remove_profile` - Remove profiles\n- `console_use_profile` - Quick connect with saved profiles\n\n#### 🔄 Background Jobs (9 tools)\n- `console_execute_async` - Execute commands asynchronously\n- `console_get_job_status` - Check job status\n- `console_get_job_output` - Get job output\n- `console_cancel_job` - Cancel running jobs\n- `console_list_jobs` - List all background jobs\n- `console_get_job_progress` - Monitor job progress\n- `console_get_job_result` - Get complete job results\n- `console_get_job_metrics` - Job execution statistics\n- `console_cleanup_jobs` - Clean up completed jobs\n\n#### ✅ Test Automation (6 tools)\n- `console_assert_output` - Assert output matches criteria\n- `console_assert_exit_code` - Assert exit codes\n- `console_assert_no_errors` - Verify no errors occurred\n- `console_save_snapshot` - Save session state snapshots\n- `console_compare_snapshots` - Compare state differences\n- `console_assert_state` - Assert session state\n\n### Quick Start Examples\n\n#### Create a Local Session\n```javascript\nconst session = await console_create_session({\n  command: \"npm\",\n  args: [\"run\", \"dev\"],\n  detectErrors: true\n});\n```\n\n#### Connect via SSH\n```javascript\nconst session = await console_create_session({\n  command: \"bash\",\n  consoleType: \"ssh\",\n  sshOptions: {\n    host: \"example.com\",\n    username: \"user\",\n    privateKeyPath: \"~/.ssh/id_rsa\"\n  }\n});\n```\n\n#### Run Tests with Assertions\n```javascript\nconst session = await console_create_session({\n  command: \"npm\",\n  args: [\"test\"]\n});\n\nawait console_assert_output({\n  sessionId: session.sessionId,\n  assertionType: \"contains\",\n  expected: \"All tests passed\"\n});\n```\n\n#### Background Job Execution\n```javascript\nconst job = await console_execute_async({\n  sessionId: session.sessionId,\n  command: \"npm run build\",\n  priority: 8\n});\n\nconst status = await console_get_job_status({\n  jobId: job.jobId\n});\n```\n\nFor more examples, see [docs/EXAMPLES.md](docs/EXAMPLES.md)\n\n## Use Cases\n\n### 1. Running and monitoring a development server\n```javascript\n// Create a session for the dev server\nconst session = await console_create_session({\n  command: \"npm\",\n  args: [\"run\", \"dev\"],\n  detectErrors: true\n});\n\n// Wait for server to start\nawait console_wait_for_output({\n  sessionId: session.sessionId,\n  pattern: \"Server running on\",\n  timeout: 10000\n});\n\n// Monitor for errors\nconst errors = await console_detect_errors({\n  sessionId: session.sessionId\n});\n```\n\n### 2. Interactive debugging session\n```javascript\n// Start a Python debugging session\nconst session = await console_create_session({\n  command: \"python\",\n  args: [\"-m\", \"pdb\", \"script.py\"]\n});\n\n// Set a breakpoint\nawait console_send_input({\n  sessionId: session.sessionId,\n  input: \"b main\\n\"\n});\n\n// Continue execution\nawait console_send_input({\n  sessionId: session.sessionId,\n  input: \"c\\n\"\n});\n\n// Step through code\nawait console_send_key({\n  sessionId: session.sessionId,\n  key: \"n\"\n});\n```\n\n### 3. Automated testing with error detection\n```javascript\n// Run tests\nconst result = await console_execute_command({\n  command: \"pytest\",\n  args: [\"tests/\"],\n  timeout: 30000\n});\n\n// Check for test failures\nconst errors = await console_detect_errors({\n  text: result.output\n});\n\nif (errors.hasErrors) {\n  console.log(\"Test failures detected:\", errors);\n}\n```\n\n### 4. Interactive CLI tool automation\n```javascript\n// Start an interactive CLI tool\nconst session = await console_create_session({\n  command: \"mysql\",\n  args: [\"-u\", \"root\", \"-p\"]\n});\n\n// Enter password\nawait console_wait_for_output({\n  sessionId: session.sessionId,\n  pattern: \"Enter password:\"\n});\n\nawait console_send_input({\n  sessionId: session.sessionId,\n  input: \"mypassword\\n\"\n});\n\n// Run SQL commands\nawait console_send_input({\n  sessionId: session.sessionId,\n  input: \"SHOW DATABASES;\\n\"\n});\n```\n\n## Error Detection Patterns\n\nThe server includes built-in patterns for detecting common error types:\n\n- Generic errors (error:, ERROR:, Error:)\n- Exceptions (Exception:, exception)\n- Warnings (Warning:, WARNING:)\n- Fatal errors\n- Failed operations\n- Permission/access denied\n- Timeouts\n- Stack traces (Python, Java, Node.js)\n- Compilation errors\n- Syntax errors\n- Memory errors\n- Connection errors\n\n## Development\n\n### Building from source\n```bash\nnpm install\nnpm run build\n```\n\n### Running in development mode\n```bash\nnpm run dev\n```\n\n### Running tests\n```bash\nnpm test\n```\n\n### Type checking\n```bash\nnpm run typecheck\n```\n\n### Linting\n```bash\nnpm run lint\n```\n\n## Architecture\n\nThe server is built with:\n- **Node child processes and ssh2**: For local command execution and SSH sessions\n- **@modelcontextprotocol/sdk**: MCP protocol implementation\n- **TypeScript**: For type safety and better developer experience\n- **Winston**: For structured logging\n\n### Core Components\n\n1. **ConsoleManager**: Manages terminal sessions, input/output, and lifecycle\n2. **ErrorDetector**: Analyzes output for errors and exceptions\n3. **MCP Server**: Exposes console functionality through MCP tools\n4. **Session Management**: Handles multiple concurrent console sessions\n\n## Requirements\n\n- Node.js >= 18.0.0\n- Windows, macOS, or Linux operating system\n- Optional serial-port integrations can require platform build tools.\n\n## Testing\n\nRun static validation, the build, MCP smoke tests, and the test suite:\n```bash\nnpm run lint\nnpm run typecheck\nnpm run build\nnpm run test:mcp\nnpm run test:logger\nnpm run test:installer\nnpm run test:package\nnpm test\n```\n\n## Troubleshooting\n\n### Common Issues\n\n1. **Permission denied errors**: Ensure the server has permission to spawn processes\n2. **Optional native dependency errors**: Install platform build tools only when enabling serial-port integrations\n3. **Session not responding**: Check if the command requires TTY interaction\n4. **Output not captured**: Some applications may write directly to terminal, bypassing stdout\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/AmazingFeature`)\n3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)\n4. Push to the branch (`git push origin feature/AmazingFeature`)\n5. Open a Pull Request\n\n## License\n\nMIT License - see LICENSE file for details\n\n## Support\n\nFor issues, questions, or suggestions, please open an issue on GitHub:\nhttps://github.com/ooples/mcp-console-automation/issues\n\n## Roadmap\n\n- [ ] Add support for terminal recording and playback\n- [ ] Implement session persistence and recovery\n- [ ] Add more error detection patterns for specific languages\n- [ ] Support for terminal multiplexing (tmux/screen integration)\n- [ ] Web-based terminal viewer\n- [ ] Session sharing and collaboration features\n- [ ] Performance profiling tools\n- [ ] Integration with popular CI/CD systems\n",
  "bytes": 15760,
  "sha": "800402620763876ec839f51f11c4cae7ef21fb9f5e7ffcdfc297033b8425fb6d",
  "repo_slug": "ooples/mcp-console-automation",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_ooples_mcp_console_automation_4ec86ea1/readme"
}