Skip to main content
Glama
heroku-review-app-mcp
by oakbow

heroku-review-app-mcp

An MCP server for working with Heroku Review Apps from a coding agent, hard-scoped to the review apps of one pipeline.

The official Heroku MCP server can reach every app your account can, including production. This one cannot: every tool that acts on an app first checks that the app's id is in the configured pipeline's review-app list, and refuses otherwise. That makes it reasonable to let an agent call it without a confirmation prompt for each step.

What it does

Tool

Purpose

list_review_apps

Review apps of the pipeline with PR, branch, status, URL

get_review_app

Status of one review app (poll after creating)

get_logs

Recent log lines

run_task

Run a task you defined in the config on a one-off dyno

run_modified_task

Run a task whose definition or script differs from the default branch

run_command

Run an arbitrary command on a one-off dyno (off by default)

create_review_app

Create a review app for a PR or a default-branch commit

destroy_review_app

Delete a review app (its pr-predestroy script runs)

Apps are addressed by pr (number) or app (name).

Related MCP server: MCP Heroku Server

The scope guarantee

  • The pipeline is fixed in the config file when the server starts. No tool argument can change it.

  • An app is accepted only if its id is in GET /pipelines/{id}/review-apps at the time of the call. Pipeline couplings (which include staging and production) and app-name patterns are never used.

  • Any failure to establish membership rejects: a lookup error, a truncated list, a malformed record, an app still being created or deleted.

  • After the check, the server uses the id returned by the API, not the text the caller passed.

  • Commands run through the Platform API by app id, and task parameters travel as environment variables in a JSON body. Nothing the caller supplies passes through a local shell.

"Review app only" is not the same as "isolated". A review app's dynos hold whatever config vars your pipeline gives review apps, and those are often real credentials for shared services. That is why run_command is opt-in, and why you may still want your client to ask before run_command, run_modified_task, create_review_app and destroy_review_app.

Setup

Requires Node.js 20 or later.

Credentials:

  • Heroku: HEROKU_API_KEY, or a logged-in Heroku CLI (heroku auth:token is used).

  • GitHub (when repo is set: for create_review_app and for checking tasks against the default branch): GITHUB_TOKEN / GH_TOKEN, or a logged-in GitHub CLI.

Register it with your MCP client, pointing at a config file in your project:

{
  "mcpServers": {
    "heroku-review-app": {
      "command": "npx",
      "args": ["-y", "github:oakbow/heroku-review-app-mcp#v0.2.0", "--config", ".heroku-review-app-mcp.json", "--pipeline", "my-pipeline", "--repo", "my-org/my-app"]
    }
  }
}

--pipeline and --repo are optional but recommended. They pin those two values in the launch command, which is what your client asks you to approve: if the config file says anything else, the server does not start.

The config path can also come from HEROKU_REVIEW_APP_MCP_CONFIG; the default is .heroku-review-app-mcp.json in the working directory.

Config

{
  "pipeline": "my-pipeline",
  "repo": "my-org/my-app",
  "allowRunCommand": false,
  "tasks": {
    "seed_demo_data": {
      "description": "Load the demo data set.",
      "command": "bin/rails demo:seed",
      "timeoutSeconds": 900
    },
    "promote_user": {
      "description": "Give a seeded user a role.",
      "command": "bin/rails runner 'eval(ENV.fetch(\"TASK_SCRIPT\"))'",
      "scriptFile": "review-app-tasks/promote_user.rb",
      "params": {
        "email": { "description": "user email", "pattern": "^[a-z0-9._+-]+@[a-z0-9.-]+$" },
        "role": { "pattern": "^(admin|editor|viewer)$" }
      },
      "resultPrefix": "RESULT="
    }
  }
}

The same config with its script file is in examples/rails.

Key

Meaning

pipeline

Pipeline name or id. Required.

repo

owner/name of the connected GitHub repository. Needed for create_review_app (not offered without it) and for run_task (refuses every task without it).

allowRunCommand

Offer run_command. Default false.

tasks

Named commands for run_task.

Task fields:

Field

Meaning

description

Shown to the agent. Required.

command

Fixed command line run on the dyno. Parameters are never inserted into it. Required.

params

Declared parameters. Each arrives on the dyno as TASK_<NAME>. A value must match pattern in full (default ^[A-Za-z0-9_.@:+/-]{1,200}$); undeclared parameters are rejected.

scriptFile

A file in your project (relative to the config file, and not outside its directory) whose content arrives as TASK_SCRIPT. Lets a task run code that is not deployed on the review app.

resultPrefix

If set, a successful run returns only the output lines that start with this prefix, with the prefix removed. A failed run returns all output.

timeoutSeconds

Default 600. The dyno is stopped when it elapses.

Tasks are how you add project-specific steps, such as preparing test data or opening a session for a test user, without teaching the server anything about your app.

Reviewed and modified tasks

The config file and the script files sit in the working tree, where the agent can edit them. If run_task ran whatever is there, allowing it without a prompt would allow arbitrary code on the dyno.

run_task therefore runs a task only if its definition and its script file are identical to the copies on the repository's default branch, read from GitHub at the time of the call. Anything else — an edited script, a changed command or parameter pattern, a task that exists only on a feature branch — is refused, and run_modified_task runs it from the working tree instead. Allow run_task and keep run_modified_task on ask: reviewed tasks run unattended, and the operator sees every run of an unreviewed one.

If GitHub cannot be queried, or the config has no repo, run_task refuses; it never falls back to the working tree. The config file must be inside the git checkout of repo. The comparison is byte for byte, so a checkout that rewrites line endings will not match.

pipeline and repo come from the same editable config. Unless the launch command pins them with --pipeline and --repo (see Setup), someone who can edit the config and restart the server can point repo at another repository whose default branch holds matching files, or pipeline at another pipeline's review apps.

Creating review apps

create_review_app takes either pr, or sha plus branch.

A review app receives the pipeline's config vars and runs your postdeploy script, so the server deploys only code that is already in the connected repository:

  • a PR must be open and must not come from a fork; it is deployed at its head commit;

  • a bare sha must be on the repository's default branch.

If GitHub cannot be queried, nothing is created. The call returns as soon as the review app is requested; poll get_review_app until the status is created.

The source comes from GitHub's repository tarball endpoint, which answers with a short-lived signed URL; that URL is handed to Heroku's POST /review-apps. The GitHub token is sent to api.github.com only.

Development

npm install
npm test
npm run build

License

MIT

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Provides comprehensive Heroku application management through the Heroku Platform API for AI assistants using the Model Context Protocol. It enables users to scale dynos, view deployment history, access logs, and manage environment variables through natural language.
      8
      MIT
    • A
      license
      B
      quality
      C
      maintenance
      Enables AI agents to deploy and roll back applications, read build and runtime logs, diagnose broken apps, and run commands inside containers. It also manages environment variables, PostgreSQL databases, domains, cron jobs, marketplace services, and backups on a PaaS platform, with safety annotations so clients can confirm destructive actions.
      58
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables an AI agent to inspect and manage hosted applications, including projects, environments, previews, logs, domains, health, and backups, with explicit confirmation required for deploys, deletions, and production changes.
      MIT