agenza-line-bot-mcp 0.0.1-local
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +199 -0
- package/README.md +215 -0
- package/dist/common/response.d.ts +14 -0
- package/dist/common/response.d.ts.map +1 -0
- package/dist/common/response.js +22 -0
- package/dist/common/response.js.map +1 -0
- package/dist/common/schema/actionSchema.d.ts +139 -0
- package/dist/common/schema/actionSchema.d.ts.map +1 -0
- package/dist/common/schema/actionSchema.js +85 -0
- package/dist/common/schema/actionSchema.js.map +1 -0
- package/dist/common/schema/constants.d.ts +2 -0
- package/dist/common/schema/constants.d.ts.map +1 -0
- package/dist/common/schema/constants.js +2 -0
- package/dist/common/schema/constants.js.map +1 -0
- package/dist/common/schema/flexMessage.d.ts +1654 -0
- package/dist/common/schema/flexMessage.d.ts.map +1 -0
- package/dist/common/schema/flexMessage.js +337 -0
- package/dist/common/schema/flexMessage.js.map +1 -0
- package/dist/common/schema/textMessage.d.ts +12 -0
- package/dist/common/schema/textMessage.d.ts.map +1 -0
- package/dist/common/schema/textMessage.js +9 -0
- package/dist/common/schema/textMessage.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +73 -0
- package/dist/index.js.map +1 -0
- package/dist/tools/AbstractTool.d.ts +9 -0
- package/dist/tools/AbstractTool.d.ts.map +1 -0
- package/dist/tools/AbstractTool.js +3 -0
- package/dist/tools/AbstractTool.js.map +1 -0
- package/dist/tools/broadcastFlexMessage.d.ts +9 -0
- package/dist/tools/broadcastFlexMessage.d.ts.map +1 -0
- package/dist/tools/broadcastFlexMessage.js +28 -0
- package/dist/tools/broadcastFlexMessage.js.map +1 -0
- package/dist/tools/broadcastTextMessage.d.ts +9 -0
- package/dist/tools/broadcastTextMessage.d.ts.map +1 -0
- package/dist/tools/broadcastTextMessage.js +27 -0
- package/dist/tools/broadcastTextMessage.js.map +1 -0
- package/dist/tools/cancelRichMenuDefault.d.ts +9 -0
- package/dist/tools/cancelRichMenuDefault.d.ts.map +1 -0
- package/dist/tools/cancelRichMenuDefault.js +16 -0
- package/dist/tools/cancelRichMenuDefault.js.map +1 -0
- package/dist/tools/createRichMenu.d.ts +10 -0
- package/dist/tools/createRichMenu.d.ts.map +1 -0
- package/dist/tools/createRichMenu.js +278 -0
- package/dist/tools/createRichMenu.js.map +1 -0
- package/dist/tools/deleteRichMenu.d.ts +9 -0
- package/dist/tools/deleteRichMenu.d.ts.map +1 -0
- package/dist/tools/deleteRichMenu.js +27 -0
- package/dist/tools/deleteRichMenu.js.map +1 -0
- package/dist/tools/getMessageQuota.d.ts +9 -0
- package/dist/tools/getMessageQuota.d.ts.map +1 -0
- package/dist/tools/getMessageQuota.js +21 -0
- package/dist/tools/getMessageQuota.js.map +1 -0
- package/dist/tools/getProfile.d.ts +10 -0
- package/dist/tools/getProfile.d.ts.map +1 -0
- package/dist/tools/getProfile.js +34 -0
- package/dist/tools/getProfile.js.map +1 -0
- package/dist/tools/getRichMenuList.d.ts +9 -0
- package/dist/tools/getRichMenuList.d.ts.map +1 -0
- package/dist/tools/getRichMenuList.js +21 -0
- package/dist/tools/getRichMenuList.js.map +1 -0
- package/dist/tools/pushFlexMessage.d.ts +10 -0
- package/dist/tools/pushFlexMessage.d.ts.map +1 -0
- package/dist/tools/pushFlexMessage.js +40 -0
- package/dist/tools/pushFlexMessage.js.map +1 -0
- package/dist/tools/pushTextMessage.d.ts +10 -0
- package/dist/tools/pushTextMessage.d.ts.map +1 -0
- package/dist/tools/pushTextMessage.js +39 -0
- package/dist/tools/pushTextMessage.js.map +1 -0
- package/dist/tools/setRichMenuDefault.d.ts +9 -0
- package/dist/tools/setRichMenuDefault.d.ts.map +1 -0
- package/dist/tools/setRichMenuDefault.js +22 -0
- package/dist/tools/setRichMenuDefault.js.map +1 -0
- package/dist/version.d.ts +3 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +3 -0
- package/dist/version.js.map +1 -0
- package/package.json +54 -0
- package/richmenu-template/template-01.md +46 -0
- package/richmenu-template/template-02.md +49 -0
- package/richmenu-template/template-03.md +74 -0
- package/richmenu-template/template-04.md +60 -0
- package/richmenu-template/template-05.md +67 -0
- package/richmenu-template/template-06.md +66 -0
package/README.ja.md
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
# LINE Bot MCP Server
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@line/line-bot-mcp-server)
|
|
4
|
+
|
|
5
|
+
LINE公式アカウントとAI Agentを接続するために、LINE Messaging APIを統合する[Model Context Protocol (MCP)](https://github.com/modelcontextprotocol) Server
|
|
6
|
+
|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
> [!NOTE]
|
|
10
|
+
> このリポジトリはプレビュー版として提供されています。実験的な目的で提供されており、完全な機能や包括的なサポートが含まれていないことにご注意ください。
|
|
11
|
+
|
|
12
|
+
## Tools
|
|
13
|
+
|
|
14
|
+
1. **push_text_message**
|
|
15
|
+
- LINEでユーザーにシンプルなテキストメッセージを送信する。
|
|
16
|
+
- **入力:**
|
|
17
|
+
- `userId` (string?): メッセージ受信者のユーザーID。デフォルトはDESTINATION_USER_ID。`user_id`または`DESTINATION_USER_ID`のどちらか一方は必ず設定する必要があります。
|
|
18
|
+
- `message.text` (string): ユーザーに送信するテキスト。
|
|
19
|
+
2. **push_flex_message**
|
|
20
|
+
- LINEでユーザーに高度にカスタマイズ可能なフレックスメッセージを送信する。
|
|
21
|
+
- **入力:**
|
|
22
|
+
- `user_id` (string?): メッセージ受信者のユーザーID。デフォルトはDESTINATION_USER_ID。`user_id`または`DESTINATION_USER_ID`のどちらか一方は必ず設定する必要があります。
|
|
23
|
+
- `message.altText` (string): フレックスメッセージが表示できない場合に表示される代替テキスト。
|
|
24
|
+
- `message.contents` (any): フレックスメッセージの内容。メッセージのレイアウトとコンポーネントを定義するJSONオブジェクト。
|
|
25
|
+
- `message.contents.type` (enum): コンテナのタイプ。'bubble'は単一コンテナ、'carousel'は複数のスワイプ可能なバブルを示す。
|
|
26
|
+
3. **broadcast_text_message**
|
|
27
|
+
- LINE公式アカウントと友だちになっているすべてのユーザーに、LINEでシンプルなテキストメッセージを送信する。
|
|
28
|
+
- **入力:**
|
|
29
|
+
- `message.text` (string): ユーザーに送信するテキスト。
|
|
30
|
+
4. **broadcast_flex_message**
|
|
31
|
+
- LINE公式アカウントと友だちになっているすべてのユーザーに、LINEで高度にカスタマイズ可能なフレックスメッセージを送信する。
|
|
32
|
+
- **入力:**
|
|
33
|
+
- `message.altText` (string): フレックスメッセージが表示できない場合に表示される代替テキスト。
|
|
34
|
+
- `message.contents` (any): フレックスメッセージの内容。メッセージのレイアウトとコンポーネントを定義するJSONオブジェクト。
|
|
35
|
+
- `message.contents.type` (enum): コンテナのタイプ。'bubble'は単一コンテナ、'carousel'は複数のスワイプ可能なバブルを示す。
|
|
36
|
+
5. **get_profile**
|
|
37
|
+
- LINEユーザーの詳細なプロフィール情報を取得する。表示名、プロフィール画像URL、ステータスメッセージ、言語を取得できる。
|
|
38
|
+
- **入力:**
|
|
39
|
+
- `userId` (string?): プロフィールを取得したいユーザーのユーザーID。デフォルトはDESTINATION_USER_ID。`user_id`または`DESTINATION_USER_ID`のどちらか一方は必ず設定する必要があります。
|
|
40
|
+
6. **get_message_quota**
|
|
41
|
+
- LINE公式アカウントのメッセージ容量と消費量を取得します。月間メッセージ制限と現在の使用量が表示されます。
|
|
42
|
+
- **入力:**
|
|
43
|
+
- なし
|
|
44
|
+
7. **get_rich_menu_list**
|
|
45
|
+
- LINE公式アカウントに登録されているリッチメニューの一覧を取得する。
|
|
46
|
+
- **入力:**
|
|
47
|
+
- なし
|
|
48
|
+
8. **delete_rich_menu**
|
|
49
|
+
- LINE公式アカウントからリッチメニューを削除する。
|
|
50
|
+
- **入力:**
|
|
51
|
+
- `richMenuId` (string): 削除するリッチメニューのID。
|
|
52
|
+
9. **set_rich_menu_default**
|
|
53
|
+
- リッチメニューをデフォルトとして設定する。
|
|
54
|
+
- **入力:**
|
|
55
|
+
- `richMenuId` (string): デフォルトとして設定するリッチメニューのID。
|
|
56
|
+
10. **cancel_rich_menu_default**
|
|
57
|
+
- デフォルトのリッチメニューを解除する。
|
|
58
|
+
- **入力:**
|
|
59
|
+
- なし
|
|
60
|
+
11. **create_rich_menu**
|
|
61
|
+
- 指定されたアクションに基づいてリッチメニューを作成。画像を生成してアップロード。デフォルトとして設定する。
|
|
62
|
+
- **入力:**
|
|
63
|
+
- `chatBarText` (string): チャットバー表示、リッチメニュー名にされるテキスト。
|
|
64
|
+
- `actions` (array): リッチメニューのアクション。最小1つから最大6つのアクションを指定できる。各アクションは以下のいずれかのタイプを指定できる:
|
|
65
|
+
- `postback`: ポストバックアクションを送信する
|
|
66
|
+
- `message`: テキストメッセージを送信する
|
|
67
|
+
- `uri`: URLを開く
|
|
68
|
+
- `datetimepicker`: 日付/時間選択ツールを開く
|
|
69
|
+
- `camera`: カメラを開く
|
|
70
|
+
- `cameraRoll`: カメラロールを開く
|
|
71
|
+
- `location`: 現在位置を送信する
|
|
72
|
+
- `richmenuswitch`: 別のリッチメニューに切り替える
|
|
73
|
+
- `clipboard`: テキストをクリップボードにコピーする
|
|
74
|
+
|
|
75
|
+
## インストール (npxを使用)
|
|
76
|
+
|
|
77
|
+
要件:
|
|
78
|
+
- Node.js v20 以上
|
|
79
|
+
|
|
80
|
+
### Step 1: LINE公式アカウントを作成
|
|
81
|
+
|
|
82
|
+
このMCP ServerはLINE公式アカウントを利用しています。公式アカウントをお持ちでない場合は、[こちらの手順](https://developers.line.biz/ja/docs/messaging-api/getting-started/#create-oa)に従って作成してください。
|
|
83
|
+
|
|
84
|
+
LINE公式アカウントをお持ちであれば、[こちらの手順](https://developers.line.biz/ja/docs/messaging-api/getting-started/#using-oa-manager)に従ってMessaging APIを有効にしてください。
|
|
85
|
+
|
|
86
|
+
### Step 2: AI Agentを設定
|
|
87
|
+
|
|
88
|
+
Claude DesktopやClaudeなどのAI Agentに次の設定を追加してください。
|
|
89
|
+
|
|
90
|
+
環境変数や引数は次のように設定してください:
|
|
91
|
+
|
|
92
|
+
- `CHANNEL_ACCESS_TOKEN`: (必須) チャネルアクセストークン。これを取得するには、[こちらの手順](https://developers.line.biz/ja/docs/basics/channel-access-token/#long-lived-channel-access-token)に従ってください。
|
|
93
|
+
- `DESTINATION_USER_ID`: (オプション) デフォルトのメッセージ受信者のユーザーID。Toolの入力に`userId`が含まれていない場合、`DESTINATION_USER_ID`は必ず設定する必要があります。これを確認するには、[こちらの手順](https://developers.line.biz/ja/docs/messaging-api/getting-user-ids/#get-own-user-id)に従ってください。
|
|
94
|
+
|
|
95
|
+
```json
|
|
96
|
+
{
|
|
97
|
+
"mcpServers": {
|
|
98
|
+
"line-bot": {
|
|
99
|
+
"command": "npx",
|
|
100
|
+
"args": [
|
|
101
|
+
"@line/line-bot-mcp-server"
|
|
102
|
+
],
|
|
103
|
+
"env": {
|
|
104
|
+
"CHANNEL_ACCESS_TOKEN" : "FILL_HERE",
|
|
105
|
+
"DESTINATION_USER_ID" : "FILL_HERE"
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## インストール (Dockerを使用)
|
|
113
|
+
|
|
114
|
+
### Step 1: LINE公式アカウントを作成
|
|
115
|
+
|
|
116
|
+
このMCP ServerはLINE公式アカウントを利用しています。公式アカウントをお持ちでない場合は、[こちらの手順](https://developers.line.biz/ja/docs/messaging-api/getting-started/#create-oa)に従って作成してください。
|
|
117
|
+
|
|
118
|
+
LINE公式アカウントをお持ちであれば、[こちらの手順](https://developers.line.biz/ja/docs/messaging-api/getting-started/#using-oa-manager)に従ってMessaging APIを有効にしてください。
|
|
119
|
+
|
|
120
|
+
### Step 2: line-bot-mcp-serverをインストール
|
|
121
|
+
|
|
122
|
+
このリポジトリをクローンします:
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
git clone git@github.com:line/line-bot-mcp-server.git
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Dockerイメージをビルドします:
|
|
129
|
+
```
|
|
130
|
+
docker build -t line/line-bot-mcp-server .
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Step 3: AI Agentを設定
|
|
134
|
+
|
|
135
|
+
Claude DesktopやClaudeなどのAI Agentに次の設定を追加してください。
|
|
136
|
+
|
|
137
|
+
環境変数や引数は次のように設定してください:
|
|
138
|
+
|
|
139
|
+
- `mcpServers.args`: (必須) `line-bot-mcp-server`へのパス。
|
|
140
|
+
- `CHANNEL_ACCESS_TOKEN`: (必須) チャネルアクセストークン。これを取得するには、[こちらの手順](https://developers.line.biz/ja/docs/basics/channel-access-token/#long-lived-channel-access-token)に従ってください。
|
|
141
|
+
- `DESTINATION_USER_ID`: (オプション) デフォルトのメッセージ受信者のユーザーID。Toolの入力に`userId`が含まれていない場合、`DESTINATION_USER_ID`は必ず設定する必要があります。これを確認するには、[こちらの手順](https://developers.line.biz/ja/docs/messaging-api/getting-user-ids/#get-own-user-id)に従ってください。
|
|
142
|
+
|
|
143
|
+
```json
|
|
144
|
+
{
|
|
145
|
+
"mcpServers": {
|
|
146
|
+
"line-bot": {
|
|
147
|
+
"command": "docker",
|
|
148
|
+
"args": [
|
|
149
|
+
"run",
|
|
150
|
+
"-i",
|
|
151
|
+
"--rm",
|
|
152
|
+
"-e",
|
|
153
|
+
"CHANNEL_ACCESS_TOKEN",
|
|
154
|
+
"-e",
|
|
155
|
+
"DESTINATION_USER_ID",
|
|
156
|
+
"line/line-bot-mcp-server"
|
|
157
|
+
],
|
|
158
|
+
"env": {
|
|
159
|
+
"CHANNEL_ACCESS_TOKEN" : "FILL_HERE",
|
|
160
|
+
"DESTINATION_USER_ID" : "FILL_HERE"
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Inspector を使用したローカル開発
|
|
168
|
+
|
|
169
|
+
MCP Inspector を使用して、サーバーをローカルでテストおよびデバッグできます。
|
|
170
|
+
|
|
171
|
+
### 前提条件
|
|
172
|
+
|
|
173
|
+
1. リポジトリをクローンする:
|
|
174
|
+
```bash
|
|
175
|
+
git clone git@github.com:line/line-bot-mcp-server.git
|
|
176
|
+
cd line-bot-mcp-server
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
2. 依存関係をインストールする:
|
|
180
|
+
```bash
|
|
181
|
+
npm install
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
3. プロジェクトをビルドする:
|
|
185
|
+
```bash
|
|
186
|
+
npm run build
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Inspector の実行
|
|
190
|
+
|
|
191
|
+
プロジェクトをビルドした後、MCP Inspector を起動できます:
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
npx @modelcontextprotocol/inspector node dist/index.js \
|
|
195
|
+
-e CHANNEL_ACCESS_TOKEN="YOUR_CHANNEL_ACCESS_TOKEN" \
|
|
196
|
+
-e DESTINATION_USER_ID="YOUR_DESTINATION_USER_ID"
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
これにより、MCP Inspector インターフェースが起動し、LINE Bot MCP Server のツールを操作して機能をテストできます。
|
package/README.md
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
[日本語版 READMEはこちら](README.ja.md)
|
|
2
|
+
|
|
3
|
+
# LINE Bot MCP Server
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@line/line-bot-mcp-server)
|
|
6
|
+
|
|
7
|
+
[Model Context Protocol (MCP)](https://github.com/modelcontextprotocol) server implementation that integrates the LINE Messaging API to connect an AI Agent to the LINE Official Account.
|
|
8
|
+
|
|
9
|
+

|
|
10
|
+
|
|
11
|
+
> [!NOTE]
|
|
12
|
+
> This repository is provided as a preview version. While we offer it for experimental purposes, please be aware that it may not include complete functionality or comprehensive support.
|
|
13
|
+
|
|
14
|
+
## Tools
|
|
15
|
+
|
|
16
|
+
1. **push_text_message**
|
|
17
|
+
- Push a simple text message to a user via LINE.
|
|
18
|
+
- **Inputs:**
|
|
19
|
+
- `userId` (string?): The user ID to receive a message. Defaults to DESTINATION_USER_ID. Either `userId` or `DESTINATION_USER_ID` must be set.
|
|
20
|
+
- `message.text` (string): The plain text content to send to the user.
|
|
21
|
+
2. **push_flex_message**
|
|
22
|
+
- Push a highly customizable flex message to a user via LINE.
|
|
23
|
+
- **Inputs:**
|
|
24
|
+
- `userId` (string?): The user ID to receive a message. Defaults to DESTINATION_USER_ID. Either `userId` or `DESTINATION_USER_ID` must be set.
|
|
25
|
+
- `message.altText` (string): Alternative text shown when flex message cannot be displayed.
|
|
26
|
+
- `message.contents` (any): The contents of the flex message. This is a JSON object that defines the layout and components of the message.
|
|
27
|
+
- `message.contents.type` (enum): Type of the container. 'bubble' for single container, 'carousel' for multiple swipeable bubbles.
|
|
28
|
+
3. **broadcast_text_message**
|
|
29
|
+
- Broadcast a simple text message via LINE to all users who have followed your LINE Official Account.
|
|
30
|
+
- **Inputs:**
|
|
31
|
+
- `message.text` (string): The plain text content to send to the users.
|
|
32
|
+
4. **broadcast_flex_message**
|
|
33
|
+
- Broadcast a highly customizable flex message via LINE to all users who have added your LINE Official Account.
|
|
34
|
+
- **Inputs:**
|
|
35
|
+
- `message.altText` (string): Alternative text shown when flex message cannot be displayed.
|
|
36
|
+
- `message.contents` (any): The contents of the flex message. This is a JSON object that defines the layout and components of the message.
|
|
37
|
+
- `message.contents.type` (enum): Type of the container. 'bubble' for single container, 'carousel' for multiple swipeable bubbles.
|
|
38
|
+
5. **get_profile**
|
|
39
|
+
- Get detailed profile information of a LINE user including display name, profile picture URL, status message and language.
|
|
40
|
+
- **Inputs:**
|
|
41
|
+
- `userId` (string?): The ID of the user whose profile you want to retrieve. Defaults to DESTINATION_USER_ID.
|
|
42
|
+
6. **get_message_quota**
|
|
43
|
+
- Get the message quota and consumption of the LINE Official Account. This shows the monthly message limit and current usage.
|
|
44
|
+
- **Inputs:**
|
|
45
|
+
- None
|
|
46
|
+
7. **get_rich_menu_list**
|
|
47
|
+
- Get the list of rich menus associated with your LINE Official Account.
|
|
48
|
+
- **Inputs:**
|
|
49
|
+
- None
|
|
50
|
+
8. **delete_rich_menu**
|
|
51
|
+
- Delete a rich menu from your LINE Official Account.
|
|
52
|
+
- **Inputs:**
|
|
53
|
+
- `richMenuId` (string): The ID of the rich menu to delete.
|
|
54
|
+
9. **set_rich_menu_default**
|
|
55
|
+
- Set a rich menu as the default rich menu.
|
|
56
|
+
- **Inputs:**
|
|
57
|
+
- `richMenuId` (string): The ID of the rich menu to set as default.
|
|
58
|
+
10. **cancel_rich_menu_default**
|
|
59
|
+
- Cancel the default rich menu.
|
|
60
|
+
- **Inputs:**
|
|
61
|
+
- None
|
|
62
|
+
11. **create_rich_menu**
|
|
63
|
+
- Create a rich menu based on the given actions. Generate and upload an image. Set as default.
|
|
64
|
+
- **Inputs:**
|
|
65
|
+
- `chatBarText` (string): Text displayed in chat bar, also used as rich menu name.
|
|
66
|
+
- `actions` (array): The actions of the rich menu. You can specify minimum 1 to maximum 6 actions. Each action can be one of the following types:
|
|
67
|
+
- `postback`: For sending a postback action
|
|
68
|
+
- `message`: For sending a text message
|
|
69
|
+
- `uri`: For opening a URL
|
|
70
|
+
- `datetimepicker`: For opening a date/time picker
|
|
71
|
+
- `camera`: For opening the camera
|
|
72
|
+
- `cameraRoll`: For opening the camera roll
|
|
73
|
+
- `location`: For sending the current location
|
|
74
|
+
- `richmenuswitch`: For switching to another rich menu
|
|
75
|
+
- `clipboard`: For copying text to clipboard
|
|
76
|
+
|
|
77
|
+
## Installation (Using npx)
|
|
78
|
+
|
|
79
|
+
requirements:
|
|
80
|
+
- Node.js v20 or later
|
|
81
|
+
|
|
82
|
+
### Step 1: Create LINE Official Account
|
|
83
|
+
|
|
84
|
+
This MCP server utilizes a LINE Official Account. If you do not have one, please create it by following [this instructions](https://developers.line.biz/en/docs/messaging-api/getting-started/#create-oa).
|
|
85
|
+
|
|
86
|
+
If you have a LINE Official Account, enable the Messaging API for your LINE Official Account by following [this instructions](https://developers.line.biz/en/docs/messaging-api/getting-started/#using-oa-manager).
|
|
87
|
+
|
|
88
|
+
### Step 2: Configure AI Agent
|
|
89
|
+
|
|
90
|
+
Please add the following configuration for an AI Agent like Claude Desktop or Cline.
|
|
91
|
+
|
|
92
|
+
Set the environment variables or arguments as follows:
|
|
93
|
+
|
|
94
|
+
- `CHANNEL_ACCESS_TOKEN`: (required) Channel Access Token. You can confirm this by following [this instructions](https://developers.line.biz/en/docs/basics/channel-access-token/#long-lived-channel-access-token).
|
|
95
|
+
- `DESTINATION_USER_ID`: (optional) The default user ID of the recipient. If the Tool's input does not include `userId`, `DESTINATION_USER_ID` is required. You can confirm this by following [this instructions](https://developers.line.biz/en/docs/messaging-api/getting-user-ids/#get-own-user-id).
|
|
96
|
+
|
|
97
|
+
```json
|
|
98
|
+
{
|
|
99
|
+
"mcpServers": {
|
|
100
|
+
"line-bot": {
|
|
101
|
+
"command": "npx",
|
|
102
|
+
"args": [
|
|
103
|
+
"@line/line-bot-mcp-server"
|
|
104
|
+
],
|
|
105
|
+
"env": {
|
|
106
|
+
"CHANNEL_ACCESS_TOKEN" : "FILL_HERE",
|
|
107
|
+
"DESTINATION_USER_ID" : "FILL_HERE"
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Installation (Using Docker)
|
|
115
|
+
|
|
116
|
+
### Step 1: Create LINE Official Account
|
|
117
|
+
|
|
118
|
+
This MCP server utilizes a LINE Official Account. If you do not have one, please create it by following [this instructions](https://developers.line.biz/en/docs/messaging-api/getting-started/#create-oa).
|
|
119
|
+
|
|
120
|
+
If you have a LINE Official Account, enable the Messaging API for your LINE Official Account by following [this instructions](https://developers.line.biz/en/docs/messaging-api/getting-started/#using-oa-manager).
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
### Step 2: Build line-bot-mcp-server image
|
|
124
|
+
|
|
125
|
+
Clone this repository:
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
git clone git@github.com:line/line-bot-mcp-server.git
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Build the Docker image:
|
|
132
|
+
|
|
133
|
+
```
|
|
134
|
+
docker build -t line/line-bot-mcp-server .
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Step 3: Configure AI Agent
|
|
138
|
+
|
|
139
|
+
Please add the following configuration for an AI Agent like Claude Desktop or Cline.
|
|
140
|
+
|
|
141
|
+
Set the environment variables or arguments as follows:
|
|
142
|
+
|
|
143
|
+
- `mcpServers.args`: (required) The path to `line-bot-mcp-server`.
|
|
144
|
+
- `CHANNEL_ACCESS_TOKEN`: (required) Channel Access Token. You can confirm this by following [this instructions](https://developers.line.biz/en/docs/basics/channel-access-token/#long-lived-channel-access-token).
|
|
145
|
+
- `DESTINATION_USER_ID`: (optional) The default user ID of the recipient. If the Tool's input does not include `userId`, `DESTINATION_USER_ID` is required.
|
|
146
|
+
You can confirm this by following [this instructions](https://developers.line.biz/en/docs/messaging-api/getting-user-ids/#get-own-user-id).
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
```json
|
|
150
|
+
{
|
|
151
|
+
"mcpServers": {
|
|
152
|
+
"line-bot": {
|
|
153
|
+
"command": "docker",
|
|
154
|
+
"args": [
|
|
155
|
+
"run",
|
|
156
|
+
"-i",
|
|
157
|
+
"--rm",
|
|
158
|
+
"-e",
|
|
159
|
+
"CHANNEL_ACCESS_TOKEN",
|
|
160
|
+
"-e",
|
|
161
|
+
"DESTINATION_USER_ID",
|
|
162
|
+
"line/line-bot-mcp-server"
|
|
163
|
+
],
|
|
164
|
+
"env": {
|
|
165
|
+
"CHANNEL_ACCESS_TOKEN" : "FILL_HERE",
|
|
166
|
+
"DESTINATION_USER_ID" : "FILL_HERE"
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Local Development with Inspector
|
|
174
|
+
|
|
175
|
+
You can use the MCP Inspector to test and debug the server locally.
|
|
176
|
+
|
|
177
|
+
### Prerequisites
|
|
178
|
+
|
|
179
|
+
1. Clone the repository:
|
|
180
|
+
```bash
|
|
181
|
+
git clone git@github.com:line/line-bot-mcp-server.git
|
|
182
|
+
cd line-bot-mcp-server
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
2. Install dependencies:
|
|
186
|
+
```bash
|
|
187
|
+
npm install
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
3. Build the project:
|
|
191
|
+
```bash
|
|
192
|
+
npm run build
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### Run the Inspector
|
|
196
|
+
|
|
197
|
+
After building the project, you can start the MCP Inspector:
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
npx @modelcontextprotocol/inspector node dist/index.js \
|
|
201
|
+
-e CHANNEL_ACCESS_TOKEN="YOUR_CHANNEL_ACCESS_TOKEN" \
|
|
202
|
+
-e DESTINATION_USER_ID="YOUR_DESTINATION_USER_ID"
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
This will start the MCP Inspector interface where you can interact with the LINE Bot MCP Server tools and test their functionality.
|
|
206
|
+
|
|
207
|
+
## Versioning
|
|
208
|
+
|
|
209
|
+
This project respects semantic versioning
|
|
210
|
+
|
|
211
|
+
See http://semver.org/
|
|
212
|
+
|
|
213
|
+
## Contributing
|
|
214
|
+
|
|
215
|
+
Please check [CONTRIBUTING](./CONTRIBUTING.md) before making a contribution.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const createErrorResponse: (message: string) => {
|
|
2
|
+
isError: boolean;
|
|
3
|
+
content: {
|
|
4
|
+
type: "text";
|
|
5
|
+
text: string;
|
|
6
|
+
}[];
|
|
7
|
+
};
|
|
8
|
+
export declare const createSuccessResponse: (response: object) => {
|
|
9
|
+
content: {
|
|
10
|
+
type: "text";
|
|
11
|
+
text: string;
|
|
12
|
+
}[];
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=response.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../src/common/response.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,GAAI,SAAS,MAAM;;;;;;CAUlD,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,UAAU,MAAM;;;;;CASrD,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export const createErrorResponse = (message) => {
|
|
2
|
+
return {
|
|
3
|
+
isError: true,
|
|
4
|
+
content: [
|
|
5
|
+
{
|
|
6
|
+
type: "text",
|
|
7
|
+
text: message,
|
|
8
|
+
},
|
|
9
|
+
],
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export const createSuccessResponse = (response) => {
|
|
13
|
+
return {
|
|
14
|
+
content: [
|
|
15
|
+
{
|
|
16
|
+
type: "text",
|
|
17
|
+
text: JSON.stringify(response),
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=response.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"response.js","sourceRoot":"","sources":["../../src/common/response.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,OAAe,EAAE,EAAE;IACrD,OAAO;QACL,OAAO,EAAE,IAAI;QACb,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAe;gBACrB,IAAI,EAAE,OAAO;aACd;SACF;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,QAAgB,EAAE,EAAE;IACxD,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAe;gBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;aAC/B;SACF;KACF,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const actionSchema: z.ZodUnion<[z.ZodObject<{
|
|
3
|
+
type: z.ZodLiteral<"postback">;
|
|
4
|
+
label: z.ZodString;
|
|
5
|
+
data: z.ZodString;
|
|
6
|
+
displayText: z.ZodOptional<z.ZodString>;
|
|
7
|
+
inputOption: z.ZodOptional<z.ZodEnum<["closeRichMenu", "openRichMenu", "openKeyboard", "openVoice"]>>;
|
|
8
|
+
fillInText: z.ZodOptional<z.ZodString>;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
type?: "postback";
|
|
11
|
+
data?: string;
|
|
12
|
+
label?: string;
|
|
13
|
+
displayText?: string;
|
|
14
|
+
inputOption?: "closeRichMenu" | "openRichMenu" | "openKeyboard" | "openVoice";
|
|
15
|
+
fillInText?: string;
|
|
16
|
+
}, {
|
|
17
|
+
type?: "postback";
|
|
18
|
+
data?: string;
|
|
19
|
+
label?: string;
|
|
20
|
+
displayText?: string;
|
|
21
|
+
inputOption?: "closeRichMenu" | "openRichMenu" | "openKeyboard" | "openVoice";
|
|
22
|
+
fillInText?: string;
|
|
23
|
+
}>, z.ZodObject<{
|
|
24
|
+
type: z.ZodLiteral<"message">;
|
|
25
|
+
label: z.ZodString;
|
|
26
|
+
text: z.ZodString;
|
|
27
|
+
}, "strip", z.ZodTypeAny, {
|
|
28
|
+
type?: "message";
|
|
29
|
+
label?: string;
|
|
30
|
+
text?: string;
|
|
31
|
+
}, {
|
|
32
|
+
type?: "message";
|
|
33
|
+
label?: string;
|
|
34
|
+
text?: string;
|
|
35
|
+
}>, z.ZodObject<{
|
|
36
|
+
type: z.ZodLiteral<"uri">;
|
|
37
|
+
label: z.ZodString;
|
|
38
|
+
uri: z.ZodString;
|
|
39
|
+
altUri: z.ZodOptional<z.ZodObject<{
|
|
40
|
+
desktop: z.ZodOptional<z.ZodString>;
|
|
41
|
+
}, "strip", z.ZodTypeAny, {
|
|
42
|
+
desktop?: string;
|
|
43
|
+
}, {
|
|
44
|
+
desktop?: string;
|
|
45
|
+
}>>;
|
|
46
|
+
}, "strip", z.ZodTypeAny, {
|
|
47
|
+
type?: "uri";
|
|
48
|
+
label?: string;
|
|
49
|
+
uri?: string;
|
|
50
|
+
altUri?: {
|
|
51
|
+
desktop?: string;
|
|
52
|
+
};
|
|
53
|
+
}, {
|
|
54
|
+
type?: "uri";
|
|
55
|
+
label?: string;
|
|
56
|
+
uri?: string;
|
|
57
|
+
altUri?: {
|
|
58
|
+
desktop?: string;
|
|
59
|
+
};
|
|
60
|
+
}>, z.ZodObject<{
|
|
61
|
+
type: z.ZodLiteral<"datetimepicker">;
|
|
62
|
+
label: z.ZodString;
|
|
63
|
+
data: z.ZodString;
|
|
64
|
+
mode: z.ZodEnum<["date", "time", "datetime"]>;
|
|
65
|
+
initial: z.ZodOptional<z.ZodString>;
|
|
66
|
+
max: z.ZodOptional<z.ZodString>;
|
|
67
|
+
min: z.ZodOptional<z.ZodString>;
|
|
68
|
+
}, "strip", z.ZodTypeAny, {
|
|
69
|
+
max?: string;
|
|
70
|
+
type?: "datetimepicker";
|
|
71
|
+
data?: string;
|
|
72
|
+
min?: string;
|
|
73
|
+
label?: string;
|
|
74
|
+
mode?: "time" | "date" | "datetime";
|
|
75
|
+
initial?: string;
|
|
76
|
+
}, {
|
|
77
|
+
max?: string;
|
|
78
|
+
type?: "datetimepicker";
|
|
79
|
+
data?: string;
|
|
80
|
+
min?: string;
|
|
81
|
+
label?: string;
|
|
82
|
+
mode?: "time" | "date" | "datetime";
|
|
83
|
+
initial?: string;
|
|
84
|
+
}>, z.ZodObject<{
|
|
85
|
+
type: z.ZodLiteral<"camera">;
|
|
86
|
+
label: z.ZodString;
|
|
87
|
+
}, "strip", z.ZodTypeAny, {
|
|
88
|
+
type?: "camera";
|
|
89
|
+
label?: string;
|
|
90
|
+
}, {
|
|
91
|
+
type?: "camera";
|
|
92
|
+
label?: string;
|
|
93
|
+
}>, z.ZodObject<{
|
|
94
|
+
type: z.ZodLiteral<"cameraRoll">;
|
|
95
|
+
label: z.ZodString;
|
|
96
|
+
}, "strip", z.ZodTypeAny, {
|
|
97
|
+
type?: "cameraRoll";
|
|
98
|
+
label?: string;
|
|
99
|
+
}, {
|
|
100
|
+
type?: "cameraRoll";
|
|
101
|
+
label?: string;
|
|
102
|
+
}>, z.ZodObject<{
|
|
103
|
+
type: z.ZodLiteral<"location">;
|
|
104
|
+
label: z.ZodString;
|
|
105
|
+
}, "strip", z.ZodTypeAny, {
|
|
106
|
+
type?: "location";
|
|
107
|
+
label?: string;
|
|
108
|
+
}, {
|
|
109
|
+
type?: "location";
|
|
110
|
+
label?: string;
|
|
111
|
+
}>, z.ZodObject<{
|
|
112
|
+
type: z.ZodLiteral<"richmenuswitch">;
|
|
113
|
+
label: z.ZodString;
|
|
114
|
+
richMenuAliasId: z.ZodString;
|
|
115
|
+
data: z.ZodString;
|
|
116
|
+
}, "strip", z.ZodTypeAny, {
|
|
117
|
+
type?: "richmenuswitch";
|
|
118
|
+
data?: string;
|
|
119
|
+
label?: string;
|
|
120
|
+
richMenuAliasId?: string;
|
|
121
|
+
}, {
|
|
122
|
+
type?: "richmenuswitch";
|
|
123
|
+
data?: string;
|
|
124
|
+
label?: string;
|
|
125
|
+
richMenuAliasId?: string;
|
|
126
|
+
}>, z.ZodObject<{
|
|
127
|
+
type: z.ZodLiteral<"clipboard">;
|
|
128
|
+
label: z.ZodString;
|
|
129
|
+
clipboardText: z.ZodString;
|
|
130
|
+
}, "strip", z.ZodTypeAny, {
|
|
131
|
+
type?: "clipboard";
|
|
132
|
+
label?: string;
|
|
133
|
+
clipboardText?: string;
|
|
134
|
+
}, {
|
|
135
|
+
type?: "clipboard";
|
|
136
|
+
label?: string;
|
|
137
|
+
clipboardText?: string;
|
|
138
|
+
}>]>;
|
|
139
|
+
//# sourceMappingURL=actionSchema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actionSchema.d.ts","sourceRoot":"","sources":["../../../src/common/schema/actionSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA4ExB,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAUvB,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
// references:
|
|
3
|
+
// * document:
|
|
4
|
+
// https://developers.line.biz/ja/docs/messaging-api/actions/
|
|
5
|
+
// * line-bot-sdk-nodejs:
|
|
6
|
+
// https://github.com/line/line-bot-sdk-nodejs/blob/master/lib/messaging-api/model/action.ts
|
|
7
|
+
// 1. Postback action
|
|
8
|
+
const postbackActionSchema = z.object({
|
|
9
|
+
type: z.literal("postback"),
|
|
10
|
+
label: z.string(),
|
|
11
|
+
data: z.string(),
|
|
12
|
+
displayText: z.string().optional(),
|
|
13
|
+
inputOption: z
|
|
14
|
+
.enum(["closeRichMenu", "openRichMenu", "openKeyboard", "openVoice"])
|
|
15
|
+
.optional(),
|
|
16
|
+
fillInText: z.string().optional(),
|
|
17
|
+
});
|
|
18
|
+
// 2. Message action
|
|
19
|
+
const messageActionSchema = z.object({
|
|
20
|
+
type: z.literal("message"),
|
|
21
|
+
label: z.string(),
|
|
22
|
+
text: z.string(),
|
|
23
|
+
});
|
|
24
|
+
// 3. URI action
|
|
25
|
+
const uriActionSchema = z.object({
|
|
26
|
+
type: z.literal("uri"),
|
|
27
|
+
label: z.string(),
|
|
28
|
+
uri: z.string(),
|
|
29
|
+
altUri: z
|
|
30
|
+
.object({
|
|
31
|
+
desktop: z.string().optional(),
|
|
32
|
+
})
|
|
33
|
+
.optional(),
|
|
34
|
+
});
|
|
35
|
+
// 4. Datetime picker action
|
|
36
|
+
const datetimePickerActionSchema = z.object({
|
|
37
|
+
type: z.literal("datetimepicker"),
|
|
38
|
+
label: z.string(),
|
|
39
|
+
data: z.string(),
|
|
40
|
+
mode: z.enum(["date", "time", "datetime"]),
|
|
41
|
+
initial: z.string().optional(),
|
|
42
|
+
max: z.string().optional(),
|
|
43
|
+
min: z.string().optional(),
|
|
44
|
+
});
|
|
45
|
+
// 5. Camera action
|
|
46
|
+
const cameraActionSchema = z.object({
|
|
47
|
+
type: z.literal("camera"),
|
|
48
|
+
label: z.string(),
|
|
49
|
+
});
|
|
50
|
+
// 6. Camera roll action
|
|
51
|
+
const cameraRollActionSchema = z.object({
|
|
52
|
+
type: z.literal("cameraRoll"),
|
|
53
|
+
label: z.string(),
|
|
54
|
+
});
|
|
55
|
+
// 7. Location action
|
|
56
|
+
const locationActionSchema = z.object({
|
|
57
|
+
type: z.literal("location"),
|
|
58
|
+
label: z.string(),
|
|
59
|
+
});
|
|
60
|
+
// 8. Rich menu switch action
|
|
61
|
+
const richMenuSwitchActionSchema = z.object({
|
|
62
|
+
type: z.literal("richmenuswitch"),
|
|
63
|
+
label: z.string(),
|
|
64
|
+
richMenuAliasId: z.string(),
|
|
65
|
+
data: z.string(),
|
|
66
|
+
});
|
|
67
|
+
// 9. Clipboard action
|
|
68
|
+
const clipboardActionSchema = z.object({
|
|
69
|
+
type: z.literal("clipboard"),
|
|
70
|
+
label: z.string(),
|
|
71
|
+
clipboardText: z.string(),
|
|
72
|
+
});
|
|
73
|
+
// actions
|
|
74
|
+
export const actionSchema = z.union([
|
|
75
|
+
postbackActionSchema,
|
|
76
|
+
messageActionSchema,
|
|
77
|
+
uriActionSchema,
|
|
78
|
+
datetimePickerActionSchema,
|
|
79
|
+
cameraActionSchema,
|
|
80
|
+
cameraRollActionSchema,
|
|
81
|
+
locationActionSchema,
|
|
82
|
+
richMenuSwitchActionSchema,
|
|
83
|
+
clipboardActionSchema,
|
|
84
|
+
]);
|
|
85
|
+
//# sourceMappingURL=actionSchema.js.map
|