Skip to content

Claude Code Channels — Discord Integration Plan

Created 2026-03-20
Updated 2026-03-20
Status draft
Tags infrastructureautomationdiscordclaude-codechannelsplan

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.


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.


RequirementPatrick’s MacVPS (baseworks-agents)
Claude Code v2.1.80+Needs update (currently v2.1.63)Already v2.1.80 (updated 2026-03-20)
Bun runtimeNot installedNeeds install
claude.ai loginYesToken-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.

Terminal window
# On Patrick's Mac
claude update
curl -fsSL https://bun.sh/install | bash

Verify:

Terminal window
claude --version # should be 2.1.80+
bun --version # should return a version number
  1. Go to Discord Developer Portal
  2. Click New Application → name it “Baseworks Claude” (or similar)
  3. Go to Bot section → click Reset Token → copy the token
  4. Under Privileged Gateway Intents, enable Message Content Intent
  5. Go to OAuth2 → URL Generator:
    • Scope: bot
    • Permissions: View Channels, Send Messages, Send Messages in Threads, Read Message History, Attach Files, Add Reactions
  6. 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”
Terminal window
# 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.

Terminal window
# Exit and restart Claude Code with channels enabled
claude --channels plugin:discord@claude-plugins-official

Then:

  1. DM the bot on Discord — it replies with a pairing code
  2. In Claude Code, run: /discord:access pair <code>
  3. Lock down access: /discord:access policy allowlist

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 ChannelPurpose
#claude-generalGeneral vault queries, lookups, drafting
#claude-infraInfrastructure commands, server checks, backup status
#claude-inboxInbox management — check items, add items, summarize
#claude-alertsReceive 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.

n8n workflow → HTTP POST → custom webhook channel → Claude Code session
Claude acts on it
Posts result to Discord / Slack
Event SourceCurrent BehaviorWith Channels
Backup failurePosts to Patrick’s inbox fileAlso pushes to Claude → Claude SSHs into VPS, diagnoses, retries, reports to Discord
Inbox change (GitHub webhook)Posts @mention in #agent-alertsAlso pushes to Claude → Claude reads the new item, summarizes in Discord
Daily infra reportWritten to Patrick’s inboxPushed to Claude → Claude reviews, flags issues, posts digest to #claude-alerts
KB site build failureWarning in GitHub Actions logWebhook fires → Claude fixes frontmatter/wikilinks, commits, pushes
Vault capture completePosts to #vault-inbox in SlackAlso pushes to Claude → Opus reviews Haiku’s output for voice compliance

Building a custom webhook channel requires:

  1. An MCP server that listens for HTTP POSTs and pushes them into the session
  2. The --dangerously-load-development-channels flag (during research preview, custom channels aren’t on the allowlist)
  3. 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.

  1. 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.
  2. Synology NAS (Patrick’s home) — fallback. Residential IP avoids the Cloudflare bot-detection issue that blocks interactive claude login on the VPS. NAS is always-on by design. Being reconfigured as of 2026-03-20.
  3. Patrick’s Mac — last resort. Requires the Mac to stay awake, which isn’t practical long-term.
  1. Authentication: Channels require claude.ai login. The VPS uses CLAUDE_CODE_OAUTH_TOKEN because 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.
  2. 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
  3. 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)”
Terminal window
# On baseworks-agents VPS, in a tmux session
tmux new -s claude-channels
claude --channels plugin:discord@claude-plugins-official --dangerously-skip-permissions

With a systemd service for auto-restart:

[Unit]
Description=Claude Code Channels (Discord)
After=network.target
[Service]
Type=simple
User=patrick
WorkingDirectory=/srv/baseworks/knowledge-base
ExecStart=/home/patrick/.local/bin/claude --channels plugin:discord@claude-plugins-official --dangerously-skip-permissions
Restart=on-failure
RestartSec=30
[Install]
WantedBy=multi-user.target

Option 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):

  1. Install Claude Code and Bun on the NAS (directly or via Docker)
  2. Run claude login — should work from a residential IP
  3. Clone the vault repo to the NAS
  4. Install and configure the Discord channel plugin
  5. 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

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

  • 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-permissions should 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

  1. Bot name and avatar — what should the Discord bot be called?
  2. 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?
  3. Which n8n events to route first — start with backup failures? Inbox changes? All at once?
  4. Permission mode — comfortable with --dangerously-skip-permissions on the agents VPS or NAS?
  5. Asia access — pair Asia’s Discord account from the start or add later?
  6. NAS networking — if the NAS becomes the host, use Cloudflare Tunnel or Tailscale for n8n webhook connectivity?