Terminal MCP Server
Enables safe execution of terminal commands across different shells (bash, cmd, PowerShell) with configurable timeouts, working directories, and resource limits for command-line operations through AI assistants.
README
MCP Terminal Server (Python)
MCP Terminal Server — это сервер для выполнения терминальных команд через протокол Model Context Protocol (MCP), интегрируемый с Cursor AI. Проект предоставляет инструменты для безопасного и гибкого запуска команд в различных оболочках (bash, cmd, PowerShell) с поддержкой ограничений и метрик.
Возможности
- Поддерживаемые оболочки: PowerShell (по умолчанию на Windows), cmd, bash
- Параметры:
command— команда для выполненияshell— оболочка (опционально)cwd— рабочая директория (опционально)timeout_seconds— таймаут выполнения (опционально)
- Транспорт MCP: stdio
- Метрики и ограничения:
- Максимальный размер stdout/stderr
- Ограничение длины команды
- Ограничение числа одновременных процессов
- Грейс-период для завершения процессов
Быстрый старт
1. Клонирование и установка зависимостей
python -m venv .venv
source .venv/bin/activate # Linux/macOS
# или .venv\Scripts\activate # Windows PowerShell
pip install -r requirements.txt
2. Конфигурация Cursor
Создайте файл .cursor/mcp.json в корне TMCP:
{
"mcpServers": {
"terminal-mcp": {
"command": "python",
"args": ["-m", "TMCP.mcp_terminal.server"]
}
}
}
Cursor автоматически запустит MCP сервер через stdio.
3. Запуск вручную (для отладки)
python -m TMCP.mcp_terminal.server
Использование
После запуска сервера инструмент run_command будет доступен в Cursor.
Примеры вызова
- PowerShell (по умолчанию на Windows):
command:Get-ChildItem
- Через cmd:
shell:cmdcommand:dir
- С указанием рабочей папки и таймаута:
cwd:C:\CursorProjects\TMCPtimeout_seconds:60
Структура проекта
TMCP/
├── mcp_terminal/
│ ├── __init__.py
│ └── server.py # Основная логика MCP сервера
├── scripts/
│ └── test_terminal_mcp.py # Пример теста клиента
├── .cursor/
│ └── mcp.json # Пример конфигурации для Cursor
├── requirements.txt
├── README.md
└── __init__.py
Для разработчиков
- Код сервера написан на Python 3.8+
- Для тестирования используйте скрипты из папки
scripts/ - Для расширения функционала добавляйте новые инструменты через декоратор
@server.tool - Метрики и кастомные маршруты реализованы для мониторинга и интеграции
Безопасность
- Не передавайте неподтверждённые команды — сервер выполняет любые команды, полученные через MCP.
- Запускайте сервер без повышенных прав (не от root/Administrator).
- Используйте переменные окружения для ограничения разрешённых оболочек, директорий и таймаутов.
Лицензия
MIT License
Контакты и поддержка
Автор: magadsm Вопросы и предложения: через GitHub Issues
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.