Mcp Await

io.github.ricardo-hdrn由 GitHub 帳號 ricardo-hdrn 發布v0.1.3更新於 Oct 24, 2026

Condition watcher for AI assistants — wait for ports, files, URLs, processes, and more

概覽

AI 產生的概覽

本機 MCP 伺服器兼命令列工具,讓助理等待某個條件成立:連接埠、檔案事件、URL 狀態、行程、Docker 容器、GitHub Actions 執行或 shell 指令。

可以做什麼
等待網路與服務就緒:TCP 連接埠和帶預期 HTTP 狀態的 URL,可選非阻塞模式,回傳 watch ID 與資源 URI 供稍後讀取或取消。
適用情境
當助理需要先等待服務、部署、檔案、行程、容器或 CI 執行完成再繼續時使用,避免撰寫浪費往返的 sleep 或重試迴圈。
執行需求
以本機行程在使用者機器上執行,可透過預先建置的執行檔、crates.io 或原始碼安裝。部分工具依賴 PATH 中的外部程式:URL 等待需要 curl,容器等待需要 docker,GitHub Actions 等待需要 gh。未宣告帳號、API 金鑰或環境變數。
安裝前請注意
指令等待工具會透過 sh -c 反覆執行任意 shell 指令直到結束碼為 0,因此會在本機執行助理提供的任何指令。URL 等待會發出對外網路請求,GitHub Actions 等待使用本機 gh 憑證。非阻塞監看會在背景持續執行,直到完成或被取消。

安裝

在 SourceWeft 中

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

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

其他 MCP 客戶端

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

README

mcp-await

[crates.io] [CI] [license]

Condition watcher MCP server + CLI for AI CLI assistants (Claude Code, Codex, Cursor, etc.).

Instead of polling with sleep loops and curl --retry that waste API round-trips, call a wait tool once — it blocks until the condition is met and returns the result.

[demo]

Installation

bash
# Prebuilt binary (Linux, macOS, Windows) — download from GitHub Releases# https://github.com/ricardo-hdrn/mcp-await/releases/latest
# From crates.iocargo install mcp-await
# From sourcegit clone https://github.com/ricardo-hdrn/mcp-await.gitcd mcp-awaitcargo build --release

Quick Start

bash
# Wait for a service to be readymcp-await port localhost 8080 --timeout 30
# Wait for a file to appearmcp-await file /tmp/deploy.lock --event create --timeout 60
# Wait for a command to succeedmcp-await cmd "curl -sf http://localhost:8080/health" --interval 2 --timeout 30

Tools

ToolKey ParamsHow it watches
wait_for_porthost, portTCP dial loop, 500ms interval
wait_for_filepath, event (create/modify/delete)inotify via notify crate, no polling
wait_for_urlurl, expected_status (default 200)curl loop, 2s interval (requires curl)
wait_for_pidpid/proc/{pid} check, 500ms interval
wait_for_dockercontainerdocker wait (requires docker)
wait_for_gh_runrun_id, repo (optional)gh run watch (requires gh)
wait_for_commandcommand, interval_seconds (default 5)Re-run via sh -c until exit 0
cancel_watchwatch_idCancels a non-blocking watch

All tools accept timeout_seconds (default: 300) and blocking (default: true).

CLI Usage

The binary doubles as a standalone CLI tool:

bash
# TCP portmcp-await port localhost 5432 --timeout 30
# File eventsmcp-await file /var/log/app.log --event modify --timeout 120mcp-await file /tmp/flag --event create --timeout 60mcp-await file /tmp/old.pid --event delete --timeout 30
# HTTP statusmcp-await url https://api.example.com/health --status 200 --timeout 120
# Process exitmcp-await pid 12345 --timeout 300
# Docker container exitmcp-await docker my-container --timeout 600
# GitHub Actions runmcp-await gh-run 12345678 --repo owner/repo --timeout 1800
# Arbitrary shell command (exit 0 = success)mcp-await cmd "test -f /tmp/ready" --interval 2 --timeout 30

Exit Codes

CodeMeaning
0Condition met (success)
1Timeout
2Error

Output Format

All commands output JSON:

json
{  "status": "success",  "elapsed_seconds": 1.23,  "detail": "localhost:8080 is accepting connections"}

MCP Server Setup

Claude Code

Add to ~/.claude.json:

json
{  "mcpServers": {    "await": {      "command": "/path/to/mcp-await"    }  }}

The binary runs as a stdio MCP server when invoked without a subcommand (or with mcp-await serve).

MCP Inspector

bash
npx @modelcontextprotocol/inspector ./target/release/mcp-await

Blocking vs Non-Blocking Mode

Blocking (default)

The tool call holds until the condition is met, times out, or is cancelled. This is the simplest mode — the AI assistant waits for the result.

Non-Blocking

Set blocking: false to get an immediate response with a watch_id and resource URI. The server monitors in the background and pushes a notification when done.

Flow:

  1. Call wait_for_port with blocking: false
  2. Get back immediately:
    json
    {"watch_id": "port-1", "resource": "watch://port-1", "status": "watching"}
  3. Do other work while waiting
  4. Receive notifications/resources/updated when the condition is met
  5. Read watch://port-1 for the full result

Cancellation

Cancel any non-blocking watch with cancel_watch:

json
{"watch_id": "port-1"}

Resources

Non-blocking watches are exposed as MCP resources at watch://{watch_id}.

  • list_resources — returns all active and completed watches
  • read_resource("watch://port-1") — returns JSON with the watch status and result

Reinforcing Agent Usage

Agents sometimes fall back to shell workarounds instead of using mcp-await. Add a snippet to your project's agent instructions file to reinforce the behavior:

AgentInstructions file
Claude CodeCLAUDE.md
CodexAGENTS.md
Gemini CLIGEMINI.md
Cursor.cursor/rules/
Windsurf.windsurfrules
markdown
## Waiting for conditions
Use mcp-await tools instead of shell workarounds:- `wait_for_port` instead of `while ! nc ...; do sleep 1; done`- `wait_for_url` instead of `curl --retry`- `wait_for_file` instead of polling loops- `wait_for_command` instead of `while ! cmd; do sleep N; done`
Prefer `blocking: false` when there is independent work to do in parallel.

Roadmap

  • Agent-level instructions to enforce mcp-await usage across all agents (system prompts, tool metadata hints)
  • Broader agent compatibility testing (Codex, Gemini CLI, Cursor, Windsurf)

Development

bash
cargo build           # debug buildcargo build --release # release buildcargo test            # run testscargo clippy          # lintcargo fmt             # format

License

MIT

來源:README.md,提交 8dbd6d0

工具

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

版本歷史

1
  1. v0.1.3最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

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

  • 近 30 天內可連通25 分

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

  • 已宣告認證方式10 分

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

  • 已列出工具15 分

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

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