跳过安装。2 分钟内即可运行。
在 cloud.anythingmcp.com 开始免费试用,一键添加 Railway,然后将你的 AI 客户端(Claude、ChatGPT、Copilot 或 Cursor)指向生成的 MCP 端点。无需 Docker,无需 git clone,无需任何工程经验。
摘要
让你的 AI 照看你的 Railway 应用:列出项目、环境和服务,检查部署并读取其构建日志和运行日志,查看设置了哪些环境变量(仅名称),估算用量,并在与你确认后重新部署或重启服务。
试试这样问
Railway 的示例提示
点击任意提示即可复制,然后粘贴到 Claude、ChatGPT、Cursor、Gemini、Copilot 或 OpenClaw 中,在该连接器上运行。
Claude 是 AI,可能会出错。请核对回答。
💡 无需安装? 直接使用 cloud.anythingmcp.com。 登录、点击 Connectors → Railway、粘贴凭证、生成 MCP API key,即可完成。无 Docker、无
git clone、无本地服务器。
Railway
让你的 AI 照看你的 Railway 应用:列出项目、环境和服务,检查部署并读取其构建日志和运行日志,查看设置了哪些环境变量(仅名称),估算用量,并在与你确认后重新部署或重启服务。
设置
- 在 Railway 中打开 Account Settings → Tokens(
https://railway.com/account/tokens)并创建一个令牌。选择 No workspace 会得到一个可访问你所有工作区的账户令牌;选择某个工作区则会得到仅限该工作区的工作区令牌,对团队来说这是更好的选择。 - 按 Railway 显示的原样把令牌粘贴到
RAILWAY_API_TOKEN,不要加 Bearer 一词,然后安装连接器。 - 用
railway_list_projects检查设置。
项目令牌无法使用:项目令牌(在项目设置的 Tokens 中)只能访问一个项目的一个环境,使用的是另一个请求头,并且无法列出项目。请使用账户令牌或工作区令牌。railway_get_me 只能配合账户令牌使用;使用工作区令牌时,Railway 会返回 Not Authorized。
它能做什么:项目及其环境和服务,每个服务的运行方式(构建器、启动命令、健康检查、区域、副本、域名),部署及其构建日志和运行日志,环境变量的名称,以及用量。状态为 FAILED 的部署通常是在构建时出错,所以 AI 会读取 railway_get_build_logs;状态为 CRASHED 的部署是在运行时出错,所以它会读取 railway_get_deployment_logs。
重新部署和重启会先问你:railway_redeploy_deployment 会重新构建服务并替换正在运行的部署,这会计入计费用量;railway_restart_deployment 会停止并重新启动其容器,不进行新的构建。两者都可能短暂中断服务,因此 AI 会告诉你是哪个服务和环境,并等你同意。这里没有任何操作会删除或停止服务。
变量值留在 Railway 中:railway_list_variable_names 只显示设置了哪些变量。railway_get_variable_values 会返回变量值(密码、密钥、连接字符串),安装时默认关闭;只有在允许 AI 看到这些值时才开启它。运行日志会显示你的应用输出的任何内容,因此也要把它们当作敏感信息。
是用量,不是金额:railway_get_estimated_usage 和 railway_get_usage 返回的 CPU 以 vCPU 分钟计,内存和卷以 GB 分钟计,出站流量以 GB 计。AI 会按 Railway 的标价换算(例如 CPU 为每 vCPU 每月 20 美元);套餐额度和折扣不计算在内。
其他读取操作:railway_graphql_query 可以运行 Railway API 的任何查询。Railway 不发布 schema 文件,因此 railway_graphql_schema 和 railway_graphql_schema_url 无法加载它;AI 会改用内省(introspection)查询来查找类型。railway_graphql_mutation 可能修改和删除令牌能访问的任何内容,因此和 railway_graphql_subscription 一样,安装时默认关闭。管理员可以有意识地开启它们。
常见错误:Railway 对大多数问题都返回 HTTP 200 和一条消息,连接器会把它报告为错误。Not Authorized:令牌错误、已撤销或无权访问该项目(或者用工作区令牌调用了 railway_get_me)。Project not found 或 Deployment not found:id 错误或没有访问权限。HTTP 429:你的套餐每小时的请求上限已用完(Free 为 100,Hobby 为 1,000,Pro 为 10,000);请稍候。
该连接器不会创建、修改或删除项目、服务、环境、变量、域名或卷,也不会回滚部署或绘制指标图表。
前提条件: RAILWAY_API_TOKEN
本地安装连接器
curl -fsSL https://raw.githubusercontent.com/HelpCode-ai/anythingmcp/main/docker-compose.quickstart.yml -o docker-compose.yml
printf 'JWT_SECRET=%s\nENCRYPTION_KEY=%s\n' "$(openssl rand -hex 32)" "$(openssl rand -hex 32)" > .env
docker compose up -d
打开 http://localhost:3000/connectors/store,选择 Railway 并填入前提条件中列出的环境变量。
可用工具
| Tool | What it does |
|---|---|
railway_get_me | Read the Railway account behind an account token: id, name, email, username and its workspaces (id, name) |
railway_list_projects | List the projects the token can see, most recently updated first: id, name, description, workspace and created and updated dates |
railway_get_project | Read one project with its environments and services, and per service and environment: region, replicas, start command, public domains and… |
railway_get_service_instance | Read how one service runs in one environment: builder, build and start commands, root directory, health check, region, replicas, restart… |
railway_list_deployments | List the deployments of a project, environment or service, newest first: id, status (SUCCESS, FAILED, CRASHED, BUILDING, DEPLOYING… |
railway_get_deployment | Read one deployment: status and when it last changed, service and environment, URL, whether it can be redeployed or rolled back, whether it… |
railway_get_deployment_logs | Read the runtime logs of a deployment (what the running app printed): timestamp, severity and message per line |
railway_get_build_logs | Read the build logs of a deployment (installing dependencies, building the image): timestamp, severity and message per line |
railway_redeploy_deployment | Redeploy a deployment: Railway builds it again from the same source (or reuses the image with use_previous_image_tag) and replaces the… |
railway_restart_deployment | Restart a running deployment without building it again: its containers stop and start, so the service is briefly unavailable |
railway_list_variable_names | List the names of the environment variables of a service (or the shared variables of an environment), without their values, which are often… |
railway_get_variable_values | Read the environment variables of a service with their values |
railway_get_estimated_usage | Estimate the usage of the current billing period up to its end for a project or a workspace, per measurement (CPU in vCPU minutes, memory… |
railway_get_usage | Read the measured usage of a project or workspace over a period, per measurement and, with group_by, per service or environment (CPU in… |
railway_graphql_schema_url | Return the URL of the GraphQL schema (SDL); Railway publishes no SDL file, so use an introspection query with railway_graphql_query |
railway_graphql_schema | Fetch the GraphQL schema; Railway publishes no SDL file, so the AI looks types up with an introspection query instead |
railway_graphql_query | Run any GraphQL query against the Railway API, for reads the ready-made tools do not cover |
railway_graphql_mutation | Run any GraphQL mutation; switched off at install because it can change and delete anything the token reaches |
railway_graphql_subscription | Run a GraphQL subscription; switched off at install |
示例提示
- “我的哪些 Railway 服务的最新部署失败或崩溃了?给我看说明原因的日志行。”
- “读取生产环境中 api 服务最近一次部署的构建日志,告诉我构建为什么失败。”
- “staging 环境的 worker 服务上设置了 DATABASE_URL 吗?只检查变量名称。”
- “估算 shop 项目本月的 Railway 用量,以及大概要花多少钱。”
- “重启生产环境中的 api 服务。告诉我你要重启哪个部署,并等我确认。”
下一步
这份指南对你有帮助吗?