n8n is a powerful workflow automation tool that lets you build complex automations with a visual node-based interface. It’s open-source, self-hostable, and supports hundreds of integrations out of the box.
When combined with Model Context Protocol (MCP) servers, n8n can leverage AI agents that have access to your tools and infrastructure, enabling intelligent automation workflows that can interact with your APIs, databases, and other services.
This guide will show you how to connect n8n to a Gram-hosted MCP server using the example Push Advisor API from the Gram concepts guide. You’ll learn how to set up the connection, test it, and use natural language to perform vibe checks before running automated deployments.
Give your toolset a name (for example, Push Advisor) and click Continue.
Notice that the names of the tools that will be generated from your OpenAPI document are displayed in this dialog.
Step 3: Configure MCP
Enter a URL slug for the MCP server and click Continue.
Gram will create the toolset from the OpenAPI document.
Click Toolsets in the sidebar to view the Push Advisor toolset.
Configuring environment variables
Environments store API keys and configuration separate from your toolset logic.
In the Environments tab, click the Default environment. Click Edit and then Fill for Toolset. Select the Push Advisor toolset and click Fill Variables to automatically populate the required variables.
The Push Advisor API is hosted at canpushtoprod.abdulbaaridavids04.workers.dev, so set the <API_name>_SERVER_URL environment variable to https://canpushtoprod.abdulbaaridavids04.workers.dev. Click Update and then Save.
Publishing an MCP server
Let’s make the toolset available as an MCP server.
Go to the MCP tab, find the Push Advisor toolset, and click Edit.
On the MCP Details page, tick the Public checkbox and click Save.
Scroll down to the MCP Config section and copy the Public Server configuration.
Use the Authenticated Server configuration if you want to use the MCP server in a private environment.
You’ll need an API key to use an authenticated server. Generate an API key in the Settings tab and copy it to the GRAM_KEY environment variable in place of <your-key-here>.
The authenticated server configuration looks something like this: