Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Universal System Command Wrapper - A universal system command wrapper that can dynamically ingest any system command and auto-generate plugin specifications for the Animus Letta MCP Server

License

Unknown, Unknown licenses found

Licenses found

Unknown
LICENSE
Unknown
LICENSE-DOCS
Notifications You must be signed in to change notification settings

actuallyrizzn/ucw

Repository files navigation

Universal Command Wrapper (UCW)

License: AGPL-3.0 Documentation License: CC BY-SA 4.0 Python Version Zero Dependencies

A powerful command wrapper generator that can be used standalone or as an SMCP plugin. UCW automatically analyzes system commands and generates callable wrappers or MCP plugin files, bridging the gap between command-line tools and Python applications through intelligent command parsing and wrapper generation.

πŸš€ Features

  • Cross-platform Support: Works on Windows (/?) and POSIX (--help, man) systems
  • Zero Dependencies: Uses only Python standard library
  • Intelligent Parsing: Automatically extracts options, flags, and positional arguments
  • Type Inference: Infers parameter types from help text descriptions
  • Dual Output Modes:
    • Library mode: Generate callable Python wrappers
    • Builder mode: Generate complete MCP plugin files
  • File Management: Create new CLI files or update existing ones
  • SMCP Plugin: Primary use case as SMCP plugin (just copy folder)
  • Standalone Tool: Can be used independently for development/testing
  • MCP Compatibility: Generates plugins compatible with MCP servers

πŸ“‹ Table of Contents

πŸ›  Installation

As SMCP Plugin (Primary Use)

UCW is primarily designed to be used as a plugin for SMCP (Simple MCP):

  1. Clone the repository:

    git clone https://github.com/actuallyrizzn/ucw.git
  2. Place in SMCP plugins directory:

    # Copy to your SMCP plugins directory
    cp -r ucw /path/to/smcp/plugins/
  3. Make CLI executable:

    chmod +x /path/to/smcp/plugins/ucw/cli.py

Standalone Usage (Development/Testing)

For development, testing, or standalone usage:

# Clone the repository
git clone https://github.com/actuallyrizzn/ucw.git
cd ucw

# Install production dependencies (zero external dependencies)
pip install -r requirements.txt

# Install testing dependencies (for development/testing)
pip install -r requirements-testing.txt

# Run tests
python -m pytest tests/

# Use CLI directly
python cli.py wrap ls

πŸš€ Quick Start

CLI Usage

SMCP Plugin Mode (Default - JSON Output)

# Generate wrapper in memory (JSON output)
python cli.py wrap ls

# Generate wrapper and save to file (JSON output)
python cli.py wrap ls --output cli.py

# Parse command specification (JSON output)
python cli.py parse ls

# Execute command (JSON output)
python cli.py execute ls --args "/root" --options '{"--all": true}'

Standalone Mode (Human-Readable Output)

# Generate wrapper in memory (human-readable output)
python cli.py --standalone wrap ls
python cli.py --human wrap ls  # Alternative flag

# Parse command specification (human-readable output)
python cli.py --standalone parse ls

# Execute command (human-readable output)
python cli.py --standalone execute ls --args "/root" --options '{"--all": true}'

# Generate CLI file (human-readable output)
python cli.py --standalone wrap tar --output cli.py

# Update existing CLI file (human-readable output)
python cli.py --standalone wrap find --update cli.py

Library Usage

from ucw import UniversalCommandWrapper

# Initialize UCW
ucw = UniversalCommandWrapper(platform_name="auto")

# Parse and wrap a command
spec = ucw.parse_command("echo")
wrapper = ucw.build_wrapper(spec)

# Execute the command with arguments
result = wrapper.run("hello", "world")
print(result.stdout)

πŸ“– Usage

For comprehensive usage documentation, see the Usage Guide.

Quick Examples

CLI Usage:

# Generate wrapper
python cli.py wrap echo

# Parse command
python cli.py parse ls

# Execute command
python cli.py execute echo --args "hello" "world"

Library Usage:

from __init__ import UniversalCommandWrapper

