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
- Sign up at relayrail.dev/signup
- Navigate to the Dashboard
- 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:
- Go to Settings → Notifications
- Enter your phone number (with country code)
- 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:
- Analyze the code
- Send you an SMS: "About to modify auth/login.ts. Approve?"
- Wait for your reply
- Proceed or skip based on your answer
- 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
- Learn about approval flow types
- Read best practices for human-in-the-loop
- Explore the full API reference
Questions? Reach out at support@relayrail.dev.