Skip to content
Gram

Using Claude Code with Gram-hosted MCP servers

Claude Code is Anthropic’s terminal-based tool that brings Claude’s capabilities directly to your command line. Unlike Claude Desktop, which runs in a graphical interface, the Claude Code CLI can access your current project folder.

Claude Code terminal interface showing welcome message

When combined with Model Context Protocol (MCP) servers, Claude Code becomes even more useful. Using MCP servers, you can give Claude access to your tools and infrastructure, allowing it to work with your APIs, databases, and other services.

This guide will show you how to connect Claude Code 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 you vibe code.

Find the full code and OpenAPI document in the Push Advisor API repository.

You’ll need:

First, authenticate with Claude Code.

Then, verify that Claude Code is installed correctly:

Terminal window
claude --help

If installation is successful, you’ll see Claude Code’s available commands and options.

If you already have a Gram MCP server configured, you can skip to connecting Claude Code to your Gram-hosted MCP server. For an in-depth guide to how Gram works and more details on how to create a Gram-hosted MCP server, check out the Gram concepts guide.

In the Gram dashboard, click New Project to start the guided setup flow for creating a toolset and MCP server.

Screenshot of the Gram dashboard showing the New Project link

Enter a project name and click Submit.

Gram will then guide you through the following steps.

Upload the Push Advisor OpenAPI document, enter the name of your API, and click Continue.

Screenshot of the upload your OpenAPI spec dialog

Give your toolset a name (for example, “Push Advisor”) and click Continue.

Screenshot of the create toolset dialog

Notice that the names of the tools that will be generated from your OpenAPI document are displayed in this dialog.

Enter a URL slug for the MCP server and click Continue.

Screenshot of the configure MCP dialog

Gram will create the toolset from the OpenAPI document.

Click Toolsets in the sidebar to view the Push Advisor toolset.

Screenshot of the Gram dashboard showing the Push Advisor toolset

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.

Screenshot showing the fill for toolset dialog to automatically populate 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.

Set server URL

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.

Screenshot of the MCP details page

Scroll down to the MCP Config section and copy the Public Server configuration.

Screenshot showing the MCP server config dialog for the Push Advisor toolset

The configuration will look something like this:

{
"mcpServers": {
"GramPushadvisor": {
"command": "npx",
"args": [
"mcp-remote",
"https://app.getgram.ai/mcp/canipushtoprod"
]
}
}
}

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:

{
"mcpServers": {
"GramPushadvisor": {
"command": "npx",
"args": [
"mcp-remote",
"https://app.getgram.ai/mcp/canipushtoprod",
"--header",
"Authorization: ${GRAM_KEY}"
],
"env": {
"GRAM_KEY": "Bearer <your-key-here>"
}
}
}
}

Connecting Claude Code to your Gram-hosted MCP server

Section titled “Connecting Claude Code to your Gram-hosted MCP server”

Now we’ll connect Claude Code to your newly created MCP server.

Claude Code approaches MCP server configuration differently from Claude Desktop. Instead of using a JSON config file, you add servers using the claude mcp add command.

If you’re using the Public Server configuration, run the following command in your terminal using your MCP server URL:

Terminal window
claude mcp add push-advisor -- npx mcp-remote https://app.getgram.ai/mcp/canipushtoprod

If you’re using the Authenticated Server configuration, run the following command:

Terminal window
claude mcp add push-advisor \
-e GRAM_KEY="Bearer your-api-key-here" \
-- npx mcp-remote https://app.getgram.ai/mcp/canipushtoprod --header "Authorization: ${GRAM_KEY}"

Here’s what these commands do:

  • push-advisor – The name you’re giving the server locally.
  • -- – Separates Claude Code flags from the server command.
  • npx mcp-remote – The package that handles remote MCP server connections.

In the command for authenticated servers:

  • -e GRAM_KEY=... – Sets your API key as an environment variable.
  • --header – The flag that passes the authorization header to the remote server.

Check that the server was added successfully:

Terminal window
claude mcp list

You should see push-advisor in the list.

To see the full configuration:

Terminal window
claude mcp get push-advisor

Screenshot showing the terminal output after successfully adding and configuring an MCP server in Claude Code

Now test the connection by starting Claude Code and running a vibe check.

First, start an interactive session with Claude Code in your terminal:

Terminal window
claude

Ask Claude a basic question like, “What’s the vibe today?”

Ask Claude to check if it’s safe to push code to production today.

Is it safe to push code to production today?

Screenshot showing Claude Code's tool permission prompt when Claude wants to use an MCP tool

Claude Code will use the can_i_push_to_prod tool to check the current day and ask for permission to use it. A prompt will appear asking to confirm the tool call.

Screenshot showing the result after Claude Code successfully calls the Push Advisor API tool

Let’s go through some common issues and how to fix them.

If Claude Code can’t find your server:

Terminal window
# Check if the server is listed
claude mcp list
# Remove and re-add the server
claude mcp remove push-advisor
claude mcp add push-advisor -- npx mcp-remote https://app.getgram.ai/mcp/canipushtoprod

If you get authentication errors:

  • Verify your Gram API key in the dashboard under Settings > API Keys.
  • Check that environment variables are correctly set in Gram.
  • Ensure the Push Advisor API base URL is accessible.

If Claude Code isn’t calling the tools:

  • Test the MCP server in the Gram Playground first.
  • Check that the toolset includes the tools to use.
  • Verify the environment is correctly configured with the required variables.

You now have Claude Code connected to a Gram-hosted MCP server with vibe-checking capabilities.

Ready to build your own MCP server? Try Gram today and see how easy it is to turn any API into agent-ready tools.