Skip to content

About

MCP server for a personal LINE account: local archive, search and messaging for coding agents

Topics

Resources

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

line-mcp

npm CI Release License

Give your coding agents your LINE chats. line-mcp keeps a local SQLite copy of one personal LINE account and serves it over MCP, so Claude Code, Codex and T3 Code can read, search and answer your messages.

Warning

line-mcp is an unofficial client, not affiliated with or endorsed by LINE. It speaks LINE's private protocol through LINEJS. Using it may break LINE's terms of use, and LINE may restrict or ban an account that uses it. Use it at your own risk.

Quick start

You need Node 24.18 or a later Node 24, or Node 26 or later, on macOS, Linux with systemd or Windows, and the LINE app on your phone, logged in to the account.

npm i -g line-mcp-server
line-mcp login     # scan the QR code with LINE on your phone, then enter the PIN
line-mcp install   # start the background daemon
line-mcp doctor    # check the setup without contacting LINE

line-mcp joins the account as a secondary device; the phone stays the primary one. From then on the daemon syncs every chat, starts again after a reboot, and serves MCP at http://127.0.0.1:47822/mcp. If LINE ends the session, it keeps serving the local archive, shows a desktop notification and waits for another login.

Linux and Windows have a few extra requirements: see Platforms.

Connect your agent

Claude Code

claude plugin marketplace add stickerdaniel/line-mcp-server
claude plugin install line-mcp-server@line-mcp-server

Codex

codex plugin marketplace add stickerdaniel/line-mcp-server
codex plugin add line-mcp-server@line-mcp-server

The plugin connects the agent to the running daemon and adds the line-mcp skill. T3 Code runs Claude Code and Codex, so it needs nothing else.

Without the plugin, or with another port

The plugins expect the default port. Otherwise add the server by hand, with your LINE_MCP_PORT in place of 47822.

Claude Code:

claude mcp add --transport http --scope user line http://127.0.0.1:47822/mcp

Codex, in ~/.codex/config.toml:

[mcp_servers.line]
url = "http://127.0.0.1:47822/mcp"
# Attachment downloads can take longer than the 60 s default.
tool_timeout_sec = 180

For the skill, link or copy plugins/line-mcp-server/skills/line-mcp/ from this repository into the agent's skills directory. It runs line-mcp from PATH, where the npm install puts it.

Tools

Tool What it does
query Read-only SQL over the local archive: chats, names, messages, read state, full-text search.
status Session health, last sync times, coverage gaps, backfill progress and the archive time zone.
get_attachment Metadata of an image, video, audio or file message, or the file saved to a private cache.
get_announcements Pinned announcements of a group, room or OpenChat.
get_profile Your own profile, another LINE user's, or an OpenChat member's.
send_message Sends text, an image or a file, optionally as a reply.
react Reacts to a message.
unsend Unsends one of your messages for everyone.

Reads never mark anything as read. Every send, reaction and unsend needs an idempotency_key: a retry with the same key and arguments never acts twice. A result with state unknown means LINE may have acted: check the chat before you retry with a new key. Any local process can call these tools: see SECURITY.md.

CLI

Every tool is also a line-mcp command that calls the running daemon:

line-mcp query --sql "
  SELECT local_time(sent_at), text FROM message
  WHERE instr(text, '晚餐') ORDER BY sent_at DESC LIMIT 5"

line-mcp help lists the commands. The status tool is line-mcp sync-status, since line-mcp status reports the local setup. Results are JSON.

Platforms

The daemon runs as a per-user service: a LaunchAgent on macOS, a systemd user unit on Linux, a scheduled task on Windows. install writes it, and running install again after an upgrade rewrites it.

macOS
What Where
Archive ~/Library/Application Support/line-mcp/line.db (0600)
Attachments ~/Library/Application Support/line-mcp/attachments
Logs ~/Library/Logs/line-mcp/daemon.log, without message content
LaunchAgent ~/Library/LaunchAgents/io.github.stickerdaniel.line-mcp.plist
Linux

