Skip to content

Rename bundled MCP server to Agent Relay MCP#1005

Merged
willwashburn merged 4 commits into
mainfrom
codex/rename-agent-relay-mcp
May 27, 2026
Merged

Rename bundled MCP server to Agent Relay MCP#1005
willwashburn merged 4 commits into
mainfrom
codex/rename-agent-relay-mcp

Conversation

@willwashburn

@willwashburn willwashburn commented May 27, 2026

Copy link
Copy Markdown
Member

Summary: Rename the bundled MCP implementation, tests, and helper to agent-relay-mcp; remove the stale relaycast-named entrypoint/helper; add AGENT_RELAY_MCP_COMMAND; update tracked MCP configs and docs to use agent-relay mcp. Also move the Agent Relay MCP tools table out of the root README and Claude plugin page into a dedicated Agent Relay MCP docs reference, with docs nav and cross-links.

Tests: vitest agent-relay-mcp tests; vitest core.test.ts; tsc --noEmit -p packages/cli/tsconfig.json; cargo test relaycast_server_config_includes_agent_result_vars; cargo test opencode_creates_config_file_and_returns_agent_flag; npm --prefix packages/cli run build; npm --prefix web run build; git diff --check; prettier --check supported changed files; cargo fmt --check.

@coderabbitai

coderabbitai Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR completes the Agent Relay MCP module naming and refactoring by exporting an AgentRelayMcpServerOptions interface and renaming public functions, updates CLI/broker integration to use the new module, migrates all tests, and restructures documentation by moving the MCP tools table to a dedicated reference page with updated navigation and cross-references across plugins and configuration.

Changes

Agent Relay MCP module rename, implementation, and integration

Layer / File(s) Summary
Agent Relay MCP server API and options interface
packages/cli/src/cli/agent-relay-mcp.ts
Introduces AgentRelayMcpServerOptions interface and refactors public function names: createAgentRelayMcpServer, resolveStdioBootstrapOptions, and startAgentRelayMcpStdio with updated return types.
Bundled Agent Relay MCP script resolution and command building
packages/cli/src/cli/lib/agent-relay-mcp-command.ts
Adds resolveBundledAgentRelayMcpScript to locate agent-relay-mcp.js artifacts and buildBundledAgentRelayMcpCommand to construct Node execution commands.
CLI bootstrap and broker lifecycle integration
packages/cli/src/cli/bootstrap.ts, packages/cli/src/cli/lib/broker-lifecycle.ts, scripts/watch-cli-tools.sh
Updates CLI mcp command to import ./agent-relay-mcp.js, adds ensureBundledAgentRelayMcpCommand helper to manage AGENT_RELAY_MCP_COMMAND environment variable with fallback to RELAYCAST_MCP_COMMAND, and exports new env var in watch-cli-tools.sh.
Broker MCP server configuration and agent descriptions
crates/broker/src/snippets.rs
Updates relaycast_server_config() to read AGENT_RELAY_MCP_COMMAND (with fallback), updates Opencode agent description to "Agent with Agent Relay MCP enabled", and updates Cursor MCP documentation and test assertions.
Test suite migration to agent-relay-mcp module
packages/cli/src/cli/agent-relay-mcp.startup.test.ts, packages/cli/src/cli/agent-relay-mcp.test.ts, packages/cli/src/cli/commands/core.test.ts
Migrates all test suites to import from agent-relay-mcp.js and call refactored public functions (createAgentRelayMcpServer, resolveStdioBootstrapOptions, startAgentRelayMcpStdio). Updates MCP command initialization tests to verify new script paths and environment variable handling.
Package exports and public module entry point
packages/cli/package.json
Updates exports["./mcp"] types and import targets to ./dist/cli/agent-relay-mcp.* artifacts.
README restructuring and dedicated Agent Relay MCP documentation
README.md, web/content/docs/agent-relay-mcp.mdx
Removes inline "Agent Relay MCP Tools" section from README and adds link to new documentation. Introduces comprehensive Agent Relay MCP reference page covering server usage, tool definitions, conditional submit_result exposure, and related documentation links.
Web documentation navigation and updated Claude Code plugin docs
web/lib/docs-nav.ts, web/components/docs/DocsNav.tsx, web/content/docs/plugin-claude-code.mdx
Adds "Agent Relay MCP" navigation item to Tools section, maps slug to Plug icon, and replaces tools table with paragraph linking to new reference with a Next Steps card link.
Plugin documentation updates for Codex and Gemini
plugins/codex-relay-skill/README.md, plugins/codex-relay-skill/SKILL.md, plugins/gemini-relay-extension/README.md, packages/sdk-py/src/agent_relay/communicate/adapters/claude_sdk.py
Updates references from "Relaycast MCP server" to "Agent Relay MCP server" across setup instructions, templates, feature descriptions, and code comments.
Configuration file and metadata updates
.mcp.json, packages/sdk/.mcp.json, CHANGELOG.md, packages/sdk/src/__tests__/communicate/adapters/claude-sdk.test.ts, .agentworkforce/trajectories/completed/2026-05/*
Updates MCP configuration files to use agent-relay argument, updates CHANGELOG with new environment variable, updates test description, and records two completed trajectory documents.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

  • AgentWorkforce/relay#955: This PR directly implements the module rename and environment variable changes that affect MCP command launching and structured-result submit_result tool exposure described in that issue.

Possibly related PRs

  • AgentWorkforce/relay#819: Both PRs update MCP bootstrap code to use agent-relay-mcp while maintaining early token trust for at_live_* credentials.
  • AgentWorkforce/relay#886: Both extend web/components/docs/DocsNav.tsx navIcons mapping with new documentation slug entries.
  • AgentWorkforce/relay#977: Both PRs update MCP command wiring (broker/CLI config and bundled agent-relay mcp module usage) when removing external dependencies.

Suggested reviewers

  • khaliqgant
  • barryollama

Poem

🐰 Relay renamed to Agent Relay bold,
New docs shine bright, the tools retold,
Bootstrap refactored, configs aligned,
Tests all migrated, not one left behind!

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 27.78% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The PR description provides a clear summary of changes and lists comprehensive test/validation commands, but the description format does not match the required template structure with explicit 'Summary' and 'Test Plan' sections with checkboxes. Restructure the description to follow the template format: use '## Summary' and '## Test Plan' sections with checkbox items ([ ] Tests added/updated, [ ] Manual testing completed) for consistency with repository standards.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The PR title 'Rename bundled MCP server to Agent Relay MCP' accurately and concisely summarizes the main change across the changeset—renaming the MCP implementation and all related references from relaycast to agent-relay.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/rename-agent-relay-mcp

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

web/content/docs/agent-relay-mcp.mdx

Parsing error: Expression expected.

web/content/docs/plugin-claude-code.mdx

Parsing error: Expression expected.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request renames the bundled Relay MCP implementation to Agent Relay MCP, updates configuration files, tests, and documentation to reflect the change, and adds compatibility shims for legacy relaycast-named imports and environment variables. The reviewer's feedback correctly points out a potential runtime crash when accessing the private _requestHandlers property on mcpServer.server without a defensive check, and provides a robust code suggestion to resolve the issue.

Comment on lines +1503 to +1526
const handlers = (
mcpServer.server as unknown as {
_requestHandlers: Map<
string,
(req: unknown, extra: unknown) => Promise<{ tools?: Array<Record<string, unknown>> }>
>;
}
)._requestHandlers;
const origToolsListHandler = handlers.get('tools/list');
if (origToolsListHandler) {
mcpServer.server.setRequestHandler(ListToolsRequestSchema, async (req, extra) => {
const result = await origToolsListHandler(req, extra);
if (result?.tools) {
result.tools = result.tools.map((tool) => {
const { execution, outputSchema, _meta, ...clean } = tool;
void execution;
void outputSchema;
void _meta;
return clean;
});
}
return result;
});
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Accessing the private _requestHandlers property on mcpServer.server is risky because it relies on internal implementation details of @modelcontextprotocol/sdk which could change or be renamed in future versions. To prevent potential runtime crashes (e.g., TypeError: Cannot read properties of undefined (reading 'get')), add a defensive check to ensure handlers is defined before calling .get().

  const handlers = (
    mcpServer.server as unknown as {
      _requestHandlers?: Map<
        string,
        (req: unknown, extra: unknown) => Promise<{ tools?: Array<Record<string, unknown>> }>
      >;
    }
  )._requestHandlers;
  if (handlers) {
    const origToolsListHandler = handlers.get('tools/list');
    if (origToolsListHandler) {
      mcpServer.server.setRequestHandler(ListToolsRequestSchema, async (req, extra) => {
        const result = await origToolsListHandler(req, extra);
        if (result?.tools) {
          result.tools = result.tools.map((tool) => {
            const { execution, outputSchema, _meta, ...clean } = tool;
            void execution;
            void outputSchema;
            void _meta;
            return clean;
          });
        }
        return result;
      });
    }
  }

@github-actions

Copy link
Copy Markdown
Contributor

Preview deployed!

Environment URL
Web https://dma9dz52youty.cloudfront.net

This preview will be cleaned up when the PR is merged or closed.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
crates/broker/src/snippets.rs (1)

274-289: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Add RELAYCAST_MCP_COMMAND fallback for compatibility in broker-side config generation.

relaycast_server_config() now only checks AGENT_RELAY_MCP_COMMAND, so legacy environments that still set RELAYCAST_MCP_COMMAND silently lose their custom MCP command.

Suggested fix
-    if let Ok(custom_cmd) = std::env::var("AGENT_RELAY_MCP_COMMAND") {
+    if let Ok(custom_cmd) = std::env::var("AGENT_RELAY_MCP_COMMAND")
+        .or_else(|_| std::env::var("RELAYCAST_MCP_COMMAND"))
+    {
         let parts: Vec<&str> = custom_cmd.split_whitespace().collect();
         if let Some((cmd, args_slice)) = parts.split_first() {
             server.insert("command".into(), Value::String(cmd.to_string()));
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/broker/src/snippets.rs` around lines 274 - 289, The code in
relaycast_server_config (snippet building `server` map) only checks
AGENT_RELAY_MCP_COMMAND and drops legacy RELAYCAST_MCP_COMMAND; update the logic
to first try std::env::var("AGENT_RELAY_MCP_COMMAND"), and if that is not set
then try std::env::var("RELAYCAST_MCP_COMMAND"), parsing either value into `cmd`
and `args` exactly as the current split_first flow does, and only default to
"npx" when neither env var exists so legacy environments keep their custom MCP
command.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/cli/src/cli/lib/broker-lifecycle.ts`:
- Around line 454-462: ensureBundledAgentRelayMcpCommand is currently
overwriting the legacy RELAYCAST_MCP_COMMAND fallback when
AGENT_RELAY_MCP_COMMAND is empty; modify the function to first check
deps.env.RELAYCAST_MCP_COMMAND (and use it to set
deps.env.AGENT_RELAY_MCP_COMMAND if present and non-empty) before calling
buildBundledAgentRelayMcpCommand, and only fall back to
buildBundledAgentRelayMcpCommand when RELAYCAST_MCP_COMMAND is absent; keep
using buildBundledAgentRelayMcpCommand(deps.execPath, deps.cliScript,
deps.fs.existsSync) and only assign its return value to
deps.env.AGENT_RELAY_MCP_COMMAND if neither AGENT_RELAY_MCP_COMMAND nor
RELAYCAST_MCP_COMMAND are set.

---

Outside diff comments:
In `@crates/broker/src/snippets.rs`:
- Around line 274-289: The code in relaycast_server_config (snippet building
`server` map) only checks AGENT_RELAY_MCP_COMMAND and drops legacy
RELAYCAST_MCP_COMMAND; update the logic to first try
std::env::var("AGENT_RELAY_MCP_COMMAND"), and if that is not set then try
std::env::var("RELAYCAST_MCP_COMMAND"), parsing either value into `cmd` and
`args` exactly as the current split_first flow does, and only default to "npx"
when neither env var exists so legacy environments keep their custom MCP
command.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9619e8d1-73a6-43d9-9e23-de9d77ce2565

📥 Commits

Reviewing files that changed from the base of the PR and between f904124 and c4c4941.

📒 Files selected for processing (27)
  • .agentworkforce/trajectories/completed/2026-05/traj_paoj645u94py/summary.md
  • .agentworkforce/trajectories/completed/2026-05/traj_paoj645u94py/trajectory.json
  • .agentworkforce/trajectories/completed/2026-05/traj_s5eyi5jw2q1u/summary.md
  • .agentworkforce/trajectories/completed/2026-05/traj_s5eyi5jw2q1u/trajectory.json
  • .mcp.json
  • CHANGELOG.md
  • README.md
  • crates/broker/src/snippets.rs
  • packages/cli/package.json
  • packages/cli/src/cli/agent-relay-mcp.startup.test.ts
  • packages/cli/src/cli/agent-relay-mcp.test.ts
  • packages/cli/src/cli/agent-relay-mcp.ts
  • packages/cli/src/cli/bootstrap.ts
  • packages/cli/src/cli/commands/core.test.ts
  • packages/cli/src/cli/lib/agent-relay-mcp-command.ts
  • packages/cli/src/cli/lib/broker-lifecycle.ts
  • packages/sdk-py/src/agent_relay/communicate/adapters/claude_sdk.py
  • packages/sdk/.mcp.json
  • packages/sdk/src/__tests__/communicate/adapters/claude-sdk.test.ts
  • plugins/codex-relay-skill/README.md
  • plugins/codex-relay-skill/SKILL.md
  • plugins/gemini-relay-extension/README.md
  • scripts/watch-cli-tools.sh
  • web/components/docs/DocsNav.tsx
  • web/content/docs/agent-relay-mcp.mdx
  • web/content/docs/plugin-claude-code.mdx
  • web/lib/docs-nav.ts

Comment on lines +454 to 462
function ensureBundledAgentRelayMcpCommand(deps: CoreDependencies): void {
if (deps.env.AGENT_RELAY_MCP_COMMAND?.trim()) {
return;
}

const command = buildBundledRelaycastMcpCommand(deps.execPath, deps.cliScript, deps.fs.existsSync);
const command = buildBundledAgentRelayMcpCommand(deps.execPath, deps.cliScript, deps.fs.existsSync);
if (command) {
deps.env.RELAYCAST_MCP_COMMAND = command;
deps.env.AGENT_RELAY_MCP_COMMAND = command;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Preserve legacy MCP override fallback before auto-populating AGENT_RELAY_MCP_COMMAND.

This now ignores an existing RELAYCAST_MCP_COMMAND override and replaces behavior with bundled default, which breaks backward compatibility for existing setups.

Suggested fix
 function ensureBundledAgentRelayMcpCommand(deps: CoreDependencies): void {
   if (deps.env.AGENT_RELAY_MCP_COMMAND?.trim()) {
     return;
   }
+  if (deps.env.RELAYCAST_MCP_COMMAND?.trim()) {
+    deps.env.AGENT_RELAY_MCP_COMMAND = deps.env.RELAYCAST_MCP_COMMAND;
+    return;
+  }

   const command = buildBundledAgentRelayMcpCommand(deps.execPath, deps.cliScript, deps.fs.existsSync);
   if (command) {
     deps.env.AGENT_RELAY_MCP_COMMAND = command;
   }
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
function ensureBundledAgentRelayMcpCommand(deps: CoreDependencies): void {
if (deps.env.AGENT_RELAY_MCP_COMMAND?.trim()) {
return;
}
const command = buildBundledRelaycastMcpCommand(deps.execPath, deps.cliScript, deps.fs.existsSync);
const command = buildBundledAgentRelayMcpCommand(deps.execPath, deps.cliScript, deps.fs.existsSync);
if (command) {
deps.env.RELAYCAST_MCP_COMMAND = command;
deps.env.AGENT_RELAY_MCP_COMMAND = command;
}
function ensureBundledAgentRelayMcpCommand(deps: CoreDependencies): void {
if (deps.env.AGENT_RELAY_MCP_COMMAND?.trim()) {
return;
}
if (deps.env.RELAYCAST_MCP_COMMAND?.trim()) {
deps.env.AGENT_RELAY_MCP_COMMAND = deps.env.RELAYCAST_MCP_COMMAND;
return;
}
const command = buildBundledAgentRelayMcpCommand(deps.execPath, deps.cliScript, deps.fs.existsSync);
if (command) {
deps.env.AGENT_RELAY_MCP_COMMAND = command;
}
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/cli/src/cli/lib/broker-lifecycle.ts` around lines 454 - 462,
ensureBundledAgentRelayMcpCommand is currently overwriting the legacy
RELAYCAST_MCP_COMMAND fallback when AGENT_RELAY_MCP_COMMAND is empty; modify the
function to first check deps.env.RELAYCAST_MCP_COMMAND (and use it to set
deps.env.AGENT_RELAY_MCP_COMMAND if present and non-empty) before calling
buildBundledAgentRelayMcpCommand, and only fall back to
buildBundledAgentRelayMcpCommand when RELAYCAST_MCP_COMMAND is absent; keep
using buildBundledAgentRelayMcpCommand(deps.execPath, deps.cliScript,
deps.fs.existsSync) and only assign its return value to
deps.env.AGENT_RELAY_MCP_COMMAND if neither AGENT_RELAY_MCP_COMMAND nor
RELAYCAST_MCP_COMMAND are set.

@willwashburn willwashburn merged commit 38d4255 into main May 27, 2026
50 checks passed
@willwashburn willwashburn deleted the codex/rename-agent-relay-mcp branch May 27, 2026 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant