Smart Terminal MCP
Use it as a safety-constrained local MCP workspace assistant for file/search/folder operations, allowlisted shell/git, and opt-in Python.
Execute only allowlisted
bashcommands (ls,pwd,echo, read-onlygit status/log/diff/show); shell metacharacters are rejected.Run Python code or workspace
.pyfiles only whenSMART_TERMINAL_ALLOW_PYTHON=1(not sandboxed).Find files with
globpatterns and search text withgrep.Read text files (up to 1 MB) and create/write files inside the workspace jail; README says overwrite requires
overwrite=True.Create folders and soft-delete folders into
.trash/; workspace root cannot be deleted.All file/search/git operations are confined to
SMART_TERMINAL_ROOT, with a secrets blocklist and output/time limits.Note: schema descriptions are broader than README; e.g.,
bashsounds generic but is actually allowlisted.
Provides read-only git tools (status, log, diff, show) scoped to the workspace, with risky flags like --output and --no-index blocked.
Enables execution of Python snippets and .py files from the workspace (opt-in via an environment variable, 20 s timeout); note the README states Python execution is not sandboxed.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Smart Terminal MCP list files in current directory"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
โก Published on PyPI and compatible with MCP clients that support the stdio transport.
Smart Terminal MCP
A lightweight Model Context Protocol (MCP) server built with FastMCP that lets AI assistants work with files, git and Python on your local machine, inside a protected workspace folder.
Giving an AI agent a raw terminal is risky: it could delete files, read secrets or run commands you never intended. This project explores how to expose useful local tools to MCP clients with safety nets built in.
โจ Features
List, read, write and search files (
glob,grep,read_file,write_file)Create and (softly) delete folders
Run a small allowlist of safe commands:
ls,pwd,echoand read-only git (status,log,diff,show)Run Python code and Python files (opt-in, off by default)
Every file operation is confined to one workspace folder
Works on Windows, macOS and Linux (developed and tested on Windows)
One command to run:
uvx smart_terminal_mcp
Related MCP server: local-mcp
๐ก๏ธ Security Model
Safety net | What it does |
Workspace jail | Every path is resolved to its real location ( |
Secrets blocklist |
|
No raw shell |
|
Read-only git | Only |
Limits | 20 s timeout, 20,000-character output cap, 1 MB file-size cap |
Clean environment | Launched programs only receive |
No accidental overwrite |
|
Soft delete |
|
Friendly errors | Anything blocked returns a readable |
Python is opt-in |
|
โ ๏ธ Important limitation
The folder jail protects the file, search and git tools. Python execution is not sandboxed: when enabled, Python code can access anything your user account can. Enable it only with agents you trust, or run the server inside Docker (on the roadmap).
๐ฆ Installation
Using uv (Recommended)
Run it directly without installing:
uvx smart_terminal_mcpOr add it to a project:
uv add smart_terminal_mcpUsing pip
pip install smart_terminal_mcp๐ MCP Server Configuration
You need an MCP client (Claude Desktop, Claude Code, Cursor, VS Code, Codex, or your own LangGraph app) and uv installed.
Claude Desktop / Cursor style
{
"mcpServers": {
"smart_terminal": {
"command": "uvx",
"args": ["smart_terminal_mcp"],
"env": {
"SMART_TERMINAL_ROOT": "C:\\Users\\me\\projects\\my-app"
}
}
}
}LangChain MCP adapters style
{
"smart_terminal": {
"transport": "stdio",
"command": "uvx",
"args": ["smart_terminal_mcp"],
"env": {
"SMART_TERMINAL_ROOT": "/path/to/workspace"
}
}
}Claude Code
claude mcp add smart_terminal -- uvx smart_terminal_mcpSettings (environment variables)
Variable | Default | Meaning |
| current folder | The workspace folder every tool is confined to. Set this explicitly. |
| off | Set to |
๐ Available Tools
Tool | Description |
| Run one allowlisted command: |
| Run a Python snippet (opt-in, 20 s timeout) |
| Run a |
| Read a text file in the workspace (max 1 MB) |
| Create a file; overwrites only with |
| List files matching a pattern such as |
| Search for text inside a file |
| Create a folder in the workspace |
| Move a folder to |
๐ How It Works
LLM โ MCP client (Claude, Cursor, ...) โ smart_terminal_mcp โ workspace folder
(cloud) (on your computer) (started by uvx, stdio) (your files and git)Your MCP client starts the server with
uvx smart_terminal_mcp.The LLM asks the client to call a tool; the client forwards it over stdio.
The server validates the request (path jail, allowlist, limits) and only then runs it.
The result, or a
Blocked/Errormessage, goes back to the LLM.
The server runs entirely on your own machine. Nothing is hosted.
๐งช Testing
uv run python test.pyOr open the MCP Inspector against the server:
npx @modelcontextprotocol/inspector uv run smart_terminal_mcpThings worth trying: ls; whoami (blocked), reading ../anything (blocked), reading .env (blocked), writing to an existing file without overwrite=True (refused).
๐ Project Structure
smart_terminal_mcp/
โ
โโโ src/
โ โโโ smart_terminal_mcp/
โ โโโ main.py
โ โโโ tools.py
โ
โโโ test.py
โโโ pyproject.toml
โโโ README.md
โโโ LICENSE๐ฏ Motivation
The goal of this project was to gain hands-on experience with the Model Context Protocol (MCP) by building a practical server, and to learn why safety design matters when AI agents can touch a real machine.
It helped me understand:
MCP architecture and the stdio transport
Tool registration with FastMCP
Path traversal and why paths must be resolved before checking
Why raw
shell=Trueis dangerous, and allowlisting as an alternativePython packaging and PyPI publishing
Honest threat modelling: what a safeguard does and does not protect
๐ฎ Roadmap
Docker mode for a true sandbox (including Python execution)
delete_file,edit_file(partial edits),moveandcopyoperationsMore read-only commands and richer
lsoptionsGit actions with explicit approval (add, commit)
Tool execution audit log
More testing on macOS and Linux
โ ๏ธ Disclaimer
This project is intended for educational and development purposes. Even with the safety nets above, only connect it to agents and clients you trust, and point SMART_TERMINAL_ROOT at a dedicated project folder, never at your home directory or system folders.
๐ License
MIT License
๐จโ๐ป Author
Mohd Bilal
If you found this project interesting, feel free to star the repository.
Available Tools
9 toolsbashC
This function will execute a bash command and return the output. This function is useful for executing bash commands including creating files, directories, and other bash commands.
Inputs: command (required).
create_folderB
This function will create a folder with the given name. If the folder already exists, it will return a message indicating that the folder already exists.
Inputs: folder (required).
delete_folderA
This function will delete a folder with the given name. If the folder does not exist, it will return a message indicating that the folder does not exist.
Inputs: folder (required).
globB
This function will return a list of files that match the given pattern. This function is useful for finding files in a directory.
Inputs: pattern (required).
grepB
This function will search for the given pattern in the specified file and return the matching lines.
Inputs: file (required), pattern (required).
python_codeB
This function will execute a python code and return the output.
Inputs: code (required).
python_fileB
This function will execute a python file and return the output.
Inputs: file (required).
read_fileB
This function will read the contents of a file and return it as a string.
Inputs: file (required).
write_fileA
This function will write the given content to a file. If the file does not exist, it will be created.
Inputs: file (required), content (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogโฆ
TDQS
Scored across 9 tools
Most tools have distinct purposes, but 'bash' overlaps with many others (can create files/folders, run python), and 'python_code' vs 'python_file' are similar. Descriptions help, but boundaries are somewhat blurry.
All names use lowercase with underscores, but the pattern is mixed: 'read_file' and 'create_folder' follow verb_noun, while 'bash', 'python_code', 'glob', and 'grep' do not. Consistent style, but not a uniform convention.
9 tools is a well-scoped set for a terminal/file manipulation server, covering core operations without being excessive or too sparse.
The domain is file and terminal operations, and the set covers read/write, directory create/delete, glob, grep, and execution via bash/python. Missing a direct delete_file or list_directory, but bash can handle those, so gaps are minor and workable.
Related MCP Connectors
MCP server for AI dialogue using various LLM models via AceDataCloud
Nifty's MCP server โ exposes tasks, projects, messages, and files as tools for AI agents.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yoโฆ
MCP server that lets your AI assistant build and deploy apps, hosting each one at a live URL.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA MCP server for Windows/Linux that provides 90+ tools enabling AI assistants to systematically manage local systems, including system probing, command execution, file editing, network diagnostics, and more.13MIT
- AlicenseNot gradedqualityDmaintenanceA lightweight, stdio-based MCP server enabling AI assistants to perform local file system operations like reading, writing, searching, and executing commands.5,159 npmMIT
- FlicenseAqualityDmaintenanceA simple MCP server that exposes a terminal tool, allowing AI agents to execute shell commands.1-
- AlicenseAqualityDmaintenanceA secure local MCP server that provides AI assistants controlled filesystem access and command execution with an interactive approval system for dangerous actions.1711 npmMIT