Skip to content

feat: add cross-platform launcher for plugin use#25

Open
trostmarvin wants to merge 1 commit into
willibrandon:mainfrom
trostmarvin:feat/cross-platform-launcher
Open

feat: add cross-platform launcher for plugin use#25
trostmarvin wants to merge 1 commit into
willibrandon:mainfrom
trostmarvin:feat/cross-platform-launcher

Conversation

@trostmarvin

Copy link
Copy Markdown

Implements #18.

What

  • New cmd/pixel-mcp-launcher: a small native binary that detects the platform via runtime.GOOS/runtime.GOARCH, locates pixel-mcp-{os}-{arch}[.exe] next to its own (symlink-resolved) location, and runs it with args, stdio, and environment passed through. On Unix it execs the server in place so signals and exit codes belong to the server process directly; on Windows it stays as parent and propagates the child's exit code.
  • make cross target: cross-compiles server and launcher for darwin/amd64, darwin/arm64, linux/amd64, linux/arm64, windows/amd64.
  • GoReleaser builds and publishes the launcher binaries alongside the server.

Why

pixel-plugin's .mcp.json points at bin/pixel-mcp, a bash wrapper that native Windows cannot spawn — the MCP server never starts and no tools are exposed (willibrandon/pixel-plugin#3). A native launcher removes the shell dependency entirely.

Shipped in the plugin as bin/pixel-mcp.exe, it also gives .mcp.json a single cross-platform command: Windows appends .exe when spawning the extensionless ${CLAUDE_PLUGIN_ROOT}/bin/pixel-mcp path and gets the launcher, while Unix executes the existing wrapper at the same path.

Testing

  • Unit/behavior tests (TDD): platform binary naming, arg/stdin/stdout passthrough, exit code propagation, missing-binary error, symlinked-launcher resolution (go test -race ./cmd/pixel-mcp-launcher/ — all pass; go vet/gofmt clean; goreleaser check passes).
  • End-to-end on Windows 11: pixel-mcp.exe (launcher) next to pixel-mcp-windows-amd64.exe, driven over a native cmd.exe pipe — correct initialize response through the launcher.
  • End-to-end with real Claude Code on Windows 11 via --plugin-dir with a patched pixel-plugin: all 50 mcp__aseprite__ tools exposed. Control run without the launcher exe: 0 tools.
  • Same verification on Linux (WSL2) with the Linux server binary.

One note from the investigation: the shipped pixel-mcp-windows-amd64.exe v0.5.0 answers MCP stdio correctly when driven with clean pipes — the earlier "server writes nothing to stdout" reports appear to be PowerShell test-harness artifacts, not a server bug.

Companion plugin PR: uses this launcher and removes the ${HOME} env block that fails validation on native Windows.

🤖 Generated with Claude Code

pixel-plugin ships per-platform server binaries and selects one via a bash
wrapper script, which native Windows cannot execute — the MCP server never
starts and no tools are exposed (willibrandon/pixel-plugin#3).

Add cmd/pixel-mcp-launcher: a small native binary that detects the platform
via runtime.GOOS/GOARCH, locates pixel-mcp-{os}-{arch}[.exe] next to its own
resolved location, and runs it with args, stdio, and environment passed
through. On Unix it execs the server in place; on Windows it stays as parent
and propagates the child's exit code.

Also add a `make cross` target building server and launcher for all five
release platforms, and publish launcher binaries via GoReleaser.

Closes willibrandon#18

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant