Provides real-time access to Android notifications via Termux, enabling monitoring, retrieval, and filtering of system-wide notifications from all installed apps.
Termux Notification List MCP Server
A Model Context Protocol (MCP) server that provides access to Android notifications via Termux, enabling AI agents to monitor and read Android notifications in real-time.
Features
- Real-time notification monitoring: Stream new notifications as they arrive
- Current notification retrieval: Get a snapshot of all active notifications
- Filtering capabilities: Filter notifications by package name or limit results
- Clean notification data: Structured JSON output with all notification metadata
Prerequisites
- Android device with Termux installed
- Termux API app installed and configured
- Node.js 18+ in Termux environment
- Proper permissions for notification access
Setup Termux Environment
- Install Termux and Termux from F-Droid or Google Play
- Install required packages in Termux:
- Grant notification access permissions to Termux:API in Android settings
Installation
Or build from source:
Usage
As MCP Server (stdio)
Run the server directly:
Or use the built version:
As SSE Server
The package can also run as an SSE server for web-based MCP clients:
Or use the built version:
The SSE server listens on port 3000 by default, configurable via PORT environment variable.
Running as a Background Service in Termux
To run the SSE server indefinitely as a background service using runit:
Automated Setup
Run the provided setup script:
Note: After running the setup script, restart your Termux session or run source $PREFIX/etc/profile
to use service management commands.
Manual Setup
- Install termux-services:
- Install the package globally:
- Create the service directory:
- Create the run script:
- Enable and start the service:
The service will now run automatically and restart if it crashes. You can check its status with:
Stop the service with:
Restart the service with:
Configuration for MCP Clients
Add to your MCP client configuration (e.g., Claude Desktop):
For SSE clients, connect to http://localhost:3000/sse
Available Tools
waitForNotification
Start monitoring for new Android notifications. Returns immediately and sends notifications via server events as they arrive.
Parameters:
timeout
(optional): Number of seconds to monitor before automatically stopping
Example:
stopWaitingForNotification
Stop monitoring for new notifications.
Parameters: None
Example:
getCurrentNotifications
Retrieve all currently active Android notifications.
Parameters:
packageName
(optional): Filter notifications by specific app package namelimit
(optional): Limit the number of notifications returned (1-100)
Example:
Notification Data Structure
Each notification contains the following fields:
Server Events
The server sends real-time notifications via MCP's notification system:
- New Notification Event: Sent when
waitForNotification
is active and a new notification arrives - Error Events: Sent when monitoring encounters errors
Best Practices
- Monitoring Lifecycle: Always call
stopWaitingForNotification
when done monitoring to free resources - Error Handling: Handle cases where
termux-notification-list
command is not available - Privacy: Be mindful that this tool can access all Android notifications - implement appropriate access controls
- Performance: Use
limit
parameter when you only need recent notifications
Security Considerations
- This server provides access to all Android notifications, which may contain sensitive information
- Ensure proper authentication and authorization when deploying
- Consider implementing filtering or access controls for production use
- Follow the principle of least privilege
Troubleshooting
termux-notification-list
command not found
- Ensure Termux:API is installed
- Verify
termux-api
package is installed:pkg install termux-api
- Check that notification permissions are granted in Android settings
No notifications received
- Verify Termux has notification access permissions
- Check that there are active notifications to read
- Ensure the monitoring is actually started with
waitForNotification
Permission denied errors
- Grant all requested permissions to Termux:API in Android settings
- Restart Termux after granting permissions
Development
Building
Testing
Running in Development
License
FSL-1.1-MIT - See LICENSE file for details.
This server cannot be installed
local-only server
The server can only run on the client's local machine because it depends on local resources.
Enables AI agents to monitor and read Android notifications in real-time via Termux. Provides access to current notifications with filtering capabilities and real-time streaming of new notifications as they arrive.