home / mcp / swift test mcp server
Exposes a swift-test MCP tool to run Swift tests in a Swift package directory via stdio or client embedding.
Configuration
View docs{
"mcpServers": {
"acyment-swifttest-mcp-server": {
"command": "swifttest-mcp-server",
"args": []
}
}
}Swift Test MCP Server provides an MCP endpoint that exposes a single swift-test tool to run Swift tests inside a Swift package directory. It is useful when your MCP client can invoke tools over stdio without needing an interactive shell, enabling automation and editor integrations.
You can run the server as a local stdio MCP server or embed it in MCP-aware clients. The server offers a dedicated tool named swift-test that executes swift test in a specified package directory. Use the stdio transport to connect a local client (for example, an editor integration) to the swifttest-mcp-server CLI.
Prerequisites include Bun v1.0+ as the runtime for the server and CLI, and a Swift toolchain with swift test available on PATH.
# Install from npm (recommended)
npm install -g swifttest-mcp-server
# or: pnpm add -g swifttest-mcp-server
# or: bunx swifttest-mcp-server (runs without installing globally)Install from source (for contributors):
bun install
bun run buildNote: If your environment restricts temporary/cache locations, set TMPDIR and/or XDG_CACHE_HOME before installing.
The MCP server is designed to connect over stdio. After you install, you can start the server using the chosen CLI flow (for example, a standard dev/start script or a direct CLI invocation) and register it with an MCP-aware client using a stdio transport that points to the Bun command you selected.
Tool: swift-test—Runs swift test inside the Swift package found at the given path and streams combined stdout/stderr along with metadata such as exit code, duration, and the executed command. If the test run fails, non-zero exit codes are reported as MCP tool errors so the client can react while still capturing output.
Development commands (as described in the repository) include live TypeScript development, type checking, and bundling the server into a single ESM entry. Tests spin up the MCP server over stdio and exercise the swift-test tool. Ensure you’re using the published version or rebuild from source if issues arise.
Executes swift test in a given Swift package directory and streams combined stdout/stderr with tool metadata (exit code, duration).