Skip to main content

Screen session manager with MCP support

Project description

Screen Session Manager

Manage screen sessions programmatically. Send commands, capture output, and automate workflows.

Install

pip install -e .

Quick Start

from screen_manager import ScreenSessionManager

manager = ScreenSessionManager()

# Create session and send commands
manager.create_session("work")
manager.send_command("work", "python script.py")
output = manager.capture("work")

CLI Usage

# Create and manage sessions  
python -m screen_manager create work
python -m screen_manager send work "echo hello"
python -m screen_manager capture work

# Send multiple commands
python -m screen_manager send-commands work -c "echo 1" -c "echo 2"

# Execute files
python -m screen_manager send-file work script.py

# List and attach
python -m screen_manager list --all
python -m screen_manager attach work

# Smart create/attach  
python -m screen_manager create-or-attach work

# Cleanup
python -m screen_manager cleanup work

MCP Server

# Run as MCP server
python -m screen_manager serve

# Or from Python
from screen_manager.mcp_server import main
main()

MCP Configuration

Add to your MCP client configuration:

{
  "mcpServers": {
    "screen-manager": {
      "command": "python",
      "args": ["-m", "screen_manager.mcp_server"],
      "description": "Manage screen sessions, send commands, and capture output"
    }
  }
}

API Methods

  • create_session(name) - Create new session
  • send_command(name, cmd) - Send single command
  • send_commands(name, cmds) - Send command list
  • send_command_from_file(name, file) - Execute file
  • capture(name, lines=-1) - Get output
  • list_sessions(all_sessions=False) - List sessions
  • attach_session(name) - Get attach instructions
  • create_or_attach_session(name) - Smart create/attach
  • cleanup_session(name) - Remove session

MCP Tools

The MCP server provides 10 tools:

  • create_session
  • send_command
  • send_commands
  • send_command_from_file
  • capture_output
  • list_sessions
  • list_all_sessions
  • attach_session
  • create_or_attach_session
  • cleanup_session

Use Case: Debugging with selective breakpoints

manager.send_commands("debug", [ "export CIPDB_IDS=validate,transform", "python script_with_cipdb.py" ])

Requirements

  • Python 3.8+
  • screen command (install with apt install screen or brew install screen)

That's it. Simple screen session management for Python.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

screen_manager-0.1.0.tar.gz (28.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

screen_manager-0.1.0-py3-none-any.whl (21.2 kB view details)

Uploaded Python 3

File details

Details for the file screen_manager-0.1.0.tar.gz.

File metadata

  • Download URL: screen_manager-0.1.0.tar.gz
  • Upload date:
  • Size: 28.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.0rc1

File hashes

Hashes for screen_manager-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1e01bdac7924a0758256949c6ebb5a0c4a948ec706c431b688dcb98030dfafc8
MD5 7127614cc31a3ac69525f192f0b14016
BLAKE2b-256 6b5249107af3812384eb79c3e3ae5d76e333fd9251da8b5c6e717a1e15242ecd

See more details on using hashes here.

File details

Details for the file screen_manager-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: screen_manager-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 21.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.0rc1

File hashes

Hashes for screen_manager-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 37afb1dc4b6c603e9d4ca6b773441e151d5cad9e72ddf6aca063e813ae6ea5e5
MD5 2fc1667a5d5c6c3c303afacc174ac92a
BLAKE2b-256 8c1e32e5f3b947058cad746b2990177ec6ff02a1c85c9409598688d31ade53b6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page