pushpage-mcp 1.8.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.
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
HELP.md
|
|
2
|
+
target/
|
|
3
|
+
.mvn/wrapper/maven-wrapper.jar
|
|
4
|
+
!**/src/main/**/target/
|
|
5
|
+
!**/src/test/**/target/
|
|
6
|
+
|
|
7
|
+
### STS ###
|
|
8
|
+
.apt_generated
|
|
9
|
+
.classpath
|
|
10
|
+
.factorypath
|
|
11
|
+
.project
|
|
12
|
+
.settings
|
|
13
|
+
.springBeans
|
|
14
|
+
.sts4-cache
|
|
15
|
+
|
|
16
|
+
### IntelliJ IDEA ###
|
|
17
|
+
.idea
|
|
18
|
+
*.iws
|
|
19
|
+
*.iml
|
|
20
|
+
*.ipr
|
|
21
|
+
|
|
22
|
+
### NetBeans ###
|
|
23
|
+
/nbproject/private/
|
|
24
|
+
/nbbuild/
|
|
25
|
+
/dist/
|
|
26
|
+
/nbdist/
|
|
27
|
+
/.nb-gradle/
|
|
28
|
+
build/
|
|
29
|
+
!**/src/main/**/build/
|
|
30
|
+
!**/src/test/**/build/
|
|
31
|
+
|
|
32
|
+
### VS Code ###
|
|
33
|
+
.vscode/
|
|
34
|
+
|
|
35
|
+
### postpage local dev ###
|
|
36
|
+
data/
|
|
37
|
+
pages/
|
|
38
|
+
|
|
39
|
+
.claude/
|
|
40
|
+
.env
|
|
41
|
+
mcp/__pycache__/
|
|
42
|
+
mcp/pushpage_mcp/__pycache__/
|
|
43
|
+
mcp/dist/
|
|
44
|
+
mcp/*.egg-info/
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ramy Mohamed
|
|
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,71 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: pushpage-mcp
|
|
3
|
+
Version: 1.8.0
|
|
4
|
+
Summary: MCP server for pushpage: let AI agents publish HTML as shareable URLs.
|
|
5
|
+
Project-URL: Homepage, https://pushpage.link
|
|
6
|
+
Project-URL: Repository, https://github.com/rgf2004/pushpage
|
|
7
|
+
Project-URL: Documentation, https://github.com/rgf2004/pushpage/blob/main/docs/mcp.md
|
|
8
|
+
Author: rgf2004
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: ai-agents,html,mcp,model-context-protocol,publishing
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
14
|
+
Requires-Python: >=3.10
|
|
15
|
+
Requires-Dist: fastmcp>=4.1.8
|
|
16
|
+
Requires-Dist: httpx>=0.28.1
|
|
17
|
+
Requires-Dist: uvicorn>=0.54.0
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
|
|
20
|
+
# pushpage MCP server
|
|
21
|
+
|
|
22
|
+
MCP server for [pushpage](https://pushpage.link), an HTML publishing service for AI agents. An agent sends HTML and gets a shareable URL back, instead of pasting long output into chat.
|
|
23
|
+
|
|
24
|
+
<!-- mcp-name: io.github.rgf2004/pushpage -->
|
|
25
|
+
mcp-name: io.github.rgf2004/pushpage
|
|
26
|
+
|
|
27
|
+
**Tools:** `publish_page`, `list_pages`, `delete_page`, `health`.
|
|
28
|
+
|
|
29
|
+
## Run it locally (stdio)
|
|
30
|
+
|
|
31
|
+
No key is needed to try it: without one the server runs in **guest mode** (`publish_page` works, pages expire after 30 minutes, and the result tells you to sign up or sign in). For permanent pages, `list_pages` and `delete_page`, get an API key from the Account tab of https://pushpage.link/dashboard and add this to your MCP client:
|
|
32
|
+
|
|
33
|
+
```json
|
|
34
|
+
{
|
|
35
|
+
"mcpServers": {
|
|
36
|
+
"pushpage": {
|
|
37
|
+
"command": "uvx",
|
|
38
|
+
"args": ["pushpage-mcp"],
|
|
39
|
+
"env": { "PUSHPAGE_API_KEY": "pp_your_key_here" }
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Claude Code:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
claude mcp add pushpage -e PUSHPAGE_API_KEY=pp_your_key_here -- uvx pushpage-mcp
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Requires [uv](https://docs.astral.sh/uv/). To use a self-hosted instance, set `PUSHPAGE_URL` to its API address and `PUSHPAGE_PUBLIC_URL` to its public address (used for the sign-up links in guest mode). Both default to `https://pushpage.link`.
|
|
52
|
+
|
|
53
|
+
## No install: hosted endpoint
|
|
54
|
+
|
|
55
|
+
`https://pushpage.link/mcp` (streamable-http). Try it in guest mode with one command and no key:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
claude mcp add --transport http pushpage https://pushpage.link/mcp
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
With an account, send the key as `X-Api-Key` or `Authorization: Bearer`:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
claude mcp add --transport http pushpage https://pushpage.link/mcp --header "Authorization: Bearer pp_your_key_here"
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Options
|
|
68
|
+
|
|
69
|
+
`pushpage-mcp --http [--host H] [--port P]` serves streamable-http at `/mcp` instead of stdio. In that mode each client supplies its own key in the request headers, or none for guest mode.
|
|
70
|
+
|
|
71
|
+
Source, docs and self-hosting: https://github.com/rgf2004/pushpage (MIT).
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# pushpage MCP server
|
|
2
|
+
|
|
3
|
+
MCP server for [pushpage](https://pushpage.link), an HTML publishing service for AI agents. An agent sends HTML and gets a shareable URL back, instead of pasting long output into chat.
|
|
4
|
+
|
|
5
|
+
<!-- mcp-name: io.github.rgf2004/pushpage -->
|
|
6
|
+
mcp-name: io.github.rgf2004/pushpage
|
|
7
|
+
|
|
8
|
+
**Tools:** `publish_page`, `list_pages`, `delete_page`, `health`.
|
|
9
|
+
|
|
10
|
+
## Run it locally (stdio)
|
|
11
|
+
|
|
12
|
+
No key is needed to try it: without one the server runs in **guest mode** (`publish_page` works, pages expire after 30 minutes, and the result tells you to sign up or sign in). For permanent pages, `list_pages` and `delete_page`, get an API key from the Account tab of https://pushpage.link/dashboard and add this to your MCP client:
|
|
13
|
+
|
|
14
|
+
```json
|
|
15
|
+
{
|
|
16
|
+
"mcpServers": {
|
|
17
|
+
"pushpage": {
|
|
18
|
+
"command": "uvx",
|
|
19
|
+
"args": ["pushpage-mcp"],
|
|
20
|
+
"env": { "PUSHPAGE_API_KEY": "pp_your_key_here" }
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Claude Code:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
claude mcp add pushpage -e PUSHPAGE_API_KEY=pp_your_key_here -- uvx pushpage-mcp
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Requires [uv](https://docs.astral.sh/uv/). To use a self-hosted instance, set `PUSHPAGE_URL` to its API address and `PUSHPAGE_PUBLIC_URL` to its public address (used for the sign-up links in guest mode). Both default to `https://pushpage.link`.
|
|
33
|
+
|
|
34
|
+
## No install: hosted endpoint
|
|
35
|
+
|
|
36
|
+
`https://pushpage.link/mcp` (streamable-http). Try it in guest mode with one command and no key:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
claude mcp add --transport http pushpage https://pushpage.link/mcp
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
With an account, send the key as `X-Api-Key` or `Authorization: Bearer`:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
claude mcp add --transport http pushpage https://pushpage.link/mcp --header "Authorization: Bearer pp_your_key_here"
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Options
|
|
49
|
+
|
|
50
|
+
`pushpage-mcp --http [--host H] [--port P]` serves streamable-http at `/mcp` instead of stdio. In that mode each client supplies its own key in the request headers, or none for guest mode.
|
|
51
|
+
|
|
52
|
+
Source, docs and self-hosting: https://github.com/rgf2004/pushpage (MIT).
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
import os
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
import uvicorn
|
|
6
|
+
from fastmcp import FastMCP
|
|
7
|
+
from fastmcp.server.dependencies import get_http_request
|
|
8
|
+
|
|
9
|
+
_url = os.environ.get("PUSHPAGE_URL", "https://pushpage.link").rstrip("/")
|
|
10
|
+
# Public address users should open to sign up / sign in (differs from _url when the MCP
|
|
11
|
+
# container talks to the publisher over an internal address).
|
|
12
|
+
_public_url = os.environ.get("PUSHPAGE_PUBLIC_URL", "https://pushpage.link").rstrip("/")
|
|
13
|
+
|
|
14
|
+
mcp = FastMCP(
|
|
15
|
+
"pushpage",
|
|
16
|
+
instructions=(
|
|
17
|
+
"Publish HTML as shareable pages, list your pages, and delete them by ID. "
|
|
18
|
+
"The id returned by publish_page can be passed directly to delete_page. "
|
|
19
|
+
"No API key is needed to try it: without one, publish_page works in guest mode "
|
|
20
|
+
"(pages expire after 30 minutes). Sign up or sign in to the pushpage dashboard to "
|
|
21
|
+
"get an API key for permanent accounts, list_pages and delete_page."
|
|
22
|
+
),
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
# ── Helpers ───────────────────────────────────────────────────────────────────
|
|
27
|
+
|
|
28
|
+
def _api_key() -> str:
|
|
29
|
+
"""API key for the current call.
|
|
30
|
+
|
|
31
|
+
HTTP transport: taken from the request headers (each client sends its own).
|
|
32
|
+
stdio transport (no HTTP request): taken from PUSHPAGE_API_KEY, or from
|
|
33
|
+
AUTHORIZATION (``Bearer <key>``), set by the client launching the process.
|
|
34
|
+
"""
|
|
35
|
+
try:
|
|
36
|
+
request = get_http_request()
|
|
37
|
+
except RuntimeError:
|
|
38
|
+
return _env_api_key()
|
|
39
|
+
headers = dict(request.headers)
|
|
40
|
+
auth = headers.get("authorization", "")
|
|
41
|
+
key = auth[len("Bearer "):].strip() if auth.lower().startswith("bearer ") else ""
|
|
42
|
+
return key or headers.get("x-api-key", "").strip()
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def _env_api_key() -> str:
|
|
46
|
+
key = os.environ.get("PUSHPAGE_API_KEY", "").strip()
|
|
47
|
+
if key:
|
|
48
|
+
return key
|
|
49
|
+
# Env var names are case-sensitive on Linux; some launchers (e.g. Glama) pass "Authorization".
|
|
50
|
+
auth = (os.environ.get("AUTHORIZATION") or os.environ.get("Authorization") or "").strip()
|
|
51
|
+
return auth[len("Bearer "):].strip() if auth.lower().startswith("bearer ") else auth
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def _client_ip_headers() -> dict:
|
|
55
|
+
"""Forward the real client IP so the publisher rate-limits per client, not per MCP container.
|
|
56
|
+
|
|
57
|
+
nginx sets X-Real-IP from the connecting address, so it is trustworthy here. Not available
|
|
58
|
+
over stdio (the caller is local), where the publisher sees this machine's own address.
|
|
59
|
+
"""
|
|
60
|
+
try:
|
|
61
|
+
request = get_http_request()
|
|
62
|
+
except RuntimeError:
|
|
63
|
+
return {}
|
|
64
|
+
ip = request.headers.get("x-real-ip") or (request.client.host if request.client else "")
|
|
65
|
+
return {"X-Real-IP": ip, "X-Forwarded-For": ip} if ip else {}
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def _client() -> httpx.Client:
|
|
69
|
+
headers = {"Content-Type": "application/json", **_client_ip_headers()}
|
|
70
|
+
key = _api_key()
|
|
71
|
+
if key:
|
|
72
|
+
# Omit the header entirely for guests: the API treats an empty key as invalid.
|
|
73
|
+
headers["X-Api-Key"] = key
|
|
74
|
+
return httpx.Client(base_url=_url, headers=headers, timeout=30)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def _signup_message(reason: str) -> str:
|
|
78
|
+
return (
|
|
79
|
+
f"{reason} Sign up or sign in at {_public_url}/dashboard to get an API key, "
|
|
80
|
+
"then set it as the X-Api-Key header (or the PUSHPAGE_API_KEY environment variable "
|
|
81
|
+
"for the local uvx server) and reconnect."
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def _guest_sign_in_required(what: str) -> dict:
|
|
86
|
+
return {
|
|
87
|
+
"error": "Sign in required",
|
|
88
|
+
"guest_mode": True,
|
|
89
|
+
"message": _signup_message(f"{what} needs a pushpage account, and this session is in guest mode (no API key)."),
|
|
90
|
+
"signup_url": f"{_public_url}/dashboard",
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
# ── Tools ─────────────────────────────────────────────────────────────────────
|
|
95
|
+
|
|
96
|
+
@mcp.tool(annotations={"title": "Publish HTML page", "readOnlyHint": False,
|
|
97
|
+
"destructiveHint": False, "idempotentHint": False,
|
|
98
|
+
"openWorldHint": False})
|
|
99
|
+
def publish_page(html: str, title: str | None = None) -> dict:
|
|
100
|
+
"""Publish a self-contained HTML document as a public page and return its shareable URL.
|
|
101
|
+
|
|
102
|
+
Use this to share rich output (reports, dashboards, prototypes) as a link instead of
|
|
103
|
+
pasting it into chat. Each call creates a NEW page with a new id; it never updates an
|
|
104
|
+
existing one (delete the old page with delete_page if you are replacing it).
|
|
105
|
+
The page is served publicly at the returned URL, sandboxed (scripts run, but cannot
|
|
106
|
+
access the pushpage dashboard or API), so do not include secrets.
|
|
107
|
+
|
|
108
|
+
Works without an API key in GUEST MODE: the page is created anonymously and is deleted
|
|
109
|
+
after 30 minutes. In that case the result includes guest_mode=true and a message telling
|
|
110
|
+
the user to sign up or sign in at the pushpage dashboard for an API key (permanent
|
|
111
|
+
retention per plan, list_pages and delete_page). Always relay that message to the user.
|
|
112
|
+
An invalid API key is rejected with 401; it is never silently downgraded to guest mode.
|
|
113
|
+
|
|
114
|
+
Args:
|
|
115
|
+
html: Complete HTML document (inline CSS/JS; external resources are fine).
|
|
116
|
+
Maximum size is set by the service (1 MB by default).
|
|
117
|
+
title: Optional display title shown in list_pages. If omitted it is taken from
|
|
118
|
+
the HTML <title> tag, falling back to 'Untitled'.
|
|
119
|
+
|
|
120
|
+
Returns:
|
|
121
|
+
{url, id, expires_at} on success: the public URL, the page id (pass it to
|
|
122
|
+
delete_page), and the ISO-8601 time the page is deleted automatically (set by the
|
|
123
|
+
account's retention plan, or 30 minutes in guest mode). Guest results also carry
|
|
124
|
+
guest_mode=true, message and signup_url. On failure: {error, status_code, detail},
|
|
125
|
+
e.g. 401 for an invalid API key, 400 if html is empty, 413 if the HTML is too large,
|
|
126
|
+
429 if the quota or rate limit is exceeded (guest results then also carry a sign-up
|
|
127
|
+
message, since accounts have higher limits).
|
|
128
|
+
"""
|
|
129
|
+
guest = not _api_key()
|
|
130
|
+
with _client() as client:
|
|
131
|
+
payload = {"html": html}
|
|
132
|
+
if title is not None:
|
|
133
|
+
payload["title"] = title
|
|
134
|
+
r = client.post("/api/pages", json=payload)
|
|
135
|
+
try:
|
|
136
|
+
r.raise_for_status()
|
|
137
|
+
except httpx.HTTPStatusError as e:
|
|
138
|
+
result = {"error": "Failed to publish page", "status_code": e.response.status_code, "detail": e.response.text}
|
|
139
|
+
if guest and e.response.status_code == 429:
|
|
140
|
+
result["guest_mode"] = True
|
|
141
|
+
result["message"] = _signup_message("Guest publishing is rate limited.")
|
|
142
|
+
result["signup_url"] = f"{_public_url}/dashboard"
|
|
143
|
+
return result
|
|
144
|
+
data = r.json()
|
|
145
|
+
result = {"url": data["url"], "id": data["id"], "expires_at": data["expires_at"]}
|
|
146
|
+
if guest:
|
|
147
|
+
result["guest_mode"] = True
|
|
148
|
+
result["message"] = _signup_message(
|
|
149
|
+
"Published in guest mode: this page is deleted after 30 minutes (see expires_at)."
|
|
150
|
+
)
|
|
151
|
+
result["signup_url"] = f"{_public_url}/dashboard"
|
|
152
|
+
return result
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
@mcp.tool(annotations={"title": "List my pages", "readOnlyHint": True,
|
|
156
|
+
"destructiveHint": False, "idempotentHint": True,
|
|
157
|
+
"openWorldHint": False})
|
|
158
|
+
def list_pages() -> list[dict]:
|
|
159
|
+
"""List the pages published with the current API key's account, including expiry.
|
|
160
|
+
|
|
161
|
+
Read-only. Takes no arguments. Admin accounts see every user's pages. Requires an API key:
|
|
162
|
+
in guest mode (no key) it returns a one-element list with guest_mode=true and a message
|
|
163
|
+
telling the user to sign up or sign in at the pushpage dashboard; relay that message.
|
|
164
|
+
|
|
165
|
+
Returns:
|
|
166
|
+
A list of page objects, each with id, title, url, created_at and expires_at
|
|
167
|
+
(ISO-8601). Use an id with delete_page. On failure a one-element list
|
|
168
|
+
[{error, status_code, detail}], e.g. status 401 for a missing or invalid key.
|
|
169
|
+
"""
|
|
170
|
+
if not _api_key():
|
|
171
|
+
return [_guest_sign_in_required("Listing pages")]
|
|
172
|
+
with _client() as client:
|
|
173
|
+
r = client.get("/api/pages")
|
|
174
|
+
try:
|
|
175
|
+
r.raise_for_status()
|
|
176
|
+
except httpx.HTTPStatusError as e:
|
|
177
|
+
return [{"error": "Failed to list pages", "status_code": e.response.status_code, "detail": e.response.text}]
|
|
178
|
+
return r.json()
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
@mcp.tool(annotations={"title": "Delete a page", "readOnlyHint": False,
|
|
182
|
+
"destructiveHint": True, "idempotentHint": False,
|
|
183
|
+
"openWorldHint": False})
|
|
184
|
+
def delete_page(id: str) -> dict:
|
|
185
|
+
"""Permanently delete one of your published pages, making its URL stop working.
|
|
186
|
+
|
|
187
|
+
This cannot be undone. You can only delete your own pages (admin accounts can delete
|
|
188
|
+
any page). Requires an API key: in guest mode (no key) it returns guest_mode=true and a
|
|
189
|
+
message telling the user to sign up or sign in at the pushpage dashboard; relay that
|
|
190
|
+
message. Guest pages cannot be deleted; they expire after 30 minutes.
|
|
191
|
+
|
|
192
|
+
Args:
|
|
193
|
+
id: The page id returned by publish_page or listed by list_pages (for example
|
|
194
|
+
'a1b2c3d4'), not the full URL.
|
|
195
|
+
|
|
196
|
+
Returns:
|
|
197
|
+
{deleted: true, id} on success. On failure {error, status_code, detail}, e.g. 404
|
|
198
|
+
if the id does not exist, 403 if the page is not yours, 401 if the key is invalid.
|
|
199
|
+
"""
|
|
200
|
+
if not _api_key():
|
|
201
|
+
return _guest_sign_in_required("Deleting pages")
|
|
202
|
+
with _client() as client:
|
|
203
|
+
r = client.delete(f"/api/pages/{id}")
|
|
204
|
+
try:
|
|
205
|
+
r.raise_for_status()
|
|
206
|
+
except httpx.HTTPStatusError as e:
|
|
207
|
+
return {"error": "Failed to delete page", "status_code": e.response.status_code, "detail": e.response.text}
|
|
208
|
+
return {"deleted": True, "id": id}
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
@mcp.tool(annotations={"title": "Service health", "readOnlyHint": True,
|
|
212
|
+
"destructiveHint": False, "idempotentHint": True,
|
|
213
|
+
"openWorldHint": False})
|
|
214
|
+
def health() -> dict:
|
|
215
|
+
"""Check whether the pushpage service is reachable and healthy.
|
|
216
|
+
|
|
217
|
+
Read-only. Takes no arguments and does not require a valid API key.
|
|
218
|
+
|
|
219
|
+
Returns:
|
|
220
|
+
The service status object, e.g. {status: 'UP', version, uptimeSeconds, livePages,
|
|
221
|
+
storage}. On failure {error, status_code, detail}.
|
|
222
|
+
"""
|
|
223
|
+
with _client() as client:
|
|
224
|
+
r = client.get("/api/health")
|
|
225
|
+
try:
|
|
226
|
+
r.raise_for_status()
|
|
227
|
+
except httpx.HTTPStatusError as e:
|
|
228
|
+
return {"error": "Service unreachable", "status_code": e.response.status_code, "detail": e.response.text}
|
|
229
|
+
return r.json()
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
# ── Entry point ───────────────────────────────────────────────────────────────
|
|
233
|
+
|
|
234
|
+
def main(argv: list[str] | None = None, *, default_transport: str = "stdio",
|
|
235
|
+
default_host: str = "127.0.0.1") -> None:
|
|
236
|
+
"""Run the MCP server.
|
|
237
|
+
|
|
238
|
+
``pushpage-mcp`` (the PyPI command) defaults to stdio for local MCP clients.
|
|
239
|
+
The Docker image runs ``server.py``, which defaults to streamable-http.
|
|
240
|
+
"""
|
|
241
|
+
parser = argparse.ArgumentParser(
|
|
242
|
+
prog="pushpage-mcp",
|
|
243
|
+
description="pushpage MCP server: publish, list and delete HTML pages.",
|
|
244
|
+
)
|
|
245
|
+
mode = parser.add_mutually_exclusive_group()
|
|
246
|
+
mode.add_argument("--stdio", action="store_true", help="serve over stdio (local clients)")
|
|
247
|
+
mode.add_argument("--http", action="store_true", help="serve streamable-http at /mcp")
|
|
248
|
+
parser.add_argument("--host", default=os.environ.get("HOST", default_host),
|
|
249
|
+
help="HTTP bind address (default: %(default)s)")
|
|
250
|
+
parser.add_argument("--port", type=int, default=int(os.environ.get("PORT", "8000")),
|
|
251
|
+
help="HTTP port (default: %(default)s)")
|
|
252
|
+
args = parser.parse_args(argv)
|
|
253
|
+
|
|
254
|
+
if args.stdio:
|
|
255
|
+
transport = "stdio"
|
|
256
|
+
elif args.http:
|
|
257
|
+
transport = "http"
|
|
258
|
+
else:
|
|
259
|
+
transport = os.environ.get("PUSHPAGE_MCP_TRANSPORT", default_transport).lower()
|
|
260
|
+
|
|
261
|
+
if transport == "stdio":
|
|
262
|
+
# Launched by an MCP client; the API key comes from the environment.
|
|
263
|
+
mcp.run(transport="stdio")
|
|
264
|
+
return
|
|
265
|
+
app = mcp.http_app(path="/mcp", transport="streamable-http")
|
|
266
|
+
uvicorn.run(app, host=args.host, port=args.port)
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
def cli() -> None:
|
|
270
|
+
"""Console-script entry point (``pushpage-mcp``)."""
|
|
271
|
+
main()
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "pushpage-mcp"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "MCP server for pushpage: let AI agents publish HTML as shareable URLs."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
license-files = ["LICENSE"]
|
|
12
|
+
requires-python = ">=3.10"
|
|
13
|
+
authors = [{ name = "rgf2004" }]
|
|
14
|
+
keywords = ["mcp", "model-context-protocol", "ai-agents", "html", "publishing"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"Topic :: Software Development :: Libraries",
|
|
18
|
+
]
|
|
19
|
+
dependencies = [
|
|
20
|
+
"fastmcp>=4.1.8",
|
|
21
|
+
"httpx>=0.28.1",
|
|
22
|
+
"uvicorn>=0.54.0",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
[project.urls]
|
|
26
|
+
Homepage = "https://pushpage.link"
|
|
27
|
+
Repository = "https://github.com/rgf2004/pushpage"
|
|
28
|
+
Documentation = "https://github.com/rgf2004/pushpage/blob/main/docs/mcp.md"
|
|
29
|
+
|
|
30
|
+
[project.scripts]
|
|
31
|
+
pushpage-mcp = "pushpage_mcp.server:cli"
|
|
32
|
+
|
|
33
|
+
[tool.hatch.version]
|
|
34
|
+
path = "pushpage_mcp/__init__.py"
|
|
35
|
+
|
|
36
|
+
[tool.hatch.build.targets.wheel]
|
|
37
|
+
packages = ["pushpage_mcp"]
|
|
38
|
+
|
|
39
|
+
[tool.hatch.build.targets.sdist]
|
|
40
|
+
include = ["pushpage_mcp", "README.md", "LICENSE", "pyproject.toml"]
|