home / mcp / terminal mcp server

Terminal MCP Server

Provides terminal access with restricted directory access for Claude to interact with specified filesystem paths.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "aithelab-mcp-terminal-use": {
      "command": "node",
      "args": [
        "${HOME}/path/to/mcp-terminal-use/dist/index.js"
      ],
      "env": {
        "ALLOWED_DIRECTORY": "${HOME}/your/allowed/directory"
      }
    }
  }
}

This MCP server enables terminal access so Claude can interact with specified directories on your system, providing controlled command execution and file access within a defined space.

How to use

You run a local MCP client that connects to the terminal MCP server to gain interactive shell access within the permitted directory. Start the server with the configured command, then connect from your client using the MCP protocol. Once connected, you can run terminal commands that operate only in the allowed directory, helping you manage files and run scripts directly through Claude’s terminal interface.

Optional security and configuration are handled through environment variables. Specifically, you set ALLOWED_DIRECTORY to restrict where Claude can access and modify files. You can supply this via a .env file, your system environment, or your client configuration.

How to install

Prerequisites you need before starting: Node.js installed on your system. You should have a defined directory that Claude is allowed to access.

Option A: Use a local configuration file to run the MCP server. Create or update your claude_desktop_config.json with the terminal MCP server entry shown below. Then start your client as usual to connect to the MCP server.

{
  "mcpServers": {
    "terminal": {
      "command": "node",
      "args": [
        "${HOME}/path/to/mcp-terminal-use/dist/index.js"
      ],
      "env": {
        "ALLOWED_DIRECTORY": "${HOME}/your/allowed/directory"
      }
    }
  }
}

Additional sections

Configuration notes: The server uses the ALLOWED_DIRECTORY environment variable to define the root directory Claude may access. You can place this variable in a .env file at project root, set it in your system environment, or include it in claude_desktop_config.json as shown in the configuration example.

Example configuration snippet for claude_desktop_config.json is provided to show how to wire the MCP server into Claude Desktop. This snippet sets the allowed directory and points to the runtime script.