Skip to content

The engine's environment

Providers run in the engine, so the environment they see is the engine’s, with the variables the server sends by name laid over it. What the engine’s own environment holds depends on how the engine runs: started by the server on demand, as the turf Homebrew service, in a terminal, or as a deployment of your own. turf-mcp-server engine status says which.

By default the server starts the engine when a tool first needs it. That engine has a small fixed environment, the same whichever agent or shell the server came from:

  • HOME, USER, LOGNAME, SHELL and TMPDIR;
  • the TURF_* settings (all but TURF_MCP_AUTH_TOKEN and TURF_PROVIDER_ENV), DO_NOT_TRACK and CI, from the server’s environment;
  • TF_PLUGIN_CACHE_DIR and TF_CLI_CONFIG_FILE, from the server’s environment;
  • a PATH of Homebrew’s and the system’s directories.

Nothing else of your session is in it. Providers get what they need in one of these ways:

  • Credential files need nothing set. The default profile in ~/.aws/config, ~/.kube/config, gcloud’s application-default credentials and the az login are read as anywhere. Most readers need nothing more.
  • A variable of yours. Name it in your agent’s entry for Turf: the variable in the env block, such as AWS_PROFILE, and TURF_PROVIDER_ENV naming it. The server sends it with each run. See Send a variable to providers.
  • A configuration’s own settings. A profile or a kubeconfig path that belongs to one directory, or a tool version, goes in that directory’s mise environment: see Per-configuration environment with mise.
  • Provider arguments in the configuration, below.

The Homebrew service and turf.env are for what the engine itself needs: a proxy, a PATH with extra tools, a registry token for the engine’s own installs.

brew services start turf runs the same engine from login, and takes over one a server started. The service runs the engine with launchd’s environment on a Mac, Homebrew’s PATH, and what ~/.homebrew/services/turf.env sets. It does not see your shell’s environment. Put what the engine itself needs in turf.env, one KEY=value per line:

~/.homebrew/services/turf.env
HTTPS_PROXY=http://proxy.example.com:3128
NO_PROXY=.internal.example.com

Then restart the service:

Terminal window
brew services restart turf

The server makes its own calls (init’s installs, the state backend), from its own environment: give it the proxy in the env of Turf’s entry too. A provider’s variable set in turf.env reaches providers as part of the engine’s environment, and one you name in your agent’s entry is laid over it.

A run paused at a plan gate or an approval point waits through the restart.

turf.env holds the service’s other settings too: TURF_MISE=off turns off mise, and TURF_CONSOLE_ADDR, DO_NOT_TRACK and TURF_ACCEPT_EULA are read there, not in your shell.

An engine the server started takes the same settings from the environment of the server that started it. To change one, put it in the env of Turf’s entry in each agent that has one, reconnect the agent, then run turf-mcp-server engine stop: the next call starts the engine with the new setting.

To watch the engine work, run it in the foreground:

Terminal window
export AWS_PROFILE=platform-admin
turf-mcp-server engine run

It has that terminal’s environment, and runs until you interrupt it.

When TURF_RESTATE_URL points the server at an engine you run yourself, the engine has whatever its deployment gives it. In a Kubernetes® cluster that is the engine pod’s environment: Secrets, through env or envFrom. See Credentials in a cluster.

The engine starts once the license terms are accepted, and where it looks follows the same rule as everything else on this page: its own environment, never your shell’s.

  • An engine the server started is accepted as the server is: by the record turf license accept or turf-mcp-server license accept writes, ~/.turf/license.json, or by TURF_ACCEPT_EULA=yes in the server’s environment. The server starts no engine before that.
  • The Homebrew service reads the same record. It waits for it, checking every 2 seconds, and starts the engine within seconds, with no restart. TURF_ACCEPT_EULA=yes in turf.env accepts too, after a restart of the service. The same variable in your shell, or in your MCP client’s configuration, does not reach the service.
  • An engine in a terminal reads the same record, or TURF_ACCEPT_EULA=yes in that terminal.
  • A remote engine reads only its own environment, or its --accept-eula flag. In a pod that is an env entry: see Minimal manifests.

Setting TURF_ACCEPT_EULA=yes accepts the terms at https://turf.build/license/v1/. Until the terms are accepted, turf-mcp-server engine status says awaiting license. More in Accept the license.

Credentials in their usual files are read in the engine as anywhere: the default profile in ~/.aws/config, ~/.kube/config. The local engine is this user’s, so it reads your files. A remote engine reads its own.

Provider plugins run with the configuration directory as their working directory. A relative path a provider resolves, such as a kubeconfig it writes, lands there, as with Terraform® run from that directory.

Arguments in a provider block (profile, assume_role, config_path) override the environment. They are the way to pin an account in the configuration itself:

providers.tf
provider "aws" {
profile = "staging"
region = var.region
}

A secret in a provider block arrives through a variable, never a literal. With the credentials in the environment a provider gets, a default provider instance needs no block at all; aliased instances need their own blocks for what differs.

Between runs the engine reads objects by itself: the confirming read of an object marked as changed, and the sweep (Drift). Those reads run providers with this same environment, and three settings here bound them. Set them where the engine’s other settings go: the env of Turf’s entry for an engine the server started, turf.env for the Homebrew service, the engine’s pods in a cluster, the same on every replica. The engine reads them at start.

Variable Default Meaning
TURF_DRIFT_READ_RATE 5 Background reads a second, for each provider. A decimal is accepted.
TURF_DRIFT_READ_BURST 10 How many of those reads may go out at once.
TURF_DRIFT_WEBHOOK_<NAME> unset A value a drift webhook may send as its auth header.

The read budget. There is one budget for each provider, by its source address such as registry.opentofu.org/hashicorp/kubernetes, shared by every workspace on the engine. Two clusters behind one provider share it. A marked object’s confirming read is served first, and the sweep takes only from the upper half of the budget, so a sweep cannot starve it. A run’s own plan and apply never draw on the budget.

That reserve also sets the sweep’s pace. A swept batch takes at most what is above the reserve, 5 reads at the default burst of 10, and never waits for more. So at the defaults the sweep reads about two objects a second, whatever the rate, and a larger TURF_DRIFT_READ_BURST lets a batch take more. To size a sweep cycle from this: Choosing a cycle.

The webhook. A workspace’s drift settings can name a webhook, for a host that cannot hold a watch open. The engine posts each new notice to it as JSON: addresses, classes and paths, never values.

  • No secret is kept in the settings. They name a header and an environment variable of the engine, and the variable’s name must begin TURF_DRIFT_WEBHOOK_, so a webhook can send only a value you set aside for it.
  • The header is sent only over https, or to a loopback address. Redirects are not followed.
  • A delivery is tried up to five times. One that still fails is recorded, and the notice stays open to status and watch.
  • The drift tool turns detection on and off and sets settle, sweep and confirm. It leaves a webhook as it stands. A webhook is set on the engine itself, through its drift service on restate-server’s ingress.
Terminal window
turf-mcp-server engine status

With the npx install, npx -y @turfbuild/turf-mcp-server engine status. It says where the engine runs, how it was started and whether it answers, the mise it found (or off), and where its logs are:

directory /Users/you/.turf/engine
…
mise /usr/local/bin/mise (2025.11.10 macos-x64 (2025-11-27))
logs /Users/you/.turf/engine/restate.log
/Users/you/.turf/engine/engine.log

If the engine does not come up, the reason is in engine.log, or in supervisor.log beside it for an engine the server started.

Provider Environment variables
AWS AWS_PROFILE, AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY, AWS_REGION
Azure ARM_SUBSCRIPTION_ID, ARM_CLIENT_ID, ARM_CLIENT_SECRET, ARM_TENANT_ID
Google Cloud GOOGLE_APPLICATION_CREDENTIALS, GOOGLE_PROJECT

Why the engine and not the server: Where credentials are read.

Turf™ is a trademark of Turf LLC. Terraform® is a trademark of HashiCorp. Ansible® is a trademark of Red Hat, LLC, registered in the United States and other countries. Helm®, Kubernetes®, Prometheus® and OpenTelemetry® are registered trademarks, and Jaeger™ is a trademark, of the Linux Foundation. OpenTofu® and Model Context Protocol® are registered trademarks of LF Projects, LLC. All other trademarks are the property of their respective owners. Turf is not affiliated with, endorsed by, or sponsored by HashiCorp, IBM, Red Hat, the Linux Foundation, LF Projects or the OpenTofu project.

© 2026 Turf LLC. Free for individuals, education and small businesses within the Community limits, under the Turf Community Edition License 1.0. Government and larger organizations need a commerciallicense.turf.build · Discord ·GitHub