{"id":48270453,"url":"https://github.com/atman-33/mcp-terminal-runner","last_synced_at":"2026-04-04T22:12:07.251Z","repository":{"id":330153776,"uuid":"1120085803","full_name":"atman-33/mcp-terminal-runner","owner":"atman-33","description":"A secure MCP server enabling AI agents to execute terminal commands with strict allowlist controls.","archived":false,"fork":false,"pushed_at":"2026-01-10T08:01:09.000Z","size":191,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-13T08:40:02.622Z","etag":null,"topics":["mcp","mcp-server","shell","terminal"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/mcp-terminal-runner","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/atman-33.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2025-12-20T13:09:00.000Z","updated_at":"2026-01-10T08:01:13.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/atman-33/mcp-terminal-runner","commit_stats":null,"previous_names":["atman-33/mcp-terminal-runner"],"tags_count":8,"template":false,"template_full_name":"atman-33/mcp-ts-minimal","purl":"pkg:github/atman-33/mcp-terminal-runner","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atman-33%2Fmcp-terminal-runner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atman-33%2Fmcp-terminal-runner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atman-33%2Fmcp-terminal-runner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atman-33%2Fmcp-terminal-runner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/atman-33","download_url":"https://codeload.github.com/atman-33/mcp-terminal-runner/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atman-33%2Fmcp-terminal-runner/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31416761,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T20:09:54.854Z","status":"ssl_error","status_checked_at":"2026-04-04T20:09:44.350Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mcp","mcp-server","shell","terminal"],"created_at":"2026-04-04T22:12:06.627Z","updated_at":"2026-04-04T22:12:07.242Z","avatar_url":"https://github.com/atman-33.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MCP Terminal Runner\n\nAn MCP server that allows AI agents to execute terminal commands on the host system.\n\n## Features\n\n- **Execute Command**: Run shell commands and retrieve stdout, stderr, and exit code. Supports pipes, redirects, and command chaining (e.g., `\u0026\u0026`).\n- **Execute Process (argv)**: Run a program with argv-style inputs (no shell parsing). Useful for passing large/multiline arguments safely.\n- **Security**: Strict allowlist system via `ALLOWED_COMMANDS` environment variable.\n- **Timeouts**: Commands have a default timeout (30,000ms) to prevent hanging indefinitely.\n- **Cross-Platform**: Works on Linux, macOS, and Windows.\n\n## Prerequisites\n\n- Node.js (version 18 or higher)\n\n## Configuration\n\n### Security: Allowed Commands\n\nFor security reasons, this server requires an explicit list of allowed commands. This is configured via the `ALLOWED_COMMANDS` environment variable.\n\n- **Format**: Comma-separated list of command binaries (e.g., `ls,cat,echo`).\n- **Wildcard**: Set to `*` to allow ALL commands (⚠️ **DANGEROUS**: Only use in trusted environments).\n- **Validation**: The server validates only the **first command** in the chain against the allowlist. For example, in `echo hello \u0026\u0026 ls`, only `echo` is checked.\n\n### Security (Optional): Allowed Working Directory Roots\n\nYou can optionally restrict which working directories are allowed via `ALLOWED_CWD_ROOTS`.\n\n- **Format**: Comma-separated list of allowed root paths.\n- **Behavior**:\n  - If **unset or empty**, `cwd` is not restricted (any existing directory is allowed).\n  - If set, the resolved and canonical `cwd` must be within at least one configured root.\n  - If set and any configured root cannot be canonicalized (e.g., does not exist), requests that provide `cwd` are rejected (configuration error).\n\n## Usage\n\n### MCP Client Configuration\n\nAdd the following to your MCP client configuration (e.g., VS Code `settings.json`):\n\n#### Basic Configuration\n\n```json\n{\n  \"mcpServers\": {\n    \"terminal-runner\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"mcp-terminal-runner\"],\n      \"env\": {\n        \"ALLOWED_COMMANDS\": \"ls,cat,grep,echo\"\n      }\n    }\n  }\n}\n```\n\n#### Configuration with Allowed Working Directories\n\n```json\n{\n  \"mcpServers\": {\n    \"terminal-runner\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"mcp-terminal-runner\"],\n      \"env\": {\n        \"ALLOWED_COMMANDS\": \"ls,cat,grep,echo\",\n        \"ALLOWED_CWD_ROOTS\": \"/home/user/projects,/tmp\"\n      }\n    }\n  }\n}\n```\n\n### Available Tools\n\n#### `execute_command`\nExecute a shell command. Note: This tool is for non-interactive, short-lived commands only. Interactive commands are not supported.\n\n- **Input**:\n  - `command` (string): The shell command to execute.\n  - `cwd` (string): The working directory to execute the command within.\n  - `input` (string, optional): Optional input to write to stdin. Useful for commands that require user interaction.\n  - `timeout_ms` (number, optional): Timeout in milliseconds. Defaults to 30,000ms. Max 600,000ms.\n- **Output**:\n  - Returns a YAML-formatted string containing:\n    - `exit_code`: The command's exit code.\n    - `stdout`: Standard output.\n    - `stderr`: Standard error.\n\nOn timeout, the tool returns `isError: true` and includes a timeout message.\n\n#### `execute_process`\nExecute a program using argv-style inputs (non-shell). Note: This tool is for non-interactive, short-lived commands only. Interactive commands are not supported.\n\nThis tool is recommended when you need to pass large or multiline arguments (e.g., `--content` with newlines) without dealing with shell quoting.\n\n- **Input**:\n  - `file` (string): The program to execute (e.g., `python3`).\n  - `args` (string[], optional): argv arguments to pass to the program.\n  - `cwd` (string): The working directory to execute the command within.\n  - `input` (string, optional): Optional input to write to stdin.\n  - `timeout_ms` (number, optional): Timeout in milliseconds. Defaults to 30,000ms. Max 600,000ms.\n- **Output**:\n  - Returns a YAML-formatted string containing:\n    - `exit_code`: The command's exit code.\n    - `stdout`: Standard output.\n    - `stderr`: Standard error.\n\n## Development\n\n### Setup\n\n1. Clone the repository:\n```bash\ngit clone \u003crepository-url\u003e\ncd mcp-terminal-runner\n```\n\n2. Install dependencies:\n```bash\nnpm install\n```\n\n3. Build the project:\n```bash\nnpm run build\n```\n\n### Available Scripts\n\n- `npm run build` - Build the TypeScript project\n- `npm run dev` - Run in development mode\n- `npm start` - Run the built JavaScript version\n- `npm run check` - Check code with Ultracite\n- `npm test` - Run tests with Vitest\n\n### Project Structure\n\n```\nmcp-terminal-runner/\n├── src/\n│   └── index.ts          # Main server implementation\n├── dist/                 # Built JavaScript files\n├── .husky/              # Git hooks\n├── biome.json           # Biome configuration\n├── tsconfig.json        # TypeScript configuration\n├── package.json         # Project dependencies and scripts\n└── README.md           # This file\n```\n\n## License\n\nMIT License - see LICENSE file for details.\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch\n3. Make your changes\n4. Run `npm run quality` to ensure code quality\n5. Commit your changes (Husky will run pre-commit hooks)\n6. Push to your branch\n7. Create a Pull Request\n\n## Troubleshooting\n\n### Common Issues\n\n1. **Server not starting**: Ensure all dependencies are installed and the project is built\n2. **Tools not appearing**: Check that the MCP client configuration points to the correct path\n3. **Permission errors**: Make sure the built JavaScript file has execute permissions\n\n### Debug Mode\n\nTo enable debug logging, set the environment variable:\n```bash\nDEBUG=mcp* npm start\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatman-33%2Fmcp-terminal-runner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fatman-33%2Fmcp-terminal-runner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatman-33%2Fmcp-terminal-runner/lists"}