---
title: "Better Rails for Agents: A New Remote MCP and Railway Agent in the CLI"
description: "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."
url: "https://swe.quest/articles/better-rails-for-agents-a-new-remote-mcp-and-railway-agent-in-the-cli-4b9abaf62a02f3cd"
canonical: "https://blog.railway.com/p/agent-rails-remote-mcp-cli"
source: "Railway"
published: "2026-04-17"
difficulty: "medium"
kind: "Announcement"
reading_minutes: 13
tags: ["ai-agents","api-design","developer-tools","typescript"]
---

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

A post on [Railway](https://swe.quest/sources/railway.md), published 2026-04-17, 13 min read, Announcement. Original: [https://blog.railway.com/p/agent-rails-remote-mcp-cli](https://blog.railway.com/p/agent-rails-remote-mcp-cli)

## Summary

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.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [AI agents](https://swe.quest/tags/ai-agents.md) (AI & ML)
- [API design](https://swe.quest/tags/api-design.md) (Backend & APIs)
- [Developer tools](https://swe.quest/tags/developer-tools.md) (Engineering practices)
- [TypeScript](https://swe.quest/tags/typescript.md) (Languages)

## Prerequisites

- Model Context Protocol basics
- OAuth ([easy posts on Identity & auth](https://swe.quest/tags/identity-auth.md?difficulty=easy))
- Node.js async context ([easy posts on JavaScript](https://swe.quest/tags/javascript.md?difficulty=easy))

## Keywords

Railway, MCP, Railway CLI, AsyncLocalStorage, Koa, OAuth, Claude Code, Cursor

## Related posts

- [Railway MCP - Stateful, Serverful, Pay-per-use Infrastructure](https://swe.quest/articles/railway-mcp-stateful-serverful-pay-per-use-infrastructure-781833f07db0953c.md): Railway · 2025-08-20 · Easy · 5 min read · AI agents, Deployment, Cloud platforms, Developer tools
  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.
- [Less Dashboards. More Robots. Railway, for Agents](https://swe.quest/articles/less-dashboards-more-robots-railway-for-agents-d92651b984548ff3.md): Railway · 2026-06-03 · Easy · 11 min read · AI agents, Developer tools, Deployment, Cloud platforms
  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.
- [Agentic Coding on Railway: A Practical Guide for 2026](https://swe.quest/articles/agentic-coding-on-railway-a-practical-guide-for-2026-dae3c2957727f1b2.md): Railway · 2026-05-25 · Medium · 10 min read · AI agents, AI for coding, Deployment, Cloud platforms
  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.
- [MCP or CLI? Yes.](https://swe.quest/articles/mcp-or-cli-yes-bc20ce304cab3de5.md): Sentry · 2026-11-10 · Medium · 6 min read · AI agents, Developer tools, Identity & auth
  Sentry now ships its MCP server launchable from the CLI (\`sentry mcp\`), running stdio mode with a shim that reuses CLI credentials via a separate \`Sentry-Bearer\` token header that bypasses the OAuth proxy's CIMD/DCR flow.
- [Dynamic MCPs with Docker: Stop Hardcoding Your Agents’ World](https://swe.quest/articles/dynamic-mcps-with-docker-stop-hardcoding-your-agents-world-a530a7120388ea63.md): Docker · 2025-11-06 · Medium · 11 min read · AI agents, LLMs, Sandboxing & isolation, Containers, Developer tools
  Docker MCP Gateway now exposes primordial tools (mcp-find, mcp-add) that let agents search a curated catalog of 270+ MCP servers, add them to the live session, and trigger OAuth or elicitation flows, instead of hand-editing JSON config and restarting.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
