ExMCP.StdioLauncher (ex_mcp v0.10.0)

View Source

Launcher module for STDIO servers that handles Mix.install output.

This module provides a clean way to start STDIO servers that need to use Mix.install by handling the startup output problem.

Important Note

While this module minimizes output contamination, Mix.install may still produce some stdout output during dependency resolution that cannot be completely suppressed. The ExMCP STDIO server is designed to gracefully handle and ignore such non-JSON lines during startup.

For production use, consider using pre-compiled releases instead of Mix.install to eliminate all startup output.

Usage

Instead of using Mix.install directly in your script, use:

#!/usr/bin/env elixir

ExMCP.StdioLauncher.start(MyServer, [
  {:ex_mcp, "~> 0.1"},
  {:jason, "~> 1.4"}
])

This will:

  1. Install dependencies with minimal output
  2. Configure logging appropriately for STDIO transport
  3. Start your server with STDIO transport

Summary

Functions

Starts a STDIO server with proper dependency installation.

Functions

start(server_module, deps, opts \\ [])

Starts a STDIO server with proper dependency installation.

Options

  • :deps - List of dependencies for Mix.install (required)
  • :mix_install_opts - Options to pass to Mix.install
  • :server_opts - Options to pass to server start_link