Relay

io.github.mhcoen由 GitHub 帳號 mhcoen 發布v1.2.4更新於 Oct 24, 2026

MCP relay server for Claude Desktop <-> Claude Code communication

已驗證STDIO僅桌面效率與工作流開發者工具

概覽

AI 產生的概覽

一個本機訊息中繼,讓 Claude Desktop 與 Claude Code 在不共用上下文視窗的情況下互相傳遞檔案、程式碼、資料與說明。

可以做什麼
在兩種 Claude 介面之間傳送訊息、檔案、程式碼或資料,並標註傳送方(desktop 或 code)。取得最近訊息,可選擇只取未讀,並查看訊息數量與最近活動。清空共用的訊息緩衝區。以資源方式直接引用最新訊息,而不必取得。啟動時預覽待處理訊息,並在有新訊息時跳出系統通知。
適用情境
適合在 Claude Desktop 中規劃或審閱、在 Claude Code 中執行(或反過來),且厭倦在兩個視窗間複製貼上的情境。適合單一機器上的單一使用者,希望由人控制交接,而非自動的代理間對話。
執行需求
以 Python 套件(Python 3.9+)透過 uvx 在本機以 stdio 執行,或從複製的儲存庫搭配虛擬環境執行。需同時在 Claude Desktop 設定檔與 Claude Code 專案設定中設定,並為兩端分別指定用戶端參數。選用的 /get 指令與啟動掛鉤由安裝指令寫入。桌面通知依平台使用 osascript、notify-send(libnotify)或 PowerShell 通知。
安裝前請注意
訊息以未加密形式存放在家目錄下的共用 SQLite 緩衝區,機器上任何程式都可讀取;緩衝區跨專案全域共用,可能看到其他專案的舊訊息。清空工具會刪除所有緩衝訊息。模型在認為需要對方輸入時可能自行傳送或取得,請留意中繼內容。單則訊息上限 8 KB,緩衝區僅保留最近 20 則。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Relay,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

Relay

A wonderfully simple tool that moves information—files, code, data, comments, directions, etc.—between Claude Desktop and Claude Code while keeping their main context windows separate.

Both Claudes can send messages autonomously—when they need input from the other side, they just do it. You get a system notification when something arrives. You fetch when you're ready.

Why? Desktop and Code have different strengths. Desktop is better for conversation—planning, brainstorming, reviewing, iterating on prose. Code is better for execution—editing files, running commands, working through errors. But they don't share context. If you draft something in Desktop and want Code to implement it, or you want Desktop's opinion on code you're writing, you're copy-pasting between apps.

Relay connects them without requiring you to manually specify questions and cut & paste between windows. This is basic functionality that should have been integrated by Anthropic.

You're in control. Fetching is typically a user action—you type get or /get. Models can send or fetch when they decide they need input from the other side, but there's no automatic background sync. No runaway inter-LLM conversation burning through your tokens.

Quick Example

