railgrid

module
v0.2.35 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 1, 2026 License: Apache-2.0

README

railgrid

railgrid is an open-source control plane for platform teams.

Providers publish Kubernetes-style APIs, versioned actions and MCP tools into isolated tenant workspaces. Users, teams and organizations reach them through one portal, one CLI, one API and one MCP endpoint, and every call is authorized as the caller by the same RBAC. Edges extend the control plane to clusters and servers behind NAT through outbound tunnels, so the same workspace that holds an application also reaches the cluster it runs on.

Status: alpha. railgrid is at v0.1.x, every API is v1alpha1, and it is developed by a small team. There is no hosted service; you run the hub yourself. Expect breaking changes between minor versions until the APIs stabilize.

What railgrid gives you

  • Tenancy. Organizations, teams and users each get an isolated workspace with its own API surface. Membership and roles are first-party APIs. Authenticate with any OIDC provider or, for a single user, a static token.
  • Providers. Helm-installed extensions that bring an APIExport, controllers, a backend, a portal micro-frontend, MCP tools and actions. Tenants enable a provider in a workspace and get its APIs bound there. Organizations can also register providers they run themselves, reached over an edge (BYO providers).
  • Provider actions. Versioned verbs on resources, granted through the workspace's RBAC, callable by people and by agents (design).
  • One MCP endpoint per workspace. Tools from every enabled provider and every connected edge, aggregated into one Model Context Protocol server. Each tool call runs as the calling user (architecture).
  • Edges. Kubernetes clusters and Linux servers join through an agent that dials out. The hub proxies kubectl, SSH and selected in-cluster services to them.
  • A portal. One web UI that hosts each provider's micro-frontend under the tenant's identity.

Providers in this repository

Provider What it does
edges Connectivity: KubernetesCluster and LinuxServer edges, the agent tunnel, Service connectors, per-edge MCP
infrastructure Brokers kro application templates into tenant workspaces and runs them on a runtime cluster
app-studio Persistent AI project workspaces with a chat assistant, sandboxed development instances and publishing, on the tenant's own model credentials
agents Long-running personal agents with scheduled runs, tool use, approvals, budgets and memory, reachable from Slack, Telegram, Discord and email
code Source repositories, deploy keys and collaborators as workspace resources, on GitHub today
kuery Fleet-wide object search and relationship traversal across a workspace's connected clusters
quickstart A minimal reference provider that exercises the whole plugin surface

The provider directories listed above are mirrored read-only to railgrid/provider-* repositories. Open changes here.

How it fits together

                 people · CLI · portal · AI agents (MCP)
                                 │
                        ┌────────▼────────┐
                        │    railgrid hub    │   workspaces, OIDC, RBAC,
                        │                 │   provider registry, proxies
                        └──┬─────┬─────┬──┘
           provider APIs   │     │     │   outbound tunnels
      ┌────────────────────┘     │     └────────────────────┐
┌─────▼──────┐          ┌────────▼───────┐           ┌──────▼──────┐
│  platform  │          │   org-owned    │           │    edges    │
│  providers │          │   providers    │           │ clusters &  │
│ (in-cluster│          │ (your cluster, │           │   servers   │
│  with hub) │          │  over an edge) │           │ behind NAT  │
└────────────┘          └────────────────┘           └─────────────┘

The hub is the only component that needs to be reachable. Providers register with the hub and serve their APIs inside their own workspace; agents on edges connect outward. Traffic between the hub and everything else is HTTP/1.1 and WebSockets, so any reverse proxy, ingress or tunnel in front of the hub works.

Install

Hub
helm install railgrid-hub oci://ghcr.io/railgrid/charts/railgrid-hub \
  --namespace railgrid --create-namespace \
  --set hub.hubExternalURL=https://railgrid.example.com

That is a complete single hub; its control-plane store runs inside the same release. For TLS, OIDC, ingress and the provider hardening flags, see Helm deployment. Larger installs can run the control-plane store as separate shards: single hub, multi-shard.

To try railgrid on a laptop, the CLI can create a local hub in a kind cluster:

railgrid dev init
CLI

Download a binary from the releases page, or:

# krew
kubectl krew index add railgrid https://github.com/railgrid/krew-index.git
kubectl krew install railgrid/railgrid

# from source
go install github.com/railgrid/railgrid/cmd/railgrid@latest

Quickstart

1. Log in and pick a workspace
railgrid login --hub-url https://railgrid.example.com          # OIDC in the browser
railgrid login --hub-url https://railgrid.example.com --token <static-token>
railgrid use                                                 # choose organization and workspace

--hub-url can also come from RAILGRID_HUB_URL.

2. Connect a cluster
railgrid edge create my-cluster --type kubernetes
railgrid edge join-command my-cluster        # prints the agent install command with a one-time token

Run the printed command on the target cluster. Then:

railgrid edge list
railgrid edge kubeconfig my-cluster > kc.yaml
kubectl --kubeconfig kc.yaml get nodes
3. Connect a server
railgrid edge create my-server --type server
railgrid edge join-command my-server
railgrid ssh my-server -- uptime
4. Give an AI agent your workspace
railgrid mcp url --mcpserver-name default

This prints the workspace's MCP endpoint and ready-to-paste configuration, with its long-lived token, for Claude Code, Claude Desktop and Codex. The endpoint carries the tools of every enabled provider and every connected edge, and each call is authorized as you.

Security

The hub authenticates users with OIDC or a static token, and providers with their own workspace service-account token. Org-owned providers never see a user's bearer: they receive a short-lived, workspace-bound delegated token. Agents refuse to proxy to link-local and metadata addresses and can be locked to an allow-list. Webhooks into the agents provider are signature-checked. Details are in Security.

Some hardened behaviours ship off by default for one release so existing installs can roll forward; the Helm doc's section "Turning on the hardened defaults early" lists the values that turn them on.

To report a vulnerability, open a private security advisory on this repository rather than a public issue.

CLI reference

The full, generated reference is in docs/cli (one page per command, regenerated with make docs-cli). railgrid --help groups the commands the same way; railgrid completion --help sets up shell completion.

Command What it does
railgrid login --hub-url <hub> [--token t] [-i] Log in (browser OIDC with silent refresh, or a static token); writes the railgrid kubeconfig context
railgrid logout Forget the cached tokens and the railgrid contexts on this machine
railgrid use [--org O --workspace W] Switch the active organization and workspace (interactive picker without flags)
railgrid whoami [-o json] Hub, identity, token state, org/workspace with your roles, and what kubectl points at
railgrid token [--refresh] Print a current bearer for curl; --refresh forces the OIDC refresh grant
railgrid edge create|list|get|delete <name> Manage edges; list/get take -o wide|json|yaml|name
railgrid edge join-command|upgrade <name> Print the agent join command or upgrade instructions
railgrid edge kubeconfig <name> [-o file|--merge] Kubeconfig for a cluster edge through the hub, standalone or merged as context railgrid-<name>
railgrid connect [<edge>] / railgrid disconnect Point kubectl at a cluster edge and back at the hub workspace
railgrid ssh <name> [-- cmd] Open a shell or run a command on a server edge
railgrid org list|create|members … Organizations you belong to; members list|add|remove|set-role manage access
railgrid workspace list|create|members … Workspaces of an organization and their members
railgrid mcp url --mcpserver-name <name> / --edge <name> Print the workspace or per-edge MCP endpoint
railgrid env [--json] [--no-mcp] Print HUB, CLUSTER, ORG, WS, TOKEN, AS, MCP_URL, MCP_TOKEN as shell exports
railgrid app list|create|status|sync|promote|publish Manage App Studio projects
railgrid commit <repositoryRef> [--branch main] [--dry-run] Record local git commits through railgrid (code__commit_files)
railgrid sandbox sync|exec|logs|restart|status <instance> [component] Drive a development-mode instance through the data plane
railgrid agent join|run|install|uninstall|upgrade, railgrid install Run or install the agent on a cluster or host
railgrid dev init|update|delete Manage a local kind-based environment

Hidden: railgrid get-token (the kubectl exec plugin) and railgrid kcp-workspace (raw kcp workspace navigation).

Building an app from a terminal or an AI agent

These commands call the hub REST and MCP APIs as you, resolving the org and workspace UUIDs from the kubeconfig's railgrid context. Every one takes --org / --workspace (display name or UUID) to target another workspace, and the app and sandbox commands take -o json for raw output.

eval "$(railgrid env)"                          # exports for curl and scripts
railgrid app create shop --template application --display-name Shop --wait
railgrid app status shop                        # repository ref, commits, dev URL, promotion, publishing
gh repo clone <owner>/<repository ref> shop && cd shop
railgrid sandbox sync shop-dev api ./api        # authoritative sync of api/ into component "api"
railgrid sandbox exec shop-dev api -- node -e 'console.log(1)'   # exits with the command's exit code
railgrid sandbox logs shop-dev api -f
git add -A && git commit -m "Add cart"       # commit locally, never push
railgrid commit <repository ref>                # railgrid records the commit; your branch is reset onto it
railgrid app promote shop --hostname-prefix shop   # the prefix is locked after the first promote
railgrid app publish shop --mode public         # or restricted, or private

railgrid commit refuses to run when the working tree is dirty or origin/<branch> has moved past your base. railgrid commit and railgrid sandbox sync send binary files base64-encoded (at most 25 MiB each, 48 MiB per commit or sync) when the hub's code provider or the component's dev agent supports it. Otherwise commit refuses a change that includes binaries and sync skips them with a warning. exec needs a prior sync.

Repository layout

Path Contents
cmd/ railgrid CLI (which also runs the agent through railgrid agent), railgrid-hub, and the release helper
pkg/hub Hub: control-plane bootstrap, tenancy, provider registry, proxies, MCP aggregation
pkg/agent Edge agent and tunnel
providers/ The providers listed above, each its own Go module
deploy/charts Helm charts for the hub and the agent
docs/ Published docs and design documents
skills/railgrid Agent skill for using a hub from Claude Code, Codex or Cursor; railgrid skills install fetches it from GitHub into both clients, the repo is also a Claude Code plugin marketplace (/plugin marketplace add railgrid/railgrid) and ships it under .agents/skills for Codex (install)

Documentation

Published: Getting started · Helm deployment · Security · Ingress · MCP architecture · Developer guide

Design documents in this repository: providers, organizations and the workspace tree, provider scoping, provider actions, BYO providers, MCP architecture.

Under the hood

Workspaces are served by kcp, which gives every tenant a Kubernetes-style API server without a cluster per tenant; providers publish their APIs into it and tenants bind them. You meet this as an operator when you size and back up the hub, and as a provider author when you write one. Users see the portal, the CLI, the API and MCP.

Contributing

See CONTRIBUTING.md for building, running the local stack, tests and the pull-request workflow.

License

Apache 2.0. See LICENSE.

Directories

Path Synopsis
apis
admin/v1alpha1
Package v1alpha1 contains the platform-owner-only admin API.
Package v1alpha1 contains the platform-owner-only admin API.
providers/v1alpha1
Package v1alpha1 contains the platform-owner-only API for managing railgrid providers (extensions).
Package v1alpha1 contains the platform-owner-only API for managing railgrid providers (extensions).
railgrid/v1alpha1
Package v1alpha1 contains API types for the railgrid API group.
Package v1alpha1 contains API types for the railgrid API group.
tenancy/v1alpha1
Package v1alpha1 contains tenancy API types for user management.
Package v1alpha1 contains tenancy API types for user management.
cmd
railgrid command
Package main is the entrypoint for the railgrid CLI.
Package main is the entrypoint for the railgrid CLI.
railgrid-hub command
Package main is the entrypoint for the railgrid-hub server.
Package main is the entrypoint for the railgrid-hub server.
railgrid-runner command
Command railgrid-runner serves the loopback-only generic runner protocol.
Command railgrid-runner serves the loopback-only generic runner protocol.
release command
Command release cuts release tags for railgrid components.
Command release cuts release tags for railgrid components.
config
kcp
Package kcp embeds kcp configuration files.
Package kcp embeds kcp configuration files.
hack
dex/web
Package web provides embedded web assets for the dex server.
Package web provides embedded web assets for the dex server.
edges-macos command
Command macos-stub is a localhost-only health endpoint used to validate the Edges Service transport on a MacOSServer.
Command macos-stub is a localhost-only health endpoint used to validate the Edges Service transport on a MacOSServer.
gen-core-apiexport command
gen-core-apiexport merges all individual APIExport YAMLs under config/kcp/ into a single "core.railgrid.ai" APIExport that covers every API group.
gen-core-apiexport merges all individual APIExport YAMLs under config/kcp/ into a single "core.railgrid.ai" APIExport that covers every API group.
pkg
agent
Package agent implements the railgrid agent that connects edges to the hub.
Package agent implements the railgrid agent that connects edges to the hub.
agent/discovery
Package discovery detects HTTP services running on the edge host next to the agent (e.g.
Package discovery detects HTTP services running on the edge host next to the agent (e.g.
agent/harnessplane
Package harnessplane makes a machine a harness host for its workspace.
Package harnessplane makes a machine a harness host for its workspace.
agent/reconciler
Package reconciler reconciles workloads on the agent side: it watches the edge's Placements in the tenant workspace and materializes each as a local Deployment.
Package reconciler reconciles workloads on the agent side: it watches the edge's Placements in the tenant workspace and materializes each as a local Deployment.
agent/runner/supervisor
Package supervisor runs one long-lived child process for a supervised harness runner and keeps it running.
Package supervisor runs one long-lived child process for a supervised harness runner and keeps it running.
agent/status
Package status reports agent status back to the hub.
Package status reports agent status back to the hub.
agent/tunnel
Package tunnel implements reverse-dial tunneling between agent and hub.
Package tunnel implements reverse-dial tunneling between agent and hub.
apiurl
Package apiurl is the single source of truth for all railgrid service path construction and URL parsing.
Package apiurl is the single source of truth for all railgrid service path construction and URL parsing.
browsersession
Package browsersession owns the hub's shared browser login session.
Package browsersession owns the hub's shared browser login session.
cli/auth
Package auth handles OIDC authentication for the CLI.
Package auth handles OIDC authentication for the CLI.
cli/cmd
Package cmd implements the railgrid CLI commands.
Package cmd implements the railgrid CLI commands.
cli/cmd/dev/cmd
Package cmd provides the railgrid dev command and its subcommands.
Package cmd provides the railgrid dev command and its subcommands.
cli/cmd/dev/plugin
Package plugin provides the implementation for railgrid dev command plugins.
Package plugin provides the implementation for railgrid dev command plugins.
client
Package client provides dynamic Kubernetes client utilities.
Package client provides dynamic Kubernetes client utilities.
hub
Package hub implements the railgrid hub server.
Package hub implements the railgrid hub server.
hub/actionproof
Package actionproof signs the human and tenant context of a kcp custom subresource request so a provider can make a narrowly authorized hub REST call without forwarding the caller's bearer token.
Package actionproof signs the human and tenant context of a kcp custom subresource request so a provider can make a narrowly authorized hub REST call without forwarding the caller's bearer token.
hub/admin
Package admin implements the platform-admin surface mounted at /api/admin/* and surfaced in the portal's gated /bonkers area.
Package admin implements the platform-admin surface mounted at /api/admin/* and surfaced in the portal's gated /bonkers area.
hub/appauth
Package appauth is the hub's login-time authorization endpoint for published applications.
Package appauth is the hub's login-time authorization endpoint for published applications.
hub/bootstrap
Package bootstrap embeds bootstrap resources for hub initialization.
Package bootstrap embeds bootstrap resources for hub initialization.
hub/controllers/mcpserver
Package mcpserver reconciles MCPServer objects.
Package mcpserver reconciles MCPServer objects.
hub/controllers/membershipindex
Package membershipindex implements the UMI invariant reconciler: a controller that watches UserMembershipIndex CRs in root:railgrid:users and repairs rows that strand a user.
Package membershipindex implements the UMI invariant reconciler: a controller that watches UserMembershipIndex CRs in root:railgrid:users and repairs rows that strand a user.
hub/controllers/organization
Package organization gives every new organization the same bootstrap lifecycle.
Package organization gives every new organization the same bootstrap lifecycle.
hub/controllers/softdelete
Package softdelete implements roadmap step 8: the soft-delete reconciler that honours the 30-day grace window from docs/organizations.md decisions O-8 (User delete) and O-13 (Org + Workspace delete).
Package softdelete implements roadmap step 8: the soft-delete reconciler that honours the 30-day grace window from docs/organizations.md decisions O-8 (User delete) and O-13 (Org + Workspace delete).
hub/hubaccess
Package hubaccess implements the hub-access half of the provider contract: the hub REST capabilities a provider may exercise with an admitted caller context, supplied either by a delegated user token or a short-lived action proof minted at the authenticated kcp front door.
Package hubaccess implements the hub-access half of the provider contract: the hub REST capabilities a provider may exercise with an admitted caller context, supplied either by a delegated user token or a short-lived action proof minted at the authenticated kcp front door.
hub/identity
Package identity is the hub's scoped-identity service: the one place a runtime credential for a tenant object is created.
Package identity is the hub's scoped-identity service: the one place a runtime credential for a tenant object is created.
hub/kcp
Package kcp bootstraps kcp API resources.
Package kcp bootstraps kcp API resources.
hub/leaderelection
Package leaderelection gates the hub's singleton controllers so a hub scaled to multiple replicas still reconciles each object exactly once.
Package leaderelection gates the hub's singleton controllers so a hub scaled to multiple replicas still reconciles each object exactly once.
hub/mcpaggregate
Package mcpaggregate serves the hub's always-on aggregate MCP endpoint.
Package mcpaggregate serves the hub's always-on aggregate MCP endpoint.
hub/metering
Package metering is how the hub finds the contrib-metering deployment and lets the admin area read it.
Package metering is how the hub finds the contrib-metering deployment and lets the admin area read it.
hub/providerclaims
Package providerclaims is the one answer to "which permission claims does a tenant's APIBinding to a provider's export carry".
Package providerclaims is the one answer to "which permission claims does a tenant's APIBinding to a provider's export carry".
hub/providers
Package providers backs the hub's pluggable-provider extension surface: an in-memory routing table, reverse proxies for /ui/providers/{name}/* and /services/providers/{name}/*, and the controller that keeps the table in sync with ProviderCatalogEntry resources.
Package providers backs the hub's pluggable-provider extension surface: an in-memory routing table, reverse proxies for /ui/providers/{name}/* and /services/providers/{name}/*, and the controller that keeps the table in sync with ProviderCatalogEntry resources.
hub/quota
Package quota implements the organizations-per-user caps pinned by decision O-5 in docs/organizations.md: how many Organizations one User may create, and how many of the Organizations they administer may be on the free plan at once.
Package quota implements the organizations-per-user caps pinned by decision O-5 in docs/organizations.md: how many Organizations one User may create, and how many of the Organizations they administer may be on the free plan at once.
hub/restapi
Package restapi implements roadmap step 10: the hub-mediated REST surface for Org / Workspace / Membership / User CRUD per docs/organizations.md decision O-10 ("Org workspaces are hub-mediated only"), plus the undelete actions wired to PR #212's soft-delete reconciler, the self-leave / role PATCH from O-12, and the ?cascade=true shortcut from O-9.
Package restapi implements roadmap step 10: the hub-mediated REST surface for Org / Workspace / Membership / User CRUD per docs/organizations.md decision O-10 ("Org workspaces are hub-mediated only"), plus the undelete actions wired to PR #212's soft-delete reconciler, the self-leave / role PATCH from O-12, and the ?cascade=true shortcut from O-9.
hub/serviceaccounts
Package serviceaccounts implements roadmap step 9 (O-14): bot identity for child Workspaces via native kube `core/v1.ServiceAccount`s marked with railgrid annotations.
Package serviceaccounts implements roadmap step 9 (O-14): bot identity for child Workspaces via native kube `core/v1.ServiceAccount`s marked with railgrid annotations.
hub/sharedstore
Package sharedstore is the hub's cross-replica key/value store for short-lived login state: browser sessions and published-app authorization codes.
Package sharedstore is the hub's cross-replica key/value store for short-lived login state: browser sessions and published-app authorization codes.
hub/tenant
Package tenant implements the hub-side tenant middleware described in docs/organizations.md §Switch the active context.
Package tenant implements the hub-side tenant middleware described in docs/organizations.md §Switch the active context.
hub/workloadidentity
Package workloadidentity owns the production provider-action workload capability exchange.
Package workloadidentity owns the production provider-action workload capability exchange.
kcppaths
Package kcppaths is the single source of truth for the railgrid kcp workspace topology.
Package kcppaths is the single source of truth for the railgrid kcp workspace topology.
runner
Package runner provides a durable, authenticated local execution service.
Package runner provides a durable, authenticated local execution service.
runner/client
Package client reaches one enrolled railgrid runner through the edges provider's published Service proxy, speaking the typed runner/v1 protocol in pkg/runner.
Package client reaches one enrolled railgrid runner through the edges provider's published Service proxy, speaking the typed runner/v1 protocol in pkg/runner.
runner/dispatch
Package dispatch is the runner/v1 attempt lifecycle, written once.
Package dispatch is the runner/v1 attempt lifecycle, written once.
runner/harness
Package harness defines the public execution seam for runner adapters.
Package harness defines the public execution seam for runner adapters.
runner/harness/claude
Package claude adapts headless Claude Code to the runner harness.
Package claude adapts headless Claude Code to the runner harness.
runner/harness/codex
Package codex adapts the Codex app-server protocol to the runner harness.
Package codex adapts the Codex app-server protocol to the runner harness.
runner/harness/internal/proc
Package proc holds the process-group primitives every harness adapter needs.
Package proc holds the process-group primitives every harness adapter needs.
runner/runnercli
Package runnercli holds the launch logic shared by the standalone railgrid-runner binary (cmd/railgrid-runner) and the `railgrid runner run` subcommand of the main CLI (pkg/cli/cmd/runner.go).
Package runnercli holds the launch logic shared by the standalone railgrid-runner binary (cmd/railgrid-runner) and the `railgrid runner run` subcommand of the main CLI (pkg/cli/cmd/runner.go).
server/auth
Package auth provides server-side OIDC token verification.
Package auth provides server-side OIDC token verification.
server/proxy
Package proxy reverse-proxies authenticated requests to kcp.
Package proxy reverse-proxies authenticated requests to kcp.
util/confighelpers
Package confighelpers provides bootstrap helpers inspired by github.com/kcp-dev/kcp/config/helpers.
Package confighelpers provides bootstrap helpers inspired by github.com/kcp-dev/kcp/config/helpers.
util/conncontext
Package conncontext stores and retrieves net.Conn from context.
Package conncontext stores and retrieves net.Conn from context.
util/identity
Package identity builds the cross-workspace ServiceAccount identity railgrid authorizes foreign SAs under.
Package identity builds the cross-workspace ServiceAccount identity railgrid authorizes foreign SAs under.
util/localuser
Package localuser resolves the local account a privileged installer or supervisor drops privileges to.
Package localuser resolves the local account a privileged installer or supervisor drops privileges to.
util/safeio
Package safeio writes files and directories into a location that a less privileged account can influence, without letting that account redirect the write.
Package safeio writes files and directories into a location that a less privileged account can influence, without letting that account redirect the write.
version
Package version holds build-time version information injected via ldflags.
Package version holds build-time version information injected via ldflags.
test
e2e/cases
Package cases contains shared e2e test case builders that are reused across multiple test suites.
Package cases contains shared e2e test case builders that are reused across multiple test suites.
e2e/framework
Package framework provides shared test infrastructure for railgrid e2e tests.
Package framework provides shared test infrastructure for railgrid e2e tests.
utils
testfakes
Package testfakes provides shared fake implementations for unit testing controllers that depend on multicluster-runtime manager and cluster interfaces.
Package testfakes provides shared fake implementations for unit testing controllers that depend on multicluster-runtime manager and cluster interfaces.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL