terminal-mcp
Click on "Install 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., "@terminal-mcpRun pytest."
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.
Terminal MCP
A lightweight Model Context Protocol (MCP) server providing controlled terminal access for AI agents and coding assistants.
Terminal MCP is designed to give an AI agent access to selected local command-line tools while keeping the available executables explicitly configurable.
Compatible with MCP clients such as:
LM Studio
Claude Desktop
Cursor
Windsurf
Continue
Other MCP-compatible clients
Features
Execute explicitly allowlisted executables
Configure the whitelist through CLI arguments and whitelist files
Combine multiple whitelist files
Configurable working directory
Configurable process timeout
Configurable stdout/stderr output limits
Asynchronous process execution
Windows and Linux support
MCP compliant
Related MCP server: cmd-line-mcp
Installation
Requirements
Python 3.11+
pip
Install the project:
py -m pip install -e .Or install it as a regular package when published.
Running
The server can be started directly:
terminal-mcpor:
py -m terminal_mcpWith no whitelist configured, no executable is allowed to run.
For example:
py -m terminal_mcp --whitelist py python gitallows only py, python, and git.
Command-line options
--whitelist
Adds one or more executable names directly to the whitelist:
--whitelist py python pip pytestThe option accepts multiple command names and can be followed by another --... option.
For example, both forms are valid:
terminal-mcp --timeout 60 --whitelist py python gitterminal-mcp --whitelist py python git --timeout 60The whitelist contains executable names, not complete commands or argument combinations.
--whitelist-file
Loads executable names from one or more text files:
--whitelist-file examples/whitelist-python.txtMultiple files can be supplied:
--whitelist-file examples/whitelist-python.txt examples/whitelist-python-tools.txtAll entries are merged into one whitelist.
Whitelist files use a simple one-entry-per-line format:
# Python
py
python
pip
# Testing
pytestEmpty lines are ignored. Lines beginning with # are comments.
--whitelist and --whitelist-file can also be combined. Their entries are merged.
--timeout
Sets the maximum process runtime in seconds:
--timeout 120-1 means unlimited runtime:
--timeout -1The default is:
-1--max-output-size
Sets the maximum amount of stored output per stream, in MiB:
--max-output-size 1This means up to 1 MiB of stdout and separately up to 1 MiB of stderr can be stored.
The two streams therefore have independent limits.
-1 means unlimited output. The default is:
-1MCP configuration
A minimal configuration:
{
"mcpServers": {
"terminal": {
"command": "terminal-mcp"
}
}
}A Windows configuration using Python:
{
"mcpServers": {
"terminal": {
"command": "py",
"args": [
"-m",
"terminal_mcp",
"--timeout",
"120",
"--max-output-size",
"1",
"--whitelist",
"py",
"python",
"pytest"
]
}
}
}1. Direct --whitelist
Useful for small, self-contained configurations:
{
"mcpServers": {
"terminal": {
"command": "terminal-mcp",
"args": [
"--timeout",
"120",
"--max-output-size",
"1",
"--whitelist",
"py",
"python",
"pytest",
"git"
]
}
}
}2. One whitelist file
For larger or project-specific configurations:
{
"mcpServers": {
"terminal": {
"command": "terminal-mcp",
"args": [
"--timeout",
"120",
"--max-output-size",
"1",
"--whitelist-file",
"examples/whitelist-ai-workspace.txt"
]
}
}
}The path may be relative or absolute, depending on how the MCP client starts the server.
For example:
examples/whitelist-ai-workspace.txtor:
D:/Programming Workspace/FooProject/.terminalmcp3. Multiple whitelist files
Whitelists can be composed from several files:
{
"mcpServers": {
"terminal": {
"command": "terminal-mcp",
"args": [
"--whitelist-file",
"examples/whitelist-python.txt",
"examples/whitelist-python-tools.txt"
]
}
}
}The resulting whitelist is the union of both files.
4. Combining CLI and file-based whitelists
Direct entries and file entries can be combined:
{
"mcpServers": {
"terminal": {
"command": "terminal-mcp",
"args": [
"--timeout",
"120",
"--max-output-size",
"1",
"--whitelist",
"git",
"ping",
"--whitelist-file",
"examples/whitelist-python.txt",
"examples/whitelist-python-tools.txt"
]
}
}
}This allows a small number of additional commands to be added without modifying an existing whitelist file.
5. Project-local .terminalmcp
A project can maintain its own whitelist file:
FooProject/
+-- .terminalmcp
+-- pyproject.toml
+-- src/
+-- ...For example:
# Project development tools
py
python
pytest
ruff
black
mypy
uvThe MCP configuration can then reference it:
{
"mcpServers": {
"terminal": {
"command": "terminal-mcp",
"args": [
"--whitelist-file",
"D:/Programming Workspace/FooProject/.terminalmcp"
]
}
}
}Automatic discovery of a .terminalmcp file in the current working directory is planned for a future release.
Example whitelists
The repository contains several example whitelist files in examples/:
Python development
examples/whitelist-python.txtContains the basic Python execution and package-management commands.
Python tooling
examples/whitelist-python-tools.txtContains common Python testing and code-quality tools.
AI development workstation
examples/whitelist-ai-workspace.txtContains a broader development/AI-oriented selection, including tools such as:
py
python
pip
pytest
uv
ruff
black
mypy
node
npm
npx
ping
ollama
lmsThe AI workspace example is intentionally illustrative rather than a recommended universal whitelist.
Security model
Terminal MCP uses an executable allowlist.
Before starting a process, the server extracts the executable name and checks it against the configured whitelist. Commands that are not allowlisted are rejected.
The whitelist is loaded once when the server starts. It cannot be modified through an MCP tool while the server is running.
This distinction is important:
pythonallows the executable python, but it does not restrict Python to a particular Python command or module.
Likewise:
bashallows Bash itself and therefore potentially everything that the Bash process can execute.
The same applies to powerful executables such as:
cmd
python
node
bash
powershellAllowlisting one of these should therefore be treated as granting the capabilities exposed by that executable, not as granting access to one narrowly defined operation.
The whitelist is consequently not a complete sandbox and does not attempt to understand the semantics of individual command arguments.
For example, allowing:
curldoes not mean "allow HTTP GET requests only". It allows the curl executable with whatever arguments the client supplies.
Likewise, an entry such as:
curl fetchdoes not create a restriction to the fetch subcommand. The whitelist operates on executable names, so the executable curl itself would not match that entry.
The security boundary is therefore intentionally simple:
Which executables may this MCP server launch?
More restrictive argument-level policies would require command-specific validation and are outside the scope of the current design.
Why allow redundant executables?
It can be useful to allow multiple executable names that provide essentially the same capability.
For example, both:
py
pythonmay be included.
A skill, README, generated instruction, or development guide might use:
python -m pytestwhile another uses:
py -m pytestAllowing both improves compatibility with such instructions without materially expanding the intended capability.
The same principle can apply to other platform- or environment-specific executable names.
A universal terminal MCP?
Terminal MCP is deliberately general-purpose, but a universal MCP should not necessarily replace every specialized MCP server.
A dedicated filesystem MCP, for example, can expose operations such as moving or editing files with well-defined semantics. A terminal MCP can technically perform many of the same operations through commands such as python, node, cmd, or other tools, but doing so provides a much broader capability surface.
Specialized MCP tools generally offer:
clearer semantics
more predictable parameters
narrower capabilities
easier reasoning for an AI agent
potentially stronger security boundaries
For that reason, Terminal MCP works well as a complement to specialized MCP servers rather than necessarily replacing them.
Giving an agent both a filesystem MCP and Terminal MCP is not inherently problematic. The specialized tool can be preferred for operations it explicitly supports, while Terminal MCP can provide controlled access to development tools and command-line workflows that have no dedicated MCP equivalent.
Experimental AI tooling
A particularly interesting use case is allowing local AI tooling such as:
ollama
lmsAn agent could potentially inspect available local models or start a model through commands such as:
ollama listor:
ollama run <model>This is an experimental example of how Terminal MCP could expose capabilities beyond traditional development tooling. Whether an AI agent can use such functionality effectively depends on the agent, its tool descriptions, and the surrounding MCP environment.
Working directory
Terminal MCP maintains a configurable working directory.
The directory is validated before use and must:
exist
be an actual directory
resolve to a normalized path
The working directory can also be changed through the MCP tool provided by the server.
Example prompts
Once the appropriate executables have been allowlisted, an AI agent can perform tasks such as:
Run the Python test suite.Run Ruff and Black on the project.Check which local Ollama models are available.Run the project's Node.js build.The exact capabilities available to the agent depend entirely on the configured whitelist.
Roadmap
Planned improvements include:
Automatically detect a
.terminalmcpwhitelist file in the current working directory and merge it with explicitly configured whitelists.Add support for command based argument whitelisting and blacklisting
Further refine configuration and usability based on real-world MCP client behavior.
License
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseBqualityDmaintenanceA secure MCP server for executing whitelisted shell commands with resource and timeout controls, designed for integration with Claude and other MCP-compatible LLMs.203897MIT
- AlicenseBqualityCmaintenanceA secure Model Context Protocol server that allows AI assistants to execute terminal commands with controlled directory access and command permissions. It features a robust security architecture including whitelisting, session IDs, and categorized command levels to ensure safe system interaction.8MIT
- FlicenseAqualityDmaintenanceA lightweight MCP server that provides AI assistants with access to a system's terminal through a secure terminal tool. It enables users to execute shell commands and receive stdout, stderr, and exit codes directly within an MCP-compatible client.1
- AlicenseNot gradedqualityFmaintenanceA secure MCP server for shell operations, terminal management, and process control, enabling AI assistants to safely execute commands and manage interactive sessions.1435MIT
Related MCP Connectors
MCP server for Gainium — manage trading bots, deals, and balances via AI assistants
MCP server for secureFlows: token-free URL builders and integration-linting tools for AI agents.
Security scanner for MCP servers. Detect vulnerabilities, prompt injection, and tool poisoning.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/stuck1a/terminal-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server