Skip to main content

A Model Context Protocol server for SMS and MMS messaging services

Project description

BaaS SMS/MCP Server

PyPI version Python 3.10+ License: MIT

A Model Context Protocol (MCP) server for SMS and MMS messaging services. This server provides tools for sending SMS/MMS messages, checking message status, and retrieving sending history through BaaS API integration.

Features

  • SMS Sending: Send SMS messages to single or multiple recipients
  • MMS Sending: Send MMS messages with image attachments
  • Message Status: Check sending status of message groups
  • Send History: Retrieve message sending history for projects
  • Project Isolation: Multi-tenant support with project-based access control
  • Error Handling: Comprehensive error handling with detailed error codes

Installation

Using uv (Recommended)

uv add baas-sms-mcp

Using pip

pip install baas-sms-mcp

From Source

git clone https://github.com/your-org/baas-sms-mcp.git
cd baas-sms-mcp
uv sync
uv pip install -e .

## Configuration

Set the following environment variables:

```bash
export BAAS_API_BASE_URL="https://api.aiapp.link"
export BAAS_API_KEY="your_baas_api_key_here"  
export PROJECT_ID="your_project_uuid_here"

Usage

Command Line

After installation, you can run the server directly:

baas-sms-mcp

With MCP Host (Claude Desktop, etc.)

Add this server to your MCP host configuration:

{
  "mcpServers": {
    "baas-sms-mcp": {
      "command": "baas-sms-mcp",
      "env": {
        "BAAS_API_BASE_URL": "https://api.aiapp.link",
        "BAAS_API_KEY": "your_api_key",
        "PROJECT_ID": "your_project_id"
      }
    }
  }
}

Programmatic Usage

from baas_sms_mcp import main

# Run the MCP server
main()

Available Tools

1. send_sms

Send SMS message to one or multiple recipients.

Parameters:

  • recipients: List of recipients with phone_number and member_code
  • message: SMS message content (max 2000 characters)
  • callback_number: Sender callback number
  • project_id: Project UUID (required)
  • baas_api_key: BaaS API key for authentication (required)

Example:

await send_sms(
    recipients=[
        {"phone_number": "010-1234-5678", "member_code": "user123"}
    ],
    message="Hello, this is a test SMS!",
    callback_number: "02-1234-5678"
)

Response:

{
    "success": true,
    "group_id": 12345,
    "message": "SMS sent successfully",
    "sent_count": 1,
    "failed_count": 0
}

2. send_mms

Send MMS message with images to one or multiple recipients.

Parameters:

  • recipients: List of recipients with phone_number and member_code
  • message: MMS message content (max 2000 characters)
  • subject: MMS subject line (max 40 characters)
  • callback_number: Sender callback number
  • image_urls: List of image URLs to attach (max 5 images, optional)
  • project_id: Project UUID (optional, uses env var if not provided)

Example:

await send_mms(
    recipients=[
        {"phone_number": "010-1234-5678", "member_code": "user123"}
    ],
    message="Check out this image!",
    subject: "Image MMS",
    callback_number: "02-1234-5678",
    image_urls: ["https://example.com/image.jpg"]
)

3. get_message_status

Get message sending status by group ID.

Parameters:

  • group_id: Message group ID to check status

Response:

{
    "group_id": 12345,
    "status": "1�",
    "total_count": 1,
    "success_count": 1,
    "failed_count": 0,
    "pending_count": 0,
    "messages": [
        {
            "phone": "010-1234-5678",
            "name": "���",
            "status": "1�",
            "reason": null
        }
    ]
}

4. get_send_history

Get message sending history for a project.

Parameters:

  • project_id: Project UUID (optional, uses env var if not provided)
  • offset: Number of records to skip (default: 0)
  • limit: Maximum number of records to return (default: 20, max: 100)
  • message_type: Filter by message type ("SMS", "MMS", "ALL")

Error Handling

The server provides comprehensive error handling with the following error codes:

  • MISSING_PROJECT_ID: PROJECT_ID is required
  • INVALID_RECIPIENTS_COUNT: Recipients count must be between 1 and 1000
  • MESSAGE_TOO_LONG: Message length exceeds maximum allowed
  • SUBJECT_TOO_LONG: Subject length exceeds 40 characters
  • TOO_MANY_IMAGES: Maximum 5 images allowed for MMS
  • API_ERROR: External API call failed
  • INTERNAL_ERROR: Internal server error

API Integration

This MCP server integrates with the BaaS API endpoints:

  • POST /message/sms - Send SMS messages
  • POST /message/mms - Send MMS messages
  • GET /message/send_history/sms/{group_id}/messages - Get message status

Development

Installing Development Dependencies

uv sync --group dev

Code Formatting

uv run black baas_sms_mcp/

Type Checking

uv run mypy baas_sms_mcp/

Testing

uv run pytest

Building Package

uv build

Publishing to PyPI

uv publish

License

MIT License - see LICENSE file for details.

Support

For support and questions, please contact: support@aiapp.link

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

baas_sms_mcp-0.1.0.tar.gz (40.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

baas_sms_mcp-0.1.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file baas_sms_mcp-0.1.0.tar.gz.

File metadata

  • Download URL: baas_sms_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 40.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.3

File hashes

Hashes for baas_sms_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e6ad6993045be2e110139597d664c82a30097d95a3a68ca6eb72588194d038c7
MD5 7103d4728e391bb41f7b9d8982f0c84c
BLAKE2b-256 8920fdeae596c9667aed42b4e10a90e0b2686b3d8523287fd9eff4dcc3ecffa7

See more details on using hashes here.

File details

Details for the file baas_sms_mcp-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for baas_sms_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c56e381d85b562872b4d47b5e3661efa1075c2e0c5f95ac0b7502f81a081fbf1
MD5 8540fb5d4229f9e44bb27a70f50cfa74
BLAKE2b-256 eec8ba784474b8645f26ac29e75ad6ce35594a69b73334f73c95fb107b7e2fd3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page