LINE Channel for Claude Code
繁體中文 | English | 日本語 | 한국어
Push LINE messages into your Claude Code session via the LINE Messaging API, so Claude can receive and reply to your LINE messages in real time.
Table of Contents
Requirements
- OS: Windows / macOS / Linux
- Claude Code v2.1.80+, signed in with a claude.ai account (not API key)
- Bun runtime
- ngrok account (free tier works)
- LINE Developers account (free)
Prerequisites
1. Install Claude Code
npm install -g @anthropic-ai/claude-code
Then sign in:
claude
Follow the prompts to sign in with your claude.ai account.
2. Install Bun
macOS / Linux:
curl -fsSL https://bun.sh/install | bash
Windows (PowerShell):
powershell -c "irm bun.sh/install.ps1 | iex"
Verify the installation:
bun --version
3. Install ngrok
Sign up for a free account at https://ngrok.com, then:
macOS (Homebrew):
brew install ngrok
Windows:
Download from https://ngrok.com/download, extract, and add to PATH.
Set your authtoken (copy from ngrok Dashboard):
ngrok config add-authtoken YOUR_AUTHTOKEN
4. Create a LINE Bot
- Go to LINE Developers Console and sign in
- Click Create a Provider and enter a name (e.g.
My Claude Bot)
- Click Create a new channel → select Messaging API
- Fill in the required fields (Channel name, description, Category) and create
Get your credentials:
- Channel Secret: channel → Basic settings tab → copy
Channel secret
- Channel Access Token: channel → Messaging API tab → scroll to the bottom → click Issue → copy the token
In the Messaging API tab, disable the following to prevent automatic replies from interfering:
- Auto-reply messages → Disabled
- Greeting messages → Disabled
Setup
1. Clone the repository
git clone https://github.com/Moksa1123/claude-channel-line
cd claude-channel-line
2. Save LINE credentials
Credentials are stored in ~/.claude/channels/line/.env and will not be committed to git.
macOS / Linux:
mkdir -p ~/.claude/channels/line
cat > ~/.claude/channels/line/.env << EOF
LINE_CHANNEL_ACCESS_TOKEN=your_channel_access_token
LINE_CHANNEL_SECRET=your_channel_secret
EOF
Windows (PowerShell):
New-Item -ItemType Directory -Force "$env:USERPROFILE\.claude\channels\line"
@"
LINE_CHANNEL_ACCESS_TOKEN=your_channel_access_token
LINE_CHANNEL_SECRET=your_channel_secret
"@ | Set-Content "$env:USERPROFILE\.claude\channels\line\.env"
3. Add MCP Server
macOS / Linux:
claude mcp add line bun "/path/to/claude-channel-line/server.ts"
Windows:
claude mcp add line bun "C:/path/to/claude-channel-line/server.ts"
Replace the path with the actual location where you cloned the repo.
Verify it was added:
claude mcp list
You should see line in the list.
4. Start ngrok
Open a separate terminal window and run:
ngrok http 8789
You should see something like:
Forwarding https://xxxx.ngrok-free.app -> http://localhost:8789
Copy the https://xxxx.ngrok-free.app URL — you'll need it in the next step.
Note: Keep the ngrok window open. Closing it will disconnect the tunnel. The URL changes every time you restart ngrok (free plan), so you'll need to update the Webhook URL in LINE Console each time.
5. Configure LINE Webhook
Back in LINE Developers Console, open your channel: