OneSignal MCP Server

OneSignal MCP Server

A Model Context Protocol server that wraps the OneSignal REST API, enabling management of push notifications, emails, SMS, user devices, and segments across multiple OneSignal applications.

WeirdBrains

Developer Tools
Visit Server

README

OneSignal MCP Server

A Model Context Protocol (MCP) server for interacting with the OneSignal API. This server provides a convenient interface for managing push notifications, emails, SMS, user devices, segments, templates, and more through OneSignal's REST API.

License: MIT Version

Overview

This MCP server wraps the OneSignal REST API to provide a set of tools for managing your OneSignal applications and sending messages to your users. It supports all major OneSignal operations including:

  • Sending push notifications, emails, and SMS
  • Managing user devices and subscriptions
  • Creating and managing segments
  • Creating and managing templates
  • Viewing app information and analytics
  • Organization-level operations
  • Managing multiple OneSignal applications

Requirements

  • Python 3.7 or higher
  • python-dotenv package
  • requests package
  • OneSignal account with API credentials

Installation

Option 1: Clone from GitHub

# Clone the repository
git clone https://github.com/weirdbrains/onesignal-mcp.git
cd onesignal-mcp

# Install dependencies
pip install -r requirements.txt

Option 2: Install as a Package (Coming Soon)

pip install onesignal-mcp

Configuration

  1. Create a .env file in the root directory with your OneSignal credentials:

    # Default app credentials (optional, you can also add apps via the API)
    ONESIGNAL_APP_ID=your_app_id_here
    ONESIGNAL_API_KEY=your_rest_api_key_here
    
    # Organization API key (for org-level operations)
    ONESIGNAL_ORG_API_KEY=your_organization_api_key_here
    
  2. You can find your OneSignal credentials in your OneSignal dashboard:

    • App ID: Settings > Keys & IDs > OneSignal App ID
    • REST API Key: Settings > Keys & IDs > REST API Key
    • Organization API Key: Organization Settings > API Keys

Usage

Running the Server

python onesignal_server.py

The server will start and register itself with the MCP system, making its tools available for use.

Basic Usage Examples

Sending a Push Notification

# Send a notification to all subscribed users
result = await send_notification(
    title="Hello World",
    message="This is a test notification",
    segment="Subscribed Users"
)
print(result)

Working with Multiple Apps

# Add a new app configuration
await add_app(
    key="my_second_app", 
    app_id="second-app-id", 
    api_key="second-app-api-key", 
    name="My Second App"
)

# List all configured apps
apps = await list_apps()
print(apps)

# Switch to the new app
await switch_app("my_second_app")

# Send a notification using the current app
await send_notification(
    title="Hello", 
    message="This is from my second app"
)

# Send a notification from a specific app (without switching)
await send_notification(
    title="Hello", 
    message="This is from my first app", 
    app_key="mandible"
)

Managing Segments

# List all segments
segments = await view_segments()
print(segments)

# Create a new segment
result = await create_segment(
    name="High Value Users",
    filters='[{"field":"amount_spent", "relation":">", "value":"100"}]'
)
print(result)

Working with Templates

# Create an email template
result = await create_template(
    name="Welcome Email",
    title="Welcome to Our App",
    message="<html><body><h1>Welcome!</h1><p>Thank you for joining us.</p></body></html>",
    template_type="email"
)
print(result)

Multi-App Support

This server supports managing multiple OneSignal applications. You can:

  1. Add multiple app configurations with different identifiers
  2. Switch between apps when making API calls
  3. Specify which app to use for individual operations

App Management Tools

  • list_apps: List all configured OneSignal apps in the server
  • add_app: Add a new OneSignal app configuration
  • update_app: Update an existing OneSignal app configuration
  • remove_app: Remove an OneSignal app configuration
  • switch_app: Switch the current app to use for API requests

Available Tools

Message Management

  • send_notification: Send a new push notification, email, or SMS
  • view_messages: List recent messages sent through OneSignal
  • view_message_details: Get detailed information about a specific message
  • cancel_message: Cancel a scheduled message

