Skip to content

Connecting clients

Any client that speaks MCP over HTTP can drive Turf™ in a cluster. It connects to the server’s /mcp endpoint and sends one header with every request:

Authorization: Bearer <token>

The token is the one in the turf-mcp-auth Secret, which the server reads as TURF_MCP_AUTH_TOKEN . A request without it gets 401. An agent in the cluster connects to the Service, Claude Code on your laptop through a port-forward, a CI job like any other client.

Through a port-forward, without the token:

Terminal window
kubectl port-forward -n turf svc/turf-mcp-server 3000
curl -s -o /dev/null -w '%{http_code}\n' -X POST http://127.0.0.1:3000/mcp # 401

Read the token out of its Secret when a client needs it:

Terminal window
kubectl -n turf get secret turf-mcp-auth -o jsonpath='{.data.token}' | base64 -d

Forward the server’s port, then register it with Claude Code over HTTP, the header included:

Terminal window
kubectl port-forward -n turf svc/turf-mcp-server 3000
Terminal window
claude mcp add --transport http turf http://localhost:3000/mcp \
--header "Authorization: Bearer $(kubectl -n turf get secret turf-mcp-auth -o jsonpath='{.data.token}' | base64 -d)"

A port-forward reaches the pod through the API server, past the cluster’s network plugin, so the server’s NetworkPolicy need not admit you: the token is what you show. Paths you name to init are paths in the server’s pod, such as /turf/config, not on your laptop. With TURF_CONSOLE_URL set to http://localhost:8873 on the server and the console forwarded too, the console_url in every result opens in your browser (The console in a cluster).

An agent’s pod connects to the Service, http://turf-mcp-server.turf.svc.cluster.local:3000/mcp, with the header, and the server’s NetworkPolicy admits its pods (Minimal manifests). How the agent gets the header is its runtime’s business. kagent sends it from a Secret named in a RemoteMCPServer’s headersFrom, and the agent’s own sandbox never holds it: see An agent in the cluster, with kagent.

A CI job is one more client: the same endpoint and the same header, with the token from the CI system’s secrets. Two server flags shape what such a client gets:

  • --tier (read, plan, apply or full) decides which tools a server lists and what their arguments may do. A credential handed to a server buys its tier’s calls and no other. At plan, every run is plan_only and ends planned, with a planfile for an applier. To give one client less than another, run a server per tier, each with its own token.
  • --deadline is how long a convergence call may run before it returns the stage the convergence has reached, with ended: false and next naming the call that follows, while the convergence goes on in the engine. The default, 55 seconds, sits under the MCP TypeScript SDK’s 60-second request timeout. Keep the deadline under the client’s call timeout. kagent gives a call 30 seconds by default. The kagent example raises that to five minutes and runs the server with --deadline=4m, so an apply in AWS ends inside one call and kagent asks for approval once.

A job that only connects to the server sets nothing for the license: acceptance belongs to the server and the engine, in their pods (Minimal manifests). A job that runs Turf itself, the turf CLI or a server of its own, has no terminal to answer on, so without acceptance turf prints the license notice and exits with status 77. Set TURF_ACCEPT_EULA=yes in the job’s environment. Setting it accepts the terms at https://turf.build/license/v1/, so it is a decision for whoever owns the pipeline, made once and kept in the CI system’s variables.

TURF_RESTATE_URL points the Turf CLI (or a server on your laptop) at an engine running elsewhere, such as in a cluster, instead of the local engine. The server then runs on your laptop and the engine in the cluster, which settles three things:

  • The configuration. The engine reads each configuration itself, so it must find it: at the same path the server names, or below turf-engine --workdir, with the server’s --workdir set to the directory holding the same layout.
  • Credentials. The state backend’s credentials and TF_VAR_ come from your laptop’s environment, where the server runs. Providers still run in the engine, with the engine pod’s credentials. Variables your server names in TURF_PROVIDER_ENV are sent there too, and a path among them names a file on the engine pod: see Variables the server sends.
  • Versions. The Turf CLI and turf-mcp-server must be the same release.
Client Connects to Shows
An agent in the cluster the Service, turf-mcp-server.turf.svc:3000/mcp the bearer token, from a Secret
Claude Code on a laptop localhost:3000/mcp, through kubectl port-forward the bearer token, in --header
A CI job the server’s endpoint the bearer token, from the CI system’s secrets
The Turf CLI restate-server’s ingress, TURF_RESTATE_URL nothing: the ingress has no authentication

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