Skip to main content
Glama
mcp-server-wslc

mcp-server-wslc

by aihuali213

mcp-server-wslc

npm version License Node.js

MCP (Model Context Protocol) server for Microsoft's wslc CLI — a typed API wrapper that lets AI agents manage WSL containers safely.

Supported Clients

Claude Code · Codex CLI · Hermes · OpenClaw · Cursor · VS Code Agent


Related MCP server: ContainMind

Quick Start

Add to your MCP client's configuration file:

{
  "mcpServers": {
    "wslc": {
      "command": "npx",
      "args": ["-y", "mcp-server-wslc"]
    }
  }
}

Restart the client, then try:

List all WSL containers. Pull alpine:latest. Create a container named "web-test" from ubuntu:24.04 with 512M memory.

Requirements: Node.js >= 22, wslc on PATH.


Commands

npm run dev          # tsx — run TypeScript directly
npm run build        # tsc → dist/
npm run check        # tsc --noEmit (type-check only)
npm run test         # vitest — run unit tests
npm run test:watch   # vitest — watch mode
npm run test:coverage # vitest — test coverage report
npm start            # node dist/index.js (production)

Available Tools

Core

Tool

Description

Parameters

list_containers

List all WSL containers

format (table | json)

list_images

List all WSL container images

format (table | json)

Container Management

Tool

Description

Key Parameters

container_create

Create a new container

image, name, cpus, memory, env, publish, volume, workdir, interactive, tty, rm

container_run

Run a container

image, name, detach, cpus, memory, env, publish, volume, interactive, tty, rm

container_inspect

Show container details

containerId

container_start

Start a stopped container

containerId, attach, interactive

container_stop

Stop a running container

containerId, signal, time

container_restart

Restart a container (stop + start)

containerId, signal, time

container_remove

Remove a container

containerId, force

container_logs

View container logs

containerId, follow, tail, timestamps, since, until

container_exec

Execute a command in a container

containerId, command, commandArgs, detach, env, interactive, tty, user, workdir

container_stats

Resource usage snapshot

containerId, all, format, noTrunc

container_restart composes stop + start — wslc has no native restart command.

Image Management

Tool

Description

Key Parameters

image_pull

Pull an image from a registry

image

image_push

Push an image to a registry

image

image_build

Build an image from a Dockerfile

path, file, tag, buildArg, target, pull, noCache, label, verbose

image_tag

Tag an image

source, target

image_inspect

Show image details

image

image_remove

Remove an image

image, force, noPrune

Network Management

Tool

Description

Key Parameters

network_list

List all networks

format, quiet

network_create

Create a network

name, driver, opt, label

network_remove

Remove a network

name, force

Volume Management

Tool

Description

Key Parameters

volume_list

List all volumes

format, quiet

volume_create

Create a named volume

name, driver, opt, label

volume_remove

Remove a volume

name, force

Registry Authentication

Tool

Description

Key Parameters

registry_login

Log in to a registry

server, username, password, passwordStdin

registry_logout

Log out from a registry

server

Security: Prefer passwordStdin over password to avoid exposing credentials in process lists.

System

Tool

Description

Key Parameters

system_version

Get wslc CLI version

—

system_prune

Remove all stopped containers

—


Example Prompts

List all running WSL containers.
Show me the wslc version.
What container images are available? Show in JSON format.
Create a container named "web-test" from ubuntu:24.04 with 1 CPU and 512M memory.
Run nginx in the background with port 8080 published.
View the last 50 lines of logs from container "web-test".
Get stats for all running containers in JSON format.
Pull alpine:latest and create a container from it.
Tag ubuntu:24.04 as my-ubuntu:latest.
Create a network named "backend" and run a container attached to it.

Project Structure

mcp-server-wslc/
├── src/
│   ├── index.ts                     # Entry point
│   ├── server.ts                    # McpServer + stdio transport
│   ├── registry/
│   │   └── registerTools.ts         # Central tool registration
│   ├── tools/
│   │   ├── containers/              # 11 files + 1 test
│   │   │   ├── list.ts, create.ts, run.ts, run.test.ts, inspect.ts
│   │   │   ├── start.ts, stop.ts, restart.ts, remove.ts
│   │   │   └── logs.ts, exec.ts, stats.ts
│   │   ├── images/                  # 7 files
│   │   │   ├── list.ts, pull.ts, push.ts, build.ts
│   │   │   └── tag.ts, inspect.ts, remove.ts
│   │   ├── networks/                # 3 files
│   │   │   └── list.ts, create.ts, remove.ts
│   │   ├── volumes/                 # 3 files
│   │   │   └── list.ts, create.ts, remove.ts
│   │   ├── registry/                # 2 files
│   │   │   └── login.ts, logout.ts
│   │   └── system/                  # 2 files
│   │       └── version.ts, prune.ts
│   └── utils/
│       ├── wslc.ts                  # runWslc() — single execution point
│       └── wslc.test.ts             # Unit tests for runWslc()
├── dist/                            # Compiled output (33 JS files)
├── vitest.config.ts
├── package.json
├── tsconfig.json
├── README.md
└── README.zh-CN.md

