OneSignal MCP Server
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Integrations
Used to load OneSignal API credentials from a .env configuration file for secure management of API keys and app IDs.
Referenced as the repository platform where the OneSignal MCP code is hosted and can be cloned from.
Required as the runtime environment for the MCP server, with version 3.7 or higher needed to run the OneSignal integration.
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.
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
packagerequests
package- OneSignal account with API credentials
Installation
Option 1: Clone from GitHub
Option 2: Install as a Package (Coming Soon)
Configuration
- Create a
.env
file in the root directory with your OneSignal credentials:Copy - 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
The server will start and register itself with the MCP system, making its tools available for use.
Basic Usage Examples
Sending a Push Notification
Working with Multiple Apps
Managing Segments
Working with Templates
Multi-App Support
This server supports managing multiple OneSignal applications. You can:
- Add multiple app configurations with different identifiers
- Switch between apps when making API calls
- Specify which app to use for individual operations
App Management Tools
list_apps
: List all configured OneSignal apps in the serveradd_app
: Add a new OneSignal app configurationupdate_app
: Update an existing OneSignal app configurationremove_app
: Remove an OneSignal app configurationswitch_app
: Switch the current app to use for API requests
Available Tools
Message Management
send_notification
: Send a new push notification, email, or SMSview_messages
: List recent messages sent through OneSignalview_message_details
: Get detailed information about a specific messagecancel_message
: Cancel a scheduled message
Device Management
view_devices
: List devices (users) registered in your OneSignal appview_device_details
: Get detailed information about a specific device
Segment Management
view_segments
: List all segments available in your OneSignal appcreate_segment
: Create a new segment with specified filtersdelete_segment
: Delete an existing segment
Template Management
view_templates
: List all templates available in your OneSignal appview_template_details
: Get detailed information about a specific templatecreate_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:
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:
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:
- Set up your
.env
file with the correct credentials, or - Added an app configuration using the
add_app
tool
API Key Errors
If you receive authentication errors, verify that:
- Your API keys are correct
- You're using the right key for the operation (REST API Key vs Organization API Key)
- The key has the necessary permissions in OneSignal
Rate Limiting
OneSignal has rate limits for API requests. If you encounter rate limiting:
- Reduce the frequency of your requests
- Implement retry logic with exponential backoff
Getting Help
If you encounter issues not covered here:
- Check the OneSignal API Documentation
- 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
This server cannot be installed
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.