Device Management

  • view_devices: List devices (users) registered in your OneSignal app
  • view_device_details: Get detailed information about a specific device

Segment Management

  • view_segments: List all segments available in your OneSignal app
  • create_segment: Create a new segment with specified filters
  • delete_segment: Delete an existing segment

Template Management

  • view_templates: List all templates available in your OneSignal app
  • view_template_details: Get detailed information about a specific template
  • create_template: Create a new template for notifications or emails

App Information

  • view_app_details: Get detailed information about the configured OneSignal app

Logging

The server includes comprehensive logging to help with debugging and monitoring. Logs are output to the console by default, with the following format:

YYYY-MM-DD HH:MM:SS - onesignal-mcp - LEVEL - Message

You can adjust the logging level by modifying the logging.basicConfig call in the server file.

Testing

The OneSignal MCP server includes a comprehensive test suite to ensure all functionality works as expected. The tests use Python's built-in unittest framework and mock external API calls to test the server's behavior.

Running Tests

To run the tests, use the following command:

python -m unittest discover tests

This will discover and run all tests in the tests directory.

Test Coverage

The test suite covers:

  • App configuration management
  • API request handling with proper authentication
  • Error handling and recovery
  • Multiple app support
  • Organization-level operations

Writing New Tests

If you add new functionality to the server, please also add corresponding tests. Tests should be placed in the tests directory and follow the naming convention test_*.py.

Troubleshooting

Common Issues

No App Configuration Available

If you see the error "No app configuration available", make sure you have:

  1. Set up your .env file with the correct credentials, or
  2. Added an app configuration using the add_app tool

API Key Errors

If you receive authentication errors, verify that:

  1. Your API keys are correct
  2. You're using the right key for the operation (REST API Key vs Organization API Key)
  3. The key has the necessary permissions in OneSignal

Rate Limiting

OneSignal has rate limits for API requests. If you encounter rate limiting:

  1. Reduce the frequency of your requests
  2. Implement retry logic with exponential backoff

Getting Help

If you encounter issues not covered here:

  1. Check the OneSignal API Documentation
  2. Open an issue on the GitHub repository

Contributing

We welcome contributions to improve the OneSignal MCP server! Please see CONTRIBUTING.md for guidelines.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgements

  • OneSignal for their excellent notification service and API
  • The Weirdbrains team for supporting this project

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
MCP Package Docs Server

MCP Package Docs Server

Facilitates LLMs to efficiently access and fetch structured documentation for packages in Go, Python, and NPM, enhancing software development with multi-language support and performance optimization.

Featured
Local
TypeScript
Claude Code MCP

Claude Code MCP

An implementation of Claude Code as a Model Context Protocol server that enables using Claude's software engineering capabilities (code generation, editing, reviewing, and file operations) through the standardized MCP interface.

Featured
Local
JavaScript
@kazuph/mcp-taskmanager

@kazuph/mcp-taskmanager

Model Context Protocol server for Task Management. This allows Claude Desktop (or any MCP client) to manage and execute tasks in a queue-based system.

Featured
Local
JavaScript
Linear MCP Server

Linear MCP Server

Enables interaction with Linear's API for managing issues, teams, and projects programmatically through the Model Context Protocol.

Featured
JavaScript
mermaid-mcp-server

mermaid-mcp-server

A Model Context Protocol (MCP) server that converts Mermaid diagrams to PNG images.

Featured
JavaScript
Jira-Context-MCP

Jira-Context-MCP

MCP server to provide Jira Tickets information to AI coding agents like Cursor

Featured
TypeScript
Linear MCP Server

Linear MCP Server

A Model Context Protocol server that integrates with Linear's issue tracking system, allowing LLMs to create, update, search, and comment on Linear issues through natural language interactions.

Featured
JavaScript
Sequential Thinking MCP Server

Sequential Thinking MCP Server

This server facilitates structured problem-solving by breaking down complex issues into sequential steps, supporting revisions, and enabling multiple solution paths through full MCP integration.

Featured
Python