Terminal MCP Server
Smart terminal session management for AI assistants. Solve terminal blocking issues with async execution, auto cleanup, and real-time web monitoring.
Support up to 64 concurrent terminals with intelligent idle detection, system monitoring, and auto browser opening.
✨ Key Features
- 🚀 Async Execution - Commands never block AI operations
- 🔢 Multi-Terminal - Up to 64 concurrent sessions
- 🧹 Auto Cleanup - Intelligent idle session detection
- ⚡ Broadcast - Execute commands across multiple terminals
- 📊 System Monitor - Real-time CPU/Memory/GPU tracking
- 🌐 Web Interface - Auto-open browser with full terminal view
- 🖥️ Smart Shell - Auto-detect best shell (Git Bash > PowerShell > cmd)
- 🛑 Resource Control - One-click shutdown button
🚀 Quick Start
Step 1: Add MCP Configuration
Add to your Cursor MCP config:
{
"mcpServers": {
"terminal": {
"command": "uvx",
"args": ["terminal-mcp-server"]
}
}
}
Or for Node.js:
{
"mcpServers": {
"terminal": {
"command": "npx",
"args": ["-y", "@kanniganfan/terminal-mcp"]
}
}
}
Step 2: ⚠️ IMPORTANT - Add IDE Rule
To make AI always use this MCP for terminal operations, add this rule to your IDE's Project Rules or User Rules:
All terminal operations (read/write) must be proxied through the Terminal MCP.
Use MCP tools for all terminal commands instead of direct terminal access.
In Cursor:
- Settings → Rules → Add this rule
- Or in
.cursorrulesfile in your project root
Why this is important:
- ✅ Prevents AI from getting stuck in terminal
- ✅ All commands run asynchronously
- ✅ Can monitor all terminals in web interface
- ✅ Better resource management
Step 3: Restart Cursor
Step 4: Start Using
In Cursor:
Create a terminal session named "dev"
Execute "npm run dev" in dev session
Browser auto-opens → View real-time output → Monitor system resources!
📊 Web Interface
Auto-opens at http://localhost:18888
Dashboard Features
Top Panel:
- 📊 CPU Usage (real-time)
- 💾 Memory Usage (% + GB)
- 🖥️ GPU Info (Windows)
- 📈 Session Stats
- 🛑 Shutdown Server Button
Layout:
- Left: Terminal session list
- Right: Full-screen xterm.js terminal (click to expand)
- Bottom: Command input
Actions
- Click session → Full terminal expands
- Type commands → Real-time execution
- Click 🛑 → Shutdown all sessions + release port
🛠️ Available MCP Tools
| Tool | Description |
|---|---|
create_session |
Create new terminal session |
execute_command |
Execute command (async, non-blocking) |
broadcast_command |
Execute across multiple terminals |
get_all_sessions |
List all sessions |
get_session_status |
Get session status |
get_output |
Get terminal output |
kill_session |
Terminate session |
cleanup_idle_sessions |
Clean idle sessions |
get_stats |
Get statistics |
⚙️ Configuration
Edit config.json:
{
"max_sessions": 64,
"idle_timeout": 300,
"auto_cleanup_interval": 60,
"max_output_lines": 10000,
"web_port": 18888,
"auto_open_browser": true
}
🖥️ Smart Shell Detection
Windows Priority:
- Git Bash (
C:\Program Files\Git\bin\bash.exe) - PowerShell 7 / Windows PowerShell
- cmd.exe (fallback)
Linux/Mac: Uses $SHELL environment variable
📁 Project Structure
terminal-mcp/
├── src/terminal_mcp_server/
│ ├── server.py # Core MCP server (all-in-one)
│ └── config.json # Default configuration
├── config.json # User configuration
├── mcp_config_example.json # Cursor config template
├── requirements.txt # Dependencies
└── README.md # This file
🎯 Use Cases
Development Workflow
1. Create "frontend" → npm run dev
2. Create "backend" → python manage.py runserver
3. Create "database" → docker-compose up
4. Monitor all in web interface
5. Click any terminal to view full output
Batch Operations
1. Create 5 sessions
2. Broadcast "git status" to all
3. View results in web interface
Long-running Tasks
1. Create session
2. Execute "npm run build"
3. AI continues other work
4. Check output anytime in browser
🛑 Resource Management
When switching IDEs or done working:
- Open web interface
- Click 🛑 Shutdown Server button
- All sessions terminated
- Port 18888 released
- Process fully exits
No more port conflicts or resource leaks!
📦 Installation
Python Users (PyPI)
{
"mcpServers": {
"terminal": {
"command": "uvx",
"args": ["terminal-mcp-server"]
}
}
}
Node.js Users (npm)
{
"mcpServers": {
"terminal": {
"command": "npx",
"args": ["-y", "@kanniganfan/terminal-mcp"]
}
}
}
Or install globally first:
npm install -g @kanniganfan/terminal-mcp
Then use:
{
"mcpServers": {
"terminal": {
"command": "terminal-mcp"
}
}
}
No download, no install, just works!
🔧 Troubleshooting
Web Interface Not Opening
Solution: Manually visit http://localhost:18888
Port Already in Use
Solution:
- Change
web_portin config.json - Or click shutdown button in existing web interface
Shell Not Detected
Solution: Check that Git Bash/PowerShell is installed
📄 License
MIT License - see LICENSE file
🤝 Contributing
Contributions welcome! See CONTRIBUTING.md
🌟 Star History
If this helps you, please give it a star! ⭐
Made with ❤️ for AI Assistants | Report Issues
Metadata
Release files for terminal-mcp-server 1.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| terminal_mcp_server-1.1.6.tar.gz | 20.4 kB | Without provenance | Details for terminal_mcp_server-1.1.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| terminal_mcp_server-1.1.6-py3-none-any.whl | Python 3 | none | any | Details for terminal_mcp_server-1.1.6-py3-none-any.whl |
Total release size: 37.1 kB
Release files / terminal_mcp_server-1.1.6.tar.gz
| Download URL | terminal_mcp_server-1.1.6.tar.gz |
|---|---|
| Size | 20.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ca8c5c5f380833a8302ebdd3e45e6115c3f13ee886e6f37dc83945979bc575cf
|
|
BLAKE2b-256 checksum How to use checksums |
6ef2f7e7e9faf31a33c2464dc4af45927ffff96e3dd271be2f6da015dd10bb18
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.0
|
Release files / terminal_mcp_server-1.1.6-py3-none-any.whl
| Download URL | terminal_mcp_server-1.1.6-py3-none-any.whl |
|---|---|
| Size | 16.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c49b5a7423cdeffaec0323795c9764298b68dd8bd12295bf73d671eda0832d67
|
|
BLAKE2b-256 checksum How to use checksums |
4c43e836bc258c86ee422312a4f63098477c5be8f291600756fd1fb8987e121d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.0
|
Security for terminal-mcp-server 1.1.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.