MCP server/monitoring

mcp-await MCP Server

Non-blocking awaiter for bash commands, files, ports, and more.

★ 1ricardo-hdrn/mcp-await ↗by ricardo-hdrnupdated
1

Add it to Claude Code

claude mcp add mcp-await -- mcp-await
2

Make your agent remember this setup

mcp-await's config, env vars, and the gotchas you hit — recalled in every future Claude Code, Cursor, and Codex session.

npx conare@latest

Free · one command · indexes the sessions already on disk. Set up in the browser instead →

What it does

  • Non-blocking background monitoring with watch IDs
  • Native support for files, ports, processes, and shell commands
  • Efficient event-based watching using inotify for files
  • JSON-formatted output for easy parsing by AI agents
  • Blocking and non-blocking execution modes

Tools 8

wait_for_portWaits for a TCP port to become available.
wait_for_fileWaits for a file event such as create, modify, or delete.
wait_for_urlWaits for a URL to return a specific HTTP status code.
wait_for_pidWaits for a specific process ID to exit.
wait_for_dockerWaits for a Docker container to exit.
wait_for_gh_runWaits for a GitHub Actions run to complete.
wait_for_commandRe-runs a shell command until it exits with status 0.
cancel_watchCancels a non-blocking watch operation.

Try it

Wait for the local development server on port 8080 to be ready before running the test suite.
Monitor /tmp/deploy.lock and notify me as soon as the file is created.
Wait for the Docker container 'web-app' to finish its startup process.
Check if the health check endpoint at localhost:3000 returns a 200 status code.
Original README from ricardo-hdrn/mcp-await

mcp-await

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

# Prebuilt binary (Linux, macOS, Windows) — download from GitHub Releases
# https://github.com/ricardo-hdrn/mcp-await/releases/latest

# From crates.io
cargo install mcp-await

# From source
git clone https://github.com/ricardo-hdrn/mcp-await.git
cd mcp-await
cargo build --release

Quick Start

# Wait for a service to be ready
mcp-await port localhost 8080 --timeout 30

# Wait for a file to appear
mcp-await file /tmp/deploy.lock --event create --timeout 60

# Wait for a command to succeed
mcp-await cmd "curl -sf http://localhost:8080/health" --interval 2 --timeout 30

Tools

Tool Key Params How it watches
wait_for_port host, port TCP dial loop, 500ms interval
wait_for_file path, event (create/modify/delete) inotify via notify crate, no polling
wait_for_url url, expected_status (default 200) curl loop, 2s interval (requires curl)
wait_for_pid pid /proc/{pid} check, 500ms interval
wait_for_docker container docker wait (requires docker)
wait_for_gh_run run_id, repo (optional) gh run watch (requires gh)
wait_for_command command, interval_seconds (default 5) Re-run via sh -c until exit 0
cancel_watch watch_id Cancels 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:

# TCP port
mcp-await port localhost 5432 --timeout 30

# File events
mcp-await file /var/log/app.log --event modify --timeout 120
mcp-await file /tmp/flag --event create --timeout 60
mcp-await file /tmp/old.pid --event delete --timeout 30

# HTTP status
mcp-await url https://api.example.com/health --status 200 --timeout 120

# Process exit
mcp-await pid 12345 --timeout 300

# Docker container exit
mcp-await docker my-container --timeout 600

# GitHub Actions run
mcp-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

Code Meaning
0 Condition met (success)
1 Timeout
2 Error

Output Format

All commands output JSON:

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

MCP Server Setup

Claude Code

Add to ~/.claude.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

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:
    {"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:

{"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:

Agent Instructions file
Claude Code CLAUDE.md
Codex AGENTS.md
Gemini CLI GEMINI.md
Cursor .cursor/rules/
Windsurf .windsurfrules
## Waiting for conditions

Use mcp-await tools instead of shell workarounds:
- `wait_for_port` in

Frequently Asked Questions

What are the key features of mcp-await?

Non-blocking background monitoring with watch IDs. Native support for files, ports, processes, and shell commands. Efficient event-based watching using inotify for files. JSON-formatted output for easy parsing by AI agents. Blocking and non-blocking execution modes.

What can I use mcp-await for?

Automating CI/CD pipelines by waiting for services to start. Synchronizing file-based workflows between AI agents and local scripts. Monitoring long-running background tasks or container lifecycles. Validating API availability before executing dependent tasks.

How do I install mcp-await?

Install mcp-await by running: cargo install mcp-await

What MCP clients work with mcp-await?

mcp-await works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Conare · memory for coding agents

Turn this server into reusable context

Keep mcp-await docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Set up free$npx conare@latest