# How to Build the MCP Stdio Binary for CyberStrikeAI

> Build the CyberStrikeAI MCP stdio binary with a single Go command. Learn how to compile this essential component for your AI projects using Go 1.24. Easy setup for developers.

- Repository: [公明/CyberStrikeAI](https://github.com/Ed1s0nZ/CyberStrikeAI)
- Tags: how-to-guide
- Published: 2026-03-09

---

**You can build the CyberStrikeAI MCP stdio binary by running `go build -o cyberstrike-ai-mcp cmd/mcp-stdio/main.go` from the repository root, requiring only Go 1.24 and the standard toolchain.**

The CyberStrikeAI repository by Ed1s0nZ provides a Model Context Protocol (MCP) server implementation that communicates over standard input/output, enabling seamless integration with AI assistants and IDE extensions. Building the MCP stdio binary from source allows you to customize the security tool executor or deploy the server across different platforms without external dependencies.

## Prerequisites

Before you build the MCP stdio binary, ensure you have the following tools installed:

- **Go 1.24 or later** – The `go.mod` file in Ed1s0nZ/CyberStrikeAI explicitly declares `go 1.24.0` as the minimum version. Install the latest Go toolchain from the official distribution or your package manager.
- **Git** – Required to clone the repository and verify module integrity via the included `go.sum` file.
- **Network access** – The build process automatically downloads third-party dependencies listed in `go.mod` from the Go module proxy. No manual dependency management is necessary.

## Building the MCP Stdio Binary

Follow these steps to compile the binary from the CyberStrikeAI source code.

### 1. Clone the Repository

```bash
git clone https://github.com/Ed1s0nZ/CyberStrikeAI.git
cd CyberStrikeAI

```

### 2. Compile the Binary

The entry point for the stdio server is located at [`cmd/mcp-stdio/main.go`](https://github.com/Ed1s0nZ/CyberStrikeAI/blob/main/cmd/mcp-stdio/main.go). Build it with the following command:

```bash
go build -o cyberstrike-ai-mcp cmd/mcp-stdio/main.go

```

The `-o cyberstrike-ai-mcp` flag specifies the output binary name. This command embeds all required packages into a single executable, making the binary portable without external runtime dependencies.

### 3. Cross-Compile for Different Platforms (Optional)

To build the MCP stdio binary for operating systems or architectures different from your host machine, set the `GOOS` and `GOARCH` environment variables before running `go build`.

**Example for Windows AMD64:**

```bash
GOOS=windows GOARCH=amd64 go build -o cyberstrike-ai-mcp.exe cmd/mcp-stdio/main.go

```

**Example for a static Linux binary (CGO disabled):**

```bash
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o cyberstrike-ai-mcp cmd/mcp-stdio/main.go

```

Disabling CGO produces a fully static binary ideal for minimal container environments or Alpine Linux deployments.

## What the Binary Does

Once built, the `cyberstrike-ai-mcp` binary initializes a complete MCP server stack according to the source code implementation in Ed1s0nZ/CyberStrikeAI.

The binary performs the following initialization sequence:

- **Loads configuration** via `internal/config.Load` (defined in [`internal/config/config.go`](https://github.com/Ed1s0nZ/CyberStrikeAI/blob/main/internal/config/config.go)), reading the YAML configuration file specified by the `-config` flag.
- **Initializes logging** through `internal/logger.New`, creating a Zap logger that writes exclusively to **stderr** to preserve the stdout JSON-RPC stream integrity.
- **Instantiates the MCP server** using `internal/mcp.NewServer` (see [`internal/mcp/server.go`](https://github.com/Ed1s0nZ/CyberStrikeAI/blob/main/internal/mcp/server.go)).
- **Registers security tools** via `internal/security.NewExecutor` (located in [`internal/security/executor.go`](https://github.com/Ed1s0nZ/CyberStrikeAI/blob/main/internal/security/executor.go)), binding built-in tools such as nmap and sqlmap to the MCP server.
- **Enters the stdio loop** by calling `mcp.Server.HandleStdio` (lines 71-84 in [`internal/mcp/server.go`](https://github.com/Ed1s0nZ/CyberStrikeAI/blob/main/internal/mcp/server.go)), which decodes line-delimited JSON-RPC messages from **stdin**, dispatches them to the appropriate MCP methods (e.g., `tools/list`, `tools/call`), and writes compact JSON-RPC responses to **stdout** with explicit buffer flushing after each message.

## Running and Testing the Binary

After building, you can run the MCP stdio binary directly from the command line.

Start the server with a custom configuration file:

```bash
./cyberstrike-ai-mcp -config my-config.yaml

```

Test the stdio communication by piping a JSON-RPC request directly into the binary:

```bash
echo '{"jsonrpc":"2.0","id":"1","method":"tools/list","params":{}}' | ./cyberstrike-ai-mcp

```

The binary processes the request and outputs the JSON-RPC response on **stdout**, while operational logs appear on **stderr**, maintaining the protocol separation required by MCP clients like Cursor or VS Code extensions.

## Summary

- The MCP stdio binary is built from [`cmd/mcp-stdio/main.go`](https://github.com/Ed1s0nZ/CyberStrikeAI/blob/main/cmd/mcp-stdio/main.go) using the standard Go 1.24 toolchain.
- Run `go build -o cyberstrike-ai-mcp cmd/mcp-stdio/main.go` to create a native binary, or use `GOOS`/`GOARCH` environment variables for cross-compilation.
- The binary embeds all dependencies and requires only a YAML configuration file to start the JSON-RPC server over stdio.
- Core functionality resides in [`internal/mcp/server.go`](https://github.com/Ed1s0nZ/CyberStrikeAI/blob/main/internal/mcp/server.go) (HandleStdio loop), [`internal/config/config.go`](https://github.com/Ed1s0nZ/CyberStrikeAI/blob/main/internal/config/config.go) (configuration loading), and [`internal/security/executor.go`](https://github.com/Ed1s0nZ/CyberStrikeAI/blob/main/internal/security/executor.go) (tool registration).

## Frequently Asked Questions

### What Go version is required to build the CyberStrikeAI MCP binary?

The CyberStrikeAI module requires **Go 1.24.0** or later, as specified in the `go.mod` file. Building with earlier versions will fail with a toolchain compatibility error.

### Can I run the binary without installing Go on the target machine?

Yes. Once you build the binary using `go build`, it becomes a self-contained executable with all dependencies statically linked. You can deploy the resulting `cyberstrike-ai-mcp` file to production servers or containers that do not have the Go toolchain installed.

### How do I build a completely static binary for Docker or Alpine Linux?

Set `CGO_ENABLED=0` when building to disable CGO, which removes dynamic linking against system C libraries. Use the command: `CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o cyberstrike-ai-mcp cmd/mcp-stdio/main.go`. This produces a portable static binary that runs in `scratch` or `alpine` containers.

### Where is the stdio protocol handling implemented in the source code?

The stdio transport logic is implemented in [`internal/mcp/server.go`](https://github.com/Ed1s0nZ/CyberStrikeAI/blob/main/internal/mcp/server.go), specifically in the `HandleStdio` method (lines 71-84). This method manages the line-delimited JSON-RPC decoding from stdin and ensures responses are flushed to stdout after each message, maintaining the MCP protocol contract.