loading…
Search for a command to run...
loading…
A production-grade server for programmatically controlling kitty terminal instances, allowing users to launch windows, send text or key combinations, and captur
A production-grade server for programmatically controlling kitty terminal instances, allowing users to launch windows, send text or key combinations, and capture scrollback buffer content. It facilitates automation workflows and command analysis by providing remote control over the kitty terminal through the Model Context Protocol.
A production-grade MCP server for controlling kitty terminal instances
A production-grade Model Context Protocol (MCP) server for controlling kitty terminal instances.
--app-id for window identification# Install from PyPI
pip install kitty-mcp
# Install with uv (recommended)
uv add kitty-mcp
# Clone repository
git clone https://github.com/your-username/kitty-mcp.git
cd kitty-mcp
# Install with uv
uv pip install -e ".[dev]"
# Or with pip
pip install -e ".[dev]"
# Run directly
python -m kitty_mcp
# Or using the installed script
kitty-mcp
The server communicates via stdio (standard input/output) for MCP compatibility.
Create a configuration file at ~/.config/kitty-mcp/config.json:
{
"socket_dir": "/tmp/kitty-mcp",
"max_instances": 10,
"socket_permissions": "0600",
"logging": {
"level": "INFO"
},
"kitty": {
"launch_timeout": 30,
"command_timeout": 30
}
}
Configuration options:
socket_dir: Directory for Unix sockets (default: /tmp/kitty-mcp-<uid>)max_instances: Maximum concurrent instances (default: 10, max: 100)socket_permissions: Socket file permissions (default: "0600")logging.level: Log level (DEBUG, INFO, WARNING, ERROR)kitty.launch_timeout: Timeout for launching kitty (seconds)kitty.command_timeout: Timeout for RC commands (seconds)Launch a new kitty instance with remote control enabled.
Parameters:
app_id (string, required): Unique identifier for the instanceworking_directory (string, optional): Working directorywindow_class (string, optional): Window class (defaults to app_id)Returns: {"success": true, "app_id": "...", "socket_path": "...", "pid": 1234}
Send text to a kitty window.
Parameters:
app_id (string, required): Instance identifiertext (string, required): Text to sendmatch (string, optional): Window matching criteriaSend key combination to a kitty window.
Parameters:
app_id (string, required): Instance identifierkey (string, required): Key combination (e.g., "ctrl+c", "enter")match (string, optional): Window matching criteriaLaunch a new window in an existing kitty instance.
Parameters:
app_id (string, required): Instance identifiercommand (array, required): Command to runcwd (string, optional): Working directoryCapture scrollback buffer content.
Parameters:
app_id (string, required): Instance identifierlines (integer, optional): Number of lines (default: all)match (string, optional): Window matching criteriaReturns: {"success": true, "content": "..."}
Close a kitty instance.
Parameters:
app_id (string, required): Instance identifierforce (boolean, optional): Force closeGet the app-id of a running kitty instance.
Parameters:
app_id (string, required): Instance identifierReturns: {"success": true, "app_id": "...", "configured_app_id": "..."}
Update the app-id tracking for an instance.
Parameters:
app_id (string, required): Current instance identifiernew_app_id (string, required): New identifierList all active managed kitty instances.
Returns: {"success": true, "instances": [...]}
# Run all tests
uv run pytest
# Run with coverage
uv run pytest --cov=kitty_mcp --cov-report=term-missing
# Run only unit tests
uv run pytest tests/unit/
# Run only integration tests (requires kitty)
uv run pytest tests/integration/
result = kitty_launch(app_id="my-terminal", working_directory="/home/user")
kitty_send_text(app_id="my-terminal", text="echo 'Hello World!'")
kitty_send_key(app_id="my-terminal", key="enter")
output = kitty_get_scrollback(app_id="my-terminal", lines=5)
print(output["content"]) # Hello World!
kitty_close(app_id="my-terminal")
Add to .opencode/opencode.jsonc:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"kitty": {
"type": "local",
"command": ["kitty-mcp"],
"enabled": true
}
}
}
Add to claude_desktop_config.json:
{
"mcpServers": {
"kitty": {
"command": "kitty-mcp"
}
}
}
# Type checking
mypy src/
# Linting
ruff check src/
# Format code
ruff format src/
┌─────────────────┐
│ MCP Client │ (opencode/Claude Desktop)
│ (stdio IPC) │
└────────┬────────┘
│
▼
┌──────────────────────┐
│ KittyMCP Server │ FastMCP framework
│ ├─ Tool handlers │
│ ├─ State management │
│ ├─ Configuration │
│ └─ Logging │
└────────┬─────────────┘
│ asyncio subprocess
▼
┌──────────────────────┐
│ Kitty RC Commands │ kitten @ --to unix:/socket
└────────┬─────────────┘
│ Unix socket
▼
┌──────────────────────┐
│ Kitty Instance │ allow_remote_control=yes
│ └─ --app-id set │
└──────────────────────┘
# Launch and run commands
kitty_launch(app_id="automation", working_directory="/tmp")
kitty_send_text(app_id="automation", text="ls -la")
kitty_send_key(app_id="automation", key="enter")
output = kitty_get_scrollback(app_id="automation")
print(output["content"])
# Control nvim with complex workflows
kitty_launch(app_id="editor", working_directory="/project")
kitty_send_text(app_id="editor", text="nvim")
kitty_send_key(app_id="editor", key="enter")
# Navigate nvim interfaces
kitty_send_key(app_id="editor", key="space")
kitty_send_key(app_id="editor", key="p") # Open projects
kitty_send_key(app_id="editor", key="enter")
# Launch multiple terminals
for i in range(3):
kitty_launch(app_id=f"terminal-{i}", working_directory=f"/tmp/term-{i}")
# List all instances
instances = kitty_list_instances()
print(f"Active instances: {len(instances['instances'])}")
# Close all
for instance in instances["instances"]:
kitty_close(app_id=instance["app_id"])
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
MIT License - see LICENSE for details.
See CHANGELOG.md for version history and release notes.
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"kitty-mcp-server": {
"command": "npx",
"args": []
}
}
}PRs, issues, code search, CI status
Database, auth and storage
Reference / test server with prompts, resources, and tools.
Secure file operations with configurable access controls.