MCP LINE Server

MCP LINE Server

Enables AI assistants to send LINE messages, including text, stamps, Flex Messages, and check message quotas through the LINE Messaging API.

Category
Visit Server

README

MCP × LINE ハンズオン

AI に「LINE を送る力」を授ける MCP サーバーを作るハンズオン用リポジトリです。

このリポジトリについて

このリポジトリは、MCP (Model Context Protocol) を使って、AI が LINE にメッセージを送れるようにするハンズオンのスターターキットです。

MCP サーバーを 0 から作成し、以下の機能を実装します:

  • ✅ テキストメッセージの送信
  • ✅ スタンプの送信
  • ✅ Flex Message(リッチメッセージ)の送信
  • ✅ Quota API による送信数の確認

必要なもの

  • GitHub アカウント
  • LINE アカウント
  • Gemini API キー(Google AI Studio から取得)

セットアップ

1. このリポジトリを Fork する

右上の 「Fork」 ボタンをクリックして、自分のアカウントにフォークしてください。

2. GitHub Codespaces で開く

  1. 「Code」 ボタンをクリック
  2. 「Codespaces」 タブを選択
  3. 「Create codespace on main」 をクリック

3. 環境変数を設定

.env.sample をコピーして .env ファイルを作成します:

cp .env.sample .env

.env ファイルを編集して、以下の値を設定してください:

# Gemini API Key
GEMINI_API_KEY=your_gemini_api_key_here

# LINE Messaging API
LINE_CHANNEL_ACCESS_TOKEN=your_line_channel_access_token_here
LINE_USER_ID=your_line_user_id_here

4. 依存パッケージをインストール

npm install

5. ビルド

npm run build

6. Gemini CLI に MCP サーバーを登録

gemini mcp add line-server node ~/mcp-line-handson/dist/index.js

7. Gemini CLI を起動

gemini

8. 動作確認

Gemini CLI で以下のコマンドを実行して、MCP サーバーが正しく登録されているか確認します:

> /mcp

足し算ツールを試してみましょう:

> 5 + 3 は?

ハンズオン資料

詳しい手順は、Zenn Book を参照してください:

📚 【MCP×LINE】AIに「LINEを送る力」を授けよう!

プロジェクト構成

mcp-line-handson/
├── src/
│   └── index.ts          # MCP サーバーのメインファイル
├── dist/                 # ビルド出力先(自動生成)
├── .env.sample           # 環境変数のサンプル
├── .env                  # 環境変数(Git管理外)
├── package.json          # npm 設定
├── tsconfig.json         # TypeScript 設定
└── README.md             # このファイル

開発

TypeScript を編集した場合は、ビルドしてから Gemini CLI を再起動してください。

npm run build
gemini mcp remove line-server
gemini mcp add line-server node ~/mcp-line-handson/dist/index.js
gemini

トラブルシューティング

MCP サーバーが認識されない

  • npm run build でビルドが成功しているか確認
  • gemini mcp list で登録されているか確認
  • Gemini CLI を再起動してみる

LINE にメッセージが送れない

  • .env ファイルの LINE_CHANNEL_ACCESS_TOKENLINE_USER_ID が正しく設定されているか確認
  • LINE 公式アカウントを友だち追加しているか確認
  • LINE Developers コンソールでチャネルアクセストークンが有効か確認

参考リンク

ライセンス

MIT

作者

このハンズオンは Zenn Book と連動しています。詳しくは Zenn Book をご覧ください。

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured