@Channel
@Channel declares a channel: a stream of events that your server pushes into a connected Claude Code session without being asked, like "billing is down" or "the customer replied". FrontMCP sends each event as a notifications/claude/channel message, and tells the model, in the server's instructions, that events arrive as <channel> tags. A two-way channel also gets a channel-reply tool, so the model can answer. Channels are a Claude Code research preview: Claude Code reads them from a server it starts over stdio, in a session that opted that server in. Channels in Claude Code lists the ways of running a FrontMCP server that serve such a session, and what each needs. Over HTTP, a client gets the events only when it asks for them: see what a client receives.
Changed in 1.12.0: before, no FrontMCP channel reached a Claude Code session. A stdio server now answers Claude Code's handshake so that it opens a session, and sends the events to that session without being asked.
@Channel(options)
class MyChannel extends ChannelContext {
async onEvent(payload: unknown): Promise<ChannelNotification> { /* ... */ }
}
Reference
@Channel(options)
Apply @Channel to a class that extends ChannelContext, list the class in an app's channels array, and turn channels on in @FrontMcp:
import { Channel, ChannelContext, type ChannelNotification } from "@frontmcp/sdk";
@Channel({
name: "outages",
description: "Service outages as they happen",
source: { type: "app-event", event: "outage" },
meta: { team: "sre" },
})
export class OutagesChannel extends ChannelContext {
async onEvent(payload: unknown): Promise<ChannelNotification> {
const { service } = payload as { service: string };
return { content: `${service} is down`, meta: { service } };
}
}import { App, FrontMcp } from "@frontmcp/sdk";
import { OutagesChannel } from "./outages.channel";
@App({ id: "ops", name: "Ops", tools: [ReportOutage], channels: [OutagesChannel] })
export class OpsApp {}
@FrontMcp({ info: { name: "ops", version: "1.0.0" }, apps: [OpsApp], channels: { enabled: true } })
export default class Server {}Options
Required:
| Option | Type | Description |
|---|---|---|
name | string | The channel's name, unique on the server: a second channel with the same name stops the server from starting. It's sent as meta.source with every event, and it's what channel-reply takes. |
source | ChannelSourceConfig | Where events come from. See sources. |
Optional:
| Option | Type | Default | Description |
|---|---|---|---|
meta | Record<string, string> | none | Added to the meta of every event from this channel. Keys may only have letters, digits and underscores, and can't start with a digit: "my-env" fails when the class is decorated, with Meta keys must be valid identifiers (letters, digits, underscores). The meta an event brings at run time is reduced instead: see meta keys. |
twoWay | boolean | false | Registers the channel-reply tool, which calls this channel's onReply(). See letting the model reply. |
tools | tool classes | none | Tools that come with the channel, like one that sends a message through the same service. They're registered on the server and listed like any app's tools, and see the providers of the channel's app and of the server, as the channel does. (Changed in 1.9.3: before, they saw only the server's.) |
replay | { enabled: boolean; maxEvents?: number } | off | Keeps the last maxEvents events (default 50) on the channel. Nothing sends them automatically: see replaying missed events. |
description | string | none | For people reading the code. FrontMCP doesn't send it to clients. |
tags | string[] | [] | Labels. Only the channels:list flow returns them. |
availableWhen | EntryAvailability | none | Registers the channel only where the server runs on a matching platform or runtime. Elsewhere it isn't registered: its events go nowhere, and a two-way channel's channel-reply tool isn't listed. See Offering an agent or a channel only where it works. (Changed in 1.9.2: before, it was ignored.) |
Sources
source.type decides what calls the channel's onEvent():
type | Fields | What runs onEvent(payload) | Status |
|---|---|---|---|
"app-event" | event: string | Your code, with channelEventBus.emit(event, payload) (emitting events). The payload is what you emit. An event that is the name of a declared @Event also runs for each occurrence the server publishes: see app-event channels and declared events. | Works |
"manual" | none | Your code, with channel.handleEvent(payload). | Works |
"service" | service: string, a label | this.pushIncoming(payload), called from the connection your onConnect() opens. | Works |
"file-watcher" | paths: string[], events?: ("change" | "create" | "delete" | "rename")[] | A file event on one of paths, when the channel defines no onConnect(). The payload is { event, path }. A channel that defines onConnect() watches by itself, like "service". See the file-watcher source. | Works in a long-lived Node process. Changed in 1.12.0: before, FrontMCP watched nothing, and every such channel had to watch in onConnect(). |
"webhook" | path: string | An HTTP POST to path, on FrontMCP's Node server. The payload is { body, headers, method, query }, and the request gets 200 {"ok":true,"channel":"<name>"}. | Works on the Node server. Also served by createFetchHandler(). Changed in 1.9.5: before, fetch handlers returned 404. |
"job-completion" | jobNames?: string[] | A job finishing. The payload is { jobName, jobId, status, durationMs, output, attempt, sessionId }, with output the result as JSON text, or error for a failed run. Job status also distinguishes "timeout" and "cancelled". | Works. The event goes only to the session that ran the job. |
"agent-completion" | agentIds?: string[] | An agent finishing. The payload is { agentId, agentName, status, durationMs, output, runId, sessionId }. | Works, like "job-completion". |
Changed in 1.8.5: before, the last three sources never called onEvent(). A webhook's path must not be one of FrontMCP's own paths, and two channels can't share one, or the server doesn't start. While onEvent() handles a webhook, it and the tools it calls with this.callTool() are on the "http-trigger" surface. The webhook route was checked in Node, on a server started with bootstrap(). A server over stdio opens no port, so a "webhook" channel has no route there.
The file-watcher source
For a channel that defines no onConnect(), FrontMCP watches the declared paths while the server runs, and hands each file event to onEvent(). New in 1.12.0. The channel needs no watcher of its own:
import { basename } from "node:path";
import { Channel, ChannelContext, type ChannelFileEvent, type ChannelNotification } from "@frontmcp/sdk";
@Channel({
name: "reports",
source: { type: "file-watcher", paths: ["./reports", "./logs/app.log"], events: ["create", "change"] },
})
export class ReportsChannel extends ChannelContext {
async onEvent(payload: unknown): Promise<ChannelNotification> {
const { event, path } = payload as ChannelFileEvent;
return { content: `${basename(path)}: ${event}`, meta: { file: basename(path), event } };
}
}| Field | Type | Default | Description |
|---|---|---|---|
paths | string[] | required | Files or directories, absolute or relative to the working directory. A path is watched as written: ./logs/*.log is not expanded, and the server warns at startup, Channel "…" declares "./logs/*.log": a file-watcher path is not expanded as a glob. Declare the directory to watch its direct files. |
events | ("create" | "change" | "delete" | "rename")[] | every kind | The kinds of file event the channel gets. |
- The payload is a
ChannelFileEvent,{ event, path }:eventis"create","change"or"delete", andpathis the file's absolute path, also when the declared path is relative. "rename"has no payload of its own. A renamed file is a"delete"of its old path and a"create"of its new one, so"rename"selects both.- A directory is watched for the files directly in it, not for its subdirectories. The files that are there when the watch starts are not reported.
- Several writes to one file in a short time are one
"change": three appends in a row gave one event. The framework's source says a change is reported once its directory saw none for 100 ms, that a file is watched through its parent directory, and that a path that doesn't exist yet is watched from the moment it appears. - Order.
onEvent()gets a channel's file events one at a time, in the order they happened, so a slowonEvent()delays the events after it. - Lifetime. The watch starts when the server starts, and ends when it stops or
dispose()runs, beforeonDisconnect(). - Where it doesn't run. In a serverless, edge or browser runtime nothing is watched: the server warns
Channel "…" does not watch its paths in a serverless, edge or browser runtime: watching files needs a long-lived process, and the channel is still registered. So the Playground can't run it. - A watch that fails is logged,
Channel "…" stopped watching its paths, and the server and its other channels keep running.
A channel that defines onConnect(), on its class or on a class it extends, watches by itself, as every "file-watcher" channel did before 1.12.0. FrontMCP watches nothing for it: onConnect() and onDisconnect() run as for a "service" source, onEvent() gets only what the channel pushes with pushIncoming(), and paths and events are a label it can read from this.metadata.source. The server says so once at startup, at info level: Channel "…" defines onConnect(), so it watches by itself: the framework does not watch its declared paths. Remove onConnect() to have the framework watch them. To move such a channel to FrontMCP's watch, remove its onConnect(), its onDisconnect() and its watcher, and read { event, path } in onEvent().
On a stdio server (1.12.0-rc.1, macOS), a channel with events: ["create", "change"] on a directory sent one event for a new file, one for three appends to it, none for a file removed, none for a file in a subdirectory or a file that was there at startup, and a "create" of the new path for a renamed file. The glob warning and the onConnect() line were read in a server's log. The debounce time, the order of events, when the watch starts and ends, and the runtimes that don't watch are from the framework's source.
app-event channels and declared events
A server that declares events emits each occurrence it publishes on the same bus channelEventBus.emit() uses, under the event's name. So an "app-event" channel whose event is a declared event's name runs for each published occurrence, with the occurrence as its payload, { eventId, name, timestamp, data }, not the published data alone. The exception is an occurrence published with an audience or a subscriptionId: it is for some subscribers, and a channel tells every subscribed session, so the channel doesn't run for it.
To tell Claude Code about a published event, set the event's channel option instead of declaring such a channel. The option needs no channel class, and checks for each session whether its caller may see the event; a channel sends the same to every subscribed session. Keep "app-event" for names your own code emits on the bus. An event that has the option and a channel of its name is sent to a session twice, once by each. The server logs one line at startup for each "app-event" channel whose event is a declared event (new in 1.12.0):
- The event has the
channeloption, a warning:Channel "deploys" listens to event "deploy.finished", which has the channel option: Claude Code sessions get each occurrence twice, once from the event and once from the channel. Keep one: remove the channel, or the option when the channel does what the option cannot. - The event has no
channeloption, atinfolevel:Channel "queue" listens to event "deploy.queued": the event has no channel option. Setting it can replace this channel, and checks each session's access.
The Events reference says what else listens on the bus, and how to turn this off.
ChannelContext
The class your channel extends.
| Member | Description |
|---|---|
onEvent(payload) | Required. Turns a source's payload into the event to send: { content: string; meta?: Record<string, unknown> }, the event's text and its attributes. If it throws, nothing is sent, and the server logs Channel "…" failed to handle event. A meta value that isn't a string is sent as one: see meta keys. |
onReply(reply, meta?) | For two-way channels: called by channel-reply with the model's text and meta. If it throws, or the channel doesn't define it, channel-reply fails, and the model reads Error: Failed to send reply to channel "…": and the error's message. (Changed in 1.9: before, the model was told the reply was sent either way.) |
onConnect() | For "service" sources, and for "file-watcher" channels that watch by themselves: called once, when the server starts. Open the connection here and call this.pushIncoming() for each incoming message. If it throws, the server doesn't start. |
onDisconnect() | For closing that connection: called once, when the server stops, or when dispose() of a create() or createDirect() server runs. (Changed in 1.9: before, dispose() didn't call it.) |
this.pushIncoming(payload) | protected. Runs onEvent(payload) on the same instance onConnect() ran on, and sends the result. Only works after onConnect(). |
this.get(token), this.tryGet(token) | Providers, from the channel's app and from the server. (Changed in 1.9.2: before, only the server's.) |
this.metadata | The channel's options. |
A service channel's onConnect(), pushIncoming(), onEvent() and onReply() all run on one long-lived instance, so it can keep the connection in a field. For other sources, FrontMCP makes a new instance for each event and each reply.
Emitting events from your code
The channel system belongs to the server's scope, which any tool, resource or prompt reaches as this.scope: this.scope.channels, this.scope.channelEventBus and this.scope.channelNotifications. The channel registry and notifications require channels.enabled: true. The event bus also exists when an app declares an event workflow, and both features share it. (Changed in 1.9: before, the ScopeEntry type didn't declare them, so code had to cast this.scope.)
| Member | Description |
|---|---|
channelEventBus.emit(event, payload) | Runs matching app-event channels and starts matching event workflows. Workflow runs happen in the background; emit() does not wait for them. |
channels.findByName(name) | The channel's ChannelInstance, or undefined. |
channels.getChannelInstances() | Every channel on the server. |
channel.handleEvent(payload, sessionId?) | Runs onEvent(payload) and sends the result, to one session if you pass its id. Returns the event, or null if onEvent() threw. |
channel.pushNotification(content, meta?, sessionId?) | Sends an event without calling onEvent(), to one session if you pass its id. Returns a promise (since 1.9). |
channel.replayBuffer | The events kept by replay, oldest first, as they were sent: { content, meta }, with meta.source. |
channel.replayBufferedEvents(sessionId) | Sends the kept events to one session, each with meta.replayed: "true", the whole buffer again at each call. Returns how many the session was sent: 0 when it isn't connected, didn't ask for channel events, or its credentials have expired. (Changed in 1.12.1: before, it returned how many were kept, sent or not.) |
channel.clearReplayBuffer() | Empties the buffer. |
channelNotifications.send(name, content, meta?) | Sends an event on the channel called name, without onEvent(). Returns a promise (since 1.9). |
this.scope.notifications.unsubscribeChannel(sessionId, name) stops one session receiving a channel's events, and subscribeChannel(sessionId, name) starts it again.
@FrontMcp({ channels })
| Field | Type | Description |
|---|---|---|
enabled | boolean | Required. Without enabled: true, the channels of every app are ignored: no channel-reply tool, no channel tools, and this.scope.channels is undefined. enabled: false also turns off the channel option of every event, which otherwise needs no channels setting. |
defaultMeta | Record<string, string> | Added to the meta of every channel's events, before the channel's meta and the event's own, which win. Its keys follow the rule of a channel's meta: one that isn't an identifier stops the server from starting. It is not added to an event sent by the channel option. (Changed in 1.9: before, only channelNotifications.send() added it.) |
@App({ channels }) is the only place to list channels. A plugin can't add one.
A server serves channels when channels.enabled is true and an app lists a channel, or when an event has the channel option. Only then does it advertise experimental: { "claude/channel": {} }, add the <channel> sentence to its instructions, and decline MCP 2026-07-28 over stdio. channels: { enabled: true } with no channel changes none of that.
What a client receives
Who gets an event depends on how the client connects:
| Client | Gets channel events |
|---|---|
| The stdio session: the client that started the server over stdio | Always, as lines on stdout. It declares nothing. Changed in 1.12.0: before, it had to declare the capability, which Claude Code doesn't. |
A session over Streamable HTTP, or an in-process one from connect() | Only when its client declared experimental: { "claude/channel": {} } in its initialize capabilities. Over HTTP they arrive on the session's GET SSE stream. |
| A 2026-07-28 client over HTTP, which has no session | On a subscriptions/listen stream whose request declares the capability (see below). It carries the events of channels, not the events sent by an event's channel option. |
| A 2026-07-28 client over stdio | None. A stdio server with channels declines that revision, so its client opens a session instead. |
A session is subscribed at initialize to the channels the channels:list flow returns, the stdio session included.
{
"jsonrpc": "2.0",
"method": "notifications/claude/channel",
"params": {
"content": "billing is down",
"meta": { "team": "sre", "service": "billing", "source": "outages" }
}
}
metais the server'sdefaultMeta, then the channel'smeta, then themetathatonEvent()returned, thensource, the channel's name, which always wins. Its keys are reduced to letters, digits and underscores.- The
initializeresult, and over HTTP under 2026-07-28 theserver/discoverresult, listsexperimental: { "claude/channel": {} }in the server's capabilities, and addsEvents arrive as <channel> tags.to itsinstructions, followed byReply with the channel-reply tool.when a channel is two-way, and byA tag with event and event_id attributes is an event this server published: event is its name, event_id its id.when an event has thechanneloption. (Changed in 1.9.3: before,server/discoverhad neither.) - An HTTP session whose client didn't ask for channels receives nothing, and neither does a
subscriptions/listenstream that didn't. - Expired credentials. A session whose latest request came with credentials that have since expired gets no event, until it makes a request with valid ones. The expiry is the token's
exp. A caller with no expiry isn't affected: an anonymous caller, the stdio session, a session of the shared local server. Changed in 1.12.0: before, an HTTP session kept getting channel events after its token expired. - On a 2026-07-28 stream, each event also has the stream's
io.modelcontextprotocol/subscriptionIdin itsparams._meta. Events sent to one session, like"job-completion"events, never reach a stream. (Changed in 1.9.2: before, 2026-07-28 clients received no events at all.) - Events sent while nobody is subscribed are dropped, unless
replaykeeps them.
This was checked on 1.12.0-rc.1 with a script as the client: over stdio, a session whose initialize declared no channel capability got each event; over Streamable HTTP, of two sessions on one server only the one that declared the capability did; and on the 2026-07-28 stream with createFetchHandler(), as below. The expired-credentials rule is from the framework's source and tests: nothing on this page runs a session with a token that expires.
meta keys
Claude Code's documentation says a meta key must be an identifier, letters, digits and underscores, and that it silently drops a key with any other character. So FrontMCP reduces the keys of every notification before it sends it:
- A character that isn't a letter, a digit or an underscore becomes
_:chat-idis sent aschat_id,user.nameasuser_name. An empty key is left out. - It applies to the
metathatonEvent()returns, topushNotification(),channelNotifications.send()and replayed events, and to themetaof an event with thechanneloption. - A value is sent as a string: a number or a boolean as its text, an object as its JSON, or as
String()gives it when it has none (a cycle, aBigIntinside).nullandundefinedare left out. Changed in 1.12.1: before, a value that wasn't a string stopped the event: nothing was sent, and the server loggedChannel "…" failed to send a notification. - The static
metaof@Channelandchannels.defaultMetaare not reduced: a key there that isn't an identifier still stops the server from starting.
Changed in 1.12.0: before, such a key was sent as written. A handler that returns meta: { "chat-id": id } now sends a chat_id attribute, so update instructions and prompts that name the attribute.
What the Playground can show
The Playground's client speaks 2026-07-28 and doesn't open a subscriptions/listen stream, so no channel event reaches its Call tab, and it has no stdio, so nothing here runs the handshake Claude Code uses. Everything else runs: channels register, onEvent() runs and returns its event, channel-reply calls onReply(), a service channel's onConnect() runs at startup, and channel tools are listed. A test can also open a session of its own in the page, with connect(), and collect the notifications it gets: Receiving events on a session does. Other examples give their channels replay and read replayBuffer to show each event exactly as FrontMCP would send it, and one opens a 2026-07-28 stream in a test.
Caveats
- Over HTTP, channels only reach clients that asked for
claude/channel: in a session'sinitialize, or in a 2026-07-28subscriptions/listenrequest. The stdio session gets them without asking. - Channels are in-process and aren't stored: a session gets what its own server process sends while it's connected.
- A
"webhook"source works on Node and throughcreateFetchHandler()."job-completion"and"agent-completion"events go only to the session that ran the job or agent, so a 2026-07-28 client, which has no session, never gets them. - Changed in 1.10.0: before,
create(),createDirect()andconnect()in its default mode registered webhook routes without serving HTTP. They now skip webhook registration. A configured webhook warnsChannel "…" has a webhook source but no HTTP server to serve ….connect()'s CLI mode keeps its existing initialization. Use an HTTP entry point, includingcreateFetchHandler(). replayonly keeps events; nothing replays them unless you callreplayBufferedEvents().descriptionis accepted and has no effect.
Hooks on channel flows
ChannelSendHook and ChannelListHook hook the channels:send-notification flow (stages parseInput, resolveMeta, send, finalize) and the channels:list flow (listChannels, finalize). Every event a channel sends goes through channels:send-notification, however it's sent: emit(), handleEvent(), pushNotification() or channelNotifications.send(). resolveMeta is where defaultMeta and the channel's meta are added. A session that gets channel events, the stdio session included, is subscribed to the ones the channels:list flow returns. See Hooking every event.
An event sent by an event's channel option doesn't go through channels:send-notification, so these hooks don't see it: it is sent in the notifyChannelSessions stage of the events:publish flow, which EventPublishHook hooks.
Changed in 1.9: before, FrontMCP never ran either flow itself, so their hooks only ran when your code started the flow.
Channels in Claude Code
Channels are a Claude Code research preview: its documentation says the flags and the protocol contract may change. What this section says about Claude Code is from its documentation (Channels, Channels reference and MCP, read on 2026-11-11), and from the messages the framework's tests replay, captured from Claude Code 2.1.322. What was checked says what was run for this page.
What Claude Code needs
| Requirement | Detail |
|---|---|
| A server it starts over stdio | Claude Code runs a channel as a subprocess on the same machine and talks to it over stdio. Register the command in the MCP configuration Claude Code reads, like .mcp.json. Its documentation describes no other transport for a channel. |
| The channel capability | The server declares experimental: { "claude/channel": {} }. A FrontMCP server does once it serves channels. |
| An opt-in for the session | The session names the server when it starts: claude --channels plugin:<name>@<marketplace> for a plugin on the approved list, or claude --dangerously-load-development-channels server:<name> for your own server, where <name> is its key under mcpServers. Being in .mcp.json isn't enough. The development flag asks for a confirmation, and is ignored with -p and through the Agent SDK: it needs an interactive session. |
| An organization that allows channels | In a Team or Enterprise organization, channels are blocked until an Owner enables them, with channelsEnabled: true in managed settings or in the organization's Claude Code settings. The development flag doesn't get around that. allowedChannelPlugins replaces the list of plugins --channels accepts. |
| An open session | Events arrive only while the session is open. |
| The earlier handshake | On its v2 MCP client runtime, Claude Code asks a stdio server for MCP 2026-07-28 first, and doesn't register as a channel a server that negotiates that revision. A server that doesn't support the revision connects with initialize and registers. This is why FrontMCP declines the revision. |
Ways of running the server
| How the server runs | Do its events reach the client that started it? | Notes |
|---|---|---|
runStdio(), FRONTMCP_STDIO=1, a node or cli build started with --stdio, an MCP Bundle | Yes | Nothing more is needed. The server declines 2026-07-28 and sends to the stdio session. |
frontmcp dev --stdio --serve | Yes | The dev server speaks stdio itself, over a pipe. |
frontmcp dev --stdio without --serve | Yes, through the stdio bridge | After a reload, the restarted server's events arrive too. |
runShared() | Yes, through the stdio bridge, while the session is attached to the shared server | Every attached session gets each event. A session that runs the server in its own process, the fallback of runShared(), gets none. |
A server at a URL: frontmcp dev, a node build, a deployed server | Not as a Claude Code channel | An HTTP session gets events only when its client declares the capability. The initialize captured from Claude Code 2.1.322 declares roots and elicitation only. Other clients can ask: see what a client receives. |
createFetchHandler(): Workers, Deno, Bun | Not as a Claude Code channel | It keeps no session. A 2026-07-28 client reads a subscriptions/listen stream. |
Changed in 1.12.0: before, none of the first four reached a Claude Code session.
What FrontMCP does over stdio
A stdio server that serves channels does two things for the client that started it:
- It declines MCP 2026-07-28.
server/discover,subscriptions/listenand every other request that would be served as 2026-07-28 get JSON-RPC error-32022, with the four earlier revisions indata.supported. A 2026-07-28 notification is ignored. A client that speaks both eras then sendsinitialize. This goes for every stdio client of such a server, whatevertransport.defaultProtocolVersionsays. - It sends to the stdio session without being asked. The session's
initializeneeds noexperimental["claude/channel"]. FrontMCP subscribes the session to the channelschannels:listreturns, and writes each event to stdout.
The probe, and the answer of a server with a channel:
{"jsonrpc":"2.0","id":"probe","method":"server/discover"}
{"jsonrpc":"2.0","id":"probe","error":{"code":-32022,"message":"Unsupported protocol version: 2026-07-28","data":{"supported":["2025-11-25","2025-06-18","2025-03-26","2024-11-05"],"requested":"2026-07-28"}}}
Over HTTP nothing changed: the server serves 2026-07-28, and a session gets events only when its client declares the capability.
Changed in 1.12.0: before, the stdio server answered the probe, so Claude Code stayed on 2026-07-28, where it registers no channel. And FrontMCP sent events only to a session that declared the capability, which the initialize of Claude Code 2.1.322 doesn't.
Through the stdio bridge
With runShared(), and with frontmcp dev --stdio without --serve, the process the client starts isn't the server. It's a bridge, which reads the client's messages on stdin and sends each one to an HTTP server: the shared local server, or the dev server the CLI restarts. The bridge does three things so that a channel still arrives:
- It declines 2026-07-28 for a server with channels. At the client's first 2026-07-28 request, the bridge asks the server with a
server/discoverof its own. When the server advertisesexperimental["claude/channel"], the bridge answers that request, and every later 2026-07-28 request, with-32022and the server's earlier revisions. For a server without channels nothing changed: the bridge forwards the request without the headers the revision needs over HTTP, and the client gets-32099dev_server_unreachable. - It declares the capability for the client. The bridge adds
experimental["claude/channel"]to theinitializeit forwards, and to the one it replays on a restarted or replaced server. - It relays the session's notification stream. After
initializethe bridge opens the session'sGETstream on the server, and writes each message on it to stdout: channel events, and everything else a server sends on its own, likenotifications/tools/list_changed, log messages and resource updates.
Changed in 1.12.0: before, the bridge did none of the three. A 2026-07-28 request got -32099 whatever the server had, and nothing a server sends on its own reached a bridged stdio client.
The framework's source adds the timings: the bridge sends the session's next request once the server answered the stream, or after 2 seconds; a stream that drops is opened again, after 250 ms at first and up to 4 seconds later; after five failed opens in a row, or once the server no longer knows the session, the bridge gives the stream up until the next session. What the server sends between a drop and the reopening is lost.
A session of runShared() that runs the server in its own process declines 2026-07-28 too, but gets no event: that server has no notification stream. The shared local server says when a session does that, and how a quiet session follows a server that replaced its own.
What Claude Code does with an event
According to its documentation:
- The terminal shows the event as one line,
← <server>: <content>, and Claude reads it as a<channel>tag:contentis the tag's body, and eachmetaentry is an attribute. - The tag's
sourceattribute is set from the name the server is configured under. FrontMCP also sendsmeta.source, the channel's name. Which of the two the tag shows was not observed, so put what the model should route on in ametakey of your own, likechat_id. - A
metakey with a character other than a letter, a digit or an underscore is dropped silently. FrontMCP reduces the keys so they're kept. - It doesn't acknowledge a notification: the server gets no reply and no error. It drops the notification silently when the session didn't load the server as a channel, or the organization blocks channels.
- Events queue in the session and are handled in order. Several that arrive while Claude is busy are delivered together on its next turn.
What was checked
On FrontMCP 1.12.0-rc.1, a script sent each server the messages captured from Claude Code 2.1.322: the server/discover probe on 2026-07-28, then initialize with roots and elicitation capabilities and no claude/channel, then notifications/initialized, then a tool call that emits an event. Each of these answered the probe with -32022, opened the session, and wrote the event's notifications/claude/channel line to stdout: runStdio(), the node and cli builds with --stdio, an MCP Bundle's entry, frontmcp dev --stdio with --serve and without it (there also after a reload), and two sessions of one runShared() server, over the Unix socket and over loopback HTTP. A shared session that ran the server in its own process got no event.
No Claude Code session was run against these servers for this page, so the line on Claude Code's screen was not observed here. The framework's tests replay the same capture.
Events with the channel option
An @Event with the channel option is sent to sessions as a channel notification each time it's published. New in 1.12.0. It needs no @Channel class and no channels: { enabled: true }:
import { Event, EventContext, z } from "@frontmcp/sdk";
@Event({
name: "deploy.finished",
payloadSchema: { version: z.string(), status: z.string() },
channel: true,
})
export class DeployFinished extends EventContext {}{
"jsonrpc": "2.0",
"method": "notifications/claude/channel",
"params": {
"content": "{\"version\":\"1.4.0\",\"status\":\"succeeded\"}",
"meta": { "event": "deploy.finished", "event_id": "evt_H--DYfFmWx2JMcLHocq--FTx" }
}
}
channel | What is sent |
|---|---|
true | content is the payload as JSON, JSON.stringify(payload). |
{ content?, meta? } | content(payload) returns the text, and meta(payload) returns more attributes. Both get the payload, typed by payloadSchema. Without content, the text is the payload as JSON. |
metaalways hasevent, the event's name, andevent_id, the occurrence's id. Ametafunction can't replace them, and its keys are reduced like a channel's. There is nosource, and neitherchannels.defaultMetanor a channel'smetais added.- Who is told. Each session that gets channel events, the stdio session or one whose client declared the capability, and whose caller may see the event under the event's own rules. They are checked for each session at every publish: the Events reference has them. Over stdio the caller is anonymous, so on a server whose auth signs callers in, the stdio session is told nothing. A 2026-07-28
subscriptions/listenstream is not told. - The server then serves channels, with no
@Channel: it advertises the capability, declines 2026-07-28 over stdio, and its instructions say how to read the tag. channels: { enabled: false }turns the option off for every event. The server warns once at startup:Channels are disabled (channels.enabled: false), so the channel option of 2 event(s) is ignored: "deploy.finished", "deploy.started". Remove channels.enabled: false to send them to Claude Code sessions.
Which one to declare:
| You have | Use |
|---|---|
| Something the server publishes as an event | The event's channel option. One declaration also serves the event's other clients, and each session is told only what its caller may see. |
| A conversation the model answers | @Channel with twoWay: true. An event has no reply path. |
| A connection to a service, or another system's webhook | @Channel with a "service" or "webhook" source. |
| A job or an agent finishing, files changing, or a name your code emits on the bus | @Channel with that source. |
Telling Claude Code about a published event runs one. The rule about a server whose auth signs callers in is from the framework's source: the examples on this page have no auth.
Usage
Declaring a channel and emitting events
An "app-event" channel runs whenever your code emits its event. Here report_outage emits outage, and recent_alerts reads the channel's replay buffer to show what was sent:
import { Channel, ChannelContext, type ChannelNotification } from "@frontmcp/sdk";
@Channel({
name: "outages",
source: { type: "app-event", event: "outage" },
meta: { team: "sre" },
replay: { enabled: true, maxEvents: 20 },
})
export class OutagesChannel extends ChannelContext {
async onEvent(payload: unknown): Promise<ChannelNotification> {
const { service, severity } = payload as { service: string; severity: string };
return { content: `${service} is down`, meta: { service, severity } };
}
}Starting FrontMCP in your browser…
FrontMCP starts when this example comes into view.
A session that gets channel events receives this one as a notifications/claude/channel message with this content and meta: the server's defaultMeta, the channel's meta, what onEvent() returned, and source. Take channels: { enabled: true } out and emit() isn't reached: channelEventBus is undefined, and recent_alerts finds no channel.
Sending an event to a Claude Code session
Serve the previous example's configuration over stdio. Keep the configuration in a module of its own, so that the entry file never imports a class decorated with @FrontMcp:
import "reflect-metadata";
import { FrontMcpInstance } from "@frontmcp/sdk";
import { config } from "./config";
FrontMcpInstance.runStdio(config);Register the command in the MCP configuration Claude Code reads. The key, ops here, is the name the session opts in:
{
"mcpServers": {
"ops": { "command": "node", "args": ["/abs/path/dist/stdio.js"] }
}
}A server built with frontmcp build --target node needs no entry file of its own: use { "command": "/abs/path/dist/node/ops", "args": ["--stdio"] }. Then start a session that loads the server as a channel:
claude --dangerously-load-development-channels server:opsClaude Code's documentation says what follows: it asks you to confirm the development channel, a notice under the startup banner says that messages from server:ops are injected in the session, and each event shows as a line that starts with the server's name, ← ops: billing is down. To send one, have the model call report_outage.
To check the server's side without Claude Code, send it the probe Claude Code starts with. A server that serves channels declines it, and one that answers with a list of supportedVersions isn't serving a channel:
printf '%s\n' '{"jsonrpc":"2.0","id":"probe","method":"server/discover"}' | node dist/stdio.js{"jsonrpc":"2.0","id":"probe","error":{"code":-32022,"message":"Unsupported protocol version: 2026-07-28","data":{"supported":["2025-11-25","2025-06-18","2025-03-26","2024-11-05"],"requested":"2026-07-28"}}}
After initialize and a call of report_outage, the same connection gets the event as a line on stdout, though the client declared no channel capability:
{"method":"notifications/claude/channel","params":{"content":"billing is down","meta":{"env":"production","team":"sre","service":"billing","severity":"major","source":"outages"}},"jsonrpc":"2.0"}
To share one server between several Claude Code windows, call runShared(config, { key }) in the entry file instead: every attached session gets each event. While you work on the server, frontmcp dev --stdio as the command gives the session the reloading server, and its events.
Receiving events on a session
Over HTTP, a session gets channel events only when its client declared experimental: { "claude/channel": {} } in initialize. The tests here open two in-process sessions with connect(), which follow the same rule, and collect what each one gets:
import { test, expect } from "@frontmcp/testing";
import { connect } from "@frontmcp/sdk";
import { config } from "./main";
type Message = { method: string; params?: unknown };
async function openSession(capabilities: Record<string, unknown> = {}) {
const client = await connect(config, { capabilities });
const received: unknown[] = [];
client.onNotification((message: Message) => {
if (message.method === "notifications/claude/channel") received.push(message.params);
});
return { client, received };
}
const arrival = () => new Promise((resolve) => setTimeout(resolve, 50));
test("a session that declares claude/channel gets the event", async () => {
const session = await openSession({ experimental: { "claude/channel": {} } });
await session.client.callTool("report_outage", { service: "billing" });
await arrival();
expect(session.received).toEqual([
{ content: "billing is down", meta: { team: "sre", chat_id: "C-42", attempt: "2", region: '{"name":"eu"}', source: "outages" } },
]);
await session.client.close();
});
test("a session that declares nothing gets none", async () => {
const session = await openSession();
await session.client.callTool("report_outage", { service: "billing" });
await arrival();
expect(session.received).toEqual([]);
await session.client.close();
});Starting FrontMCP in your browser…
FrontMCP starts when this example comes into view.
onEvent() returned the key chat-id, and the session got chat_id: FrontMCP reduces meta keys to what Claude Code keeps. The number and the object arrive as strings, and note: null is left out. (Changed in 1.12.1: before, a value that wasn't a string stopped the event, and the session got nothing.) The stdio session is the exception to the rule these tests show: it gets the events without declaring anything, which needs a stdio process to see (above).
Receiving events on a 2026-07-28 client
A 2026-07-28 client has no session to subscribe, so it opens a subscriptions/listen request and keeps reading its response, a stream of notifications. With experimental: { "claude/channel": {} } in that request's client capabilities, the stream carries every channel's events. The Playground's client doesn't open one, so this example's test does, through createFetchHandler(), the way a client's requests reach a server:
import { test, expect } from "@frontmcp/testing";
import { FrontMcpInstance } from "@frontmcp/sdk";
import { config } from "./main";
const asksForChannels = { experimental: { "claude/channel": {} } };
test("a stream that asks for channels gets each event", async () => {
const handler = await FrontMcpInstance.createFetchHandler(config);
const stream = (await handler(request("subscriptions/listen", { notifications: {} }, asksForChannels))).body!.getReader();
expect((await nextMessage(stream))?.method).toBe("notifications/subscriptions/acknowledged");
await handler(request("tools/call", { name: "report_outage", arguments: { service: "billing" } }));
expect(await nextMessage(stream)).toEqual({
jsonrpc: "2.0",
method: "notifications/claude/channel",
params: { content: "billing is down", meta: { team: "sre", source: "outages" }, _meta: { "io.modelcontextprotocol/subscriptionId": 1 } },
});
void stream.cancel(); // the client goes away
});
test("a stream that doesn't ask gets none", async () => {
const handler = await FrontMcpInstance.createFetchHandler(config);
const stream = (await handler(request("subscriptions/listen", { notifications: {} }))).body!.getReader();
expect((await nextMessage(stream))?.method).toBe("notifications/subscriptions/acknowledged");
await handler(request("tools/call", { name: "report_outage", arguments: { service: "email" } }));
expect(await nextMessage(stream)).toBeNull();
void stream.cancel();
});
test("`server/discover` says the server has channels", async ({ mcp }) => {
const { result } = (await mcp.raw.request({ jsonrpc: "2.0", id: 1, method: "server/discover" })) as any;
expect(result.capabilities.experimental).toEqual({ "claude/channel": {} });
expect(result.instructions).toBe("Events arrive as <channel> tags.");
});
// What a 2026-07-28 client sends: the method, in the body and a header, and its capabilities in `_meta`.
function request(method: string, params: Record<string, unknown>, capabilities: Record<string, unknown> = {}) {
return new Request("https://ops.example/", {
method: "POST",
headers: {
"content-type": "application/json",
accept: "application/json, text/event-stream",
"mcp-protocol-version": "2026-07-28",
"mcp-method": method,
...(method === "tools/call" ? { "mcp-name": String(params.name) } : {}),
},
body: JSON.stringify({
jsonrpc: "2.0",
id: 1,
method,
params: { ...params, _meta: { "io.modelcontextprotocol/protocolVersion": "2026-07-28", "io.modelcontextprotocol/clientCapabilities": capabilities } },
}),
});
}
// The next message on the stream, or null when none comes within 200 ms.
async function nextMessage(stream: ReadableStreamDefaultReader<Uint8Array>) {
const chunk = await Promise.race([stream.read(), new Promise<null>((resolve) => setTimeout(() => resolve(null), 200))]);
if (!chunk || chunk.done) return null;
const data = new TextDecoder().decode(chunk.value).split("\n").find((line) => line.startsWith("data: "));
return data ? JSON.parse(data.slice("data: ".length)) : null;
}Starting FrontMCP in your browser…
FrontMCP starts when this example comes into view.
The stream starts with notifications/subscriptions/acknowledged, then carries each event as notifications/claude/channel, with the stream's id, the request's id, as subscriptionId. A stream that didn't ask for channels gets none, and neither does any stream for an event sent to one session. A client learns that the server has channels from server/discover, as the last test shows: it lists the claude/channel capability, and its instructions tell the model about <channel> tags, after the server's own instructions when it has some. (Changed in 1.9.3: before, server/discover had neither, so a client had to know to ask, and the model learned about the tags only from your own instructions. Changed in 1.9.2: before, a 2026-07-28 client received no channel events.)
This is HTTP only. Over stdio, a server with a channel declines 2026-07-28, subscriptions/listen included, so a stdio client gets the events on a session. Changed in 1.12.0: before, such a server served subscriptions/listen over stdio too.
Telling Claude Code about a published event
A server that already publishes an event needs no channel for it: the event's channel option sends each occurrence to the sessions that get channel events. Here deploy publishes two events. deploy.finished has channel: true, and deploy.started shapes its text and attributes. The server has no @Channel and no channels setting:
import { Event, EventContext, z } from "@frontmcp/sdk";
@Event({
name: "deploy.started",
payloadSchema: { version: z.string(), env: z.string() },
channel: {
content: (payload) => `Deploy of ${payload.version} started`,
meta: (payload) => ({ "deploy-env": payload.env }),
},
})
export class DeployStarted extends EventContext {}
@Event({
name: "deploy.finished",
payloadSchema: { version: z.string(), status: z.string() },
channel: true,
})
export class DeployFinished extends EventContext {}Starting FrontMCP in your browser…
FrontMCP starts when this example comes into view.
channel: true sends the payload as JSON. With content and meta, the session reads the text you wrote, and the deploy-env key arrives as deploy_env. Both carry event and event_id, and neither has a source. Over stdio, the same server sent the same two messages to a session that declared nothing, after declining the 2026-07-28 probe. The third test publishes from outside a tool, with server.events.publish(): the occurrence published with a subscriptionId is for that subscription, so no session is told. The fourth opens a subscriptions/listen stream that asks for channels, as a 2026-07-28 client does: it is acknowledged, then told nothing, since the option sends to sessions only. Who else sees an event, and what a session may see of it, is in the Events reference.
Letting the model reply
With twoWay: true, FrontMCP registers a channel-reply tool, with channel_name, text and an optional meta. It calls the channel's onReply(), so the reply can go back to wherever the event came from:
import { Channel, ChannelContext, type ChannelNotification } from "@frontmcp/sdk";
// Stands in for the chat service the replies go to
export const sentReplies: { chatId?: string; text: string }[] = [];
@Channel({ name: "customer-chat", source: { type: "manual" }, twoWay: true })
export class CustomerChat extends ChannelContext {
async onEvent(payload: unknown): Promise<ChannelNotification> {
const { chatId, text } = payload as { chatId: string; text: string };
return { content: text, meta: { chat_id: chatId } };
}
async onReply(reply: string, meta?: Record<string, string>) {
sentReplies.push({ chatId: meta?.chat_id, text: reply });
}
}Starting FrontMCP in your browser…
FrontMCP starts when this example comes into view.
The model learns which meta to send back from the event: onEvent() put chat_id in its meta. One channel-reply tool serves every two-way channel on the server. When onReply() throws, or a two-way channel has none, the call fails with the error, as the fourth test shows, so the model knows its reply didn't go out. Changed in 1.9: before, channel-reply said the reply was sent either way. The server's instructions tell the model to reply with channel-reply, as the last test shows.
Connecting to a service
A "service" channel keeps a connection open. onConnect() runs once when the server starts; each incoming message goes through this.pushIncoming(), which runs onEvent(). The channel's tools are the other direction: tools the model calls to send messages. Here a stand-in chat service answers every message it's sent:
import { Channel, ChannelContext, Tool, ToolContext, z, type ChannelNotification } from "@frontmcp/sdk";
import { ChatService } from "./chat-service";
@Tool({
name: "send_chat_message",
description: "Send a chat message to a customer. Their answer arrives on the customer-chat channel.",
inputSchema: { to: z.string(), text: z.string() },
})
export class SendChatMessage extends ToolContext {
async execute({ to, text }: { to: string; text: string }) {
this.get(ChatService).send(to, text);
return { sent: true, to };
}
}
@Channel({
name: "customer-chat",
source: { type: "service", service: "chat" },
tools: [SendChatMessage],
replay: { enabled: true },
})
export class CustomerChat extends ChannelContext {
// Runs once, when the server starts
async onConnect() {
this.get(ChatService).onMessage((from, text) => this.pushIncoming({ from, text }));
}
// Runs once, when the server stops
async onDisconnect() {
this.get(ChatService).close();
}
async onEvent(payload: unknown): Promise<ChannelNotification> {
const { from, text } = payload as { from: string; text: string };
return { content: `${from}: ${text}`, meta: { sender: from } };
}
}Starting FrontMCP in your browser…
FrontMCP starts when this example comes into view.
ChatService is registered on the app, so the channel and its tool get the same instance: the tool sends through it, and onConnect() listens on it, as the second test shows. (Changed in 1.9.3: before, the tools in a channel's tools saw only the server's providers, so ChatService had to go on @FrontMcp, where it still works.) In a real connector, onConnect() would open a WebSocket or start polling, onDisconnect() would close it, and onEvent() would check who sent each message before passing it to the model.
Reacting to a job or an agent finishing
A "job-completion" channel runs when one of its jobNames finishes, and an "agent-completion" channel when one of its agentIds does. Each gets the run's outcome as its payload:
import { Channel, ChannelContext, type ChannelNotification } from "@frontmcp/sdk";
/** Every payload the two channels got, for the tests. */
export const received: object[] = [];
@Channel({ name: "exports", source: { type: "job-completion", jobNames: ["export-tickets"] } })
export class ExportsChannel extends ChannelContext {
async onEvent(payload: unknown): Promise<ChannelNotification> {
received.push(payload as object);
const run = payload as { jobName: string; status: string };
return { content: `${run.jobName} finished: ${run.status}` };
}
}
@Channel({ name: "triages", source: { type: "agent-completion", agentIds: ["triage"] } })
export class TriagesChannel extends ChannelContext {
async onEvent(payload: unknown): Promise<ChannelNotification> {
received.push(payload as object);
const run = payload as { agentName: string; output?: string };
return { content: `${run.agentName} answered: ${run.output}` };
}
}Starting FrontMCP in your browser…
FrontMCP starts when this example comes into view.
The event goes only to the session in sessionId, the one that ran the job or agent. The Playground's 2026-07-28 client has none, so it receives nothing, but onEvent() still runs.
Sending to one session
By default an event goes to every subscribed session. Pass a session id to handleEvent() or pushNotification() to send it to one session only, like the one whose tool call caused it. For a client that keeps a session (protocol versions before 2026-07-28), this.context.sessionId is that session's id; under 2026-07-28 it's a new id for every request, and an event sent to one session never reaches a subscriptions/listen stream. So, for a legacy client:
import { Tool, ToolContext, z } from "@frontmcp/sdk";
@Tool({ name: "start_export", description: "Export tickets; you'll be told when the file is ready", inputSchema: { month: z.string() } })
export class StartExport extends ToolContext {
async execute({ month }: { month: string }) {
const exports = this.scope.channels?.findByName("exports");
const sessionId = this.context.sessionId;
buildExport(month).then((url) => exports?.pushNotification(`The ${month} export is ready: ${url}`, { month }, sessionId));
return { started: month };
}
}To stop one session receiving a channel, call this.scope.notifications.unsubscribeChannel(sessionId, "exports"); subscribeChannel() starts it again. The Playground's own client has no session, so the tests here open two on one server, with createDirect() and its connect():
import { test, expect } from "@frontmcp/testing";
import { FrontMcpInstance } from "@frontmcp/sdk";
import { config } from "./main";
type Message = { method: string; params?: unknown };
type Server = Awaited<ReturnType<typeof FrontMcpInstance.createDirect>>;
async function openSession(server: Server) {
const client = await server.connect({ capabilities: { experimental: { "claude/channel": {} } } });
const received: unknown[] = [];
client.onNotification((message: Message) => {
if (message.method === "notifications/claude/channel") received.push(message.params);
});
return { client, received };
}
const arrival = () => new Promise((resolve) => setTimeout(resolve, 50));
test("an event sent to one session reaches only that session", async () => {
const server = await FrontMcpInstance.createDirect(config);
const first = await openSession(server);
const second = await openSession(server);
await first.client.callTool("start_export", { month: "October" });
await arrival();
expect(first.received).toEqual([{ content: "The October export is ready", meta: { month: "October", source: "exports" } }]);
expect(second.received).toEqual([]);
await server.dispose();
});
test("unsubscribeChannel() stops the channel for one session", async () => {
const server = await FrontMcpInstance.createDirect(config);
const first = await openSession(server);
const second = await openSession(server);
await first.client.callTool("mute_exports", {});
await second.client.callTool("announce", { text: "Exports are paused" });
await arrival();
expect(first.received).toEqual([]);
expect(second.received).toEqual([{ content: "Exports are paused", meta: { source: "exports" } }]);
await server.dispose();
});Starting FrontMCP in your browser…
FrontMCP starts when this example comes into view.
Hooking every event
Every event a channel sends goes through the channels:send-notification flow, so a plugin can see or change each one with ChannelSendHook. Here a plugin keeps an audit log of what was sent, and adds the time to each event's meta once the channel's and the server's are in:
import { ChannelSendHook, DynamicPlugin, FlowCtxOf, Plugin } from "@frontmcp/sdk";
export const audit: string[] = [];
@Plugin({ name: "channel-audit", description: "Logs every channel event, and stamps it with the time" })
export class ChannelAudit extends DynamicPlugin<object> {
@ChannelSendHook.Did("resolveMeta")
async stamp(ctx: FlowCtxOf<"channels:send-notification">) {
ctx.state.set("meta", { ...ctx.state.meta, sent_at: "2026-10-05T09:00:00Z" });
}
@ChannelSendHook.Will("send")
async record(ctx: FlowCtxOf<"channels:send-notification">) {
audit.push(`${ctx.state.channelName}: ${ctx.state.content}`);
}
}Starting FrontMCP in your browser…
FrontMCP starts when this example comes into view.
The second test publishes an event that has the channel option. A session gets it without the sent_at stamp, and the audit log stays empty: that notification is sent by the events:publish flow, not by a channel.
Changed in 1.9: before, FrontMCP never ran this flow for an event, so these hooks only ran when your own code started the flow.
Replaying missed events
Events sent while no session is subscribed are lost. With replay, the channel keeps the last maxEvents, and replayBufferedEvents(sessionId) sends them to a session, marked replayed: "true". FrontMCP doesn't call it for you, so give the model a tool to catch up with:
import { App, Channel, ChannelContext, FrontMcp, Tool, ToolContext, z, type ChannelNotification } from "@frontmcp/sdk";
@Channel({ name: "outages", source: { type: "app-event", event: "outage" }, replay: { enabled: true, maxEvents: 2 } })
export class OutagesChannel extends ChannelContext {
async onEvent(payload: unknown): Promise<ChannelNotification> {
return { content: `${(payload as { service: string }).service} is down` };
}
}
@Tool({ name: "report_outage", description: "Report that a service is down", inputSchema: { service: z.string() } })
export class ReportOutage extends ToolContext {
async execute({ service }: { service: string }) {
this.scope.channelEventBus?.emit("outage", { service });
return { reported: service };
}
}
@Tool({ name: "catch_up", description: "Resend the latest outage alerts to this session", inputSchema: {} })
export class CatchUp extends ToolContext {
async execute() {
const channel = this.scope.channels?.findByName("outages");
const kept = [...(channel?.replayBuffer ?? [])].map((event) => event.content);
const resent = channel?.replayBufferedEvents(this.context.sessionId ?? "") ?? 0;
return { kept, resent };
}
}
@App({ id: "ops", name: "Ops", tools: [ReportOutage, CatchUp], channels: [OutagesChannel] })
export class OpsApp {}
export const config = { info: { name: "ops", version: "1.0.0" }, apps: [OpsApp], channels: { enabled: true } };
@FrontMcp(config)
export default class Server {}Starting FrontMCP in your browser…
FrontMCP starts when this example comes into view.
In the Call tab, resent is 0: the Playground's client has no session, so nothing is sent to it. The second test opens one after two events were sent. Connecting replays nothing; once the session calls catch_up, it gets both, each with meta.replayed set to "true", and resent is 2. Changed in 1.12.1: before, resent counted the kept events whether or not the session was sent them.
Troubleshooting
Claude Code never shows my channel's events
Claude Code doesn't acknowledge a notification, and silently drops one from a server it didn't register as a channel, so the server sees no error either way. Check, in order:
- The server runs FrontMCP 1.12.0 or later. Before, no FrontMCP channel reached a Claude Code session.
- Claude Code starts the server over stdio, in one of the first four ways of running it. A server it connects to by URL isn't a channel for it. With
runShared(), the session must be attached to the shared server: one that runs the server in its own process gets no event, and says so once on stderr,[frontmcp shared] warn running the shared server "…" in this process: …. - The server serves channels:
@FrontMcp({ channels: { enabled: true } })is set and the channel is in an app'schannels, or an event has thechanneloption. Send the server the probe: it should answer-32022. - The session opted the server in, with
claude --dangerously-load-development-channels server:<name>, where<name>is the server's key undermcpServers, and you confirmed the warning. The flag is ignored with-p. In a Team or Enterprise organization, an Owner must have enabled channels (channelsEnabled). - The channel's
availableWhen, if it has one, matches where the server runs: otherwise the channel isn't registered. - The source can reach the client: a
"webhook"needs a matching POST request, which a stdio server has no route for, and"job-completion"and"agent-completion"events go only to the session that ran the job or agent. onEvent()didn't throw. The server's log saysChannel "…" failed to handle eventwhen it did, andChannel "…" failed to send a notificationwhen sending failed. A stdio server writes its log to stderr and to its file in~/.frontmcp/logs/. (Before 1.12.1, only when its configuration had aloggingoption: on an older FrontMCP, addlogging: {}.)- The session is still subscribed:
unsubscribeChannel()stops a channel for one session. - For an event with the
channeloption, the session's caller may see the event: see the Events reference.
Over HTTP, a client other than Claude Code gets events only when it asked for them, with experimental: { "claude/channel": {} }: in its initialize, for a client that keeps a session, or in its subscriptions/listen request, for a 2026-07-28 client. The Playground's client opens no stream, so its Call tab never shows a channel event.
Channel messages from "…" are unavailable: this connection's protocol version has no channel delivery path
Claude Code 2.1.322 showed this at startup for a FrontMCP stdio server older than 1.12.0, in the framework's capture. The server answered Claude Code's server/discover probe, so the connection stayed on MCP 2026-07-28, where Claude Code registers no channel. Upgrade to 1.12.0 or later: a stdio server with channels declines the probe, and Claude Code falls back to initialize.
Unsupported protocol version: 2026-07-28 from a stdio server
JSON-RPC error -32022, with the four earlier revisions in data.supported. The server serves channels, so it declines MCP 2026-07-28 for every stdio client: server/discover, subscriptions/listen and any request that names the revision. Send initialize and use a session. A server without a channel, and without an event that has the channel option, serves 2026-07-28 over stdio as before. Changed in 1.12.0: before, a stdio server with channels served it too. See What FrontMCP does over stdio.
An HTTP session stopped getting events
The credentials of the session's latest request have expired. FrontMCP sends a session no channel event, and no event with the channel option, once that token's exp has passed, until the session makes a request with valid credentials. Changed in 1.12.0: before, the session kept getting channel events. See what a client receives.
A meta attribute has _ where its key has another character
FrontMCP sends every character of a meta key that isn't a letter, a digit or an underscore as _, because Claude Code drops a key that has one: chat-id arrives as chat_id. Name the key that way, and update instructions that mention it. Changed in 1.12.0: before, the key was sent as written. See meta keys.
A published event arrives twice
The event has the channel option, and an "app-event" channel listens to its name: each sends a notification. Keep one. The server warns about it at startup: see app-event channels and declared events.
A file-watcher channel sends nothing
One of these:
- The channel defines
onConnect(), so FrontMCP leaves the watching to it. RemoveonConnect()to have FrontMCP watch the declared paths. - A path is a glob, like
./logs/*.log. Declare the directory, or each file. - The kind of event isn't in the channel's
events, the file is in a subdirectory of a declared directory, or it was there when the server started. - The server runs in a serverless, edge or browser runtime, where nothing is watched.
The first two and the last are logged at startup: see the file-watcher source.
Meta keys must be valid identifiers (letters, digits, underscores)
A key in the channel's meta, or in channels.defaultMeta, has another character, like "my-env", or starts with a digit. Rename it, my_env. The check runs when the class is decorated, or when the server's configuration is read, so the server doesn't start. A key in the meta that onEvent() returns isn't refused: it's sent with _.
Duplicate channel name "…" — each channel must have a unique name.
Two channels on the server have the same name, maybe in different apps. Channel names are server-wide.
Failed to send reply to channel "…"
channel-reply failed because the channel's onReply() threw, with its message after the colon, or because the two-way channel doesn't define one: Channel "…" has twoWay: true but onReply() is not implemented. Implement onReply(), or fix what it calls. Before 1.9, FrontMCP logged Channel "…" failed to handle reply and told the model the reply was sent.
POST /hooks/… returns 404
Check that the request is a POST to the channel's configured path. Changed in 1.9.5: createFetchHandler() serves webhook routes too; before, it returned 404.
Before 1.8.5, no server registered the route.
Channel "…" has a webhook source but no HTTP server to serve …
The server runs in process through create(), createDirect() or connect() in its default mode. These entry points skip webhook registration and log this warning. Changed in 1.10.0: before, they registered webhook routes without serving HTTP. connect()'s CLI mode keeps its existing initialization. Start an HTTP server or use createFetchHandler() to receive webhook requests.
Channel "…" has job-completion source but no job emitter available
FrontMCP wires "job-completion" and "agent-completion" sources to the scope's completion events: see Reacting to a job or an agent finishing.
Changed in 1.8.5: before, FrontMCP logged this at startup and never wired either source.
this.scope.channels is undefined
Channels aren't enabled. Set channels: { enabled: true } on @FrontMcp. channelNotifications also needs channels enabled. channelEventBus can instead be enabled by an event workflow.
TypeScript says Property 'channelEventBus' does not exist on type 'ScopeEntry'
The project has a FrontMCP older than 1.9, whose ScopeEntry type didn't declare the channel members of the scope. Since 1.9 it declares channels, channelEventBus and channelNotifications: upgrade, and the casts older code needed can go.
Provider "…" is not available in a channel
The channel asked for a provider that isn't registered on its app or on the server, like one on another app: register it on the channel's app, or in @FrontMcp({ providers }) to share it between apps. Before 1.9.2, a channel didn't see its own app's providers either.
A channel's tools find providers in the same places. Before 1.9.3 they saw only the server's, so on an older FrontMCP, register a provider they use in @FrontMcp({ providers }).