Claude Code Channels — Discord Integration Plan
This document outlines the full plan for integrating Claude Code Channels with Discord, connecting it to the existing n8n automation infrastructure, and scaling toward autonomous agent workflows.
Overview
Section titled “Overview”Claude Code Channels (research preview, launched 2026-03-20) push external events into a running Claude Code session. Unlike standard MCP tools that Claude queries on demand, channels deliver messages proactively — enabling two-way chat bridges and webhook-driven automation.
What this gives us: The ability to message Claude from a phone via Discord and have it work against the actual vault, VPS, and WordPress sites — plus the ability to route n8n events (backup failures, inbox changes, build errors) into Claude for autonomous handling.
Prerequisites
Section titled “Prerequisites”| Requirement | Patrick’s Mac | VPS (baseworks-agents) |
|---|---|---|
| Claude Code v2.1.80+ | Needs update (currently v2.1.63) | Already v2.1.80 (updated 2026-03-20) |
| Bun runtime | Not installed | Needs install |
| claude.ai login | Yes | Token-based (see note) |
VPS authentication caveat: Channels require claude.ai login — API key / token auth is not supported. The VPS currently uses CLAUDE_CODE_OAUTH_TOKEN because Cloudflare blocks interactive login. This may be a blocker for running channels on the VPS until Anthropic provides a workaround. We may need to run the persistent channel session on a Mac instead, or test whether the existing OAuth token is accepted.
Phase 1 — Discord Bot + Local Channel (Patrick and Claude together, ~20 min)
Section titled “Phase 1 — Discord Bot + Local Channel (Patrick and Claude together, ~20 min)”Everything in this phase requires Patrick’s involvement.
Step 1: Update Claude Code + install Bun
Section titled “Step 1: Update Claude Code + install Bun”# On Patrick's Macclaude updatecurl -fsSL https://bun.sh/install | bashVerify:
claude --version # should be 2.1.80+bun --version # should return a version numberStep 2: Create Discord bot
Section titled “Step 2: Create Discord bot”- Go to Discord Developer Portal
- Click New Application → name it “Baseworks Claude” (or similar)
- Go to Bot section → click Reset Token → copy the token
- Under Privileged Gateway Intents, enable Message Content Intent
- Go to OAuth2 → URL Generator:
- Scope:
bot - Permissions: View Channels, Send Messages, Send Messages in Threads, Read Message History, Attach Files, Add Reactions
- Scope:
- Open the generated URL → add the bot to the Baseworks Discord server
Step 3: Install and configure the Discord plugin
Section titled “Step 3: Install and configure the Discord plugin”# In a Claude Code session/plugin install discord@claude-plugins-official
# If plugin not found:/plugin marketplace add anthropics/claude-plugins-official/plugin install discord@claude-plugins-official
# Configure with the bot token from Step 2/discord:configure <your_bot_token>This saves the token to ~/.claude/channels/discord/.env.
Step 4: Launch with channels and pair
Section titled “Step 4: Launch with channels and pair”# Exit and restart Claude Code with channels enabledclaude --channels plugin:discord@claude-plugins-officialThen:
- DM the bot on Discord — it replies with a pairing code
- In Claude Code, run:
/discord:access pair <code> - Lock down access:
/discord:access policy allowlist
Step 5: Test
Section titled “Step 5: Test”Send a message to the bot from Discord: “What’s in Patrick’s inbox today?”
Claude should read the inbox file, summarize it, and reply in Discord.
Phase 2 — Dedicated Discord Channels for Different Functions
Section titled “Phase 2 — Dedicated Discord Channels for Different Functions”Once the bot is working, create dedicated channels in the Baseworks Discord server:
| Discord Channel | Purpose |
|---|---|
#claude-general | General vault queries, lookups, drafting |
#claude-infra | Infrastructure commands, server checks, backup status |
#claude-inbox | Inbox management — check items, add items, summarize |
#claude-alerts | Receive automated alerts (connected in Phase 3) |
The bot listens in all channels it has access to. The channel name gives Claude context about what kind of request to expect.
Phase 3 — n8n Webhook Integration (Custom Channel)
Section titled “Phase 3 — n8n Webhook Integration (Custom Channel)”This phase connects the existing n8n automation to Claude Code via a custom webhook channel. Claude can do most of this autonomously.
Architecture
Section titled “Architecture”n8n workflow → HTTP POST → custom webhook channel → Claude Code session ↓ Claude acts on it ↓ Posts result to Discord / SlackWhat gets routed to Claude
Section titled “What gets routed to Claude”| Event Source | Current Behavior | With Channels |
|---|---|---|
| Backup failure | Posts to Patrick’s inbox file | Also pushes to Claude → Claude SSHs into VPS, diagnoses, retries, reports to Discord |
| Inbox change (GitHub webhook) | Posts @mention in #agent-alerts | Also pushes to Claude → Claude reads the new item, summarizes in Discord |
| Daily infra report | Written to Patrick’s inbox | Pushed to Claude → Claude reviews, flags issues, posts digest to #claude-alerts |
| KB site build failure | Warning in GitHub Actions log | Webhook fires → Claude fixes frontmatter/wikilinks, commits, pushes |
| Vault capture complete | Posts to #vault-inbox in Slack | Also pushes to Claude → Opus reviews Haiku’s output for voice compliance |
Implementation
Section titled “Implementation”Building a custom webhook channel requires:
- An MCP server that listens for HTTP POSTs and pushes them into the session
- The
--dangerously-load-development-channelsflag (during research preview, custom channels aren’t on the allowlist) - n8n HTTP Request nodes configured to POST to the webhook endpoint
Reference: Channels reference — building custom channels
Claude can write the custom channel code and n8n workflow configurations autonomously.
Phase 4 — Persistent Session on VPS (Always-On Agent)
Section titled “Phase 4 — Persistent Session on VPS (Always-On Agent)”Goal: Run Claude Code in a persistent tmux session on the VPS with channels enabled, so it’s always available.
Hosting priority order
Section titled “Hosting priority order”- VPS (baseworks-agents) — preferred. Already configured with vault, SSH, n8n connectivity, tmux sessions, and a long-lived OAuth token (~2027-03-11 expiry). Try this first.
- Synology NAS (Patrick’s home) — fallback. Residential IP avoids the Cloudflare bot-detection issue that blocks interactive
claude loginon the VPS. NAS is always-on by design. Being reconfigured as of 2026-03-20. - Patrick’s Mac — last resort. Requires the Mac to stay awake, which isn’t practical long-term.
Blockers to resolve
Section titled “Blockers to resolve”- Authentication: Channels require claude.ai login. The VPS uses
CLAUDE_CODE_OAUTH_TOKENbecause Cloudflare blocks interactive login from datacenter IPs. Test first: does the existing OAuth token work with--channels? If yes, VPS is the host. If no, move to the Synology NAS option. - Permission prompts: In unattended mode, Claude pauses at permission prompts. Options:
--dangerously-skip-permissions— only in trusted environments- Pre-configure allowed tools to minimize prompts
- Session persistence: Claude Code sessions don’t survive terminal disconnects unless run in tmux/screen. Need a systemd service or a tmux auto-restart script.
Option A: VPS setup (if token auth works with —channels)
Section titled “Option A: VPS setup (if token auth works with —channels)”# On baseworks-agents VPS, in a tmux sessiontmux new -s claude-channelsclaude --channels plugin:discord@claude-plugins-official --dangerously-skip-permissionsWith a systemd service for auto-restart:
[Unit]Description=Claude Code Channels (Discord)After=network.target
[Service]Type=simpleUser=patrickWorkingDirectory=/srv/baseworks/knowledge-baseExecStart=/home/patrick/.local/bin/claude --channels plugin:discord@claude-plugins-official --dangerously-skip-permissionsRestart=on-failureRestartSec=30
[Install]WantedBy=multi-user.targetOption B: Synology NAS setup (if VPS auth doesn’t work)
Section titled “Option B: Synology NAS setup (if VPS auth doesn’t work)”The Synology NAS has a residential IP, so Cloudflare bot protection should not block the interactive claude login flow. This makes it a strong fallback for always-on Channels hosting.
Requirements to verify on the NAS:
- CPU architecture (x86 models fully supported; ARM models may have Bun compatibility issues)
- Docker support (Container Manager package) — can run Claude Code + Bun in a container
- Sufficient RAM — Claude Code + channel plugins are lightweight but need ~512MB headroom
- SSH access enabled
- Node.js available (via Synology package center, Docker, or manual install)
- Bun runtime installable (depends on architecture)
Setup approach (once confirmed compatible):
- Install Claude Code and Bun on the NAS (directly or via Docker)
- Run
claude login— should work from a residential IP - Clone the vault repo to the NAS
- Install and configure the Discord channel plugin
- Run in a persistent session (Docker with restart policy, or screen/tmux via SSH)
Advantages over VPS:
- Residential IP — no Cloudflare bot-detection issues
- On the local network — can interact with local devices/services
- No monthly hosting cost (already owned hardware)
Disadvantages vs VPS:
- Home internet reliability and potential outages
- No existing n8n connectivity (n8n is on the VPS) — webhook integration (Phase 3) would need to reach the NAS, requiring either a tunnel (Cloudflare Tunnel, Tailscale) or port forwarding
- No existing vault clone, SSH keys, or git config — initial setup needed
- Dynamic IP may require DDNS if n8n needs to reach it
Phase 5 — Scale and Extend
Section titled “Phase 5 — Scale and Extend”Once the foundation is stable, these become possible:
- Asia pairing: Add Asia’s Discord account to the bot’s allowlist so both can use it
- Scheduled vault maintenance: Combine with scheduled tasks to run nightly wikilink checks, frontmatter validation, broken link scans
- CI/CD integration: When the KB site deploys via Cloudflare Pages, push the build status into Claude for immediate action on failures
- WordPress monitoring: Route practice.baseworks.com error logs or slow query alerts through n8n into the channel
- Telegram as backup: Install the Telegram plugin as a secondary channel in case Discord has downtime
Security Considerations
Section titled “Security Considerations”- Discord bot token stored in
~/.claude/channels/discord/.env— not in the vault or git - Sender allowlist means only paired Discord accounts can message the bot
--dangerously-skip-permissionsshould only be used on the VPS, never on local machines with sensitive data- All VPS actions are logged in Claude Code’s session history
- The bot should be in a private Discord server, not a public one
Decision Points for Patrick
Section titled “Decision Points for Patrick”- Bot name and avatar — what should the Discord bot be called?
- Persistent session host — VPS first (test token auth), then Synology NAS as fallback if token doesn’t work with
--channels. Does the NAS model support x86/Docker? - Which n8n events to route first — start with backup failures? Inbox changes? All at once?
- Permission mode — comfortable with
--dangerously-skip-permissionson the agents VPS or NAS? - Asia access — pair Asia’s Discord account from the start or add later?
- NAS networking — if the NAS becomes the host, use Cloudflare Tunnel or Tailscale for n8n webhook connectivity?
Related
Section titled “Related”- Future Messaging Architecture (Slack → Discord) — prior analysis of Discord migration; Channels resolves several “triggers to revisit”
- Claude Code VPS — Overview & Getting Started
- Claude Code VPS — Setup
- Deployment Log
- Claude Code — Shared Infrastructure Context
- Claude Code Channels documentation
- Channels reference — building custom channels