TL;DR / Executive Summary
This technical user guide provides comprehensive instructions on how to install and configure the ZeroChain MCP server, utilize the compile_cpp tool within your agent's system prompt, and manage binary cleanup to maintain a pristine workspace.
What is the ZeroChain User Guide?
This User Guide serves as the definitive technical manual for integrating the ZeroChain micro-toolchain into your local AI development environment. It details the Model Context Protocol (MCP) configuration required to connect ZeroChain to clients like Claude Desktop or Google Antigravity, and provides best practices for prompting your agents to leverage the compilation and cleanup tools effectively.
Step 1: Installing the MCP Server
ZeroChain is distributed as a standalone executable MCP server. Because it embraces a "zero-configuration" philosophy, there are no complex dependencies or environment variables to set. The server manages its own internal C++ compiler downloads automatically.
To connect ZeroChain to your MCP client, you must define it in your client's configuration file (e.g., claude_desktop_config.json). Add the following server definition:
{
"mcpServers": {
"zerochain": {
"command": "C:\\path\\to\\zerochain-server.exe",
"args": [
"--timeout=5000",
"--auto-provision=true"
]
}
}
}
When the client restarts, it will automatically connect to the ZeroChain server via standard input/output (STDIO) and discover the available C++ compilation tools.
Step 2: Understanding the Exposed Tools
Once connected, ZeroChain exposes three distinct tools to the AI agent. It is crucial to understand the purpose and schema of each tool to guide your agent effectively.
1. The compile_cpp Tool
This is the primary workhorse of the ZeroChain suite. The agent passes the absolute path of the .cpp file it wishes to compile. ZeroChain handles the path translation, invokes the sandboxed compiler, and returns the compilation status.
Parameters:
source_file(string, required): The absolute path to the C++ source file.optimization_level(string, optional): E.g., "-O0", "-O2", "-O3". Defaults to "-O0" for rapid iteration.
If compilation fails, ZeroChain intercepts the raw GCC error output, formats it for readability, and returns it directly into the LLM's context window so it can immediately diagnose syntax or type errors.
2. The run_binary Tool
Once successfully compiled, the agent uses this tool to execute the resulting executable. ZeroChain wraps this execution in a strict timeout monitor (default 5000ms) to prevent infinite loops from freezing the system.
Parameters:
binary_path(string, required): The path to the compiled executable (returned by compile_cpp).args(array, optional): Command-line arguments to pass to the executable.
3. The cleanup_binary Tool
To prevent workspace clutter, agents should invoke this tool after their testing phase is complete. It safely deletes the generated .exe and .o files.
Parameters:
binary_path(string, required): The path to the compiled executable to delete.
Step 3: Prompting Best Practices
Simply providing the tools to the LLM is often not enough. To achieve highly autonomous, deterministic behavior, you should include specific directives in your agent's system prompt to guide its usage of ZeroChain.
When asked to write or modify C++ code, you must ALWAYS verify your logic using the ZeroChain tools.
1. Write the code to a .cpp file.
2. Use compile_cpp to build it. If it fails, read the errors and fix your code.
3. Use
un_binary to execute the code and verify the output matches expectations.
4. If you receive a TIMEOUT error, you have created an infinite loop. Fix your logic.
5. Once you have fully verified the code works, you MUST call cleanup_binary to keep the workspace clean.
By enforcing this workflow in the system prompt, you ensure the agent leverages the full safety and isolation capabilities of ZeroChain, resulting in a perfectly clean, highly efficient C++ development loop.
Frequently Asked Questions
Do I need to install GCC or MSVC before using ZeroChain?
No. ZeroChain's primary advantage is its zero-configuration architecture. If the --auto-provision=true flag is set, it will silently download and configure its own minimal C++ compiler on the first run.
What happens if my agent writes a malicious script?
While ZeroChain intercepts and stops infinite loops via strict timeouts, it currently operates at the user privilege level of the MCP server. It is highly recommended to run your MCP client in a restricted user environment if you are concerned about file-system level destructive commands.