This MCP server for terminal access enables Claude to interact with specified directories on your system via the Model Context Protocol (MCP). The server provides a secure way to give Claude limited filesystem access while maintaining control over which directories it can view and modify.
To get started with the MCP terminal server, follow these steps:
Clone the repository or download the source code:
git clone https://github.com/anthropic-labs/mcp-terminal-use.git
Navigate to the project directory:
cd mcp-terminal-use
Install dependencies:
npm install
Build the project:
npm run build
You must specify which directory Claude is allowed to access. This can be done in three ways:
Using a .env
file in the project root:
ALLOWED_DIRECTORY=/path/to/your/allowed/directory
Setting environment variables in your system:
export ALLOWED_DIRECTORY=/path/to/your/allowed/directory
Configuring directly in claude_desktop_config.json
(recommended)
Add the MCP server to your Claude Desktop configuration file:
Open or create claude_desktop_config.json
(typically located in your home directory)
Add the following configuration:
{
"mcpServers": {
"terminal": {
"command": "node",
"args": [
"${HOME}/path/to/mcp-terminal-use/dist/index.js"
],
"env": {
"ALLOWED_DIRECTORY": "${HOME}/your/allowed/directory"
}
}
}
}
Replace ${HOME}/path/to/mcp-terminal-use
with the actual path to where you installed the project
Replace ${HOME}/your/allowed/directory
with the directory you want Claude to access
The server will start automatically when Claude Desktop launches. You don't need to start it manually.
Once configured, you can ask Claude to perform file operations within your allowed directory:
ALLOWED_DIRECTORY
path is correctclaude_desktop_config.json
dist
directory after running npm run build
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.