ucw = UniversalCommandWrapper()
spec = ucw.parse_command("echo")
wrapper = ucw.build_wrapper(spec)
result = wrapper.run("hello", "world")
print(result.stdout)

πŸ— Architecture

ucw/
β”œβ”€β”€ __init__.py              # Main UCW class and exports
β”œβ”€β”€ cli.py                   # Command-line interface
β”œβ”€β”€ models.py                # Core data models
β”œβ”€β”€ wrapper.py               # CommandWrapper implementation
β”œβ”€β”€ parser/                  # Platform-specific parsers
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ base.py             # Abstract base parser
β”‚   β”œβ”€β”€ windows.py          # Windows command parser
β”‚   └── posix.py            # POSIX command parser
β”œβ”€β”€ generator/               # Wrapper and file generation
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ wrapper_builder.py  # Wrapper building logic
β”‚   └── file_writer.py      # File writing utilities
β”œβ”€β”€ tests/                   # Test suite
β”‚   └── test_basic.py       # Basic functionality tests
β”œβ”€β”€ docs/                    # Documentation
β”‚   β”œβ”€β”€ plugin-development-guide.md
β”‚   └── project-idea.md
β”œβ”€β”€ requirements.txt         # Production dependencies (zero external deps)
β”œβ”€β”€ requirements-testing.txt # Testing and development dependencies
└── README.md               # This file

Data Flow

  1. Command Analysis: UCW fetches help text using platform-specific methods
  2. Parsing: Help text is parsed to extract options and positional arguments
  3. Type Inference: Types are inferred from descriptions and argument names
  4. Wrapper Generation: CommandSpec is converted to executable CommandWrapper
  5. Execution: Commands are executed with proper argument handling

Supported Command Formats

Windows Commands

  • Format: command /?
  • Options: /option, /option:value
  • Examples: dir /?, copy /?

POSIX Commands

  • Format: command --help or man command
  • Options: -o, --option, --option=value
  • Examples: ls --help, grep --help

🀝 Contributing

We welcome contributions! Please see CONTRIBUTING.md for details.

Development Setup

# Clone repository
git clone https://github.com/actuallyrizzn/ucw.git
cd ucw

# Install in development mode
pip install -e .

# Install production dependencies (zero external dependencies)
pip install -r requirements.txt

# Install testing dependencies (for development/testing)
pip install -r requirements-testing.txt

# Run tests
python -m pytest tests/

Adding New Features

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Submit a pull request

πŸ“„ License

Code License

This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0) - see the LICENSE file for details.

Documentation License

This documentation is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License (CC BY-SA 4.0) - see the LICENSE-DOCS file for details.

πŸ”’ Security Considerations

UCW executes system commands, so consider security implications:

  • Command validation: UCW doesn't validate command safety
  • Privilege escalation: Commands run with current user privileges
  • Input sanitization: Validate inputs before passing to UCW

UCW Security Model

UCW assumes the runtime environment defines its own boundaries. For containment, deploy SMCP inside a container or restricted user namespace. UCW operates entirely within those boundaries β€” it neither enforces nor bypasses them.

Recommended Security Practices:

  • Run SMCP in a Docker container or lightweight VM
  • Mount only the directories or devices you want the agent to see
  • Use a limited service account or UID with no sudo privileges
  • Cap CPU/RAM/network with container or cgroup limits

This approach gives the agent total reach within that defined sandbox, while keeping UCW philosophically pure: maximum capability, user-defined sovereignty.

πŸ™ Acknowledgments

  • Inspired by the need for seamless command-line tool integration
  • Built for the Animus, SanctumOS and Letta MCP Server ecosystem
  • Thanks to the Python community for excellent standard library tools

πŸ“ž Support


Universal Command Wrapper - Making command-line tools accessible to Python applications.

About

Universal System Command Wrapper - A universal system command wrapper that can dynamically ingest any system command and auto-generate plugin specifications for the Animus Letta MCP Server

Topics

Resources

License

Unknown, Unknown licenses found

Licenses found

Unknown
LICENSE
Unknown
LICENSE-DOCS

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages