Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Railway 10 min read How-to mediumAdept

Agentic Coding on Railway: A Practical Guide for 2026

Railway's official MCP server, per-PR preview environments with isolated databases, one-call rollback, environment promotion and per-environment secrets let agents like Claude Code, Cursor and Codex deploy, debug and validate their own PRs without leaving the loop. Five workflows are walked through: scaffolding and deploying a service, adding Postgres with migrations, creating preview environments, debugging failed deploys from structured logs, and agents testing their own PRs against preview URLs. Long-running migrations, multi-service ordering and cost reasoning still stall. The advice is to scope agent tokens to non-production environments, require human approval for production promotions, set spend alerts, watch for revert loops, add observability via MCP, and write business constraints where the agent can read them.

Assumes: PaaS deployment basicsModel Context ProtocolCI preview environments

Related posts

  • Less Dashboards. More Robots. Railway, for Agents

    Railway easyNovice

    Railway is repositioning its platform around coding agents, bundling the CLI, MCP configuration and agent skills behind a single installer (`install.sh --agents -y`) so harnesses like Claude or Codex can deploy, configure and debug services without the dashboard. The CLI gains `--json` output, non-interactive flags and explicit project/service/environment scoping. A CLI-based MCP and an OAuth Remote MCP replace the deprecated NPM server, and a route-first `use-railway` skill loads only the references a task needs. Safety layers include staged changesets reviewed as diffs, MCP `destructiveHint` flags, 48-hour soft deletes and workspace guardrails such as GitHub org allowlists.

  • Better Rails for Agents: A New Remote MCP and Railway Agent in the CLI

    Railway mediumAdept

    Railway shipped a remote MCP server at mcp.railway.com, which connects to MCP clients over OAuth with no local install, and a new `railway agent` CLI command for interactive, scripted or CI use with JSON output. The MCP surface is kept deliberately small at 7 tools, because every tool definition costs client context and multi-step operations cost a round-trip each. Questions such as "why is my deploy crashing" go to a `railway-agent` tool that runs the multi-step investigation server-side and returns one answer. Instead of a separate service, the MCP server is a stateless Koa route inside the main backend. It reuses the existing OIDC provider and permission controllers, passes per-request context through AsyncLocalStorage, and wraps tools in a factory that handles auth and errors.

  • Railway MCP - Stateful, Serverful, Pay-per-use Infrastructure

    Railway easyNovice

    Railway's MCP server lets coding agents deploy services and templates, create isolated environments, manage variables and pull logs, pitched alongside Railway's usage-based pricing and vertical autoscaling as a good fit for agent-driven infrastructure. The design deliberately omits destructive tools like delete actions. It runs as a local stdio server rather than a remote Streamable HTTP one, because Railway lacks OAuth and its users work in local editors. The server wraps the Railway CLI under the hood, which reuses the CLI's login flow and lets agents fall back to CLI commands when they hit edge cases.

  • Agents in the Sandbox

    Railway mediumAdept

    Railway sandboxes now ship Claude Code, Codex, OpenCode and Pi in the default image and can join an environment's private network, which lets agents test against real Postgres, Redis and internal services. The suggested workflow builds a template, configures a sandbox, takes a disk checkpoint, then creates or forks sandboxes from it so parallel agents start from a prepared workspace. Templates are cached builds from shell instructions, checkpoints are server-side disk snapshots that outlive the source sandbox, and forks clone a running sandbox's files but not its processes. TypeScript SDK and CLI examples cover detached agent sessions you can reattach to, port forwarding and a four-agent repo review app.

  • Harness engineering: leveraging Codex in an agent-first world

    OpenAI mediumAdept

    A small OpenAI team built and shipped an internal product of roughly a million lines over five months with zero manually written code, merging about 1,500 Codex-authored PRs at around 3.5 PRs per engineer per day, an estimated 10x faster than writing it by hand. The engineers' job shifted to building the environment agents work in. Each git worktree boots its own app instance, the Chrome DevTools Protocol lets agents drive the UI, and a per-worktree ephemeral observability stack can be queried with LogQL, PromQL and TraceQL. A short AGENTS.md acts as a map into a structured, CI-validated docs/ directory instead of one giant instruction file. A rigid layered domain architecture is enforced by custom linters whose error messages carry remediation instructions for the agent.

The quest for software engineering knowledge.

Look:
Layout: