Back to blog
TutorialJanuary 2, 20254 min read

Getting Started with MCP and RelayRail

A step-by-step guide to integrating RelayRail with your MCP-compatible AI agent in under 5 minutes.

The Model Context Protocol (MCP) is becoming the standard way for AI agents to interact with external tools and services. RelayRail is built MCP-native, which means you can add human-in-the-loop capabilities to any MCP-compatible agent in minutes.

In this tutorial, we'll walk through setting up RelayRail with Claude Desktop, Cursor, and Cline.

Prerequisites

  • Node.js 18 or higher installed
  • A RelayRail account (free tier available)
  • An MCP-compatible agent (Claude Desktop, Cursor, or Cline)

Step 1: Get Your API Key

  1. Sign up at relayrail.dev/signup
  2. Navigate to the Dashboard
  3. Create a new agent and copy your API key

Your API key looks like: rr_xxxxxxxxxxxxxxxxxxxxx

Step 2: Configure Your Agent

For Claude Desktop

Edit your Claude Desktop configuration file (found in ~/Library/Application Support/Claude/ on macOS):

{
  "mcpServers": {
    "relayrail": {
      "command": "npx",
      "args": ["@relayrail/server", "start"],
      "env": {
        "RELAYRAIL_API_KEY": "rr_your_api_key_here"
      }
    }
  }
}

For Cursor

Create or edit ~/.cursor/mcp.json:

{
  "relayrail": {
    "command": "npx",
    "args": ["@relayrail/server", "start"],
    "env": {
      "RELAYRAIL_API_KEY": "rr_your_api_key_here"
    }
  }
}

For Cline

Add to your VS Code settings:

{
  "cline.mcpServers": {
    "relayrail": {
      "command": "npx",
      "args": ["@relayrail/server", "start"],
      "env": {
        "RELAYRAIL_API_KEY": "rr_your_api_key_here"
      }
    }
  }
}

Step 3: Configure Your Phone Number

In the RelayRail dashboard:

  1. Go to Settings → Notifications
  2. Enter your phone number (with country code)
  3. Verify via the SMS code we send

Step 4: Test the Integration

Restart your agent and try this prompt:

"Send me a test notification using RelayRail to confirm everything is working."

You should receive an SMS within seconds. If you do, congratulations—you're all set!

Using RelayRail Tools

Your agent now has access to these tools:

request_approval

Ask the user for a yes/no decision:

request_approval({
  message: "Deploy to production?",
  type: "yes_no"
})
// Returns: { approved: true/false }

send_notification

Send an informational message:

send_notification({
  message: "Build completed successfully!",
  priority: "normal"
})

await_response

Wait for a free-form text response:

await_response({
  message: "What should the new feature be called?"
})
// Returns: { response: "user's answer" }

get_pending_commands

Check if the user has sent any commands:

get_pending_commands()
// Returns: { commands: ["PAUSE", "Check status"] }

Example Workflow

Here's a real-world example. Tell your agent:

"Refactor the auth module. Before making any changes to files, ask for my approval. When you're done, send me a notification."

The agent will:

  1. Analyze the code
  2. Send you an SMS: "About to modify auth/login.ts. Approve?"
  3. Wait for your reply
  4. Proceed or skip based on your answer
  5. Send a final notification when complete

Tips for Success

  • Be explicit: Tell your agent when you want approvals. "Ask before deploying" is better than hoping it will ask.
  • Set expectations: "Notify me of progress every 5 files" helps you stay informed without constant interruptions.
  • Use priorities: Reserve high-priority notifications for errors to avoid notification fatigue.

Next Steps

Questions? Reach out at support@relayrail.dev.