Quick Start
- Choose or create an MCP server - Use a Heroku template or build your own
- Deploy to Heroku - Push your MCP app to Heroku
- Add MCP line to Procfile - Declare your MCP server process
- Attach to your model - Connect the MCP app to your AI model
- Use in agents - Tools become available via
/v1/agents/heroku
Why Use MCP on Heroku?
Automatic Tool Orchestration
Instead of manually building control loops to handle tool calls, Heroku automatically:- Registers your custom tools
- Executes tool calls in secure, isolated dynos
- Manages multiple MCP servers and tool sets
- Handles tool responses and error conditions
Security and Isolation
- Tools run in one-off dynos, not long-running processes
- Each tool execution is isolated
- No need for multi-tenant MCP servers
- Reduced security risks and costs
Simplified Management
- Deploy standard apps - no special MCP hosting required
- Use familiar Heroku workflows
- Manage all tools through a single endpoint
- Scale tool execution independently
Deploy and Register Custom MCP Servers
Step 1: Choose or Create an MCP Server
Use a Heroku Template (Recommended)
The fastest way to get started is to use one of Heroku’s example MCP servers. Each template includes a “Deploy to Heroku” button for one-click deployment:| Purpose | Repository | Tools Included |
|---|---|---|
| Ruby Code Execution | mcp-code-exec-ruby | code_exec_ruby |
| Python Code Execution | mcp-code-exec-python | code_exec_python |
| Go Code Execution | mcp-code-exec-go | code_exec_go |
| Node Code Execution | mcp-code-exec-node | code_exec_node |
| Document Parsing | mcp-doc-reader | HTML & PDF to Markdown conversion |
These tools are also available as built-in
heroku_tools. Deploying as MCP servers offers additional benefits like no upper limit on ttl_seconds for dyno runtime.Build Your Own MCP Server
To create a custom MCP server, implement the MCP protocol specification:- Define your tools with clear descriptions and input schemas
- Implement tool execution logic
- Handle MCP protocol messages (initialize, tools/list, tools/call)
- Add language-specific dependencies (requirements.txt, Gemfile, etc.)
Step 2: Deploy to Heroku
Deploy your MCP server like any standard Heroku app:Step 3: Add MCP Line to Procfile
To register your MCP server with Heroku, add a process declaration to yourProcfile:
Requirements
- Process name must start with
"mcp" - Process name must be unique across all apps registered with your model
- Must specify the STDIO server command
Example Procfiles
Python MCP Server:The MCP process only declares how to run your server - it doesn’t need to be running continuously. Heroku executes it in one-off dynos when tools are called.
Step 4: Attach to Your Model
Connect your MCP app to a Heroku Managed Inference and Agents model to make tools available:Option A: Create and Attach a New Model
If you don’t have a model yet:Option B: Attach an Existing Model
If you already have a model resource:MY_MODEL_RESOURCE with your model’s resource ID or alias.
Option C: Attach MCP Server to Your Main App
If you have a separate app that makes inference requests:Step 5: Verify Registration
After attaching, Heroku automatically:- Registers your MCP server
- Syncs available tools
- Makes tools callable via
/v1/agents/heroku
"server_status": "registered" and "primitives_status": "synced".
Using MCP Tools with Agents
Once registered, your MCP tools become available through the/v1/agents/heroku endpoint. Include them in the tools array with "type": "mcp".