kode-gopher
A Go-native take on Cloudflare's Code Mode, for Google Cloud. kode-gopher is an MCP server (and a CLI). The model writes an ordinary Go program against the real cloud.google.com/go/... SDKs, and kode-gopher compiles it and runs it in a sandboxed Kubernetes pod. It returns a structured result.
Why Go: the model's tool surface already exists as importable packages, and the model has seen plenty of real code that uses them. Those packages include cloud.google.com/go/storage, Compute, BigQuery, GKE and k8s.io/client-go. So instead of generating typed stubs from tool schemas, as Cloudflare's TypeScript version does, the model writes a normal program. One agent step can make many API calls and return one result.
MCP client ──► kode-gopher serve ──► sandbox pod (agent-sandbox, gVisor on GKE)
(Claude Code, execute_go_code go build + run, with the Google Cloud SDKs
Claude Desktop, gcp_auth_status and client-go precompiled; credentials are
Gemini CLI, …) lookup_package_docs your own, or the signed-in user's
A typical snippet:
package snippet
import (
"context"
"cloud.google.com/go/storage"
"google.golang.org/api/iterator"
)
func run(ctx context.Context) (any, error) {
c, err := storage.NewClient(ctx)
if err != nil {
return nil, err
}
defer c.Close()
var names []string
it := c.Buckets(ctx, "my-project")
for {
b, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
return nil, err
}
names = append(names, b.Name)
}
return names, nil
}
Whatever run returns comes back to the model as JSON. Errors and panics come back as structured results too, and compile errors come back as phase=build. On GKE with gVisor, a snippet like this takes about 4 seconds end to end.
Two ways to run it
Status
Pre-alpha, and no release has been tagged yet. Built and verified so far:
- Local mode: the CLI and the stdio MCP server, on kind and on GKE Autopilot with gVisor.
- Fast builds: a CI-published sandbox image with the SDKs precompiled.
- In-cluster server: a GKE Gateway with a managed certificate, a static token or OAuth 2.1 sign-in fronting Google (with Google's Agent Identity credential vault), service-account mode, and the
client_credentialsgrant for automation. Real Google sign-in from Claude Code has been tested on GKE. - CI: presubmits, a kind end-to-end test, and signed multi-arch images.
What's next, and the evidence behind each step, are in docs/plan.md and docs/decisions.md.
Docs
gke-demos.github.io/kode-gopher has the user documentation: getting started, deploying for a team, concepts, and reference pages for the MCP tools, the CLI and the precompiled packages. Its sources are in docs/site.
Design and project records, in this repository:
Repository layout
Built on
- kubernetes-sigs/agent-sandbox — SandboxClaim / SandboxTemplate / SandboxWarmPool CRDs, in-pod runtime, controller, and Go client (
sigs.k8s.io/agent-sandbox/clients/go/sandbox). - gke-demos/go-runtime-sandbox: where kode-gopher started. We used its image as our base until slice 7;
cmd/sandbox-servernow implements the same agent-sandbox runtime protocol. - modelcontextprotocol/go-sdk — MCP server + client SDK.
- traefik/yaegi — only inside
experiments/yaegi-poc/(standalone module, not pulled into the main build) as the interpreter behind the shelved Slice 6 PoC.