Skip to content
Heroku Workshops

Deploying the MCP to the Cloud (Heroku)

Heroku supports MCP servers out of the box, there is support for stdio and http transports. HTTP transport, as you guessed, is just a regular web application so you can use a web process type in the Procfile.

Procfile
web: node dist/index.js http

And for the stdio transport, you can use a mcp process type in the Procfile.

Procfile
mcp: node dist/index.js stdio

The mcp process type is a special process type that will allow using the MCP within an Heroku Agent using the Heroku Managed Inference and Agents add-on.

So, before deploying, let's create a Procfile file in the root of the project.

Procfile
web: node dist/index.js http
mcp: node dist/index.js stdio

And then we can deploy the MCP Server to the Cloud using Heroku.

WARNING

❗️ Make sure you have initialized this project as a git repository and run heroku git:remote -a <username>-mcp-task-manager to setup the remote repository.

bash
git add .
git commit -m "Deploying the MCP Server to the Cloud"
git push heroku main

Once deployed let's scale our web process to 1 instance.

bash
heroku ps:scale web=1

TIP

💡If there is a problem with the deployment, you can check the logs by running: heroku logs --tail

Let's test the remote MCP Server with the inspector by running:

bash
npx @modelcontextprotocol/inspector --transport http --server-url https://<app-name-id>.herokuapp.com/mcp

Now that our MCP Server is deployed, let's integrate it with your favorite AI tool.