terminal-mcp
An agent-capable MCP server with terminal access, filesystem control, and persistent memory. It includes sandboxing, access control, activity logging, and a file-backed memory store for context across conversations.
README
terminal-mcp
An agent-capable MCP server with terminal access, filesystem control, and persistent memory. Built-in sandboxing, access control, activity logging, and a file-backed memory store — so Claude can run commands, manage files, and remember context across conversations.
What it does
terminal-mcp provides 10 tools across two categories:
Terminal Tools
| Tool | Access Scope | Description |
|---|---|---|
run_command |
Full ROOT_DIR | Execute shell commands with dangerous-command blocking |
read_file |
Allowed dirs only | Read files from whitelisted paths |
write_file |
Allowed dirs only | Write/overwrite files in whitelisted paths |
list_files |
Full ROOT_DIR | Browse directory contents (recursive supported) |
run_workflow |
Full ROOT_DIR | Named workflows: npm_install, npm_run, python_run, shell_script |
Memory Tools
| Tool | Description |
|---|---|
memory_store |
Save a memory with name, type, tags, and content |
memory_recall |
Retrieve a specific memory by name |
memory_search |
Search all memories by keyword and/or type |
memory_delete |
Remove a memory |
memory_list |
List all stored memories (returns the MEMORY.md index) |
Memory System
The memory system gives Claude persistent context that survives across conversations. Memories are stored as individual markdown files with YAML frontmatter inside claude_playground/memory/, with an auto-maintained MEMORY.md index.
Memory Types
| Type | Purpose | Example |
|---|---|---|
user |
Who the user is, their preferences, expertise | "Senior backend engineer, prefers Go" |
feedback |
How to approach work (corrections + confirmations) | "Don't mock the database in integration tests" |
project |
Ongoing work context, goals, deadlines | "Auth rewrite driven by compliance, due March 15" |
reference |
Pointers to external resources | "Pipeline bugs tracked in Linear project INGEST" |
note |
General-purpose memory | Anything that doesn't fit above |
How it works
claude_playground/
└── memory/
├── MEMORY.md # Auto-generated index (grouped by type)
├── user_role.md # Individual memory files
├── feedback_testing.md
├── project_auth_rewrite.md
└── ...
Each memory file looks like:
---
name: testing preferences
type: feedback
tags: [testing, database]
created: 2025-01-15T14:30:00
updated: 2025-01-20T09:15:00
---
Integration tests must hit a real database, not mocks.
**Why:** Prior incident where mock/prod divergence masked a broken migration.
**How to apply:** Any test touching the data layer should use the test database.
The MEMORY.md index is automatically rebuilt whenever a memory is stored or deleted:
# Memory Index
## User
- [user role](user_role.md) — Senior backend engineer, prefers Go
## Feedback
- [testing preferences](feedback_testing.md) — Integration tests must hit a real database
Usage
Claude can use memory tools naturally in conversation:
- "Remember that I prefer concise responses with no trailing summaries"
- "What do you know about the auth rewrite?"
- "Search your memory for anything about testing"
- "Forget the note about the old API endpoint"
- "What's in your memory?"
Safety Features
- Path sandboxing —
read_fileandwrite_filerestricted to allowed directories - Dangerous command blocking —
rm -rf /,mkfs, disk overwrites, fork bombs blocked - Dynamic access control — edit
path.txtto grant access without restarting - Activity logging — every action (including memory operations) logged with timestamps
- Configurable root — restrict the entire server to a specific directory tree
Installation
pip install terminal-mcp
Or from source:
git clone https://github.com/koushikmaji/terminal-mcp.git
cd terminal-mcp
pip install -e .
Setup
Configure Claude Desktop
{
"mcpServers": {
"terminal": {
"command": "terminal-mcp"
}
}
}
To restrict the root directory:
{
"mcpServers": {
"terminal": {
"command": "terminal-mcp",
"env": {
"TERMINAL_MCP_ROOT": "/Users/you/projects"
}
}
}
}
Granting File Access
By default, read_file and write_file only work inside $ROOT/claude_playground/. To grant access to additional paths, add them to claude_playground/path.txt:
# One absolute path per line
/Users/you/projects/my-app
/Users/you/Documents/notes
Changes take effect immediately — no restart needed.
Environment Variables
| Variable | Default | Description |
|---|---|---|
TERMINAL_MCP_ROOT |
$HOME |
Base directory for all operations |
TERMINAL_MCP_PLAYGROUND |
claude_playground |
Playground subdirectory name |
TERMINAL_MCP_SHELL |
/bin/zsh (macOS) or /bin/bash |
Shell for command execution |
TERMINAL_MCP_TIMEOUT |
30 |
Default command timeout (seconds) |
Architecture
run_command / list_files / run_workflow
┌─────────────────────────────────────────┐
│ Full ROOT_DIR │
│ │
│ read_file / write_file │
│ ┌──────────────────────────┐ │
│ │ claude_playground/ │ │
│ │ + paths in path.txt │ │
│ │ │ │
│ │ memory_* │ │
│ │ ┌────────────────┐ │ │
│ │ │ memory/ │ │ │
│ │ │ MEMORY.md │ │ │
│ │ │ *.md files │ │ │
│ │ └────────────────┘ │ │
│ └──────────────────────────┘ │
└─────────────────────────────────────────┘
Logging
All actions are logged to claude_playground/terminal.log:
[2025-01-15 14:32:01] [RUN] CMD: ls -la | CWD: /Users/you
[2025-01-15 14:32:05] [READ] FILE: /Users/you/projects/app/config.json
[2025-01-15 14:33:00] [MEMORY] STORE: user role (user)
[2025-01-15 14:33:10] [MEMORY] SEARCH: q=testing type=None hits=2
Requirements
- Python 3.10+
- MCP-compatible client (Claude Desktop, Claude Code, etc.)
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。