Skip to content

feat(mcp): Expose MCP relay tools as callable functions for agents#290

Merged
khaliqgant merged 2 commits intomainfrom
feature/mcp-tool-exposure
Jan 24, 2026
Merged

feat(mcp): Expose MCP relay tools as callable functions for agents#290
khaliqgant merged 2 commits intomainfrom
feature/mcp-tool-exposure

Conversation

@khaliqgant
Copy link
Copy Markdown
Member

@khaliqgant khaliqgant commented Jan 24, 2026

Summary

Implement MCP tool exposure so agents can use relay communication tools as callable functions.

This enables agents to call:

  • relay_send() - Send messages to other agents/channels
  • relay_spawn() - Create worker agents
  • relay_release() - Terminate agents
  • relay_inbox() - Check pending messages
  • relay_who() - List online agents
  • relay_status() - Get connection diagnostics

What Changed

  • Expose RELAY_SOCKET to spawned agents for MCP tool discovery
  • Agents can now use MCP tools as primary communication method
  • File-based relay protocol remains as fallback

Testing

Agents successfully communicate via relay protocol (both file-based and MCP tools)

🤖 Generated with Claude Code


Open with Devin

…overy

When Claude Code starts as a spawned agent, the MCP server (started by
Claude Code from .mcp.json config) needs to discover the relay daemon
socket to connect and register tools. Previously, the socket path wasn't
passed to spawned agents, so the MCP server had to rely on filesystem
discovery which could fail in some environments.

Now we explicitly pass RELAY_SOCKET environment variable to spawned
agents, ensuring the MCP server can reliably connect to the daemon and
expose relay_send, relay_spawn, relay_release, relay_inbox, relay_who,
and relay_status as callable functions.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@my-senior-dev-pr-review
Copy link
Copy Markdown

my-senior-dev-pr-review Bot commented Jan 24, 2026

🤖 My Senior Dev — Analysis Complete

👤 For @khaliqgant

📁 Expert in src (662 edits) • ⚡ 143rd PR this month

View your contributor analytics →


📊 2 files reviewed • 1 need attention

⚠️ Needs Attention:

  • packages/bridge/src/spawner.ts — Security implications due to environment variable changes that could lead to information exposure.

🚀 Open Interactive Review →

The full interface unlocks features not available in GitHub:

  • 💬 AI Chat — Ask questions on any file, get context-aware answers
  • 🔍 Smart Hovers — See symbol definitions and usage without leaving the diff
  • 📚 Code Archeology — Understand how files evolved over time (/archeology)
  • 🎯 Learning Insights — See how this PR compares to similar changes

💬 Chat here: @my-senior-dev explain this change — or try @chaos-monkey @security-auditor @optimizer @skeptic @junior-dev

📖 View all 12 personas & slash commands

You can interact with me by mentioning @my-senior-dev in any comment:

In PR comments or on any line of code:

  • Ask questions about the code or PR
  • Request explanations of specific changes
  • Get suggestions for improvements

Slash commands:

  • /help — Show all available commands
  • /archeology — See the history and evolution of changed files
  • /profile — Performance analysis and suggestions
  • /expertise — Find who knows this code best
  • /personas — List all available AI personas

AI Personas (mention to get their perspective):

Persona Focus
@chaos-monkey 🐵 Edge cases & failure scenarios
@skeptic 🤨 Challenge assumptions
@optimizer Performance & efficiency
@security-auditor 🔒 Security vulnerabilities
@accessibility-advocate Inclusive design
@junior-dev 🌱 Simple explanations
@tech-debt-collector 💳 Code quality & shortcuts
@ux-champion 🎨 User experience
@devops-engineer 🚀 Deployment & scaling
@documentation-nazi 📚 Documentation gaps
@legacy-whisperer 🏛️ Working with existing code
@test-driven-purist Testing & TDD

For the best experience, view this PR on myseniordev.com — includes AI chat, file annotations, and interactive reviews.

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional flags.

Open in Devin Review

After PR #290 (MCP tool exposure) merges, update all relay documentation
to emphasize MCP as primary communication method for agents.

Task: bd-mcp-docs-001
Priority: 60 (high)
Scope: CLAUDE.md, packages/mcp/README.md, cloud docs, examples

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@khaliqgant khaliqgant merged commit 7a07008 into main Jan 24, 2026
24 of 25 checks passed
@khaliqgant khaliqgant deleted the feature/mcp-tool-exposure branch January 24, 2026 16:11
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