MCP Tools

MCP Tools

The tools Relay's MCP server offers to AI agents.

Overview

Relay's MCP server gives AI agents a set of tools for reading, editing, organizing and sending your requests, reading responses and History, setting up variables and auth, creating drafts, importing APIs, generating code and editing scripts. An agent calls a tool with a JSON object of arguments and gets back a JSON result. Each result is both structured content and the same JSON as text, for clients that read only text. Every tool declares the shape of its structured content as an output schema, which lists the fields that are always present. generate_code is the exception: its text is the generated code.

The server speaks the Model Context Protocol over Streamable HTTP at http://127.0.0.1:47823/mcp (or the port you choose), and every request needs the bearer token from the MCP pane of Relay's settings. To set it up, see Connecting an AI agent to Relay.

When a tool can't do what it's asked, such as when an id doesn't exist or an argument has the wrong type, it returns a result marked as an error, with a message that says what went wrong and, where it can, what to try instead. Arguments a tool doesn't know are ignored.

Workspaces

Relay has no current workspace for MCP, because each Relay window shows its own. Tools that act on an existing workspace take a workspaceId, which is required when Relay has more than one workspace. Use get_active_workspace for the workspace you were working in last.

A workspace that's read-only, because files in its folder can't be read, or unavailable, because Relay can't find or open it, can't be changed through MCP. Drafts are always writable.

Undo

Changes made through MCP aren't added to any window's undo history, deletions included. Delete a draft, collection or workspace you don't want the way you would any other.

Topics

Workspaces and requests

  • list_requests: Lists the requests and drafts in Relay, with the workspaces that hold them.
  • get_active_workspace: Returns the workspace of the Relay window you used last.
  • get_request: Reads a request or draft as written, with its secrets hidden.
  • update_request: Changes a request or draft.
  • send_request: Sends a request and returns its response.
  • get_response: Reads a response Relay already holds, a window at a time.
  • list_history: Lists the sends in Relay's History.
  • add_draft: Creates a draft request from a URL, method, headers, body and settings.
  • add_draft_from_curl: Creates a draft request from a curl command.

Organizing

  • create_folder: Creates a folder in a collection, or a new collection.
  • move_item: Moves a request, draft or folder, or saves a draft into a collection.
  • rename_item: Renames a request, draft, folder or collection.
  • delete_item: Deletes a request, draft, folder or collection.

Variables and auth

  • list_variables: Lists variables by scope, with secret values hidden.
  • set_variables: Adds, changes or removes variables in one scope.
  • get_auth: Reads the auth a request, folder, collection or workspace sets.
  • set_auth: Sets the auth of a request, folder, collection or workspace.

Importing

  • import_collection: Imports an OpenAPI spec, a Postman collection or a Postman environment.
  • import_openapi: Imports an OpenAPI 3.0 or 3.1 spec as a collection of requests.

Code generation

  • list_generators: Lists the code generators that can export requests as code.
  • get_generator: Returns a code generator's manifest and JavaScript source.
  • generate_code: Generates code that sends a request, using a code generator.
  • test_generator: Runs a code generator's source once without saving it.
  • create_generator: Saves a new JavaScript code generator.

Scripts

  • get_scripts: Reads the scripts of a request, folder or collection.
  • set_scripts: Replaces the scripts of a request, folder or collection.

See Also