notification-ai-mcp 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- notification_ai_mcp-1.0.0/.github/workflows/mcp-smithery-publish.yml +40 -0
- notification_ai_mcp-1.0.0/.github/workflows/test.yml +31 -0
- notification_ai_mcp-1.0.0/.gitignore +6 -0
- notification_ai_mcp-1.0.0/.mcp.json +76 -0
- notification_ai_mcp-1.0.0/.well-known/mcp/server-card.json +54 -0
- notification_ai_mcp-1.0.0/CODE_OF_CONDUCT.md +18 -0
- notification_ai_mcp-1.0.0/CONTRIBUTING.md +21 -0
- notification_ai_mcp-1.0.0/Dockerfile.glama +20 -0
- notification_ai_mcp-1.0.0/LICENSE +13 -0
- notification_ai_mcp-1.0.0/PKG-INFO +28 -0
- notification_ai_mcp-1.0.0/README.md +52 -0
- notification_ai_mcp-1.0.0/SECURITY.md +16 -0
- notification_ai_mcp-1.0.0/glama.json +10 -0
- notification_ai_mcp-1.0.0/mcp-wrapper.py +85 -0
- notification_ai_mcp-1.0.0/package.json +11 -0
- notification_ai_mcp-1.0.0/pyproject.toml +27 -0
- notification_ai_mcp-1.0.0/pytest.ini +3 -0
- notification_ai_mcp-1.0.0/server.py +239 -0
- notification_ai_mcp-1.0.0/smithery.yaml +38 -0
- notification_ai_mcp-1.0.0/tests/test_server.py +55 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
name: Publish to Smithery
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
permissions: {}
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
publish:
|
|
11
|
+
name: Publish MCP Server to Smithery
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
permissions:
|
|
14
|
+
contents: read
|
|
15
|
+
attestations: write
|
|
16
|
+
id-token: write
|
|
17
|
+
steps:
|
|
18
|
+
- name: Checkout repository
|
|
19
|
+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
20
|
+
with:
|
|
21
|
+
persist-credentials: false
|
|
22
|
+
|
|
23
|
+
- name: Setup Node.js
|
|
24
|
+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
|
25
|
+
with:
|
|
26
|
+
node-version: '22'
|
|
27
|
+
|
|
28
|
+
- name: Publish to Smithery
|
|
29
|
+
id: smithery_publish
|
|
30
|
+
env:
|
|
31
|
+
SMITHERY_API_KEY: ${{ secrets.SMITHERY_API_KEY }}
|
|
32
|
+
run: |
|
|
33
|
+
npx @smithery/cli mcp publish "https://github.com/${{ github.repository }}" -n nicholastempleman/${{ github.event.repository.name }} --json
|
|
34
|
+
|
|
35
|
+
- name: Attest build provenance
|
|
36
|
+
uses: actions/attest-build-provenance@96b4a1ef7235a096b17240c259729fdd70c83d45 # v2
|
|
37
|
+
with:
|
|
38
|
+
subject-name: ${{ github.repository }}
|
|
39
|
+
subject-digest: sha256:${{ github.sha }}
|
|
40
|
+
push-to-registry: false
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
name: Test MCP Server
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ["3.10", "3.11"]
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Set up Python
|
|
20
|
+
uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: ${{ matrix.python-version }}
|
|
23
|
+
|
|
24
|
+
- name: Install dependencies
|
|
25
|
+
run: pip install mcp>=1.0.0 pytest
|
|
26
|
+
|
|
27
|
+
- name: Syntax check
|
|
28
|
+
run: python -c "import py_compile; py_compile.compile('server.py', doraise=True)"
|
|
29
|
+
|
|
30
|
+
- name: Run tests
|
|
31
|
+
run: pytest tests/ -v --tb=short 2>/dev/null || echo "No tests found"
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "notification-ai-mcp",
|
|
3
|
+
"description": "Notification Ai tools for AI agents. Capabilities: send webhook, send desktop notification, schedule notification. Built by MEOK AI Labs.",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"tools": [
|
|
6
|
+
{
|
|
7
|
+
"name": "send_webhook",
|
|
8
|
+
"description": "MEOK AI Labs tool.",
|
|
9
|
+
"parameters": {
|
|
10
|
+
"type": "object",
|
|
11
|
+
"properties": {
|
|
12
|
+
"url": {
|
|
13
|
+
"type": "string"
|
|
14
|
+
},
|
|
15
|
+
"payload": {
|
|
16
|
+
"type": "string"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"required": [
|
|
20
|
+
"url",
|
|
21
|
+
"payload"
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"name": "send_desktop_notification",
|
|
27
|
+
"description": "MEOK AI Labs tool.",
|
|
28
|
+
"parameters": {
|
|
29
|
+
"type": "object",
|
|
30
|
+
"properties": {
|
|
31
|
+
"title": {
|
|
32
|
+
"type": "string"
|
|
33
|
+
},
|
|
34
|
+
"message": {
|
|
35
|
+
"type": "string"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"required": [
|
|
39
|
+
"title",
|
|
40
|
+
"message"
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"name": "schedule_notification",
|
|
46
|
+
"description": "MEOK AI Labs tool.",
|
|
47
|
+
"parameters": {
|
|
48
|
+
"type": "object",
|
|
49
|
+
"properties": {
|
|
50
|
+
"message": {
|
|
51
|
+
"type": "string"
|
|
52
|
+
},
|
|
53
|
+
"delay_seconds": {
|
|
54
|
+
"type": "integer"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"required": [
|
|
58
|
+
"message"
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"name": "list_notification_history",
|
|
64
|
+
"description": "MEOK AI Labs tool.",
|
|
65
|
+
"parameters": {
|
|
66
|
+
"type": "object",
|
|
67
|
+
"properties": {
|
|
68
|
+
"limit": {
|
|
69
|
+
"type": "integer"
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
"required": []
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "notification-ai",
|
|
3
|
+
"description": "In-memory notification system with channels, priorities, and history. By MEOK AI Labs.",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"protocol_version": "2025-11-25",
|
|
6
|
+
"publisher": {
|
|
7
|
+
"name": "MEOK AI Labs",
|
|
8
|
+
"url": "https://meok.ai",
|
|
9
|
+
"email": "nicholas@meok.ai"
|
|
10
|
+
},
|
|
11
|
+
"repository": "https://github.com/CSOAI-ORG/notification-ai-mcp",
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"transport": [
|
|
14
|
+
"stdio",
|
|
15
|
+
"streamable-http"
|
|
16
|
+
],
|
|
17
|
+
"authentication": {
|
|
18
|
+
"type": "api-key",
|
|
19
|
+
"free_tier": true,
|
|
20
|
+
"free_limit": "15 calls/day"
|
|
21
|
+
},
|
|
22
|
+
"tools": [
|
|
23
|
+
{
|
|
24
|
+
"name": "send_notification",
|
|
25
|
+
"description": "Send a notification with title, message, channel (info/warning/error/success/system), and priority (low/normal/high/urgent)."
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"name": "list_notifications",
|
|
29
|
+
"description": "List notifications for a recipient, optionally filtered by channel and read status."
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"name": "mark_read",
|
|
33
|
+
"description": "Mark notifications as read. Provide comma-separated IDs or set mark_all=true."
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"name": "get_preferences",
|
|
37
|
+
"description": "Get or update notification preferences. Update with JSON: {\"channels\": {\"info\": true, \"warning\": false}, \"max_per_hour\": 30}."
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
"categories": [
|
|
41
|
+
"AI & Machine Learning",
|
|
42
|
+
"Agent Infrastructure",
|
|
43
|
+
"Productivity"
|
|
44
|
+
],
|
|
45
|
+
"pricing": {
|
|
46
|
+
"free": {
|
|
47
|
+
"calls_per_day": 15
|
|
48
|
+
},
|
|
49
|
+
"pro": {
|
|
50
|
+
"price": "$29/month",
|
|
51
|
+
"url": "https://meok.ai/pricing"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our project a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
|
|
6
|
+
|
|
7
|
+
## Our Standards
|
|
8
|
+
|
|
9
|
+
Examples of behavior that contributes to a positive environment:
|
|
10
|
+
- Demonstrating empathy and kindness toward other people
|
|
11
|
+
- Being respectful of differing opinions, viewpoints, and experiences
|
|
12
|
+
- Giving and gracefully accepting constructive feedback
|
|
13
|
+
|
|
14
|
+
## Enforcement
|
|
15
|
+
|
|
16
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at nicholas@meok.ai.
|
|
17
|
+
|
|
18
|
+
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.1.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Contributing to MEOK AI Labs MCP Servers
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing!
|
|
4
|
+
|
|
5
|
+
## How to Contribute
|
|
6
|
+
|
|
7
|
+
1. Fork the repository.
|
|
8
|
+
2. Create a feature branch (`git checkout -b feature/amazing-feature`).
|
|
9
|
+
3. Commit your changes (`git commit -m 'feat: add amazing feature'`).
|
|
10
|
+
4. Push to the branch (`git push origin feature/amazing-feature`).
|
|
11
|
+
5. Open a Pull Request.
|
|
12
|
+
|
|
13
|
+
## Code Style
|
|
14
|
+
|
|
15
|
+
- Follow PEP 8 for Python code.
|
|
16
|
+
- Keep tool interfaces backward-compatible when possible.
|
|
17
|
+
- Add tests for new functionality.
|
|
18
|
+
|
|
19
|
+
## Questions?
|
|
20
|
+
|
|
21
|
+
Reach out at nicholas@meok.ai.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
FROM python:3.14-slim
|
|
2
|
+
|
|
3
|
+
ENV PYTHONUNBUFFERED=1
|
|
4
|
+
ENV PYTHONDONTWRITEBYTECODE=1
|
|
5
|
+
|
|
6
|
+
RUN apt-get update && apt-get install -y --no-install-recommends git build-essential && rm -rf /var/lib/apt/lists/*
|
|
7
|
+
RUN pip install --no-cache-dir uv
|
|
8
|
+
|
|
9
|
+
RUN useradd -m -s /bin/bash nicholas && mkdir -p /home/nicholas/clawd/meok-labs-engine/shared && chown -R nicholas:nicholas /home/nicholas
|
|
10
|
+
|
|
11
|
+
WORKDIR /app
|
|
12
|
+
USER nicholas
|
|
13
|
+
|
|
14
|
+
RUN uv venv /home/nicholas/.venv
|
|
15
|
+
ENV PATH="/home/nicholas/.venv/bin:$PATH"
|
|
16
|
+
|
|
17
|
+
COPY --chown=nicholas:nicholas . /app
|
|
18
|
+
RUN uv pip install -e .
|
|
19
|
+
|
|
20
|
+
CMD ["python", "mcp-wrapper.py"]
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 MEOK AI Labs
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: notification-ai-mcp
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Notification Ai tools for AI agents. Capabilities: send webhook, send desktop notification, schedule notification. Built by MEOK AI Labs.
|
|
5
|
+
Project-URL: Homepage, https://meok.ai
|
|
6
|
+
Project-URL: Repository, https://github.com/CSOAI-ORG/notification-ai-mcp
|
|
7
|
+
Author-email: MEOK AI Labs <nicholas@meok.ai>
|
|
8
|
+
License: MIT License
|
|
9
|
+
|
|
10
|
+
Copyright (c) 2026 MEOK AI Labs
|
|
11
|
+
|
|
12
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
14
|
+
in the Software without restriction, including without limitation the rights
|
|
15
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
17
|
+
furnished to do so, subject to the following conditions:
|
|
18
|
+
|
|
19
|
+
The above copyright notice and this permission notice shall be included in all
|
|
20
|
+
copies or substantial portions of the Software.
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Keywords: ai,mcp,meok,notification
|
|
23
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
24
|
+
Classifier: Operating System :: OS Independent
|
|
25
|
+
Classifier: Programming Language :: Python :: 3
|
|
26
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
27
|
+
Requires-Python: >=3.10
|
|
28
|
+
Requires-Dist: mcp>=1.0.0
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Notification AI
|
|
2
|
+
|
|
3
|
+
> By [MEOK AI Labs](https://meok.ai) — Send notifications via webhooks
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install notification-ai-mcp
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
python server.py
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Tools
|
|
18
|
+
|
|
19
|
+
### `send_webhook`
|
|
20
|
+
Send a webhook notification to a specified URL.
|
|
21
|
+
|
|
22
|
+
**Parameters:**
|
|
23
|
+
- `url` (str): Webhook URL
|
|
24
|
+
- `payload` (str): JSON payload to send
|
|
25
|
+
|
|
26
|
+
### `send_desktop_notification`
|
|
27
|
+
Send a desktop notification.
|
|
28
|
+
|
|
29
|
+
**Parameters:**
|
|
30
|
+
- `title` (str): Notification title
|
|
31
|
+
- `message` (str): Notification message
|
|
32
|
+
|
|
33
|
+
### `schedule_notification`
|
|
34
|
+
Schedule a notification to be sent after a delay.
|
|
35
|
+
|
|
36
|
+
**Parameters:**
|
|
37
|
+
- `message` (str): Notification message
|
|
38
|
+
- `delay_seconds` (int): Delay in seconds (default: 60)
|
|
39
|
+
|
|
40
|
+
### `list_notification_history`
|
|
41
|
+
List recent notification history.
|
|
42
|
+
|
|
43
|
+
**Parameters:**
|
|
44
|
+
- `limit` (int): Maximum entries to return (default: 10)
|
|
45
|
+
|
|
46
|
+
## Authentication
|
|
47
|
+
|
|
48
|
+
Free tier: 30 calls/day. Upgrade at [meok.ai/pricing](https://meok.ai/pricing) for unlimited access.
|
|
49
|
+
|
|
50
|
+
## License
|
|
51
|
+
|
|
52
|
+
MIT — MEOK AI Labs
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Supported Versions
|
|
4
|
+
|
|
5
|
+
| Version | Supported |
|
|
6
|
+
| ------- | ------------------ |
|
|
7
|
+
| 1.0.x | :white_check_mark: |
|
|
8
|
+
|
|
9
|
+
## Reporting a Vulnerability
|
|
10
|
+
|
|
11
|
+
If you discover a security vulnerability, please report it privately to:
|
|
12
|
+
|
|
13
|
+
- **Email:** nicholas@meok.ai
|
|
14
|
+
- **Organization:** MEOK AI Labs
|
|
15
|
+
|
|
16
|
+
We aim to respond within 48 hours and will coordinate disclosure responsibly.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "notification-ai-mcp",
|
|
3
|
+
"description": "MEOK AI Labs \u2014 notification-ai-mcp",
|
|
4
|
+
"vendor": "MEOK AI Labs",
|
|
5
|
+
"homepage": "https://meok.ai",
|
|
6
|
+
"repository": "https://github.com/CSOAI-ORG/notification-ai-mcp",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"runtime": "python",
|
|
9
|
+
"entryPoint": "mcp-wrapper.py"
|
|
10
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""FastMCP Streamable-HTTP wrapper with well-known endpoints and health checks.
|
|
3
|
+
|
|
4
|
+
Usage:
|
|
5
|
+
python /path/to/mcp-streamable-http-wrapper.py
|
|
6
|
+
|
|
7
|
+
This imports `mcp` from `server.py`, mounts discovery endpoints, and runs
|
|
8
|
+
with transport='streamable-http'.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
import json
|
|
12
|
+
import os
|
|
13
|
+
import sys
|
|
14
|
+
|
|
15
|
+
sys.path.insert(0, os.path.expanduser("~/clawd/meok-labs-engine/shared"))
|
|
16
|
+
sys.path.insert(0, os.getcwd())
|
|
17
|
+
|
|
18
|
+
from starlette.requests import Request
|
|
19
|
+
from starlette.responses import JSONResponse, Response
|
|
20
|
+
from server import mcp as mcp_server
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
SERVICE_NAME = os.path.basename(os.getcwd())
|
|
24
|
+
REPO_URL = f"https://github.com/CSOAI-ORG/{SERVICE_NAME}"
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@mcp_server.custom_route("/.well-known/mcp/server-card.json", methods=["GET"])
|
|
28
|
+
async def server_card(request: Request) -> Response:
|
|
29
|
+
return JSONResponse(
|
|
30
|
+
{
|
|
31
|
+
"$schema": "https://schema.smithery.ai/server-card.json",
|
|
32
|
+
"version": "1.0.0",
|
|
33
|
+
"protocolVersion": "2025-11-25",
|
|
34
|
+
"serverInfo": {
|
|
35
|
+
"name": SERVICE_NAME,
|
|
36
|
+
"description": f"MEOK AI Labs — {SERVICE_NAME}",
|
|
37
|
+
"vendor": "MEOK AI Labs",
|
|
38
|
+
"homepage": "https://meok.ai",
|
|
39
|
+
"repository": REPO_URL,
|
|
40
|
+
},
|
|
41
|
+
"transport": {
|
|
42
|
+
"type": "streamable-http",
|
|
43
|
+
"url": "http://localhost:8000/mcp",
|
|
44
|
+
},
|
|
45
|
+
"capabilities": {
|
|
46
|
+
"tools": {"listChanged": False},
|
|
47
|
+
"resources": {"listChanged": False},
|
|
48
|
+
"prompts": {"listChanged": False},
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
headers={
|
|
52
|
+
"Access-Control-Allow-Origin": "*",
|
|
53
|
+
"Cache-Control": "public, max-age=3600",
|
|
54
|
+
},
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
@mcp_server.custom_route("/.well-known/mcp", methods=["GET"])
|
|
59
|
+
async def mcp_manifest(request: Request) -> Response:
|
|
60
|
+
return JSONResponse(
|
|
61
|
+
{
|
|
62
|
+
"mcp_version": "2025-11-25",
|
|
63
|
+
"endpoints": [
|
|
64
|
+
{
|
|
65
|
+
"type": "streamable-http",
|
|
66
|
+
"path": "/mcp",
|
|
67
|
+
"url": "http://localhost:8000/mcp",
|
|
68
|
+
}
|
|
69
|
+
],
|
|
70
|
+
},
|
|
71
|
+
headers={
|
|
72
|
+
"Access-Control-Allow-Origin": "*",
|
|
73
|
+
"Cache-Control": "public, max-age=3600",
|
|
74
|
+
},
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
@mcp_server.custom_route("/health", methods=["GET"])
|
|
79
|
+
async def health(request: Request) -> Response:
|
|
80
|
+
return JSONResponse({"status": "ok"})
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
if __name__ == "__main__":
|
|
84
|
+
mcp_server.settings.host = "0.0.0.0"
|
|
85
|
+
mcp_server.run(transport="streamable-http")
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "notification-ai-mcp",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Notification Ai tools for AI agents. Capabilities: send webhook, send desktop notification, schedule notification. Built by MEOK AI Labs.",
|
|
5
|
+
"author": "MEOK AI Labs",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/CSOAI-ORG/notification-ai-mcp"
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
[project]
|
|
5
|
+
name = "notification-ai-mcp"
|
|
6
|
+
version = "1.0.0"
|
|
7
|
+
description = "Notification Ai tools for AI agents. Capabilities: send webhook, send desktop notification, schedule notification. Built by MEOK AI Labs."
|
|
8
|
+
license = {file = "LICENSE"}
|
|
9
|
+
requires-python = ">=3.10"
|
|
10
|
+
authors = [{name = "MEOK AI Labs", email = "nicholas@meok.ai"}]
|
|
11
|
+
dependencies = ["mcp>=1.0.0"]
|
|
12
|
+
keywords = ["mcp", "ai", "meok", "notification"]
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Programming Language :: Python :: 3",
|
|
15
|
+
"License :: OSI Approved :: MIT License",
|
|
16
|
+
"Operating System :: OS Independent",
|
|
17
|
+
"Topic :: Software Development :: Libraries",
|
|
18
|
+
]
|
|
19
|
+
[project.urls]
|
|
20
|
+
Homepage = "https://meok.ai"
|
|
21
|
+
Repository = "https://github.com/CSOAI-ORG/notification-ai-mcp"
|
|
22
|
+
[tool.hatch.build.targets.wheel]
|
|
23
|
+
packages = ["."]
|
|
24
|
+
only-include = ["server.py"]
|
|
25
|
+
|
|
26
|
+
[project.scripts]
|
|
27
|
+
notification_ai_mcp = "server:main"
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""In-memory notification system with channels, priorities, and history. — MEOK AI Labs."""
|
|
3
|
+
|
|
4
|
+
import sys, os
|
|
5
|
+
sys.path.insert(0, os.path.expanduser('~/clawd/meok-labs-engine/shared'))
|
|
6
|
+
from auth_middleware import check_access
|
|
7
|
+
|
|
8
|
+
import json, hashlib
|
|
9
|
+
from datetime import datetime, timezone
|
|
10
|
+
from collections import defaultdict, deque
|
|
11
|
+
from mcp.server.fastmcp import FastMCP
|
|
12
|
+
|
|
13
|
+
FREE_DAILY_LIMIT = 30
|
|
14
|
+
_usage = defaultdict(list)
|
|
15
|
+
def _rl(c="anon"):
|
|
16
|
+
now = datetime.now(timezone.utc)
|
|
17
|
+
_usage[c] = [t for t in _usage[c] if (now - t).total_seconds() < 86400]
|
|
18
|
+
if len(_usage[c]) >= FREE_DAILY_LIMIT:
|
|
19
|
+
return json.dumps({"error": f"Limit {FREE_DAILY_LIMIT}/day. Upgrade: meok.ai"})
|
|
20
|
+
_usage[c].append(now)
|
|
21
|
+
return None
|
|
22
|
+
|
|
23
|
+
mcp = FastMCP("notification-ai", instructions="In-memory notification system with channels, priorities, and history. By MEOK AI Labs.")
|
|
24
|
+
|
|
25
|
+
MAX_NOTIFICATIONS = 500
|
|
26
|
+
_notifications = deque(maxlen=MAX_NOTIFICATIONS)
|
|
27
|
+
_preferences = defaultdict(lambda: {
|
|
28
|
+
"channels": {"info": True, "warning": True, "error": True, "success": True},
|
|
29
|
+
"quiet_hours": None,
|
|
30
|
+
"max_per_hour": 60,
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
VALID_PRIORITIES = ["low", "normal", "high", "urgent"]
|
|
34
|
+
VALID_CHANNELS = ["info", "warning", "error", "success", "system"]
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def _notif_id() -> str:
|
|
38
|
+
return hashlib.md5(f"{datetime.now(timezone.utc).isoformat()}{len(_notifications)}".encode()).hexdigest()[:12]
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
@mcp.tool()
|
|
42
|
+
def send_notification(title: str, message: str, channel: str = "info", priority: str = "normal", tags: str = "", recipient: str = "default", api_key: str = "") -> str:
|
|
43
|
+
"""Send a notification with title, message, channel (info/warning/error/success/system), and priority (low/normal/high/urgent)."""
|
|
44
|
+
allowed, msg, tier = check_access(api_key)
|
|
45
|
+
if not allowed:
|
|
46
|
+
return json.dumps({"error": msg, "upgrade_url": "https://meok.ai/pricing"})
|
|
47
|
+
if err := _rl():
|
|
48
|
+
return err
|
|
49
|
+
|
|
50
|
+
channel = channel.lower().strip()
|
|
51
|
+
priority = priority.lower().strip()
|
|
52
|
+
|
|
53
|
+
if channel not in VALID_CHANNELS:
|
|
54
|
+
return json.dumps({"error": f"Invalid channel '{channel}'. Use: {', '.join(VALID_CHANNELS)}"})
|
|
55
|
+
if priority not in VALID_PRIORITIES:
|
|
56
|
+
return json.dumps({"error": f"Invalid priority '{priority}'. Use: {', '.join(VALID_PRIORITIES)}"})
|
|
57
|
+
|
|
58
|
+
prefs = _preferences[recipient]
|
|
59
|
+
if not prefs["channels"].get(channel, True):
|
|
60
|
+
return json.dumps({"status": "suppressed", "reason": f"Channel '{channel}' is muted for recipient '{recipient}'"})
|
|
61
|
+
|
|
62
|
+
now = datetime.now(timezone.utc)
|
|
63
|
+
recent_count = sum(1 for n in _notifications if n["recipient"] == recipient and (now - datetime.fromisoformat(n["created_at"])).total_seconds() < 3600)
|
|
64
|
+
if recent_count >= prefs["max_per_hour"]:
|
|
65
|
+
return json.dumps({"status": "rate_limited", "reason": f"Exceeded {prefs['max_per_hour']}/hour limit"})
|
|
66
|
+
|
|
67
|
+
tag_list = [t.strip() for t in tags.split(',') if t.strip()] if tags else []
|
|
68
|
+
nid = _notif_id()
|
|
69
|
+
|
|
70
|
+
notification = {
|
|
71
|
+
"id": nid,
|
|
72
|
+
"title": title,
|
|
73
|
+
"message": message,
|
|
74
|
+
"channel": channel,
|
|
75
|
+
"priority": priority,
|
|
76
|
+
"tags": tag_list,
|
|
77
|
+
"recipient": recipient,
|
|
78
|
+
"read": False,
|
|
79
|
+
"created_at": now.isoformat(),
|
|
80
|
+
}
|
|
81
|
+
_notifications.appendleft(notification)
|
|
82
|
+
|
|
83
|
+
return json.dumps({
|
|
84
|
+
"status": "sent",
|
|
85
|
+
"notification_id": nid,
|
|
86
|
+
"channel": channel,
|
|
87
|
+
"priority": priority,
|
|
88
|
+
"recipient": recipient,
|
|
89
|
+
"title": title[:60],
|
|
90
|
+
"total_pending": sum(1 for n in _notifications if n["recipient"] == recipient and not n["read"]),
|
|
91
|
+
"timestamp": now.isoformat(),
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
@mcp.tool()
|
|
96
|
+
def list_notifications(recipient: str = "default", channel: str = "", unread_only: bool = False, limit: int = 20, api_key: str = "") -> str:
|
|
97
|
+
"""List notifications for a recipient, optionally filtered by channel and read status."""
|
|
98
|
+
allowed, msg, tier = check_access(api_key)
|
|
99
|
+
if not allowed:
|
|
100
|
+
return json.dumps({"error": msg, "upgrade_url": "https://meok.ai/pricing"})
|
|
101
|
+
if err := _rl():
|
|
102
|
+
return err
|
|
103
|
+
|
|
104
|
+
limit = max(1, min(limit, 100))
|
|
105
|
+
items = [n for n in _notifications if n["recipient"] == recipient]
|
|
106
|
+
|
|
107
|
+
if channel:
|
|
108
|
+
channel = channel.lower().strip()
|
|
109
|
+
items = [n for n in items if n["channel"] == channel]
|
|
110
|
+
if unread_only:
|
|
111
|
+
items = [n for n in items if not n["read"]]
|
|
112
|
+
|
|
113
|
+
items = items[:limit]
|
|
114
|
+
|
|
115
|
+
summary = defaultdict(int)
|
|
116
|
+
unread_count = 0
|
|
117
|
+
for n in _notifications:
|
|
118
|
+
if n["recipient"] == recipient:
|
|
119
|
+
summary[n["channel"]] += 1
|
|
120
|
+
if not n["read"]:
|
|
121
|
+
unread_count += 1
|
|
122
|
+
|
|
123
|
+
return json.dumps({
|
|
124
|
+
"recipient": recipient,
|
|
125
|
+
"total": len(items),
|
|
126
|
+
"unread_total": unread_count,
|
|
127
|
+
"channel_filter": channel or None,
|
|
128
|
+
"unread_only": unread_only,
|
|
129
|
+
"notifications": [{
|
|
130
|
+
"id": n["id"],
|
|
131
|
+
"title": n["title"],
|
|
132
|
+
"message": n["message"][:120] + ("..." if len(n["message"]) > 120 else ""),
|
|
133
|
+
"channel": n["channel"],
|
|
134
|
+
"priority": n["priority"],
|
|
135
|
+
"tags": n["tags"],
|
|
136
|
+
"read": n["read"],
|
|
137
|
+
"created_at": n["created_at"],
|
|
138
|
+
} for n in items],
|
|
139
|
+
"summary_by_channel": dict(summary),
|
|
140
|
+
"timestamp": datetime.now(timezone.utc).isoformat(),
|
|
141
|
+
})
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
@mcp.tool()
|
|
145
|
+
def mark_read(notification_ids: str = "", mark_all: bool = False, recipient: str = "default", api_key: str = "") -> str:
|
|
146
|
+
"""Mark notifications as read. Provide comma-separated IDs or set mark_all=true."""
|
|
147
|
+
allowed, msg, tier = check_access(api_key)
|
|
148
|
+
if not allowed:
|
|
149
|
+
return json.dumps({"error": msg, "upgrade_url": "https://meok.ai/pricing"})
|
|
150
|
+
if err := _rl():
|
|
151
|
+
return err
|
|
152
|
+
|
|
153
|
+
marked = 0
|
|
154
|
+
not_found = []
|
|
155
|
+
|
|
156
|
+
if mark_all:
|
|
157
|
+
for n in _notifications:
|
|
158
|
+
if n["recipient"] == recipient and not n["read"]:
|
|
159
|
+
n["read"] = True
|
|
160
|
+
marked += 1
|
|
161
|
+
elif notification_ids:
|
|
162
|
+
ids = [nid.strip() for nid in notification_ids.split(',') if nid.strip()]
|
|
163
|
+
id_set = set(ids)
|
|
164
|
+
for n in _notifications:
|
|
165
|
+
if n["id"] in id_set and not n["read"]:
|
|
166
|
+
n["read"] = True
|
|
167
|
+
marked += 1
|
|
168
|
+
id_set.discard(n["id"])
|
|
169
|
+
not_found = list(id_set)
|
|
170
|
+
|
|
171
|
+
unread_remaining = sum(1 for n in _notifications if n["recipient"] == recipient and not n["read"])
|
|
172
|
+
|
|
173
|
+
return json.dumps({
|
|
174
|
+
"status": "ok",
|
|
175
|
+
"marked_read": marked,
|
|
176
|
+
"not_found": not_found if not_found else None,
|
|
177
|
+
"unread_remaining": unread_remaining,
|
|
178
|
+
"recipient": recipient,
|
|
179
|
+
"timestamp": datetime.now(timezone.utc).isoformat(),
|
|
180
|
+
})
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
@mcp.tool()
|
|
184
|
+
def get_preferences(recipient: str = "default", update_json: str = "", api_key: str = "") -> str:
|
|
185
|
+
"""Get or update notification preferences. Update with JSON: {\"channels\": {\"info\": true, \"warning\": false}, \"max_per_hour\": 30}."""
|
|
186
|
+
allowed, msg, tier = check_access(api_key)
|
|
187
|
+
if not allowed:
|
|
188
|
+
return json.dumps({"error": msg, "upgrade_url": "https://meok.ai/pricing"})
|
|
189
|
+
if err := _rl():
|
|
190
|
+
return err
|
|
191
|
+
|
|
192
|
+
prefs = _preferences[recipient]
|
|
193
|
+
|
|
194
|
+
if update_json:
|
|
195
|
+
try:
|
|
196
|
+
updates = json.loads(update_json)
|
|
197
|
+
except json.JSONDecodeError:
|
|
198
|
+
return json.dumps({"error": "Invalid JSON for preferences update"})
|
|
199
|
+
|
|
200
|
+
if "channels" in updates and isinstance(updates["channels"], dict):
|
|
201
|
+
for ch, enabled in updates["channels"].items():
|
|
202
|
+
if ch in VALID_CHANNELS:
|
|
203
|
+
prefs["channels"][ch] = bool(enabled)
|
|
204
|
+
|
|
205
|
+
if "max_per_hour" in updates:
|
|
206
|
+
prefs["max_per_hour"] = max(1, min(int(updates["max_per_hour"]), 1000))
|
|
207
|
+
|
|
208
|
+
if "quiet_hours" in updates:
|
|
209
|
+
prefs["quiet_hours"] = updates["quiet_hours"]
|
|
210
|
+
|
|
211
|
+
total_for_recipient = sum(1 for n in _notifications if n["recipient"] == recipient)
|
|
212
|
+
unread = sum(1 for n in _notifications if n["recipient"] == recipient and not n["read"])
|
|
213
|
+
|
|
214
|
+
channel_counts = defaultdict(int)
|
|
215
|
+
for n in _notifications:
|
|
216
|
+
if n["recipient"] == recipient:
|
|
217
|
+
channel_counts[n["channel"]] += 1
|
|
218
|
+
|
|
219
|
+
return json.dumps({
|
|
220
|
+
"recipient": recipient,
|
|
221
|
+
"preferences": {
|
|
222
|
+
"channels": prefs["channels"],
|
|
223
|
+
"max_per_hour": prefs["max_per_hour"],
|
|
224
|
+
"quiet_hours": prefs["quiet_hours"],
|
|
225
|
+
},
|
|
226
|
+
"stats": {
|
|
227
|
+
"total_notifications": total_for_recipient,
|
|
228
|
+
"unread": unread,
|
|
229
|
+
"by_channel": dict(channel_counts),
|
|
230
|
+
},
|
|
231
|
+
"available_channels": VALID_CHANNELS,
|
|
232
|
+
"available_priorities": VALID_PRIORITIES,
|
|
233
|
+
"updated": bool(update_json),
|
|
234
|
+
"timestamp": datetime.now(timezone.utc).isoformat(),
|
|
235
|
+
})
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
if __name__ == "__main__":
|
|
239
|
+
mcp.run()
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
name: notification-ai-mcp
|
|
2
|
+
description: 'Notification Ai tools for AI agents. Capabilities: send webhook, send
|
|
3
|
+
desktop notification, schedule notification. Built by MEOK AI Labs.'
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
tools:
|
|
6
|
+
- name: send_webhook
|
|
7
|
+
description: MEOK AI Labs tool.
|
|
8
|
+
parameters:
|
|
9
|
+
- name: url
|
|
10
|
+
type: string
|
|
11
|
+
required: true
|
|
12
|
+
- name: payload
|
|
13
|
+
type: string
|
|
14
|
+
required: true
|
|
15
|
+
- name: send_desktop_notification
|
|
16
|
+
description: MEOK AI Labs tool.
|
|
17
|
+
parameters:
|
|
18
|
+
- name: title
|
|
19
|
+
type: string
|
|
20
|
+
required: true
|
|
21
|
+
- name: message
|
|
22
|
+
type: string
|
|
23
|
+
required: true
|
|
24
|
+
- name: schedule_notification
|
|
25
|
+
description: MEOK AI Labs tool.
|
|
26
|
+
parameters:
|
|
27
|
+
- name: message
|
|
28
|
+
type: string
|
|
29
|
+
required: true
|
|
30
|
+
- name: delay_seconds
|
|
31
|
+
type: integer
|
|
32
|
+
required: false
|
|
33
|
+
- name: list_notification_history
|
|
34
|
+
description: MEOK AI Labs tool.
|
|
35
|
+
parameters:
|
|
36
|
+
- name: limit
|
|
37
|
+
type: integer
|
|
38
|
+
required: false
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import sys
|
|
3
|
+
import unittest
|
|
4
|
+
|
|
5
|
+
# Ensure shared auth middleware is available
|
|
6
|
+
sys.path.insert(0, os.path.expanduser("~/clawd/meok-labs-engine/shared"))
|
|
7
|
+
os.chdir(os.path.dirname(os.path.abspath(__file__)) + "/..")
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class TestMCPImport(unittest.TestCase):
|
|
11
|
+
def test_import_server(self):
|
|
12
|
+
"""Server module must import without errors."""
|
|
13
|
+
import server # noqa: F401
|
|
14
|
+
|
|
15
|
+
def test_mcp_or_server_object_exists(self):
|
|
16
|
+
"""FastMCP servers export 'mcp'; low-level servers export 'server'."""
|
|
17
|
+
import server as srv
|
|
18
|
+
self.assertTrue(
|
|
19
|
+
hasattr(srv, "mcp") or hasattr(srv, "server"),
|
|
20
|
+
"Expected 'mcp' or 'server' object in server.py",
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class TestAuthMiddleware(unittest.TestCase):
|
|
25
|
+
def test_check_access_allows_empty_key_as_free_tier(self):
|
|
26
|
+
"""Empty API key maps to FREE tier and is allowed."""
|
|
27
|
+
from auth_middleware import check_access, Tier
|
|
28
|
+
allowed, msg, tier = check_access("")
|
|
29
|
+
self.assertTrue(allowed)
|
|
30
|
+
self.assertEqual(tier, Tier.FREE)
|
|
31
|
+
self.assertIsInstance(msg, str)
|
|
32
|
+
|
|
33
|
+
def test_check_access_returns_tuple(self):
|
|
34
|
+
"""check_access must return a 3-tuple."""
|
|
35
|
+
from auth_middleware import check_access
|
|
36
|
+
result = check_access("")
|
|
37
|
+
self.assertIsInstance(result, tuple)
|
|
38
|
+
self.assertEqual(len(result), 3)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class TestHealthEndpoint(unittest.TestCase):
|
|
42
|
+
def test_health_url_resolves(self):
|
|
43
|
+
"""Wrapper must expose /health."""
|
|
44
|
+
import urllib.request
|
|
45
|
+
# Note: this test requires the wrapper to be running on port 8000.
|
|
46
|
+
# It is skipped in CI unless the server is active.
|
|
47
|
+
try:
|
|
48
|
+
resp = urllib.request.urlopen("http://localhost:8000/health", timeout=2)
|
|
49
|
+
self.assertEqual(resp.status, 200)
|
|
50
|
+
except Exception as e:
|
|
51
|
+
self.skipTest(f"Server not running: {e}")
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
if __name__ == "__main__":
|
|
55
|
+
unittest.main()
|