Esta página todavía está en inglés. La traducción al español está en progreso.
Channels Reference — Building Custom Channels
Technical reference for building an MCP server that pushes webhooks, alerts, and chat messages into a Claude Code session.To use existing channels (Telegram, Discord, iMessage), see the Channels Guide.
Overview
A channel is an MCP server that runs on the same machine as Claude Code. Claude Code spawns it as a subprocess and communicates over stdio. Your channel server bridges external systems and the session:- Chat platforms (Telegram, Discord): your plugin runs locally and polls the platform’s API. When someone DMs the bot, the plugin receives the message and forwards it to Claude.
- Webhooks (CI, monitoring): your server listens on a local HTTP port. External systems POST to that port, and your server pushes the payload to Claude.
Requirements
@modelcontextprotocol/sdk(MCP SDK)- Node.js-compatible runtime: Bun, Node, or Deno
- Declare the
claude/channelcapability so Claude Code registers a notification listener - Emit
notifications/claude/channelevents when something happens - Connect via stdio transport
Example: Webhook Receiver
A single-file server that listens for HTTP requests and forwards them into your Claude Code session.1. Create the Project
2. Write the Server
3. Register in MCP Config
4. Test
Server Options
Notification Format
Emitnotifications/claude/channel with two params:
Expose a Reply Tool (Two-Way)
For bidirectional channels (chat bridges), expose a standard MCP tool:instructions so Claude knows to use the tool:
Gate Inbound Messages (Security)
An ungated channel is a prompt injection vector. Always check the sender against an allowlist before emitting:message.from.id), not the chat/room (message.chat.id). In group chats, anyone in the room could inject messages.
Permission Relay
Requires Claude Code v2.1.81+Bidirectional channels can forward permission prompts for remote approval.
How It Works
- Claude Code generates a request ID and notifies your server
- Your server forwards the prompt to the chat platform
- The remote user replies with
yes <id>orno <id> - Your handler parses the reply and emits a verdict
Implementation
1. Declare the capability:Permission Request Fields
Package as a Plugin
To make your channel installable and shareable:- Package it as a plugin
- Publish to a marketplace
- Users install with
/plugin installand enable with--channels plugin:<name>@<marketplace>
--dangerously-load-development-channels until added to the official allowlist or the organization’s allowedChannelPlugins.
Testing During the Research Preview
Custom channels are not on the approved allowlist. Use the development flag:channelsEnabled organization policy still applies.
References
- Channels Guide — setup for official channels (Telegram, Discord, iMessage)
- Working implementations — complete server code with pairing, reply tools, and file attachments
- MCP — the underlying protocol that channel servers implement