mcp-notify 0.1.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.
- mcp_notify-0.1.0/.github/workflows/docker.yaml +125 -0
- mcp_notify-0.1.0/.github/workflows/pypi.yaml +62 -0
- mcp_notify-0.1.0/.github/workflows/release.yaml +33 -0
- mcp_notify-0.1.0/.gitignore +14 -0
- mcp_notify-0.1.0/.python-version +1 -0
- mcp_notify-0.1.0/Dockerfile +19 -0
- mcp_notify-0.1.0/LICENSE +21 -0
- mcp_notify-0.1.0/PKG-INFO +52 -0
- mcp_notify-0.1.0/README.md +40 -0
- mcp_notify-0.1.0/docker-compose.yml +10 -0
- mcp_notify-0.1.0/glama.json +6 -0
- mcp_notify-0.1.0/mcp_notify/__init__.py +112 -0
- mcp_notify-0.1.0/mcp_notify/__main__.py +3 -0
- mcp_notify-0.1.0/pyproject.toml +21 -0
- mcp_notify-0.1.0/server.json +24 -0
- mcp_notify-0.1.0/smithery.yaml +6 -0
- mcp_notify-0.1.0/uv.lock +1367 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
name: Build Docker Image
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
release:
|
|
6
|
+
types: [published]
|
|
7
|
+
push:
|
|
8
|
+
branches: [main]
|
|
9
|
+
paths-ignore:
|
|
10
|
+
- .github/**
|
|
11
|
+
|
|
12
|
+
env:
|
|
13
|
+
GITHUB_CR_REPO: ghcr.io/${{ github.repository }}
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
build:
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
strategy:
|
|
19
|
+
fail-fast: false
|
|
20
|
+
matrix:
|
|
21
|
+
platform:
|
|
22
|
+
- linux/amd64
|
|
23
|
+
- linux/arm64
|
|
24
|
+
steps:
|
|
25
|
+
- name: Prepare
|
|
26
|
+
run: |
|
|
27
|
+
platform=${{ matrix.platform }}
|
|
28
|
+
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
|
|
29
|
+
|
|
30
|
+
- name: Docker meta
|
|
31
|
+
id: meta
|
|
32
|
+
uses: docker/metadata-action@v5
|
|
33
|
+
with:
|
|
34
|
+
images: |
|
|
35
|
+
${{ env.GITHUB_CR_REPO }}
|
|
36
|
+
|
|
37
|
+
- name: Login to GHCR
|
|
38
|
+
uses: docker/login-action@v3
|
|
39
|
+
with:
|
|
40
|
+
registry: ghcr.io
|
|
41
|
+
username: ${{ github.repository_owner }}
|
|
42
|
+
password: ${{ secrets.GITHUB_TOKEN }}
|
|
43
|
+
|
|
44
|
+
- name: Set up QEMU
|
|
45
|
+
uses: docker/setup-qemu-action@v3
|
|
46
|
+
|
|
47
|
+
- name: Set up Docker Buildx
|
|
48
|
+
uses: docker/setup-buildx-action@v3
|
|
49
|
+
|
|
50
|
+
- name: Build and push by digest
|
|
51
|
+
id: build
|
|
52
|
+
uses: docker/build-push-action@v6
|
|
53
|
+
with:
|
|
54
|
+
platforms: ${{ matrix.platform }}
|
|
55
|
+
labels: ${{ steps.meta.outputs.labels }}
|
|
56
|
+
tags: |
|
|
57
|
+
${{ env.GITHUB_CR_REPO }}
|
|
58
|
+
outputs: type=image,push-by-digest=true,name-canonical=true,push=true
|
|
59
|
+
|
|
60
|
+
- name: Export digest
|
|
61
|
+
run: |
|
|
62
|
+
mkdir -p ${{ runner.temp }}/digests
|
|
63
|
+
digest="${{ steps.build.outputs.digest }}"
|
|
64
|
+
touch "${{ runner.temp }}/digests/${digest#sha256:}"
|
|
65
|
+
|
|
66
|
+
- name: Upload digest
|
|
67
|
+
uses: actions/upload-artifact@v4
|
|
68
|
+
with:
|
|
69
|
+
name: digests-${{ env.PLATFORM_PAIR }}
|
|
70
|
+
path: ${{ runner.temp }}/digests/*
|
|
71
|
+
if-no-files-found: error
|
|
72
|
+
retention-days: 1
|
|
73
|
+
|
|
74
|
+
merge:
|
|
75
|
+
runs-on: ubuntu-latest
|
|
76
|
+
needs:
|
|
77
|
+
- build
|
|
78
|
+
steps:
|
|
79
|
+
- name: Download digests
|
|
80
|
+
uses: actions/download-artifact@v4
|
|
81
|
+
with:
|
|
82
|
+
path: ${{ runner.temp }}/digests
|
|
83
|
+
pattern: digests-*
|
|
84
|
+
merge-multiple: true
|
|
85
|
+
|
|
86
|
+
- name: Login to GHCR
|
|
87
|
+
uses: docker/login-action@v3
|
|
88
|
+
with:
|
|
89
|
+
registry: ghcr.io
|
|
90
|
+
username: ${{ github.repository_owner }}
|
|
91
|
+
password: ${{ secrets.GITHUB_TOKEN }}
|
|
92
|
+
|
|
93
|
+
- name: Set up Docker Buildx
|
|
94
|
+
uses: docker/setup-buildx-action@v3
|
|
95
|
+
|
|
96
|
+
- name: Docker meta
|
|
97
|
+
id: meta
|
|
98
|
+
uses: docker/metadata-action@v5
|
|
99
|
+
with:
|
|
100
|
+
images: |
|
|
101
|
+
${{ env.GITHUB_CR_REPO }}
|
|
102
|
+
tags: |
|
|
103
|
+
type=ref,event=branch
|
|
104
|
+
type=ref,event=pr
|
|
105
|
+
type=semver,pattern={{version}}
|
|
106
|
+
type=semver,pattern={{major}}.{{minor}}
|
|
107
|
+
|
|
108
|
+
- name: Docker tags
|
|
109
|
+
run: |
|
|
110
|
+
tags=$(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON")
|
|
111
|
+
if [ -z "$tags" ]; then
|
|
112
|
+
echo "DOCKER_METADATA_OUTPUT_VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
|
|
113
|
+
tags="-t ${{ env.GITHUB_CR_REPO }}:${{ github.ref_name }}"
|
|
114
|
+
fi
|
|
115
|
+
echo "DOCKER_METADATA_TAGS=$tags" >> $GITHUB_ENV
|
|
116
|
+
|
|
117
|
+
- name: Create manifest list and push
|
|
118
|
+
working-directory: ${{ runner.temp }}/digests
|
|
119
|
+
run: |
|
|
120
|
+
docker buildx imagetools create ${{ env.DOCKER_METADATA_TAGS }} \
|
|
121
|
+
$(printf '${{ env.GITHUB_CR_REPO }}@sha256:%s ' *)
|
|
122
|
+
|
|
123
|
+
- name: Inspect image
|
|
124
|
+
run: |
|
|
125
|
+
docker buildx imagetools inspect ${{ env.GITHUB_CR_REPO }}:${{ env.DOCKER_METADATA_OUTPUT_VERSION }}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
release:
|
|
6
|
+
types: [published]
|
|
7
|
+
push:
|
|
8
|
+
branches: [main]
|
|
9
|
+
paths-ignore:
|
|
10
|
+
- .github/**
|
|
11
|
+
|
|
12
|
+
env:
|
|
13
|
+
PYPI_PKG_NAME: mcp-notify
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
build:
|
|
17
|
+
name: Build distribution 📦
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v4
|
|
21
|
+
with:
|
|
22
|
+
persist-credentials: false
|
|
23
|
+
|
|
24
|
+
- name: Set up Python
|
|
25
|
+
uses: actions/setup-python@v5
|
|
26
|
+
with:
|
|
27
|
+
python-version: "3.x"
|
|
28
|
+
|
|
29
|
+
- name: Install pypa/build
|
|
30
|
+
run: python3 -m pip install build --user
|
|
31
|
+
|
|
32
|
+
- name: Build a binary wheel and a source tarball
|
|
33
|
+
run: python3 -m build
|
|
34
|
+
|
|
35
|
+
- name: Store the distribution packages
|
|
36
|
+
uses: actions/upload-artifact@v4
|
|
37
|
+
with:
|
|
38
|
+
name: python-package-distributions
|
|
39
|
+
path: dist/
|
|
40
|
+
|
|
41
|
+
publish-to-pypi:
|
|
42
|
+
name: Publish Python 🐍 distribution 📦 to PyPI
|
|
43
|
+
if: startsWith(github.ref, 'refs/tags/')
|
|
44
|
+
needs:
|
|
45
|
+
- build
|
|
46
|
+
runs-on: ubuntu-latest
|
|
47
|
+
environment:
|
|
48
|
+
name: pypi
|
|
49
|
+
url: https://pypi.org/p/${{ env.PYPI_PKG_NAME }}
|
|
50
|
+
permissions:
|
|
51
|
+
id-token: write
|
|
52
|
+
steps:
|
|
53
|
+
- name: Download all the dists
|
|
54
|
+
uses: actions/download-artifact@v4
|
|
55
|
+
with:
|
|
56
|
+
name: python-package-distributions
|
|
57
|
+
path: dist/
|
|
58
|
+
|
|
59
|
+
- name: Publish distribution 📦 to PyPI
|
|
60
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
61
|
+
with:
|
|
62
|
+
password: ${{ secrets.PYPI_API_TOKEN }}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
release:
|
|
6
|
+
types: [published]
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
release:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
permissions:
|
|
12
|
+
id-token: write # Required for OIDC authentication with MCP Registry
|
|
13
|
+
contents: read
|
|
14
|
+
steps:
|
|
15
|
+
- name: Wait for release
|
|
16
|
+
if: "github.event_name == 'release'"
|
|
17
|
+
run: sleep 120
|
|
18
|
+
|
|
19
|
+
- uses: actions/checkout@v4
|
|
20
|
+
|
|
21
|
+
- name: Install MCP Publisher
|
|
22
|
+
#if: "!github.event.release.prerelease"
|
|
23
|
+
run: |
|
|
24
|
+
curl -o mcp-publisher.tgz -L "https://github.com/modelcontextprotocol/registry/releases/latest/download/mcp-publisher_$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/').tar.gz"
|
|
25
|
+
tar zxvf mcp-publisher.tgz mcp-publisher
|
|
26
|
+
|
|
27
|
+
- name: Login to MCP Registry
|
|
28
|
+
#if: "!github.event.release.prerelease"
|
|
29
|
+
run: ./mcp-publisher login github-oidc
|
|
30
|
+
|
|
31
|
+
- name: Publish to MCP Registry
|
|
32
|
+
#if: "!github.event.release.prerelease"
|
|
33
|
+
run: ./mcp-publisher publish
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.13
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
FROM ghcr.io/astral-sh/uv:python3.13-alpine
|
|
2
|
+
|
|
3
|
+
LABEL io.modelcontextprotocol.server.name="io.github.aahl/mcp-notify"
|
|
4
|
+
|
|
5
|
+
ENV PYTHONUNBUFFERED=1 \
|
|
6
|
+
UV_COMPILE_BYTECODE=1 \
|
|
7
|
+
UV_LINK_MODE=copy \
|
|
8
|
+
PATH="/app/.venv/bin:$PATH" \
|
|
9
|
+
TRANSPORT=http \
|
|
10
|
+
PORT=80
|
|
11
|
+
|
|
12
|
+
WORKDIR /app
|
|
13
|
+
COPY . .
|
|
14
|
+
|
|
15
|
+
RUN --mount=type=cache,target=/root/.cache/uv \
|
|
16
|
+
uv sync --locked --no-dev
|
|
17
|
+
|
|
18
|
+
CMD ["uv", "run", "-m", "mcp_notify"]
|
|
19
|
+
HEALTHCHECK --interval=1m --start-period=30s CMD nc -zn 0.0.0.0 $PORT || exit 1
|
mcp_notify-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 aahl
|
|
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.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mcp-notify
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: MCP Server for notify
|
|
5
|
+
Project-URL: Repository, https://github.com/aahl/mcp-notify
|
|
6
|
+
License: MIT
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Keywords: llm,mcp,notify,telegram,weixin,wework
|
|
9
|
+
Requires-Python: >=3.10
|
|
10
|
+
Requires-Dist: fastmcp>=2.0.0
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
|
|
13
|
+
# 💬 Notify MCP Server
|
|
14
|
+
|
|
15
|
+
<!-- mcp-name: io.github.aahl/mcp-notify -->
|
|
16
|
+
|
|
17
|
+
提供消息推送的 MCP (Model Context Protocol) 服务器
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
## 安装
|
|
21
|
+
|
|
22
|
+
### 方式1: uvx
|
|
23
|
+
```yaml
|
|
24
|
+
{
|
|
25
|
+
"mcpServers": {
|
|
26
|
+
"mcp-notify": {
|
|
27
|
+
"command": "uvx",
|
|
28
|
+
"args": ["mcp-notify"],
|
|
29
|
+
"env": {
|
|
30
|
+
"WEWORK_BOT_KEY": "your-wework-bot-key" # 企业微信群机器人key
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### 方式2: Docker
|
|
38
|
+
```bash
|
|
39
|
+
mkdir /opt/mcp-notify
|
|
40
|
+
cd /opt/mcp-notify
|
|
41
|
+
wget https://raw.githubusercontent.com/aahl/mcp-notify/refs/heads/main/docker-compose.yml
|
|
42
|
+
docker-compose up -d
|
|
43
|
+
```
|
|
44
|
+
```yaml
|
|
45
|
+
{
|
|
46
|
+
"mcpServers": {
|
|
47
|
+
"mcp-notify": {
|
|
48
|
+
"url": "http://0.0.0.0:8809/mcp" # Streamable HTTP
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
```
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# 💬 Notify MCP Server
|
|
2
|
+
|
|
3
|
+
<!-- mcp-name: io.github.aahl/mcp-notify -->
|
|
4
|
+
|
|
5
|
+
提供消息推送的 MCP (Model Context Protocol) 服务器
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## 安装
|
|
9
|
+
|
|
10
|
+
### 方式1: uvx
|
|
11
|
+
```yaml
|
|
12
|
+
{
|
|
13
|
+
"mcpServers": {
|
|
14
|
+
"mcp-notify": {
|
|
15
|
+
"command": "uvx",
|
|
16
|
+
"args": ["mcp-notify"],
|
|
17
|
+
"env": {
|
|
18
|
+
"WEWORK_BOT_KEY": "your-wework-bot-key" # 企业微信群机器人key
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### 方式2: Docker
|
|
26
|
+
```bash
|
|
27
|
+
mkdir /opt/mcp-notify
|
|
28
|
+
cd /opt/mcp-notify
|
|
29
|
+
wget https://raw.githubusercontent.com/aahl/mcp-notify/refs/heads/main/docker-compose.yml
|
|
30
|
+
docker-compose up -d
|
|
31
|
+
```
|
|
32
|
+
```yaml
|
|
33
|
+
{
|
|
34
|
+
"mcpServers": {
|
|
35
|
+
"mcp-notify": {
|
|
36
|
+
"url": "http://0.0.0.0:8809/mcp" # Streamable HTTP
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
```
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import logging
|
|
3
|
+
import argparse
|
|
4
|
+
import requests
|
|
5
|
+
import hashlib
|
|
6
|
+
import base64
|
|
7
|
+
from fastmcp import FastMCP
|
|
8
|
+
from pydantic import Field
|
|
9
|
+
from starlette.middleware.cors import CORSMiddleware
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
_LOGGER = logging.getLogger(__name__)
|
|
13
|
+
|
|
14
|
+
mcp = FastMCP(name="mcp-notify")
|
|
15
|
+
|
|
16
|
+
WEWORK_BOT_KEY = os.getenv("WEWORK_BOT_KEY", "")
|
|
17
|
+
WEWORK_BASE_URL = os.getenv("WEWORK_BASE_URL") or "https://qyapi.weixin.qq.com"
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@mcp.tool(
|
|
21
|
+
title="企业微信群机器人-发送文本消息",
|
|
22
|
+
description="通过企业微信群机器人发送文本或Markdown消息",
|
|
23
|
+
)
|
|
24
|
+
def wework_send_text(
|
|
25
|
+
text: str = Field(description="消息内容,长度限制: (text: 2048个字节, markdown_v2: 4096个字节)"),
|
|
26
|
+
msgtype: str = Field("text", description="内容类型,仅支持: text/markdown_v2"),
|
|
27
|
+
bot_key: str = Field(WEWORK_BOT_KEY, description="机器人key,uuid格式"),
|
|
28
|
+
):
|
|
29
|
+
if msgtype == "markdown":
|
|
30
|
+
msgtype = "markdown_v2"
|
|
31
|
+
res = requests.post(
|
|
32
|
+
f"{WEWORK_BASE_URL}/cgi-bin/webhook/send?key={bot_key}",
|
|
33
|
+
json={"msgtype": msgtype, msgtype: {"content": text}},
|
|
34
|
+
)
|
|
35
|
+
return res.json()
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
@mcp.tool(
|
|
39
|
+
title="企业微信群机器人-发送图片消息",
|
|
40
|
+
description="通过企业微信群机器人发送图片消息",
|
|
41
|
+
)
|
|
42
|
+
def wework_send_image(
|
|
43
|
+
url: str = Field(description="图片url"),
|
|
44
|
+
bot_key: str = Field(WEWORK_BOT_KEY, description="机器人key,uuid格式"),
|
|
45
|
+
):
|
|
46
|
+
res = requests.get(url, timeout=60)
|
|
47
|
+
res.raise_for_status()
|
|
48
|
+
b64str = base64.b64encode(res.content).decode()
|
|
49
|
+
md5str = hashlib.md5(res.content).hexdigest()
|
|
50
|
+
res = requests.post(
|
|
51
|
+
f"{WEWORK_BASE_URL}/cgi-bin/webhook/send?key={bot_key}",
|
|
52
|
+
json={"msgtype": "image", "image": {"base64": b64str, "md5": md5str}},
|
|
53
|
+
)
|
|
54
|
+
return res.json()
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
@mcp.tool(
|
|
58
|
+
title="企业微信群机器人-发送图文消息",
|
|
59
|
+
description="通过企业微信群机器人发送图文链接消息",
|
|
60
|
+
)
|
|
61
|
+
def wework_send_news(
|
|
62
|
+
title: str = Field(description="标题,不超过128个字节"),
|
|
63
|
+
description: str = Field("", description="描述,不超过512个字节"),
|
|
64
|
+
url: str = Field(description="跳转链接,必填"),
|
|
65
|
+
picurl: str = Field("", description="图片url"),
|
|
66
|
+
bot_key: str = Field(WEWORK_BOT_KEY, description="机器人key,uuid格式"),
|
|
67
|
+
):
|
|
68
|
+
res = requests.post(
|
|
69
|
+
f"{WEWORK_BASE_URL}/cgi-bin/webhook/send?key={bot_key}",
|
|
70
|
+
json={
|
|
71
|
+
"msgtype": "news",
|
|
72
|
+
"news": {
|
|
73
|
+
"articles": [
|
|
74
|
+
{
|
|
75
|
+
"title": title,
|
|
76
|
+
"description": description,
|
|
77
|
+
"url": url,
|
|
78
|
+
"picurl": picurl,
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
)
|
|
84
|
+
return res.json()
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def main():
|
|
88
|
+
mode = os.getenv("TRANSPORT")
|
|
89
|
+
port = int(os.getenv("PORT", 0)) or 80
|
|
90
|
+
parser = argparse.ArgumentParser(description="Notify MCP Server")
|
|
91
|
+
parser.add_argument("--http", action="store_true", help="Use streamable HTTP mode instead of stdio")
|
|
92
|
+
parser.add_argument("--host", default="0.0.0.0", help="Host to bind to (default: 0.0.0.0)")
|
|
93
|
+
parser.add_argument("--port", type=int, default=port, help=f"Port to listen on (default: {port})")
|
|
94
|
+
|
|
95
|
+
args = parser.parse_args()
|
|
96
|
+
if args.http or mode == "http":
|
|
97
|
+
app = mcp.streamable_http_app()
|
|
98
|
+
app.add_middleware(
|
|
99
|
+
CORSMiddleware,
|
|
100
|
+
allow_origins=["*"],
|
|
101
|
+
allow_credentials=True,
|
|
102
|
+
allow_methods=["GET", "POST", "OPTIONS"],
|
|
103
|
+
allow_headers=["*"],
|
|
104
|
+
expose_headers=["mcp-session-id", "mcp-protocol-version"],
|
|
105
|
+
max_age=86400,
|
|
106
|
+
)
|
|
107
|
+
mcp.run(transport="http", host=args.host, port=args.port)
|
|
108
|
+
else:
|
|
109
|
+
mcp.run()
|
|
110
|
+
|
|
111
|
+
if __name__ == "__main__":
|
|
112
|
+
main()
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "mcp-notify"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "MCP Server for notify"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.10"
|
|
7
|
+
keywords = ["notify", "telegram", "weixin", "wework", "mcp", "llm"]
|
|
8
|
+
license = { text = "MIT" }
|
|
9
|
+
dependencies = [
|
|
10
|
+
"fastmcp>=2.0.0",
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
[project.urls]
|
|
14
|
+
Repository = "https://github.com/aahl/mcp-notify"
|
|
15
|
+
|
|
16
|
+
[project.scripts]
|
|
17
|
+
mcp-notify = "mcp_notify:main"
|
|
18
|
+
|
|
19
|
+
[build-system]
|
|
20
|
+
requires = ["hatchling"]
|
|
21
|
+
build-backend = "hatchling.build"
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-10-17/server.schema.json",
|
|
3
|
+
"name": "io.github.aahl/mcp-notify",
|
|
4
|
+
"title": "Notify MCP Server",
|
|
5
|
+
"description": "MCP Server for notify",
|
|
6
|
+
"version": "0.1.0",
|
|
7
|
+
"repository": {
|
|
8
|
+
"url": "https://github.com/aahl/mcp-notify",
|
|
9
|
+
"source": "github"
|
|
10
|
+
},
|
|
11
|
+
"packages": [
|
|
12
|
+
{
|
|
13
|
+
"registryType": "pypi",
|
|
14
|
+
"identifier": "mcp-notify",
|
|
15
|
+
"version": "0.1.0",
|
|
16
|
+
"transport": {"type": "stdio"}
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"registryType": "oci",
|
|
20
|
+
"identifier": "ghcr.io/aahl/mcp-notify:latest",
|
|
21
|
+
"transport": {"type": "stdio"}
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
}
|