Skip to main content
Glama

LmsPs

by BerejikB

LmsPs — LM Studio PowerShell MCP Server

A minimal, environment‑driven MCP server that exposes a persistent PowerShell session to LM Studio. It keeps a single pwsh.exe/powershell.exe process alive and offers tools to run commands, manage cwd, and get/set env vars. Responses to the client are trimmed (default 500 chars) while full I/O is logged.

Features

  • Tools: ps.run, ps.cd, ps.cwd, ps.reset, ps.env_get, ps.env_set
  • Persistent PowerShell between calls (stateful session)
  • 500‑char response trim to the client; full logs on disk
  • All paths/config via environment variables (no hardcoded paths)

Install (dev)

cd K:/Repos/LmsPs python -m venv .venv . .venv/Scripts/activate # Windows pip install -e .

Run (stdio)

  • From WSL (recommended by LM Studio):
bash K:/Repos/LmsPs/scripts/start_ps_mcp_stdio.sh
  • Or directly (Windows):
python -m lmsps.server

Environment variables

  • LMSPS_PWSH — PowerShell executable (default pwsh.exe, fallback powershell.exe)
  • LMSPS_PWSH_FALLBACK — override fallback exe if needed
  • LMSPS_LOGDIR — log directory (default: <repo>/logs)
  • LMSPS_TRIM_CHARS — max characters returned to client (default: 500)
  • LMSPS_TIMEOUT_SEC — per‑call timeout in seconds (default: 30)

LM Studio configuration example

Add to your LM Studio settings JSON:

{ "mcpServers": { "lmsps": { "command": "bash", "args": ["-lc", "K:/Repos/LmsPs/scripts/start_ps_mcp_stdio.sh"], "env": { "LMSPS_PWSH": "/mnt/c/Program Files/PowerShell/7/pwsh.exe", "LMSPS_LOGDIR": "/mnt/k/LMstudio/LmsPs/logs", "LMSPS_TRIM_CHARS": "500" } } } }

Smoke test (from LM Studio)

  • ps.runGet-Process | Select-Object -First 3
  • ps.cwd → should show current location
  • ps.cd → change to a test directory and re‑run ps.cwd
  • ps.env_set/ps.env_get → write/read a temp environment variable
  • Re‑run ps.run to confirm session persistence

Logs

  • Full request/response JSON lines are appended to LMSPS_LOGDIR/lmsps_server.log.

Repo layout

  • src/lmsps/server.py — MCP server implementation
  • scripts/start_ps_mcp_stdio.sh — stdio launcher (used by LM Studio)
  • logs/ — default log directory (overridable via LMSPS_LOGDIR)

License

MIT

-
security - not tested
A
license - permissive license
-
quality - not tested

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

Enables interaction with a persistent PowerShell session through LM Studio. Provides tools to run commands, manage directories, and handle environment variables while maintaining session state between calls.

  1. Features
    1. Install (dev)
      1. Run (stdio)
        1. Environment variables
          1. LM Studio configuration example
            1. Smoke test (from LM Studio)
              1. Logs
                1. Repo layout
                  1. License

                    Related MCP Servers

                    • A
                      security
                      A
                      license
                      A
                      quality
                      Enables LLMs to interact with web pages, take screenshots, and execute JavaScript in a real browser environment
                      Last updated -
                      10
                      1,346
                      238
                      JavaScript
                      MIT License
                      • Apple
                    • -
                      security
                      A
                      license
                      -
                      quality
                      A comprehensive toolkit that enhances LLM capabilities through the Model Context Protocol, allowing LLMs to interact with external services including command-line operations, file management, Figma integration, and audio processing.
                      Last updated -
                      22
                      Python
                      Apache 2.0
                      • Linux
                      • Apple
                    • A
                      security
                      F
                      license
                      A
                      quality
                      Enables interaction with lightning addresses and common lightning tools via your LLM, providing Lightning Network functionality through natural language.
                      Last updated -
                      3
                      10
                      1
                      TypeScript
                    • A
                      security
                      F
                      license
                      A
                      quality
                      A local Model Context Protocol server that allows LLMs to securely execute shell commands on remote Linux and Windows systems via SSH connections.
                      Last updated -
                      6
                      0
                      2
                      JavaScript
                      • Linux

                    View all related MCP servers

                    MCP directory API

                    We provide all the information about MCP servers via our MCP API.

                    curl -X GET 'https://glama.ai/api/mcp/v1/servers/BerejikB/LmsPs'

                    If you have feedback or need assistance with the MCP directory API, please join our Discord server