Testing

Unit tests use vitest. Tests cover:

  • runWslc() — execution wrapper: stdout/stderr trimming, timeout, ENOENT, error propagation

  • buildContainerRunArgs() — CLI argument construction for container_run: all parameter types and combinations

npm run test           # Single run
npm run test:watch     # Watch mode
npm run test:coverage  # Coverage report (v8)

License

ISC

Available Tools

28 tools
container_createC

Create a new WSL container. Returns the container ID on success.

Inputs: image (required), rm, env, tty, +9 more.

container_execB

Execute a command inside a running WSL container.

Inputs: command (required), containerId (required), env, tty, +5 more.

container_inspectB

Display detailed information about a WSL container.

Inputs: containerId (required).

container_logsB

View logs from a WSL container.

Inputs: containerId (required), tail, since, until, +2 more.

container_removeB

Remove a WSL container.

Inputs: containerId (required), force.

container_restartA

Restart a WSL container. Since wslc has no native restart command, this stops then starts the container.

Inputs: containerId (required), time, signal.

container_runB

Run a new WSL container. Defaults to foreground; use detach for background.

Inputs: image (required), rm, env, tty, +10 more.

container_startA

Start a stopped WSL container.

Inputs: containerId (required), attach, interactive.

container_statsB

Display resource usage snapshot for running WSL containers.

Inputs: all, format, noTrunc, containerId.

container_stopB

Stop a running WSL container.

Inputs: containerId (required), time, signal.

image_buildB

Build a container image from a Dockerfile.

Inputs: path (required), tag, file, pull, +5 more.

image_inspectB

Display detailed information about a container image.

Inputs: image (required).

image_pullB

Pull a container image from a registry.

Inputs: image (required).

image_pushA

Push a container image to a registry.

Inputs: image (required).

image_removeB

Remove a container image.

Inputs: image (required), force, noPrune.

image_tagB

Tag a container image with a new name/tag.

Inputs: source (required), target (required).

list_containersA

List all WSL containers. Use the optional 'format' parameter to control output format (table, json).

Inputs: format.

list_imagesA

List all WSL container images. Use the optional 'format' parameter to control output format (table, json).

Inputs: format.

network_createC

Create a new WSL network.

Inputs: name (required), opt, label, driver.

network_listA

List all WSL networks.

Inputs: quiet, format.

network_removeC

Remove one or more WSL networks.

Inputs: name (required), force.

registry_loginA

Log in to a container registry. If no server is specified, the session default is used. Prefer using passwordStdin over password to avoid exposing credentials in process lists.

Inputs: server, password, username, passwordStdin.

registry_logoutA

Log out from a container registry. If no server is specified, the session default is used.

Inputs: server.

system_pruneA

Remove all stopped containers and unused images, networks, and volumes to free up resources.

Inputs: no named parameters.

system_versionA

Get wslc CLI version information.

Inputs: no named parameters.

volume_createA

Create a new named volume that can be attached to containers.

Inputs: opt, name, label, driver.

volume_listB

List all WSL volumes.

Inputs: quiet, format.

volume_removeA

Remove one or more volumes. Volumes in use by a container cannot be removed.

Inputs: name (required), force.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 28 tools

    Disambiguation5/5

    Each tool targets a distinct resource-action pair, such as container_run vs container_create vs container_start, which are clearly differentiated by their descriptions. Resources like containers, images, volumes, networks, and registry operations are cleanly separated, leaving no ambiguity.

    Naming Consistency4/5

    Most tools follow the verb_noun pattern (e.g., container_create, image_pull, network_list), but a few like list_containers and list_images reverse the order, creating minor inconsistency. The overall structure is predictable and readable, with only slight deviations.

    Tool Count4/5

    With 28 tools, the count is on the higher end, but it corresponds to the broad domain of container management, covering containers, images, volumes, networks, and registry operations. Each tool serves a distinct purpose, making the size justified despite being above the typical 15-tool benchmark.

    Completeness4/5

    The tool surface provides comprehensive lifecycle coverage for containers (create, run, start, stop, restart, remove, inspect, logs, exec, stats), images (build, pull, push, tag, inspect, remove), and basic operations for volumes, networks, and registries. Minor gaps such as network connect/disconnect and volume inspect are present, but core workflows are well-supported.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to manage and analyze containers across Docker and Podman through natural language, providing unified inspection, monitoring, and diagnostics.
      3
      -
    • A
      license
      B
      quality
      D
      maintenance
      Enables AI assistants to manage Docker containers and Kubernetes resources through natural language, supporting operations like container management, image building, and pod/deployment/service management.
      9
      MIT