Skip to content

feat(mcp): notify_user — agent-to-OS notification surface - #61

Merged
paultyng merged 2 commits into
mainfrom
feat/notify-user-mcp-tool
Jun 23, 2026
Merged

feat(mcp): notify_user — agent-to-OS notification surface#61
paultyng merged 2 commits into
mainfrom
feat/notify-user-mcp-tool

Conversation

@paultyng

Copy link
Copy Markdown
Owner

Summary

  • New MCP tool notify_user(title, body) on both per-idea and orchestrator surfaces.
  • macOS-only OS notification via osascript; non-macOS hosts log-only (no error).
  • Per-session rate limit: 5s minimum gap, sessionID-keyed map on Manager.

Closes backlog c17aead0. Per-agent on/off and a settings UI are deferred to a follow-up.

Test plan

  • go test ./internal/mcp/ -count=1 -race: 5 new tests cover happy path, missing-args, rate limit, per-session isolation, notifier-error pass-through.
  • task lint, task build: clean.
  • Manual: start a session, call notify_user via the agent, see a real macOS Notification Center banner.

🤖 Generated with Claude Code

paultyng and others added 2 commits June 21, 2026 11:44
A backgrounded agent that finishes its work, blocks, or hits an
unrecoverable state can now ping the user via the OS notification
center instead of waiting silently in a terminal the user has stopped
watching. macOS-only for v0.1 (osascript shell-out); non-macOS hosts
log only — freedesktop / Windows toast are follow-ups when Ideate
ships beyond macOS.

Per-session rate limit (5s minimum gap) on Manager guards against a
stuck loop or runaway script spamming the notification center. Limit
is per-session so a fan-out across multiple agents stays useful; the
5s window does not advance on denied calls so a hammer keeps the
quota honest.

Registered on both per-idea and orchestrator MCP surfaces.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ilure

Two review findings on PR #61:

1. AppleScript injection: the body and title interpolate into an
   `osascript -e` statement. Unescaped newlines end the current statement
   so `body\ndisplay dialog "x"` could smuggle a second command into the
   shell. Strip \r and \n before the backslash/quote escape.

2. Rate-limit rollback: a failed osascript run was burning the session's
   5s quota even though no notification was delivered. Clear the slot on
   error so the user can retry immediately.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@paultyng
paultyng marked this pull request as ready for review June 23, 2026 13:39
@paultyng
paultyng enabled auto-merge (squash) June 23, 2026 13:39
@paultyng
paultyng merged commit 9bef64b into main Jun 23, 2026
2 checks passed
@paultyng
paultyng deleted the feat/notify-user-mcp-tool branch June 23, 2026 13:39
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