Railway Guardrail MCP

Railway Guardrail MCP

A team-wide, remote MCP server that lets Claude operate Railway projects through natural language, with safety guardrails to prevent irreversible actions without human approval.

Category
访问服务器

README

Railway Guardrail MCP

A team-wide, remote MCP server that lets Claude operate Kean on Biz Railway projects through natural language, with safety guardrails baked in so an agent cannot do irreversible damage without a human approving it.

It connects to Railway through a single service token but records which human initiated and which human approved every action. The design is contained: it only ever touches one project per session, only ever touches staging, and stops cold at anything that cannot be undone.

Safety model

Borrowed from ShipSafe: classify every operation by how dangerous it is up front, drive the gate behavior off that classification, and never let confidence substitute for a human decision on irreversible actions.

Tier Operations Behavior
Read list, logs, status, view variables (masked) Auto, logged
Reversible redeploy, set variables, generate domain, create environment Auto, logged
Create create project, create service Auto, logged
Irreversible delete service/project/environment, wipe volume, delete variables Hard gate: Slack approval + config snapshot first

The gate rule: any tool annotated destructiveHint: true is gated. Everything else runs autonomously.

Containment walls

  1. One project per session. No mutating tool runs until railway_select_project binds a project. Every tool then operates only inside that project. The binding is persisted per human identity in Postgres (the HTTP server is stateless). railway_create_project is the single documented exception, since it creates a project rather than touching an existing one.
  2. Staging only. When a project has both a staging and a production environment, the session binds to staging and production is unreachable. A production-only project pauses for an approver to confirm treating production as staging for the session.

Tools (22)

Session: railway_whoami, railway_select_project, railway_check_status. Read: railway_list_projects, railway_list_services, railway_list_environments, railway_get_logs, railway_list_variables. Reversible/create: railway_redeploy, railway_set_variables, railway_generate_domain, railway_create_environment, railway_create_project, railway_create_service, railway_add_redis, railway_edit_redis, railway_set_backup_flag. Gated: railway_delete_service, railway_delete_project, railway_delete_environment, railway_wipe_volume, railway_delete_variables.

railway_set_backup_flag (reversible tier) turns the per-project volume backup flag on or off for the bound project. When on, volume data is backed up before a gated railway_wipe_volume. Default is off (staging data is treated as throwaway). railway_check_status shows the current flag state for the bound project.

railway_add_redis (create tier) and railway_edit_redis (reversible tier) are an owner-approved extension on top of the original MVP catalog. They manage the Redis service (provision it from the official redis image with a persistent volume and a generated password, and edit its instance settings/variables), not Redis data. Adding Redis uses the documented serviceCreate image path rather than the undocumented templateDeployV2, to avoid depending on an unconfirmed schema.

Architecture

  • TypeScript, MCP TypeScript SDK (@modelcontextprotocol/sdk).
  • Streamable HTTP transport, stateless JSON mode. A fresh server and transport are built per request.
  • Railway access via the Railway Public GraphQL API, authenticated with one Railway Team/Workspace token (Authorization: Bearer).
  • Gateway auth: per-user bearer token mapped to a human identity, plus a connect allowlist.
  • Postgres for the append-only audit log, per-user session bindings, per-project flags, config snapshots, and pending approvals.
  • Approvals via Slack interactive messages (Block Kit, Approve / Deny).

Endpoints

  • POST /mcp - the MCP endpoint (requires a bearer token: a static gateway token or an OAuth access token).
  • POST /slack/interactions - receives Slack button clicks (signature verified).
  • GET /health - unauthenticated health check.
  • OAuth 2.1 + discovery: /.well-known/oauth-protected-resource, /.well-known/oauth-authorization-server, /oauth/register, /oauth/authorize, /oauth/token.

Connecting Claude

Two auth paths, both resolving to the same human-identity allowlist:

  • Claude Code (static bearer): add the server with your gateway token as a header.
    claude mcp add --transport http railway-guardrail \
      https://YOUR-APP.up.railway.app/mcp \
      --header "Authorization: Bearer YOUR_GATEWAY_TOKEN" -s user
    
  • claude.ai chat / Projects / Cowork (OAuth): their connector UI only accepts OAuth, not a static header, so the server runs a small OAuth 2.1 authorization server (dynamic client registration + PKCE). Add a custom connector pointing at https://YOUR-APP.up.railway.app/mcp; Claude runs the OAuth flow and shows a sign-in page where you paste your gateway token once. That token is validated against the same allowlist, and Claude stores the issued OAuth access token.

Onboarding still mints a gateway token per person (used at the OAuth sign-in). Removing that step with Slack/Google SSO remains the Phase 2 "per-user OAuth" item.

Configuration

All operational settings are environment variables, so onboarding a teammate or adding an approver is a config change and a restart, never a code change. See .env.example for the full list. The approver allowlist is APPROVERS (the MVP ships with just jeremy; add Taha later with APPROVERS=jeremy,taha).

Setup and deploy

See SETUP.md for plain, step by step instructions (creating the Railway token, the Slack app, the Postgres database, the gateway tokens, and deploying).

Local development

npm install
cp .env.example .env   # then fill in real values
npm run build
npm run start

Tests

npm test

The suite (Node's built-in test runner, via tsx) pins the security-critical logic with no database or network required: secret redaction (no value ever leaks), the risk-tier mapping (exactly the five irreversible tools are gated), Slack request-signature verification (forgery and replay are rejected), and the gateway/approver allowlists.

What is intentionally not built

The MVP keeps tools as primitives and stops at the containment walls. Deferred features (per-user OAuth, multi-project sessions, production access, volume restore, spend caps, composed workflows, an audit dashboard) are recorded in PHASE_2_NOTES.md and must not be added until the MVP is shipped and trusted.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选