The daemon runs as the systemd user unit line-mcp.service (line-mcp-server 0.3.0 or later). Linux also needs:

  • systemd 240 or later with a user manager, so systemctl --user status answers.
  • Lingering, for the daemon to keep running after you log out: loginctl enable-linger "$(id -un)". line-mcp never turns it on; doctor reports it.
  • An npm prefix you own, so npm i -g needs no sudo, with its bin on PATH. With a distribution Node, npm config set prefix ~/.local and ~/.local/bin on PATH do that.
  • The state directory on a local disk. SQLite's WAL mode needs shared memory, which network file systems do not provide.
What Where
Archive ~/.local/share/line-mcp/line.db (0600), under $XDG_DATA_HOME if set
Attachments ~/.local/share/line-mcp/attachments
Logs ~/.local/state/line-mcp/daemon.log, under $XDG_STATE_HOME if set
Unit ~/.config/systemd/user/line-mcp.service, under $XDG_CONFIG_HOME if set
  • install writes the state directory into the unit, so the daemon opens the same archive whatever environment the user manager has. The unit must go where the user manager looks: with an XDG_CONFIG_HOME set only in your shell, install fails with unit_not_found and removes the unit again.
  • Notifications go through notify-send when it is installed.
  • A Node from nvm, fnm, Volta, asdf or snap lives in a directory that goes away with its version, and the daemon with it; install and doctor warn about that. Pass --node with a Node that stays, such as the distribution's /usr/bin/node, or run line-mcp install again after switching versions.
  • Without systemd, for example in a container, run line-mcp daemon in the foreground.
  • WSL 2 with systemd enabled works like Linux. Keep the state directory in the Linux file system, not under /mnt/c. A systemd service does not keep WSL running, so the daemon stops when WSL shuts down after its last terminal closes.
Windows

The daemon runs as the scheduled task line-mcp-<your user SID> (line-mcp-server 0.3.0 or later), which starts it when you log on and runs it while you stay logged on. When PowerShell's execution policy blocks the scripts npm installs, run npm.cmd and line-mcp.cmd instead of npm and line-mcp.

What Where
Archive %LOCALAPPDATA%\line-mcp\line.db
Attachments %LOCALAPPDATA%\line-mcp\attachments
Logs %LOCALAPPDATA%\line-mcp\logs\daemon.log, also with LINE_MCP_HOME
Task files %LOCALAPPDATA%\line-mcp\service, also with LINE_MCP_HOME
  • The state must stay inside your user profile, readable by you, SYSTEM and Administrators only. line-mcp refuses state that others can read and never changes access lists itself; doctor prints the fix.
  • Paths with a " or a % cannot run as a scheduled task, so install refuses them.
  • Logging off ends the daemon without a shutdown. SQLite recovers the archive when the task starts again at your next logon, and the sync catches up from there.
  • A Node from nvm-windows lives in a directory that goes away with its version, and the daemon with it; install and doctor warn about that. Pass --node with a Node that stays, such as C:\Program Files\nodejs\node.exe, or run line-mcp install again after switching versions.
Environment variables

Set them before install, which passes them on to the service.

Variable Default What it does
LINE_MCP_HOME the paths above Moves the state directory.
LINE_MCP_PORT 47822 The MCP port. It must differ from the lock port.
LINE_MCP_LOCK_PORT 47821 The lock port: one process at a time talks to LINE.

Upgrade and uninstall

npm i -g line-mcp-server@latest
line-mcp install              # restarts the daemon; the archive and session stay
line-mcp uninstall            # stops the daemon, keeps the archive
line-mcp uninstall --purge    # also deletes the state directory
npm rm -g line-mcp-server

To revoke the session itself, log the device out in LINE's device list on your phone.

Development

bun install
bun run verify

See CONTRIBUTING.md and the architecture. The agent eval of the tools lives in evals/.

License

Apache-2.0

About

MCP server for a personal LINE account: local archive, search and messaging for coding agents

Topics

Resources

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages