OpenTofu Test
MCP server that scaffolds, mocks, validates and runs OpenTofu/Terraform native tests
OpenTofu Test is an open-source MCP server for developer tools. It runs locally on your machine and is started by your AI client.
- Pricing
- Open source
- Platforms
- CLI, Linux, macOS
- Runs
- Locally
- Version
- 0.1.0
- Listing updated
Similar MCP servers
Install
Run in a terminal
claude mcp add opentofu-test -- docker run -i --rm ghcr.io/ogormans-deptstack/opentofu-test-mcp:0.1.0Add to claude_desktop_config.json
{
"mcpServers": {
"opentofu-test": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"ghcr.io/ogormans-deptstack/opentofu-test-mcp:0.1.0"
]
}
}
}Add to ~/.cursor/mcp.json
{
"mcpServers": {
"opentofu-test": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"ghcr.io/ogormans-deptstack/opentofu-test-mcp:0.1.0"
]
}
}
}Add to .vscode/mcp.json
{
"servers": {
"opentofu-test": {
"type": "stdio",
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"ghcr.io/ogormans-deptstack/opentofu-test-mcp:0.1.0"
]
}
}
}Add to ~/.codeium/windsurf/mcp_config.json
{
"mcpServers": {
"opentofu-test": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"ghcr.io/ogormans-deptstack/opentofu-test-mcp:0.1.0"
]
}
}
}Add to your client's MCP settings (most use this shape)
{
"mcpServers": {
"opentofu-test": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"ghcr.io/ogormans-deptstack/opentofu-test-mcp:0.1.0"
]
}
}
}Using several servers? Build one config file with the MCP config generator.
About OpenTofu Test
The server gives an AI agent reference material for the OpenTofu and Terraform test grammar, covering run, assert and mock_provider blocks. Its scaffolding tool reads a module's variables and outputs to produce a starter .tftest.hcl file, and its schema-based tool emits mock_provider blocks from an initialized module's provider schema.
The README says it drives the tofu CLI when present and falls back to terraform. Static validation of test files works without either CLI, while schema and run-backed tools need one installed. The container image bundles OpenTofu.
It suits developers who use coding agents to write Terraform module tests and want the agent to check its own work before running the suite. Native tests can apply real infrastructure, so the README advises mounting only trusted modules.
Tools this server provides (5)
Taken from the project documentation; the running server may differ.
- tf_explain_test_schema
- Reference and example for a test-framework block.
- tf_scaffold_test
- Generates a .tftest.hcl starter from module variables and outputs.
- tf_gen_mock_provider
- Emits mock_provider blocks from the provider schema.
- tf_validate_test
- Statically checks a .tftest.hcl file or content.
- tf_run_tests
- Runs tofu test -json and returns a pass/fail summary.
What it does
- Test block reference
- Returns reference text and an example for a test-framework block such as run, assert or expect_failures.
- Test scaffolding from module
- Generates a .tftest.hcl starter with a run block, per-output assertions and placeholders for required variables.
- Mock provider generation
- Builds mock_provider blocks from the provider schema of an initialized module, with defaults for computed attributes.
- Static test validation
- Checks test files for invalid commands, missing assert fields and duplicate run names without running OpenTofu.
- Native test runner summary
- Runs tofu test in JSON mode and returns a condensed pass/fail summary per run.
Good for
- Letting a coding agent draft native tests for a Terraform module
- Catching malformed run or assert blocks before running a test suite
- Generating mock providers so module tests run without cloud credentials
- Summarising pass and fail results from tofu test runs for an agent
Pricing
Open source
MIT licensed, free to run locally or in Docker.
OpenTofu Test FAQ
Which CLI does the server need?
The README says it uses tofu when present and falls back to terraform. Schema- and run-backed tools need one of them; the explain and validate tools work without either.
Does OpenTofu Test need cloud credentials?
The README says the container image does not inherit host cloud credentials, and its own fixtures use the built-in terraform_data provider so no credentials are needed.
How is OpenTofu Test installed?
The README gives a go install command, prebuilt binaries on GitHub Releases, and a Docker image at ghcr.io/ogormans-deptstack/opentofu-test-mcp.
Is OpenTofu Test free?
Yes. OpenTofu Test is open source, so you can use and self-host it for free.
How do I add OpenTofu Test to Claude Code?
Run this command in your terminal: claude mcp add opentofu-test -- docker run -i --rm ghcr.io/ogormans-deptstack/opentofu-test-mcp:0.1.0
What are the best alternatives to OpenTofu Test?
The closest alternatives to OpenTofu Test are Universal Test Framework, Tofu, Testing, Forge Test MCP and Test Intel.
Where this comes from
- Description: written from the project's README and its MCP Registry entry.
- Install steps: from the official MCP Registry entry.