Enhanced iTerm MCP Server
Provides advanced iTerm2 terminal automation using Python API integration, enabling AI assistants to create and manage terminal sessions, split panes, execute commands, broadcast to multiple panes, and monitor terminal state in real-time.
README
🚀 Enhanced iTerm MCP Server
Advanced iTerm2 automation with Python API integration - The ultimate terminal control solution for AI assistants.
⚡ Now with native Python API - Direct iTerm2 integration for maximum reliability and performance
⚡ Quick Start
1. Installation
Via NPM (Recommended) - Now Available!
npm install -g enhanced-iterm-mcp-server
🎉 Just Published! The package is now available on NPM registry for easy installation.
From Source
git clone https://github.com/2black0/enhanced-iterm-mcp-server.git
cd enhanced-iterm-mcp-server
npm install
./setup-python-api.sh
npm run build
2. Enable iTerm2 Python API
- Open iTerm2 → Preferences (⌘,)
- Go to General → Magic
- Check "Enable Python API"
- Restart iTerm2
3. Add to MCP Configuration
{
"mcpServers": {
"enhanced-iterm": {
"command": "node",
"args": ["/path/to/enhanced-iterm-mcp-server/dist/index-python-api.js"],
"type": "stdio"
}
}
}
4. Test Setup
# If installed globally
enhanced-iterm-mcp test
# If installed from source
npm test
📦 Installation Methods
Global Installation (NPM)
# Install globally
npm install -g enhanced-iterm-mcp-server
# Use anywhere
enhanced-iterm-mcp --help
# Configuration path for Claude Desktop
# ~/.npm/lib/node_modules/enhanced-iterm-mcp-server/dist/index-python-api.js
✅ Package is now live on NPM! Install with
npm install -g enhanced-iterm-mcp-server
Local Project Installation
# Install in project
npm install enhanced-iterm-mcp-server
# Use with npx
npx enhanced-iterm-mcp --help
# Configuration for Claude Desktop
# /path/to/project/node_modules/enhanced-iterm-mcp-server/dist/index-python-api.js
Direct Usage (NPX)
# Use without installation
npx enhanced-iterm-mcp-server --help
# Claude Desktop configuration
{
"mcpServers": {
"enhanced-iterm": {
"command": "npx",
"args": ["enhanced-iterm-mcp-server"],
"type": "stdio"
}
}
}
🚀 Live on NPM Registry: https://www.npmjs.com/package/enhanced-iterm-mcp-server
🛠 Available Tools
Terminal Management
open-terminal- Create new terminals with profiles and commandslist-all-sessions- Complete overview of all iTerm2 windows/tabs/sessions
Advanced Pane Operations
split-terminal-horizontal/split-terminal-vertical- Split panes with profile supportexecute-command-in-pane- Execute commands in specific panesbroadcast-input- Send commands to multiple panes simultaneously
Real-time Information
get-session-info- Basic session information and statusget-session-details- Comprehensive session details with all variablesmonitor-session- Monitor session changes over time
Visual Customization
set-tab-color- Set tab colors (named colors or hex codes)
Legacy Compatibility
list-panes- List tracked panesget-terminal-state- Terminal state overview
🎯 Key Features
🐍 Python API Integration
- Direct access to iTerm2's native Python API
- Real-time session variable monitoring
- Robust error handling with automatic retries
- No AppleScript limitations
📊 Advanced Automation
- Multi-pane broadcasting for simultaneous commands
- Profile-based terminal creation with custom configurations
- Real-time session monitoring with 10+ variables
- Visual customization with tab coloring
🔧 Production Ready
- Comprehensive error handling and logging
- Timeout protection for all operations
- Virtual environment isolation
- Clean TypeScript implementation
📖 Usage Examples
Create and Split Terminals
// Open new terminal
await callTool("open-terminal", {
command: "htop",
workingDirectory: "/Users/username/projects"
})
// Split horizontally with profile
await callTool("split-terminal-horizontal", {
profile: "Development",
command: "npm run dev"
})
Multi-pane Operations
// Broadcast command to multiple panes
await callTool("broadcast-input", {
paneIds: ["session-1", "session-2", "session-3"],
command: "git status"
})
// Monitor session changes
await callTool("monitor-session", {
paneId: "session-1",
duration: 30
})
Real-time Information
// Get comprehensive session details
await callTool("get-session-details", {
sessionId: "213D676B-19F7-42A4-9E34-B2B81D40105B"
})
// List all active sessions
await callTool("list-all-sessions", {})
🔧 Development
Build & Run
npm run build # Build TypeScript
npm start # Run production
npm run dev # Development mode
Testing
npm test # Test tool listing
npm run test-sessions # Test session access
🚨 Troubleshooting
"Python API not enabled"
- Enable in iTerm2 Preferences → General → Magic → Python API
- Restart iTerm2 after enabling
"Connection error"
- Ensure iTerm2 is running
- Check Python virtual environment:
source iterm_env/bin/activate - Verify iterm2 package:
pip list | grep iterm2
"Session not found"
- Use
list-all-sessionsto get valid session IDs - Session IDs change when sessions are closed/reopened
📄 License
ISC License
🙏 Built With
- Model Context Protocol SDK
- iTerm2 Python API
- TypeScript + Node.js
🎯 The Ultimate iTerm2 Automation Solution for AI Assistants
🤝 Contributing
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
Quick Start for Contributors
git clone https://github.com/2black0/enhanced-iterm-mcp-server.git
cd enhanced-iterm-mcp-server
npm install
./setup-python-api.sh
npm run dev
📜 Changelog
See CHANGELOG.md for detailed version history.
🙏 Acknowledgments
- Model Context Protocol by Anthropic
- iTerm2 Python API by George Nachman
- TypeScript community for excellent tooling
⭐ Support
If this project helps you, please consider:
- ⭐ Starring the repository
- 🐛 Reporting issues
- 🔧 Contributing improvements
- 📢 Sharing with others
Built with ❤️ for the AI automation community
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。