Skip to content

feat: Add get_follower_ids tool #40

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions README.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ LINE公式アカウントとAI Agentを接続するために、LINE Messaging AP
- `user_id` (string?): メッセージ受信者のユーザーID。デフォルトはDESTINATION_USER_ID。`user_id`または`DESTINATION_USER_ID`のどちらか一方は必ず設定する必要があります。
- `message.text` (string): ユーザーに送信するテキスト。
2. **push_flex_message**
- LINEでユーザーに高度にカスタマイズ可能なフレックスメッセージを送信する
- LINEでユーザーに高度にカスタマイズ可能��フレックスメッセージを送信する
- **入力:**
- `user_id` (string?): メッセージ受信者のユーザーID。デフォルトはDESTINATION_USER_ID。`user_id`または`DESTINATION_USER_ID`のどちらか一方は必ず設定する必要があります。
- `message.altText` (string): フレックスメッセージが表示できない場合に表示される代替テキスト。
Expand All @@ -30,29 +30,33 @@ LINE公式アカウントとAI Agentを接続するために、LINE Messaging AP
4. **broadcast_flex_message**
- LINE公式アカウントと友だちになっているすべてのユーザーに、LINEで高度にカスタマイズ可能なフレックスメッセージを送信する。
- **入力:**
- `message.altText` (string): フレックスメッセージが表示できない場合に表示される代替テキスト
- `message.altText` (string): フレックス��ッセージが表示できない場合に表示される代替テキスト
- `message.content` (any): フレックスメッセージの内容。メッセージのレイアウトとコンポーネントを定義するJSONオブジェクト。
- `message.contents.type` (enum): コンテナのタイプ。'bubble'は単一コンテナ、'carousel'は複数のスワイプ可能なバブルを示す。
5. **get_profile**
- LINEユーザーの詳細なプロフィール情報を取得する。表示名、プロフィール画像URL、ステータスメッセージ、言語を取得できる。
- **入力:**
- `user_id` (string?): プロフィールを取得したいユーザーのユーザーID。デフォルトはDESTINATION_USER_ID。`user_id`または`DESTINATION_USER_ID`のどちらか一方は必ず設定する必要があります。=======
- `user_id` (string?): プロフィールを取得したいユーザーのユーザーID。デフォルトはDESTINATION_USER_ID。`user_id`または`DESTINATION_USER_ID`のどちらか一方は必ず設定する必要があります。
6. **get_message_quota**
- LINE公式アカウントのメッセージ容量と消費量を取得します。月間メッセージ制限と現在の使用量が表示されます。
- **入力:**
- なし
7. **get_follower_ids**
- LINE公式アカウントを友だち追加したユーザーのリストを取得します。この機能は、認証済みまたはプレミアムアカウントでのみ利用できます。注: このAPIは、友だちのユーザーIDを降順では返しません。代わりに、ユーザーがボットを友だち追加したときの昇順でユーザーIDのリストを返します。
- **入力:**
- `limit` (number?): 1回のリクエストで取得するユーザーIDの最大数。最大値: 1000。デフォルト: 300。
- `start` (string?): レスポンスで返されたJSONオブジェクトのnextプロパティにある継続トークンの値。次のユーザーIDの配列を取得するためにこのパラメータを含めます。

## インストール (npxを使用)

要件:

- Node.js v20 以上

### Step 1: LINE公式アカウントを作成

このMCP ServerはLINE公式アカウントを利用しています。公式アカウントをお持ちでない場合は、[こちらの手順](https://developers.line.biz/ja/docs/messaging-api/getting-started/#create-oa)に従って作成してください。

LINE公式アカウントをお持ちであれば、[こちらの手順](https://developers.line.biz/ja/docs/messaging-api/getting-started/#using-oa-manager)に従ってMessaging APIを有効にしてください。

Comment on lines -54 to -55
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This not should be removed.

### Step 2: AI Agentを設定

Claude DesktopやClaudeなどのAI Agentに次の設定を追加してください。
Expand Down Expand Up @@ -96,6 +100,7 @@ git clone [email protected]:line/line-bot-mcp-server.git
```

Dockerイメージをビルドします:

```
docker build -t line/line-bot-mcp-server .
```
Expand Down Expand Up @@ -132,4 +137,4 @@ Claude DesktopやClaudeなどのAI Agentに次の設定を追加してくださ
}
}
}
```
```
22 changes: 13 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,24 +40,30 @@
- **Inputs:**
- `user_id` (string?): The ID of the user whose profile you want to retrieve. Defaults to DESTINATION_USER_ID.
6. **get_message_quota**
- Get the message quota and consumption of the LINE Official Account. This shows the monthly message limit and current usage.
- **Inputs:**
- None
- Get the message quota and consumption of the LINE Official Account. This shows the monthly message limit and current usage.
- **Inputs:**
- None
7. **get_follower_ids**
- Get a list of users who have added your LINE Official Account as a friend. This feature is available only for verified or premium accounts. Note: This API doesn't return friend user IDs in descending order. Instead, it returns a list of user IDs in ascending order of when the user added the bot as a friend.
- **Inputs:**
- `limit` (number?): The maximum number of user IDs to retrieve in a single request. Max value: 1000. Default: 300.
- `start` (string?): Value of the continuation token found in the next property of the JSON object returned in the response. Include this parameter to get the next array of user IDs.

## Installation (Using npx)

requirements:

- Node.js v20 or later

### Step 1: Create LINE Official Account

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).
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).

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).

### Step 2: Configure AI Agent

Please add the following configuration for an AI Agent like Claude Desktop or Cline.
Please add the following configuration for an AI Agent like Claude Desktop or Cline.

Set the environment variables or arguments as follows:

Expand Down Expand Up @@ -89,7 +95,6 @@ This MCP server utilizes a LINE Official Account. If you do not have one, please

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).


### Step 2: Build line-bot-mcp-server image

Clone this repository:
Expand All @@ -115,7 +120,6 @@ Set the environment variables or arguments as follows:
- `DESTINATION_USER_ID`: (optional) The default user ID of the recipient. If the Tool's input does not include `user_id`, `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).


```json
{
"mcpServers": {
Expand Down Expand Up @@ -144,8 +148,8 @@ You can confirm this by following [this instructions](https://developers.line.bi

This project respects semantic versioning

See http://semver.org/
See <http://semver.org/>

## Contributing

Please check [CONTRIBUTING](./CONTRIBUTING.md) before making a contribution.
Please check [CONTRIBUTING](./CONTRIBUTING.md) before making a contribution.
116 changes: 66 additions & 50 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@
"bugs": "https://github.com/line/line-bot-mcp-server/issues",
"dependencies": {
"@line/bot-sdk": "^9.8.0",
"@modelcontextprotocol/sdk": "^1.8.0",
"@modelcontextprotocol/sdk": "^1.13.0",
"zod": "^3.24.2"
},
"devDependencies": {
"@types/node": "^22",
"@types/node": "^20.11.25",
"prettier": "3.5.3",
"shx": "^0.4.0",
"tsx": "^4.19.3",
"typescript": "^5.6.2"
},
"license": "Apache-2.0",
"packageManager": "[email protected]+sha512.6540583f41cc5f628eb3d9773ecee802f4f9ef9923cc45b69890fb47991d4b092964694ec3a4f738a420c918a333062c8b925d312f42e4f0c263eb603551f977"
}
}
11 changes: 11 additions & 0 deletions src/common/schema/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

import { z } from 'zod';

export const destinationId = process.env.DESTINATION_USER_ID || '';

export const userIdSchema = z
.string()
.default(destinationId)
.describe(
'The user ID to receive a message. Defaults to DESTINATION_USER_ID.'
);
23 changes: 23 additions & 0 deletions src/common/schema/flexMessage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

import { z } from 'zod';

export const flexMessageSchema = z.object({
type: z.literal('flex').default('flex'),
altText: z
.string()
.describe('Alternative text shown when flex message cannot be displayed.'),
contents: z
.object({
type: z
.enum(['bubble', 'carousel'])
.describe(
"Type of the container. 'bubble' for single container, 'carousel' for multiple swipeable bubbles."
),
})
.passthrough()
.describe(
"Flexible container structure following LINE Flex Message format. For 'bubble' type, can include header, " +
"hero, body, footer, and styles sections. For 'carousel' type, includes an array of bubble containers in " +
"the 'contents' property."
),
});
10 changes: 10 additions & 0 deletions src/common/schema/textMessage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

import { z } from 'zod';

export const textMessageSchema = z.object({
type: z.literal('text').default('text'),
text: z
.string()
.max(5000)
.describe('The plain text content to send to the user.'),
});
Loading