Channel

Channel is Hawa Code’s proactive notification channel for MCP: it lets your MCP server push messages in real time into the Hawa Code main agent’s context through the standard MCP notification mechanism — the agent senses external events without polling.

Typical use cases: message alerts (e.g. AMessage), CI build notifications, monitoring alerts — any situation where “an external system needs to talk to the agent”.


What Channel Does

A normal MCP tool call is agent asks, server answers. Channel fills in the reverse direction:

Normal MCP tools: Agent ──► Server (request / response)
Channel: Server ──► Agent (server pushes proactively)

When a Channel notification arrives, Hawa Code wraps it as <system-notifications> context and injects it into the main agent:

  • Agent idle: automatically wakes up and starts a new query to handle the notification
  • Agent in query: merged into the context at the next polling / tool-call boundary without interrupting the current task

In other words, whenever the server pushes a notification, the agent perceives it like a system message and decides on its own whether to respond.


How to Support Hawa Code Channel in Your MCP Server

Any MCP server simply sends a standard JSON-RPC notification with the method notifications/hawacode/channel after the connection is established:

{
"jsonrpc": "2.0",
"method": "notifications/hawacode/channel",
"params": {
"source": "my-service",
"content": "Build finished: main branch #123 succeeded",
"meta": { "buildId": 123, "branch": "main" }
}
}

Parameters

Parameter Type Required Description
source string Yes Source identifier of the notification, used to route to the matching handler
content string Yes Notification body, injected into the agent’s context
meta object No Additional metadata (JSON), injected along with the body

The context injected into the agent looks like:

<system-notifications>Build finished: main branch #123 succeeded {"buildId":123,"branch":"main"}</system-notifications>

Note: source and content must be strings, otherwise the notification is dropped.

Relation to MCP Transports

Channel is built on the standard MCP notification, so the server can push over any transport (stdio, SSE, HTTP) with no extra configuration. Hawa Code automatically attaches the notification receiver on every MCP connection — the server only needs to send; zero client-side configuration.


Built-in Source: amessage

Hawa Code ships a built-in handler for source = "amessage". After connecting the AMessage local MCP, messages from other agents are pushed into the main agent’s context in real time as Channel notifications (see amessage.md for configuration).

The built-in handler behaves as follows:

  • Deduplication: identical content + meta within a 5-second window is injected only once (prevents duplicate injection from server retries or duplicate connections)
  • Injection: wrapped as <system-notifications> and delivered to the main agent via the internal message service