MCP Terminal Server
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., "@MCP Terminal Servercreate a new terminal session and run 'ls -la' to list files"
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.
π₯οΈ MCP Terminal Server
Interactive terminal sessions via Model Context Protocol (MCP)
MCP Terminal Server provides cross-platform PTY (pseudo-terminal) support for Windows, Linux, and macOS, exposing terminal sessions through both REST API and MCP protocol. Perfect for AI assistants, remote terminal access, and terminal automation.
β¨ Features
π Cross-platform: Works on Windows (cmd.exe/PowerShell), Linux, and macOS
π Real PTY: Supports interactive commands (vim, nano, htop, etc.)
ποΈ Visual Snapshots: Captures what a human would see on the terminal screen
π€ UTF-8 Support: Handles special characters and emojis correctly
π MCP Protocol: Auto-exposes all endpoints as MCP tools via fastapi-mcp
π‘ REST API: Full HTTP/REST API with FastAPI
π― Multiple Sessions: Manage multiple terminal sessions simultaneously
Related MCP server: Shell Server
π¦ Installation
From PyPI
pip install mcp-terminalFrom Source
git clone https://github.com/alejoair/mcp-terminal
cd mcp-terminal
pip install -e .π Quick Start
Start the Server
# Start on default port (8777)
mcp-terminal
# Start on custom port
mcp-terminal --port 9000
# Development mode with auto-reload
mcp-terminal --reload
# Custom host and port
mcp-terminal --host 0.0.0.0 --port 8888Access the Server
Once running, you can access:
API Documentation: http://localhost:8777/docs
MCP Endpoint: http://localhost:8777/mcp
Health Check: http://localhost:8777/health
π Usage
REST API
Create a Terminal
curl -X POST http://localhost:8777/terminals \
-H "Content-Type: application/json" \
-d '{"rows": 24, "cols": 80}'Response:
{
"success": true,
"terminal_id": "550e8400-e29b-41d4-a716-446655440000",
"message": "Terminal created successfully"
}Send Commands
curl -X POST http://localhost:8777/terminals/{terminal_id}/input \
-H "Content-Type: application/json" \
-d '{"data": "echo Hello World\n"}'Get Visual Snapshot
curl http://localhost:8777/terminals/{terminal_id}/snapshotResponse:
{
"terminal_id": "550e8400-e29b-41d4-a716-446655440000",
"display": "C:\\Users\\...\nHello World\nC:\\Users\\...> ",
"lines": ["C:\\Users\\...", "Hello World", "C:\\Users\\...> "],
"cursor": {"row": 2, "col": 15},
"size": {"rows": 24, "cols": 80},
"is_alive": true,
"created_at": "2024-01-01T00:00:00"
}List Terminals
curl http://localhost:8777/terminalsResize Terminal
curl -X PUT http://localhost:8777/terminals/{terminal_id}/resize \
-H "Content-Type: application/json" \
-d '{"rows": 30, "cols": 100}'Close Terminal
curl -X DELETE http://localhost:8777/terminals/{terminal_id}MCP Tools
When using with MCP clients (like Claude Desktop), the following tools are automatically available:
create_terminal_terminals__post- Create new terminallist_terminals_terminals__get- List active terminalsget_terminal_snapshot_terminals__terminal_id__snapshot_get- Get visual snapshotsend_terminal_input_terminals__terminal_id__input_post- Send commandsresize_terminal_terminals__terminal_id__resize_put- Resize terminalclose_terminal_terminals__terminal_id__delete- Close terminal
Python API
from mcp_terminal import TerminalManager
# Create manager
manager = TerminalManager()
# Create terminal
terminal_id = await manager.create(rows=24, cols=80)
# Send input
await manager.send_input(terminal_id, "echo Hello\n")
# Get snapshot
snapshot = await manager.get_snapshot(terminal_id)
print(snapshot["display"])
# Close terminal
await manager.close(terminal_id)ποΈ Architecture
src/mcp_terminal/
βββ __init__.py # Package initialization
βββ __main__.py # CLI entry point
βββ server.py # FastAPI application with MCP integration
βββ core/
β βββ terminal/
β βββ session.py # TerminalSession - PTY management
β βββ buffer.py # TerminalBuffer - Visual screen capture
β βββ manager.py # TerminalManager - Multi-session coordinator
βββ models/
βββ terminal.py # Pydantic models for APIπ§ Configuration
Command Line Options
--host HOST Host to bind to (default: 127.0.0.1)
--port PORT Port to bind to (default: 8777)
--reload Enable auto-reload for development
--log-level LEVEL Set log level (debug, info, warning, error, critical)
--version Show version and exitEnvironment Variables
You can also configure via environment variables:
export MCP_TERMINAL_HOST=0.0.0.0
export MCP_TERMINAL_PORT=9000
export MCP_TERMINAL_LOG_LEVEL=debugπ§ͺ Testing
# Install dev dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Run with coverage
pytest --cov=mcp_terminalπ€ Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Fork the repository
Create your feature branch (
git checkout -b feature/amazing-feature)Commit your changes (
git commit -m 'Add amazing feature')Push to the branch (
git push origin feature/amazing-feature)Open a Pull Request
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π Acknowledgments
Built with FastAPI
Uses terminado for cross-platform PTY support
Uses pyte for terminal emulation
MCP integration via fastapi-mcp
π Resources
π Bug Reports
If you find a bug, please open an issue on GitHub.
π¬ Support
For questions and support, please use GitHub Discussions.
Made with β€οΈ by the MCP Terminal team
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
- Alicense-qualityDmaintenanceEnables AI agents to interact with terminal environments through multiple concurrent PTY sessions. Supports cross-platform terminal operations including command execution, session management, and real-time communication.Last updated443MIT
- 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.Last updated1
- Alicense-qualityCmaintenanceProvides AI agents with fully interactive terminal sessions, including TUI support, keyboard control, and screen capture across Windows, Linux, and Mac.Last updatedMIT
- Alicense-qualityBmaintenanceExposes an interactive terminal over MCP, enabling remote shell command execution, file operations, and directory management via ChatGPT or Claude Desktop.Last updated1MIT
Related MCP Connectors
OCR, transcription, file extraction, and image generation for AI agents via MCP.
MCP connector that lets ChatGPT list, search, and run your Apple Shortcuts via a local Mac agent
Your memory, everywhere AI goes. Build knowledge once, access it via MCP anywhere.
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/alejoair/mcp-terminal'
If you have feedback or need assistance with the MCP directory API, please join our Discord server