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.6.tar.gz (8.9 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.6-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ps7_mcp_tool-1.0.6.tar.gz
  • Upload date:
  • Size: 8.9 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.6.tar.gz
Algorithm Hash digest
SHA256 27f7379f3b9904851e0124725717c1be90bec767349a8b267247fdf3e663bc10
MD5 a9bc2697565e9d15950635d06d1e3b3c
BLAKE2b-256 a4b5db5dc15c50a23b50f6aa882f6829fb4f22dabab42e8ca6965526a8b31d8e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ps7_mcp_tool-1.0.6-py3-none-any.whl
  • Upload date:
  • Size: 9.2 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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 8bb1b218e10dca0ac998d9128e12688d3ec0b462f3504046fba1ac2765bd3c6c
MD5 ee3ed76ac223f01603530b1073339408
BLAKE2b-256 ee6a76a6054d0ac97e54dfadbab551f22d5b938fb1172d10798cda74a4110cdf

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