Skip to main content

PowerShell 7 MCP Server for Zencoder - Execute PowerShell commands via MCP protocol

Project description

PS7 Tool - PowerShell 7 MCP Server for Zencoder

A custom MCP (Model Context Protocol) server that exposes PowerShell 7 command execution to Zencoder, bypassing the broken Bash tool.

Features

  • ✅ Full MCP protocol support (JSONRpc)
  • ✅ PowerShell 7 command execution (no cmd.exe wrapper)
  • ✅ Timeout support (default 240s, configurable)
  • ✅ Background execution mode
  • ✅ Full stdout/stderr capture
  • ✅ Exit code tracking
  • ✅ Comprehensive logging to ~/.ps7_tool/logs/
  • ✅ Working directory support
  • ✅ Command description/tagging for logging

Requirements

  • Python: 3.8+ (tested with 3.12+)
  • PowerShell: PowerShell 7 installed and in PATH (pwsh)
  • OS: Windows (primary), Linux/macOS with PS7

Installation

Quick Start

Minimal setup (30 seconds):

  1. Ensure PowerShell 7 is installed
  2. Install locally:
    cd "C:\Users\nomad\PycharmProjects\Fallout 4 OCBPC project\PS7 tool"
    pip install -e .
    
  3. Register in Zencoder: File > Settings > Tools > Zencoder > Agent Tools > Add Custom MCP
    • Name: ps7_tool
    • Command: python
    • Args: -m ps7_tool.mcp_server

Prerequisites

  1. Install PowerShell 7 (if not already installed):

Option A: Install from Local Directory (Development)

For development or local testing:

cd "C:\Users\nomad\PycharmProjects\Fallout 4 OCBPC project\PS7 tool"
pip install -e .

This creates entry points ps7-mcp-server and ps7-mcp-tool in your Python environment.

Then in Zencoder MCP settings (with uvx):

{
  "ps7_tool": {
    "command": "uvx",
    "args": ["ps7-mcp-tool"]
  }
}

Or use direct Python module invocation:

{
  "ps7_tool": {
    "command": "python",
    "args": ["-m", "ps7_tool.mcp_server"]
  }
}

Option B: MCP Library Installation (Recommended)

After installing locally with pip install -e .:

  1. Open File > Settings (or JetBrains IDE > Settings on macOS)

  2. Navigate to Tools > Zencoder > Agent Tools

  3. Click Add Custom MCP

  4. Fill in:

    • Name: ps7_tool
    • Command: python
    • Args: -m ps7_tool.mcp_server
  5. Click Install

Option C: Direct MCP Registration (JetBrains IDE)

  1. Open File > Settings (or JetBrains IDE > Settings on macOS)

  2. Navigate to Tools > Zencoder > MCP Servers

  3. Click Edit in settings.json and add:

    {
      "ps7_tool": {
        "command": "python",
        "args": [
          "C:\\Users\\nomad\\PycharmProjects\\Fallout 4 OCBPC project\\PS7 tool\\mcp_server.py"
        ]
      }
    }
    
  4. Click Apply and restart your IDE

VS Code Registration (Limited Support)

Note: VS Code currently only supports stdio connections. After full Zencoder support for VS Code MCP servers is released, you can add:

  1. Open Settings (Cmd/Ctrl + ,)

  2. Search for MCP Servers and click Edit in settings.json

  3. Add to your settings.json:

    "zencoder.mcpServers": {
      "ps7_tool": {
        "command": "python",
        "args": ["-m", "ps7_tool.mcp_server"]
      }
    }
    
  4. Save and reload the IDE

Usage in Zencoder

Once registered, the MCP tool exposes execute_powershell command with the following parameters:

Parameters

Parameter Type Required Default Description
command string - PowerShell command to execute
timeout integer 240 Timeout in seconds
background boolean false Run in background mode
cwd string null Working directory
description string "" Optional command description

Example Commands (from Zencoder)

In Zencoder chat with Coding Agent enabled:

Execute this PowerShell command: Get-ChildItem -Path C:\Users\nomad\Desktop

The tool will:

  1. Execute Get-ChildItem -Path C:\Users\nomad\Desktop via PowerShell 7
  2. Capture stdout/stderr
  3. Return exit code and full output
  4. Log results to ~/.ps7_tool/logs/ps7_exec_*.json

Output Format

Response Structure

{
  "exit_code": 0,
  "stdout": "File content here...",
  "stderr": "",
  "execution_time": 0.245,
  "log_file": "C:\\Users\\nomad\\.ps7_tool\\logs\\ps7_exec_20251220_204535_123.json"
}

Logs

All command executions are logged to:

~/.ps7_tool/logs/ps7_exec_YYYYMMDD_HHMMSS_mmm.json

Server logs are written to:

~/.ps7_tool/mcp_server.log

Troubleshooting

"PowerShell 7 (pwsh) not found in PATH"

Solution: Install PowerShell 7 and ensure pwsh is in your PATH:

$env:Path -split ';'  # Check if PowerShell 7 is in PATH

MCP Server not visible in Zencoder

  1. Verify Python path is correct in settings.json
  2. Check ~/.ps7_tool/mcp_server.log for errors
  3. Reload IDE
  4. Ensure Coding Agent is enabled in Zencoder

Command timeout

Default timeout is 240 seconds (4 minutes). Increase via timeout parameter:

{
  "command": "long-running-ps-command",
  "timeout": 600
}

File Structure

PS7 tool/
├── ps7_tool/              # Python package
│   ├── __init__.py        # Package init
│   ├── mcp_server.py      # Main MCP server
│   └── ps7_executor.py    # Legacy executor
├── pyproject.toml         # Python package metadata
├── MANIFEST.in            # Package manifest
├── .gitignore             # Git ignore rules
├── README.md              # This file
├── mcp_server.py          # Root copy (legacy)
├── ps7_executor.py        # Root copy (legacy)
├── test_executor.py       # Test suite
└── test.bat               # Test launcher

Note: Root-level mcp_server.py and ps7_executor.py are kept for backward compatibility. The packaged version uses ps7_tool/ directory.

Development

Running Tests

python test_executor.py

Manual Testing

python mcp_server.py

Then send JSON requests on stdin:

{"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {}}
{"jsonrpc": "2.0", "id": 2, "method": "tools/list", "params": {}}

Notes

  • This tool is a direct replacement for the broken Bash tool in Zencoder
  • PowerShell is used instead of cmd.exe for better command compatibility
  • All commands run with -NoProfile flag to avoid startup delays
  • Background execution uses Popen (non-blocking)
  • Foreground execution waits for completion or timeout
  • Package structure (ps7_tool/) allows installation via pip and library manager
  • Entry point ps7-mcp-server is automatically created on install
  • Works with both local installation and future remote MCP deployment

Why This Tool?

The Zencoder Bash tool has limitations on Windows:

  • Uses cmd.exe which lacks PowerShell features
  • Doesn't handle UTF-8/Unicode properly
  • Path handling issues with backslashes
  • Missing environment variable interpolation

This MCP server replaces Bash with PowerShell 7, providing:

  • ✅ Full PowerShell cmdlet support
  • ✅ Proper Windows path handling
  • ✅ UTF-8/Unicode support
  • ✅ MCP protocol compliance
  • ✅ Timeout and background execution
  • ✅ Comprehensive logging

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

ps7_mcp_tool-1.0.1.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

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

ps7_mcp_tool-1.0.1-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file ps7_mcp_tool-1.0.1.tar.gz.

File metadata

  • Download URL: ps7_mcp_tool-1.0.1.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for ps7_mcp_tool-1.0.1.tar.gz
Algorithm Hash digest
SHA256 60a7fe189f6c252cd2eee696252daa957db110becfcbc9ad72795a98bd1f6250
MD5 8f60f95a7251d151caca0c923c38da83
BLAKE2b-256 e3921df82fb40957dd9a068bcc4b7f79e43ddb65dc49c48ee404026740aa3439

See more details on using hashes here.

File details

Details for the file ps7_mcp_tool-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: ps7_mcp_tool-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for ps7_mcp_tool-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8d45165bedd4ea19dc3da4465ce5c44bd14f84bc65f2d5da3bf37de8a93754c9
MD5 3daab3fcb0272901ab6e9580258d8545
BLAKE2b-256 87b262c0292e420e6ab344f6fcf2e6ef9d66daa024e69f406306afb340c2d9ba

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