# Connect your LINE OA from Claude Code.

> Connect a LINE OA from Claude Code: add LINE OA MCP, and one sentence creates the connection, sets how the AI answers and tests the first message.

Web page: https://agentlab.cresclab.com/en/channels/line/claude-code  
繁體中文 (Markdown): https://agentlab.cresclab.com/channels/line/claude-code.md

LINE OA × Claude Code · Agent Lab

Add LINE OA MCP to Claude Code and say "connect my LINE OA to AI". Claude Code creates the connection, sends you a secure page for the channel, sets how the AI answers and confirms the first reply; it answers test users until you approve every friend.

[Connect my AI](https://app.agentlab.cresclab.com/) [See the setup](https://agentlab.cresclab.com/en/channels/line/claude-code#recipe)

Claude Code connects a LINE Official Account: it creates the connection, waits while the person enters the channel on a secure page, sets how the AI answers and confirms the first reply.

Why connect LINE from Claude Code

## Claude Code does the setup, you keep the keys

### Answers from your instructions

Describe its role, what it knows and what it must not do in plain words; the next message follows it.

### Test users first

It answers your paired test account until you approve answering every friend, signed in.

### Secrets stay out of the chat

The Channel ID and Secret go on the service's own page; the AI tool never sees them.

### Replies don't use your quota

On LINE's plans replies are free; it replies first and pushes only when the reply window has passed.

Your options

## Claude Code with LINE OA MCP, or a bot it codes from scratch

Connecting LINE from Claude Code through LINE OA MCP compared with coding a bot

| What you care about | Claude Code + LINE OA MCP | Claude Code codes a LINE bot |
| --- | --- | --- |
| What you do | Say one sentence, fill in a secure page | Have it write a webhook, deploy it, configure LINE Developers |
| Channel Secret | Claude Code never sees it | Handed to the AI or written into config |
| Webhook URL | Set and verified for you | Deploy and paste it into the LINE console yourself |
| Going live | Test users first, every friend after you approve | Write it yourself |
| Changing answers | Edit the instructions; the next message follows | Change code and redeploy |

Steps

## Connect LINE from Claude Code in four steps

1. ### Set up LINE OA MCP
   Run it on Agent Lab from the setup guide, sign in to its panel and create an agent token.
2. ### Add it to Claude Code
   Put the setup below in .mcp.json and the agent token in LINE_AGENT_SDK_TOKEN, then restart Claude Code.
3. ### Enter the channel on the secure page
   Your AI tool gives you a link. Enter the Channel ID and Secret there; no long-lived token needed. No Official Account yet? Try the shared sandbox.
4. ### Test, then approve
   Chat from your test account and tune the instructions. When it's ready, approve answering every friend.

Setup

## Connect Claude Code to LINE OA MCP

Replace <org> with your Agent Lab organization. The token stays in the environment; never write it into the file or paste it into the chat.

Copy

### .mcp.json

```
{
  "mcpServers": {
    "line-oa-mcp": {
      "type": "http",
      "url": "https://line-oa-mcp--<org>.hosting.agentlab.run/mcp",
      "headers": { "Authorization": "Bearer ${LINE_AGENT_SDK_TOKEN}" }
    }
  }
}
```

- `LINE_AGENT_SDK_TOKEN` the agent token from the panel's Agent tokens page.
- `line_*` ten tools: connect, read progress, set the instructions, request going live, read messages, sandbox and more.

Prompt

### Then say this

```
Read https://agentlab.cresclab.com/line-agent-sdk.md and connect my LINE Official Account to AI. Answer only my test account for now. It's the front desk of my café: answer opening hours and menu questions; for bookings, ask for name, date and party size. Give me a secure link for anything I need to enter.
```

FAQ

## LINE with Claude Code: questions

**Can Claude Code connect a LINE Official Account by itself?**

Yes, with LINE OA MCP. Claude Code creates the connection and follows whose turn each step is; the steps LINE requires of a person, such as entering the channel or approving every friend, come back to you as links. [LINE OA MCP tools →](https://agentlab.cresclab.com/docs/en/line/mcp-tools)

**How do I change how the bot answers from Claude Code?**

Tell Claude Code what to change. It updates the instructions (up to 4,000 characters) with line_configure_bot, and the next message follows them; it can also turn AI replies off.

**Will the AI see my Channel Secret?**

No. The Channel ID and Secret are entered on the service's own page, and the AI tool only gets an agent token from an environment variable. Never paste a secret into the chat. [LINE OA MCP tools →](https://agentlab.cresclab.com/docs/en/line/mcp-tools)

**Can I try it without a LINE Official Account?**

Yes. A shared sandbox gives you a join code: add it as a friend, send the code, and your AI answers you there. Creating a real Official Account is done by you in LINE Official Account Manager; LINE offers no API for it.

**Do AI replies count toward LINE's message quota?**

Under LINE's Official Account plans, replies to a user don't count toward the monthly message count; only push messages do. The agent replies by default and pushes only when the reply window has passed.
