line-mcp-alert

WarotAsawa/line-mcp-alert

3.2

If you are the rightful owner of line-mcp-alert and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

This is a Model Context Protocol (MCP) server designed to facilitate communication with a Line Bot using the fastMCP framework.

Line Bot MCP Server

This is a Model Context Protocol (MCP) server that allows sending messages to a Line Bot. It uses the fastMCP framework for simplified MCP server implementation.

Setup

  1. Install uv (if not already installed):

    pip install uv
    
  2. Create and activate a virtual environment with uv:

    uv venv
    source .venv/bin/activate
    
  3. Install the required dependencies with uv:

    uv pip install -r requirements.txt
    
  4. Configure your Line Bot credentials:

    • Edit the config.ini file and add your Line Bot credentials:
      • channel_id: Your Line Bot channel ID
      • channel_secret: Your Line Bot channel secret
      • user_id: The user ID or group ID to send messages to

Running the server

Start the MCP server:

# With activated virtual environment
python line_bot_mcp_server.py [port]

# Or directly with uv
uv run line_bot_mcp_server.py [port]

The default port is 8080 if not specified.

Using with Amazon Q CLI

There are multiple ways to add the MCP server to Amazon Q CLI:

Option 1: Using the q mcp add command

This is the simplest method to add the MCP server:

q mcp add http://localhost:8080

Option 2: Using the Q CLI configuration file

You can also manually edit the Q CLI configuration file:

  1. Locate the Q CLI configuration file:

    ~/.aws/q/config.json
    
  2. Add the MCP server URL to the configuration:

    {
      "mcp": {
        "servers": [
          {
            "url": "http://localhost:8080"
          }
        ]
      }
    }
    
  3. Save the file and restart the Q CLI if it's running

Option 4: Using uv command with Q CLI

If you're using uv for Python package management, you can also configure the MCP server using uv's environment management:

# Create a dedicated environment for Q CLI with MCP configuration
uv venv q-cli-env
source q-cli-env/bin/activate

# Set the MCP server in the environment
export Q_MCP_SERVERS=http://localhost:8080

# Run Q CLI in this environment
q chat

You can also create a script to automate this process:

#!/bin/bash
# File: run-q-with-mcp.sh

# Activate the environment
source q-cli-env/bin/activate

# Set MCP server
export Q_MCP_SERVERS=http://localhost:8080

# Run Q CLI
q chat

# Deactivate when done
deactivate

Make the script executable with chmod +x run-q-with-mcp.sh and run it with ./run-q-with-mcp.sh

Using with Amazon Q Developer

You can also configure Amazon Q Developer to use this MCP server by updating its configuration:

Option 1: Using the IDE settings

  1. Open your IDE settings (VS Code, JetBrains, etc.)
  2. Navigate to the Amazon Q Developer settings
  3. Add the MCP server URL (http://localhost:8080) to the list of MCP servers

Option 2: Using the configuration file

  1. Locate your Amazon Q Developer configuration file:

    • For VS Code: ~/.vscode/extensions/amazon-q.amazonq-<version>/dist/config.json
    • For JetBrains: ~/.config/JetBrains/<IDE-version>/amazon-q/config.json
    • For other IDEs: Check the documentation for the location of the config file
  2. Add the MCP server URL to the configuration:

    {
      "mcp": {
        "servers": [
          {
            "url": "http://localhost:8080"
          }
        ]
      }
    }
    
  3. Restart your IDE for the changes to take effect

After configuring, you can use the Line Bot MCP server in your conversations with Amazon Q Developer in your IDE.

Example Usage

Here are some examples of how to use the Line Bot MCP server with Amazon Q:

# Send a simple message
Send a message to Line Bot saying "Hello from Amazon Q!"

# Send a status update
Send an alert to Line Bot with the message "Server CPU usage is at 90%"

# Send a notification with formatting
Send a message to Line Bot with "ALERT: Database backup failed at 2:30 AM"

When using with Amazon Q Developer in your IDE, you can use similar prompts in the Q Developer chat panel.

Available Functions

  • send_message: Sends a text message to Line Bot
    • Parameters:
      • message: The text message to send (required)

Using with Amazon Q Developer CLI

If you're using Amazon Q Developer CLI, you can configure it to use the MCP server in several ways:

Option 1: Using uv with Amazon Q Developer CLI

# Create a dedicated environment for Q Developer CLI
uv venv qdev-cli-env
source qdev-cli-env/bin/activate

# Install Amazon Q Developer CLI
uv pip install amazon-q-developer-cli

# Set the MCP server in the environment
export Q_DEV_MCP_SERVERS=http://localhost:8080

# Run Q Developer CLI
q-dev chat

Option 2: Using configuration file

  1. Locate or create the Q Developer CLI configuration file:

    ~/.aws/q-dev/config.json
    
  2. Add the MCP server URL to the configuration:

    {
      "mcp": {
        "servers": [
          {
            "url": "http://localhost:8080"
          }
        ]
      }
    }
    

Option 3: Creating a launcher script

Create a script to automate launching Q Developer CLI with the MCP server:

#!/bin/bash
# File: run-qdev-with-mcp.sh

# Activate the environment
source qdev-cli-env/bin/activate

# Set MCP server
export Q_DEV_MCP_SERVERS=http://localhost:8080

# Run Q Developer CLI
q-dev chat

# Deactivate when done
deactivate

Make the script executable with chmod +x run-qdev-with-mcp.sh and run it with ./run-qdev-with-mcp.sh