[In Desktop]You:     Send my last error message to Code.Desktop: [sends via relay]
[notification pops up in Code's terminal]
[In Code]You:     /getCode:    Got it. That's from line 47 in parser.py—the regex isn't matching.         [fixes the bug]

Extended Example

[In Code]You:     My classifier's stuck at 72% accuracy. Send the         training config and last epoch's metrics to Desktop.Code:    [sends config.yaml and metrics via relay]
[System notification appears that a message has been sent to Desktop]
[In Desktop]You:     /getDesktop: [fetches config and metrics]         The loss curve suggests you're underfitting. Learning         rate 1e-5 is conservative for a model this size...
You:     What would you try?Desktop: Bump to 3e-5, add warmup steps, and your batch size         of 8 is small—if memory allows, try 16. Also the         class imbalance is brutal: 80/15/5 split. Consider         weighted loss or oversampling the minority classes.
You:     Specify the changes.Desktop: [sends updated config via relay]
[System notification appears that a message has been sent to Code]
[In Code]You:     /getCode:    Got it. Updating config.yaml and adding class weights         to the loss function.         [edits files, starts training run]
         Epoch 12: accuracy up to 79%, but precision on         class 2 dropped. Want Desktop's take?
You:     Yeah, send the confusion matrix.Code:    [sends via relay]
[In Desktop]You:     /getDesktop: Class 2 is getting confused with class 0—they may be         semantically close. I need more examples.         [automatically sends request to Code via relay]

Usage

Type get in Desktop or /get in Code to check for messages from the other side. That's the primary interaction.

Command variants:

  • /get — Fetch and execute messages from Desktop
  • /get status — Show message count and last activity
  • /get clear — Clear all messages from the buffer
  • /get <message> — Send a message to Desktop

Resource access: You can also reference messages directly with @relay:messages://latest. This is faster than /get and works in plan mode.

Startup preview: When Code starts, you'll see a preview of any pending messages from Desktop. Use /get to read them in full.

Sending is easy and implicit. When you say "Ask Desktop if this looks right" or "Send the README to Code," the models recognize the intent and call the relay automatically.

Notifications

When a message arrives, you'll get a system notification so you know to check the other side. No need to poll manually.

[圖片]
PlatformMethodNotes
macOSosascriptNative notification center
Linuxnotify-sendRequires libnotify
WindowsPowerShell toastNative toast notifications

Sound: Add --sound to enable notification sounds. Without a value, uses platform defaults. With a value, uses the specified sound:

PlatformDefaultCustom example
macOSblow--sound tink
Linuxfreedesktop message sound--sound /path/to/sound.oga
Windowssystem default--sound ms-winsoundevent:Notification.IM

Duration and display behavior are controlled by your OS settings.

Design Philosophy

Transport, not memory. The relay is a message bus. It does not summarize, compress, rewrite, or interpret messages. There is no shared hidden context, merged system prompts, or cross-agent planning. Messages pass through unchanged. This keeps concerns cleanly separated and avoids epistemic corruption.

Primarily user-controlled. Fetching messages is typically an explicit user action (get or /get), not a background process. This prevents runaway context growth and feedback loops. However, models may send or fetch autonomously when they decide they need input from the other side—the system allows this without encouraging it.

Independent interfaces. Desktop and Code remain fully usable on their own. You can have a long conversation in Desktop without Code, or spend hours debugging in Code without Desktop. The relay connects them when you want; it doesn't couple them. This also means no API costs—both interfaces use your existing subscriptions.

Minimal surface area. The relay does three things: send, fetch, clear. It does not attempt to provide orchestration, arbitration, consensus, or autonomous behavior. This restraint is intentional. Most multi-agent designs fail by blurring boundaries that should remain clear.

Scales naturally. Multiple Code sessions connect to the same Desktop—you direct messages to the appropriate conversation. Additional MCP-speaking peers, alternative storage backends, per-project buffers, and read-only observers all extend cleanly from this design.

This defines a distinct class of infrastructure: a human-mediated, explicitly synchronized multi-agent message bus.

Design Notes

The relay is global. The buffer at ~/.relay_buffer.db is shared across all projects. Desktop has no concept of which project you're working on, so per-project isolation isn't practical. This is intentional: one user, one machine, one relay.

If you switch projects in Code, the relay comes with you. Old messages from the previous project may still be there; use /get clear if you want a fresh start.

Large files are slow. For messages a page or two in length, the relay is fast. For large files, it's faster to drag them directly into the interface you want. You can still send accompanying context via relay.

Setup

What's uvx? uvx runs Python packages directly without installing them globally. It handles dependencies automatically. If you don't have it: curl -LsSf https://astral.sh/uv/install.sh | sh (See astral.sh/uv for more info.)

1. Configure Claude Desktop

Add to your Claude Desktop config:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
json
{  "mcpServers": {    "relay": {      "command": "uvx",      "args": ["mcp-server-relay", "--client", "desktop", "--sound"]    }  }}

Restart Claude Desktop, then tell it to remember this instruction:

Remember: When the user says "get" or "/get" alone, fetch recent messages from the relay using relay_fetch.

You can verify it was recorded by saying "Show me my memory edits."

2. Configure Claude Code

Add to .mcp.json in your project root:

json
{  "mcpServers": {    "relay": {      "command": "uvx",      "args": ["mcp-server-relay", "--client", "code"]    }  }}

Note: Only Desktop needs --sound since it handles notifications for both sides.

3. Install the /get command and startup hook

bash
uvx mcp-server-relay --setup-code

This installs the /get slash command and a SessionStart hook that shows pending messages when Code launches.

Alternative: Install from GitHub

If you prefer not to use uvx, clone the repository and run directly:

bash
git clone https://github.com/mhcoen/mcp-relay.gitcd mcp-relaypython -m venv .venv.venv/bin/pip install -e .

Then use the full path in your configs:

Claude Desktop (claude_desktop_config.json):

json
{  "mcpServers": {    "relay": {      "command": "/path/to/mcp-relay/.venv/bin/python",      "args": ["/path/to/mcp-relay/relay_server.py", "--client", "desktop", "--sound"]    }  }}

Claude Code (.mcp.json):

json
{  "mcpServers": {    "relay": {      "command": "/path/to/mcp-relay/.venv/bin/python",      "args": ["/path/to/mcp-relay/relay_server.py", "--client", "code"]    }  }}

Replace /path/to/mcp-relay with your actual clone location.

Tools

ToolDescription
relay_send(message, sender)Send a message (sender: "desktop" or "code")
relay_fetch(limit, reader, unread_only)Fetch recent messages, optionally mark as read
relay_clear()Delete all messages from the buffer

Technical Details

  • Buffer: SQLite at ~/.relay_buffer.db
  • Rolling window: 20 messages max (oldest evicted first)
  • Message limit: 8 KB per message
  • Idle timeout: 1 hour (server exits automatically when inactive)
  • Transport: stdio (standard MCP)
  • Python: 3.9+

Author

Michael Coen — [email protected] · [email protected]

來源:README.md,提交 71c4c5e

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v1.2.4最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分