mcp terminal

Local 2025-08-31 23:27:48 0

A secure server for executing terminal commands within predefined paths, allowing safe interaction by Large Language Models with operating system environments.


A secure command-line interface server for the Model Context Protocol (MCP) that enables AI models to interact with your terminal while maintaining security and control.

Features

  • ? Secure command execution with configurable permissions
  • ? File system operations within allowed paths
  • ? Environment variable management
  • ? Cross-platform support (Windows, macOS, Linux)
  • ? Remote system connections support via command execution

Usage with Claude Desktop

Add the server configuration to your Claude Desktop config file:

{
  "mcpServers": {
    "terminal": {
      "command": "npx",
      "args": [
        "@dillip285/mcp-terminal",
        "--allowed-paths",
        "/path/to/allowed/directory"
      ]
    }
  }
}

Restart Claude Desktop to apply the changes. You can now use the terminal capabilities through Claude with secure file access and command execution.

Available Tools

  • execute_command: Run terminal commands securely (including SSH and remote commands)

Security

  • All operations are restricted to specified allowed paths
  • Commands are validated and sanitized before execution
  • Environment variables are carefully managed
  • Proper error handling for security-related issues

Development

# Clone the repository
git clone https://github.com/dillip285/mcp-terminal.git

# Install dependencies
npm install

# Configure npm authentication
cp .npmrc.example .npmrc
# Edit .npmrc and add your NPM_TOKEN

# Run tests
npm test

# Build the project
npm run build

Publishing

To publish the package:

  1. Copy .npmrc.example to .npmrc
  2. Add your npm authentication token to .npmrc
  3. Run npm publish --access public

Note: Never commit your .npmrc file with the authentication token. It is already added to .gitignore.

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'feat: Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

MIT License - see the LICENSE file for details.

Support

For bug reports and feature requests, please open an issue.

[
  {
    "description": "Execute a command in the local system",
    "inputSchema": {
      "properties": {
        "args": {
          "description": "Command arguments",
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "command": {
          "description": "Command to execute",
          "type": "string"
        },
        "cwd": {
          "description": "Working directory for command execution",
          "type": "string"
        }
      },
      "required": [
        "command"
      ],
      "type": "object"
    },
    "name": "execute_command"
  }
]