AI Agents

Connecting an AI agent to Relay

Turn on Relay's MCP server and add it to Claude Code, Cursor or another agent.

Overview

Relay includes a Model Context Protocol (MCP) server that AI coding agents connect to over HTTP. Once an agent is connected, you can ask it to find your requests, add drafts, import an API or write code that calls an endpoint, and it does that work in Relay.

The server runs only while Relay is open, and it accepts connections only from your Mac, on the address 127.0.0.1. Every agent that connects needs the server's token, which Relay creates the first time you open the MCP pane and keeps in your keychain.

Important

Anyone with the token can read your requests and send them with your credentials. Keep it in your agent's user-level configuration, not in a project file that you commit or share.

Turn on the MCP server

  1. Choose Relay > Settings, then click MCP.
  2. Turn on Enable MCP Server.

Status shows Running on 127.0.0.1 followed by the port when the server is ready. The server starts again each time you open Relay until you turn it off.

If Status shows that the port is already in use by another app, enter a different port between 1024 and 65535 in the Port field and click Apply. The default port is 47823. Changing the port changes the server's URL, so update any agent you've already connected. If the server stops for another reason, click Retry.

Add Relay to your agent

The Client Configuration section of the MCP pane shows the configuration for your agent, with the current port and token filled in. Click the Copy button next to a snippet to copy it.

Run the command in Terminal:

claude mcp add --transport http relay http://127.0.0.1:47823/mcp --header "Authorization: Bearer <token>"

In both, <token> stands for your token. The snippets in the MCP pane include it.

For any other agent, give it these details:

  • Transport: Streamable HTTP
  • URL: http://127.0.0.1:47823/mcp, with your port if you changed it
  • Header: Authorization: Bearer followed by your token

To check the connection, ask the agent to list your Relay requests. It calls the list_requests tool and shows what it finds.

Set up an agent from the Getting Started screen

The Getting Started screen that opens the first time you use Relay has an Agents step. Turn on Enable MCP Server there, then click Copy Prompt. Relay copies instructions that include the server's URL, your token and the configuration snippets. Paste them into your agent, and it adds Relay to its own configuration.

To see the Getting Started screen again, choose Help > Show Getting Started.

Manage the token

The MCP pane shows the token masked. To see it, click the Show Token button, and to copy it, click the Copy Token button.

If the token has been shared by mistake, or you want to stop every connected agent at once, click Regenerate… and then Regenerate. Agents using the old token stop working until you update their configuration with the new one.

To turn the server off, turn off Enable MCP Server. Agents can't connect again until you turn it back on.

See Also