Heroku Code MCP Server

Local setup required. This server has to be cloned and prepared on your machine before you register it in Claude Code.
1

Set the server up locally

Run this once to clone and prepare the server before adding it to Claude Code.

Run in terminal
cd heroku
npm install
npm run build
2

Register it in Claude Code

After the local setup is done, run this command to point Claude Code at the built server.

Run in terminal
claude mcp add -e "HEROKU_API_TOKEN=${HEROKU_API_TOKEN}" heroku-code-mcp -- node "<FULL_PATH_TO_HEROKU_CODE_MCP>/dist/index.js"

Replace <FULL_PATH_TO_HEROKU_CODE_MCP>/dist/index.js with the actual folder you prepared in step 1.

Required:HEROKU_API_TOKEN
README.md

A token-efficient MCP server for the Heroku Platform API

Heroku Code MCP

A token-efficient MCP server for the Heroku Platform API using a Code Mode pattern: search + execute + auth_status.

Design references:

Context Comparison

Approach Tool surface Approx context cost at tool-list time Fits in a 200k-token context window?
official Heroku MCP 37 endpoint-oriented tools ~6,375 tokens Yes, but consumes meaningful budget up front
heroku-code-mcp (this repo) 3 control tools (search, execute, auth_status) ~368 tokens Yes, with minimal up-front overhead

The practical impact is that the agent starts with a much smaller tool schema, then asks the server for just-in-time endpoint discovery. This keeps prompt budget available for user intent, planning, and response quality instead of spending it on static endpoint metadata.

The Problem

Heroku’s API surface is broad, and an endpoint-per-tool MCP model makes the agent choose between many tools before it has enough task context. That usually increases tool-selection ambiguity, consumes tokens early, and makes multi-step tasks more brittle. The issue is not that many tools are inherently bad, but that model context is scarce and endpoint selection is an agent planning problem, not just a transport problem.

The Approach

This server applies a Code Mode-style control loop with deterministic inputs:

  1. search maps natural language intent to ranked operation_id candidates.
  2. execute validates and performs the selected Heroku API operation.
  3. auth_status provides explicit auth state so agents can branch cleanly.

The server holds schema intelligence and safety policy centrally. The agent gets a small control surface and a stable execution contract.

Tools

Tool What it does Why it exists
search Ranks Heroku operations from schema + docs context Reduces endpoint selection ambiguity
execute Validates params/body and executes by operation_id Gives one deterministic execution path
auth_status Returns {authenticated, scopes, expires_at} Supports explicit auth-aware planning
Agent                           MCP Server
  │                                  │
  ├──search({query: "list apps"})──►│ rank operations from catalog/index
  │◄──[GET /apps, ...]───────────────│
  │                                  │
  ├──execute({operation_id: ...})───►│ validate + call Heroku API
  │◄──{status, headers, body}────────│

Benchmark Highlights

Benchmarks were captured on February 22, 2026 on the same machine and account for both implementations. The numbers below compare this repo’s local HTTP MCP endpoint against the official Heroku MCP server over stdio.

Raw Comparison

Metric heroku-code-mcp official Heroku MCP Delta
Tool count 3 37 91.9% lower
Tool-list payload bytes 1,469 25,500 94.2% lower
Tool-list approx tokens 368 6,375 94.2% lower
Connect avg 14.8 ms 10,168.7 ms 687x faster
list_tools avg 4.3 ms 10.3 ms 2.4x faster
Read op avg 528.0 ms (execute GET /apps) 9,697.4 ms (list_apps) 18.4x faster

Comparison Graphs

These are static charts so labels stay readable in GitHub without giant auto-scaled Mermaid panels.

Context reduction chart

Latency comparison chart

How to Read These Results

The strongest win is context footprint. A 3-tool interface materially lowers initial prompt overhead and reduces tool-choice branching for the model. The second win is connection and read-path latency under this benchmark harness. In measured runs, the official Heroku MCP paid a much larger connect-time cost, and its measured read operation was substantially slower than execute GET /apps on this server.

This does not mean every endpoint in every environment will always have the same multiplier. It means the measured default experience in this setup favored the Code Mode control surface for both context economy and latency.

Benchmark Methodology

  • Date: February 22, 2026.
  • Environment: same local machine, same Heroku account, warm network.
  • Custom server run count: 10.
  • Official server run count: 3.
  • Context estimate: ceil(list_tools_json_bytes / 4) for rough token approximation.
  • Read comparison pairing:
    • Custom: execute GET /apps
    • Official: list_apps

Artifacts:

  • benchmarks/results/context-footprint-2026-02-22.json
  • benchmarks/results/custom-local-http-2026-02-22.json
  • benchmarks/results/official-heroku-mcp-start-2026-02-22.json
  • BENCHMARKS.md

Get Started

MCP URL: http://127.0.0.1:3000/mcp

cd heroku
npm install
npm run build
npm

Tools (3)

searchRanks Heroku operations from schema and docs context to reduce endpoint selection ambiguity.
executeValidates parameters and body, then executes a specific Heroku API operation by ID.
auth_statusReturns the current authentication state, scopes, and expiration time.

Environment Variables

HEROKU_API_TOKENrequiredAPI token for authenticating with the Heroku Platform API

Configuration

claude_desktop_config.json
{"mcpServers": {"heroku-code-mcp": {"command": "node", "args": ["/path/to/heroku-code-mcp/build/index.js"]}}}

Try it

Search for available Heroku apps in my account.
Check my current Heroku authentication status and scopes.
Execute a request to list all dynos for my production app.
Find the operation ID for restarting a specific app and execute it.

Frequently Asked Questions

What are the key features of Heroku Code MCP?

Token-efficient search-and-execute pattern. Just-in-time endpoint discovery. Built-in safety guardrails for API mutations. Reduced tool surface area for better agent planning. Explicit auth-aware state management.

What can I use Heroku Code MCP for?

Managing Heroku app lifecycles with minimal context window usage. Automating infrastructure tasks without overwhelming the LLM with static API metadata. Building agents that require secure, validated execution of Heroku API operations. Reducing latency in agentic workflows involving cloud infrastructure management.

How do I install Heroku Code MCP?

Install Heroku Code MCP by running: cd heroku && npm install && npm run build

What MCP clients work with Heroku Code MCP?

Heroku Code MCP works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep Heroku Code MCP docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare