@page2ai/mcp 0.5.1 → 0.5.2
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.
- package/CHANGELOG.md +17 -0
- package/README.md +35 -2
- package/dist/bridge/server.d.ts +6 -0
- package/dist/bridge/server.d.ts.map +1 -1
- package/dist/bridge/server.js +20 -2
- package/dist/bridge/server.js.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/tools/page-to-markdown.d.ts +17 -0
- package/dist/tools/page-to-markdown.d.ts.map +1 -1
- package/dist/tools/page-to-markdown.js +79 -27
- package/dist/tools/page-to-markdown.js.map +1 -1
- package/manifest.json +2 -2
- package/package.json +1 -1
- package/server.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,23 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and
|
|
|
5
5
|
project uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html); while the
|
|
6
6
|
major version is `0`, a minor bump may carry breaking changes.
|
|
7
7
|
|
|
8
|
+
## 0.5.2 - 2026-10-23
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- **`url` and `html` together**: the HTML is converted and the URL is its address, never fetched; relative links and image sources resolve against it, and it fills the frontmatter's `source`. Up to 0.5.1 the pair was refused, so links in HTML from a browser tool stayed relative.
|
|
13
|
+
- **The tool description is accurate again.** 0.5.0 dropped the sentences saying the server reads only the page (no Markdown copy of a docs page) and why tab groups are split, and said a connected extension converts every page; it now says when Agent Bridge is used and that a page the extension declines is fetched by the server. Through the bridge the extension's own output settings apply, and `include_images` / `include_frontmatter` say so.
|
|
14
|
+
- **The hosted endpoint keeps the tool contract reviewed for the ChatGPT plugin**: `pageToMarkdownHostedDefinition` and `pageToMarkdownHostedInputSchema` are the 0.4.1 definition (a URL only, no Agent Bridge, which a hosted server never reaches). 0.5.0 had changed what ChatGPT runs by changing the shared definition; a test now pins the hosted one.
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- **A refusing extension no longer breaks `page_to_markdown`.** With the Agent Bridge connected, any extension error was returned as the tool's answer. Now a refusal (no site access, a sign-in page, a non-web URL) or a failed tab falls back to the server's own fetch, as with no extension, and the answer says why; a bridge timeout is still an error, so the caller's time is not spent twice.
|
|
19
|
+
- **A request no longer waits for its timeout when the extension disconnects**: it fails at once with `EXTENSION_DISCONNECTED`.
|
|
20
|
+
|
|
21
|
+
### Security
|
|
22
|
+
|
|
23
|
+
- **The bridge accepts Page2AI only**: its Chrome Web Store origin, any `moz-extension://` (Firefox gives each install a random UUID), and the exact origins in `PAGE2AI_BRIDGE_ORIGINS` (an unpacked build). Before, any installed extension could open the connection without a permission, read every URL the agent asked for and write what the agent read.
|
|
24
|
+
|
|
8
25
|
## 0.5.1 - 2026-10-22
|
|
9
26
|
|
|
10
27
|
### Fixed
|
package/README.md
CHANGED
|
@@ -160,7 +160,25 @@ command per client and a verification step.
|
|
|
160
160
|
|
|
161
161
|
| Tool | Description | Read-only | Example |
|
|
162
162
|
|------|-------------|-----------|---------|
|
|
163
|
-
| `page_to_markdown` | Fetch a web page URL and convert to clean Markdown | ✅ | `page_to_markdown(url="https://docs.anthropic.com/en/api/messages")` |
|
|
163
|
+
| `page_to_markdown` | Fetch a web page URL, or take its HTML, and convert to clean Markdown | ✅ | `page_to_markdown(url="https://docs.anthropic.com/en/api/messages")` |
|
|
164
|
+
|
|
165
|
+
### Pages behind a sign-in or rendered by JavaScript
|
|
166
|
+
|
|
167
|
+
The server fetches without cookies and runs no page scripts. For a page that needs either:
|
|
168
|
+
|
|
169
|
+
- **Pass the HTML you already have** (from Playwright, Chrome DevTools MCP or another browser
|
|
170
|
+
tool) as `html`, with the page's `url`: the HTML is converted, the URL is never fetched, and
|
|
171
|
+
relative links resolve against it.
|
|
172
|
+
- **Or turn on Agent Bridge** in the Page2AI extension (1.6.0 or later): popup → *Agent Bridge*
|
|
173
|
+
switch → allow access to websites. While the extension is connected, `url` pages open in a
|
|
174
|
+
background tab of your own browser, with its cookies and scripts, and come back as the
|
|
175
|
+
extension's Markdown (its own output settings apply, not `include_images` /
|
|
176
|
+
`include_frontmatter`). The extension refuses sign-in providers' pages and anything that is
|
|
177
|
+
not http(s); a page it refuses is fetched by the server as usual, with a second text block
|
|
178
|
+
saying why. The bridge listens on `ws://127.0.0.1:3025` only. In Chrome it accepts the
|
|
179
|
+
Page2AI extension alone (its Web Store ID); Firefox gives every extension a random origin
|
|
180
|
+
per install, so there it accepts any `moz-extension://` origin, which means any Firefox
|
|
181
|
+
extension you have installed could connect while the server runs.
|
|
164
182
|
|
|
165
183
|
## Example prompts
|
|
166
184
|
|
|
@@ -219,11 +237,22 @@ No setup required — every argument has a sensible default. `page_to_markdown`
|
|
|
219
237
|
|
|
220
238
|
| Argument | Type | Default | Effect |
|
|
221
239
|
|---|---|---|---|
|
|
222
|
-
| `url` | string
|
|
240
|
+
| `url` | string | — | Absolute http(s) URL to convert. Private ranges, loopback and cloud metadata endpoints are blocked (SSRF guard). With `html`, not fetched: the base for relative links |
|
|
241
|
+
| `html` | string (≤ 10 MB) | — | The page's HTML, converted instead of a fetch. `url` or `html` is required |
|
|
223
242
|
| `include_images` | boolean | `true` | Keep `` image references in the output |
|
|
224
243
|
| `include_frontmatter` | boolean | `true` | Prepend the YAML front matter block |
|
|
225
244
|
| `timeout_ms` | integer | `15000` | Abort the fetch after N ms (1000–60000) |
|
|
226
245
|
|
|
246
|
+
The hosted endpoint takes `url` only (the contract its ChatGPT plugin was reviewed with) and
|
|
247
|
+
caps `timeout_ms` at 20000.
|
|
248
|
+
|
|
249
|
+
Environment variables of the local server, both optional:
|
|
250
|
+
|
|
251
|
+
| Variable | Default | Effect |
|
|
252
|
+
|---|---|---|
|
|
253
|
+
| `PAGE2AI_BRIDGE_PORT` | `3025` | Port of the Agent Bridge on 127.0.0.1. If it is taken (another running instance), the server starts without the bridge |
|
|
254
|
+
| `PAGE2AI_BRIDGE_ORIGINS` | — | Extra extension origins the bridge accepts, comma-separated, e.g. `chrome-extension://<id>` of an unpacked build |
|
|
255
|
+
|
|
227
256
|
Planned: a `profile` argument (`auto | docs | marketing | research | dashboard | wordpress-marketing`).
|
|
228
257
|
|
|
229
258
|
## Privacy
|
|
@@ -233,6 +262,10 @@ beyond the URLs you explicitly provide. Note that your AI client (Claude, ChatGP
|
|
|
233
262
|
still sends the extracted Markdown to its own model provider under that client's privacy
|
|
234
263
|
policy — that part is outside this server's control. See [PRIVACY.md](./PRIVACY.md) for details.
|
|
235
264
|
|
|
265
|
+
With Agent Bridge on, the extension sends this server the URL's Markdown as your browser
|
|
266
|
+
renders it, signed-in content included, over a WebSocket on 127.0.0.1; nothing else leaves
|
|
267
|
+
the machine, but the Markdown then goes to your AI client like any other result.
|
|
268
|
+
|
|
236
269
|
The optional **hosted endpoint** is different by nature: URLs you ask it to convert are
|
|
237
270
|
fetched from a server operated by the author (deployed on Vercel), and Vercel keeps its
|
|
238
271
|
standard operational logs. No accounts, no tracking. If that trade-off matters for your
|
package/dist/bridge/server.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { type BridgeConvertOptions, type BridgeConvertResult } from './protocol.js';
|
|
2
|
+
/** Page2AI's Chrome Web Store ID: Chrome, Edge and the other Chromium browsers
|
|
3
|
+
* that install from the store send this Origin. */
|
|
4
|
+
export declare const PAGE2AI_CHROME_ORIGIN = "chrome-extension://dlpaaijcnbbmlfeohlphjpnbbcnomnno";
|
|
2
5
|
export declare class BridgeServer {
|
|
3
6
|
private httpServer;
|
|
4
7
|
private wss;
|
|
@@ -9,10 +12,13 @@ export declare class BridgeServer {
|
|
|
9
12
|
private readonly port;
|
|
10
13
|
private readonly serverVersion;
|
|
11
14
|
private readonly log;
|
|
15
|
+
private readonly extraOrigins;
|
|
12
16
|
constructor(opts: {
|
|
13
17
|
port?: number;
|
|
14
18
|
serverVersion: string;
|
|
15
19
|
log: (msg: string) => void;
|
|
20
|
+
/** Exact origins accepted beside the store's, e.g. an unpacked build's. */
|
|
21
|
+
extraOrigins?: readonly string[];
|
|
16
22
|
});
|
|
17
23
|
isConnected(): boolean;
|
|
18
24
|
start(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/bridge/server.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/bridge/server.ts"],"names":[],"mappings":"AAcA,OAAO,EAGL,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EAMzB,MAAM,eAAe,CAAC;AAEvB;oDACoD;AACpD,eAAO,MAAM,qBAAqB,wDAAwD,CAAC;AAQ3F,qBAAa,YAAY;IACvB,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,GAAG,CAAgC;IAC3C,OAAO,CAAC,MAAM,CAA0B;IACxC,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,OAAO,CAAqC;IACpD,OAAO,CAAC,cAAc,CAAK;IAC3B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAS;IACvC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAwB;IAC5C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAoB;gBAErC,IAAI,EAAE;QAChB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,aAAa,EAAE,MAAM,CAAC;QACtB,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;QAC3B,2EAA2E;QAC3E,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;KAClC;IAOD,WAAW,IAAI,OAAO;IAIhB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAqDtB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAsBrB,OAAO,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IA4BvE,OAAO,CAAC,aAAa;IAuBrB,OAAO,CAAC,gBAAgB;CA+GzB"}
|
package/dist/bridge/server.js
CHANGED
|
@@ -4,13 +4,17 @@
|
|
|
4
4
|
//
|
|
5
5
|
// Security model (BrowserTools MCP v2.0, post GHSA-xvrv-w8pg-f25f):
|
|
6
6
|
// 1. Bind 127.0.0.1 only (never 0.0.0.0)
|
|
7
|
-
// 2. Origin validation:
|
|
7
|
+
// 2. Origin validation: Page2AI's Chrome Web Store origin, any moz-extension://
|
|
8
|
+
// (Firefox gives each install a random UUID), and PAGE2AI_BRIDGE_ORIGINS
|
|
8
9
|
// 3. Host header: must be 127.0.0.1:PORT or localhost:PORT
|
|
9
10
|
// 4. Per-session token: generated on auth, required on every message
|
|
10
11
|
import { createServer } from 'node:http';
|
|
11
12
|
import { randomBytes } from 'node:crypto';
|
|
12
13
|
import { WebSocketServer, WebSocket } from 'ws';
|
|
13
14
|
import { BRIDGE_PROTOCOL, DEFAULT_BRIDGE_PORT, } from './protocol.js';
|
|
15
|
+
/** Page2AI's Chrome Web Store ID: Chrome, Edge and the other Chromium browsers
|
|
16
|
+
* that install from the store send this Origin. */
|
|
17
|
+
export const PAGE2AI_CHROME_ORIGIN = 'chrome-extension://dlpaaijcnbbmlfeohlphjpnbbcnomnno';
|
|
14
18
|
export class BridgeServer {
|
|
15
19
|
httpServer = null;
|
|
16
20
|
wss = null;
|
|
@@ -21,10 +25,12 @@ export class BridgeServer {
|
|
|
21
25
|
port;
|
|
22
26
|
serverVersion;
|
|
23
27
|
log;
|
|
28
|
+
extraOrigins;
|
|
24
29
|
constructor(opts) {
|
|
25
30
|
this.port = opts.port ?? DEFAULT_BRIDGE_PORT;
|
|
26
31
|
this.serverVersion = opts.serverVersion;
|
|
27
32
|
this.log = opts.log;
|
|
33
|
+
this.extraOrigins = opts.extraOrigins ?? [];
|
|
28
34
|
}
|
|
29
35
|
isConnected() {
|
|
30
36
|
return this.client !== null && this.client.readyState === WebSocket.OPEN;
|
|
@@ -122,8 +128,14 @@ export class BridgeServer {
|
|
|
122
128
|
});
|
|
123
129
|
}
|
|
124
130
|
verifyUpgrade(req) {
|
|
131
|
+
// Page2AI only. Any installed extension may open a WebSocket to localhost
|
|
132
|
+
// without a permission, and the one holding this single connection reads
|
|
133
|
+
// every URL the agent asks for and writes what the agent then reads.
|
|
134
|
+
// Firefox origins are a random per-install UUID, so there only the scheme
|
|
135
|
+
// can be checked.
|
|
125
136
|
const origin = req.headers.origin ?? '';
|
|
126
|
-
if (
|
|
137
|
+
if (origin !== PAGE2AI_CHROME_ORIGIN && !origin.startsWith('moz-extension://')
|
|
138
|
+
&& !this.extraOrigins.includes(origin)) {
|
|
127
139
|
this.log(`bridge: rejected Origin "${origin}"`);
|
|
128
140
|
return false;
|
|
129
141
|
}
|
|
@@ -226,6 +238,12 @@ export class BridgeServer {
|
|
|
226
238
|
this.client = null;
|
|
227
239
|
this.sessionToken = null;
|
|
228
240
|
this.log('bridge: extension disconnected');
|
|
241
|
+
// Its requests can no longer be answered: fail them now, not at their timeout.
|
|
242
|
+
for (const [id, req] of this.pending) {
|
|
243
|
+
clearTimeout(req.timer);
|
|
244
|
+
req.reject(new Error('EXTENSION_DISCONNECTED: the extension closed the connection'));
|
|
245
|
+
this.pending.delete(id);
|
|
246
|
+
}
|
|
229
247
|
}
|
|
230
248
|
});
|
|
231
249
|
ws.on('error', (err) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/bridge/server.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,0EAA0E;AAC1E,+DAA+D;AAC/D,EAAE;AACF,oEAAoE;AACpE,2CAA2C;AAC3C
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/bridge/server.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,0EAA0E;AAC1E,+DAA+D;AAC/D,EAAE;AACF,oEAAoE;AACpE,2CAA2C;AAC3C,kFAAkF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7 +89,11 @@ const isServerless = !!(process.env.VERCEL || process.env.AWS_LAMBDA_FUNCTION_NA
|
|
|
89
89
|
let bridge = null;
|
|
90
90
|
if (!isServerless) {
|
|
91
91
|
const bridgePort = parseInt(process.env.PAGE2AI_BRIDGE_PORT ?? '', 10) || DEFAULT_BRIDGE_PORT;
|
|
92
|
-
|
|
92
|
+
// An unpacked or self-built extension has its own ID: list its exact origin(s),
|
|
93
|
+
// comma-separated, e.g. PAGE2AI_BRIDGE_ORIGINS=chrome-extension://<id>.
|
|
94
|
+
const extraOrigins = (process.env.PAGE2AI_BRIDGE_ORIGINS ?? '')
|
|
95
|
+
.split(',').map((s) => s.trim()).filter(Boolean);
|
|
96
|
+
bridge = new BridgeServer({ port: bridgePort, serverVersion: SERVER_VERSION, log, extraOrigins });
|
|
93
97
|
setBridge(bridge);
|
|
94
98
|
bridge.start().then(() => log(`bridge ready on ws://127.0.0.1:${bridgePort}`), (err) => {
|
|
95
99
|
log(`bridge failed to start: ${err instanceof Error ? err.message : String(err)} (the server continues without it)`);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,yCAAyC;AACzC,+EAA+E;AAC/E,4EAA4E;AAC5E,2EAA2E;AAC3E,EAAE;AACF,8EAA8E;AAC9E,6EAA6E;AAC7E,gFAAgF;AAChF,+EAA+E;AAC/E,8EAA8E;AAC9E,2EAA2E;AAC3E,qEAAqE;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxG,OAAO,EAAE,Y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,GAAG,CAAC,oCAAoC,CAAC,CAAC;QACrH,MAAM,GAAG,IAAI,CAAC;QACd,SAAS,CAAC,IAAI,CAAC,CAAC;IAClB,CAAC,CACF,CAAC;AACJ,CAAC;AAED,GAAG,CAAC,UAAU,cAAc,2CAA2C,CAAC,CAAC;AAEzE,MAAM,QAAQ,GAAG,CAAC,MAAc,EAAQ,EAAE;IACxC,GAAG,CAAC,GAAG,MAAM,oBAAoB,CAAC,CAAC;IACnC,MAAM,UAAU,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;IAC9D,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC,IAAI,CAC5C,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EACrB,CAAC,GAAY,EAAE,EAAE;QACf,GAAG,CAAC,iBAAiB,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACzE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CACF,CAAC;AACJ,CAAC,CAAC;AAEF,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;AAC/C,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC"}
|
|
@@ -54,6 +54,23 @@ export declare const pageToMarkdownDefinition: {
|
|
|
54
54
|
destructiveHint: boolean;
|
|
55
55
|
};
|
|
56
56
|
};
|
|
57
|
+
export declare const pageToMarkdownHostedInputSchema: z.ZodObject<{
|
|
58
|
+
url: z.ZodString;
|
|
59
|
+
include_images: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
60
|
+
include_frontmatter: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
61
|
+
timeout_ms: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
62
|
+
}, z.core.$strip>;
|
|
63
|
+
export declare const pageToMarkdownHostedDefinition: {
|
|
64
|
+
name: string;
|
|
65
|
+
title: string;
|
|
66
|
+
description: string;
|
|
67
|
+
annotations: {
|
|
68
|
+
readOnlyHint: boolean;
|
|
69
|
+
openWorldHint: boolean;
|
|
70
|
+
idempotentHint: boolean;
|
|
71
|
+
destructiveHint: boolean;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
57
74
|
export declare const setBridge: (bridge: BridgeServer | null) => void;
|
|
58
75
|
export declare const handlePageToMarkdown: (rawInput: unknown) => Promise<PageToMarkdownResult>;
|
|
59
76
|
//# sourceMappingURL=page-to-markdown.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-to-markdown.d.ts","sourceRoot":"","sources":["../../src/tools/page-to-markdown.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"page-to-markdown.d.ts","sourceRoot":"","sources":["../../src/tools/page-to-markdown.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAUxD,eAAO,MAAM,yBAAyB;;;;;;iBAcpC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAG5E,MAAM,MAAM,oBAAoB,GAAG,cAAc,CAAC;AAElD,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6DpC,CAAC;AAOF,eAAO,MAAM,+BAA+B;;;;;iBAa1C,CAAC;AAEH,eAAO,MAAM,8BAA8B;;;;;;;;;;CAiB1C,CAAC;AAWF,eAAO,MAAM,SAAS,GAAI,QAAQ,YAAY,GAAG,IAAI,KAAG,IAEvD,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAC/B,UAAU,OAAO,KAChB,OAAO,CAAC,oBAAoB,CAqF9B,CAAC"}
|
|
@@ -5,54 +5,62 @@
|
|
|
5
5
|
// `### Tab: {label}` sections for docs sites).
|
|
6
6
|
import { fetchAndConvert, htmlToMarkdown, SsrfBlockedError, FetchProtectionError } from '@page2ai/core';
|
|
7
7
|
import { z } from 'zod';
|
|
8
|
+
const URL_TEXT = 'Absolute HTTP or HTTPS URL of the web page to convert. Blocks private ranges, loopback, and cloud metadata endpoints. ' +
|
|
9
|
+
'Given with `html`, it is not fetched: it names the page the HTML came from, and relative links resolve against it.';
|
|
10
|
+
const HTML_TEXT = 'Raw HTML of the page to convert instead of fetching it, e.g. from a browser tool. ' +
|
|
11
|
+
'Pass the page\'s `url` with it so relative links resolve. Either `url` or `html` is required.';
|
|
12
|
+
const BRIDGE_SETTINGS_TEXT = ' Through Agent Bridge the extension\'s own output settings apply instead.';
|
|
8
13
|
export const pageToMarkdownInputSchema = z.object({
|
|
9
|
-
url: z.string().url().optional().describe(
|
|
10
|
-
html: z.string().max(10_000_000).optional().describe(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
include_images: z.boolean().optional().default(true).describe('Include image references () in the output. Default: true.'),
|
|
14
|
-
include_frontmatter: z.boolean().optional().default(true).describe('Prepend a YAML frontmatter block with title, source URL, capture timestamp, language, description, and canonical URL. Default: true.'),
|
|
14
|
+
url: z.string().url().optional().describe(URL_TEXT),
|
|
15
|
+
html: z.string().max(10_000_000).optional().describe(HTML_TEXT),
|
|
16
|
+
include_images: z.boolean().optional().default(true).describe('Include image references () in the output. Default: true.' + BRIDGE_SETTINGS_TEXT),
|
|
17
|
+
include_frontmatter: z.boolean().optional().default(true).describe('Prepend a YAML frontmatter block with title, source URL, capture timestamp, language, description, and canonical URL. Default: true.' + BRIDGE_SETTINGS_TEXT),
|
|
15
18
|
timeout_ms: z.number().int().min(1000).max(60000).optional().default(15000).describe('Abort the fetch after N milliseconds. Range: 1000-60000. Default: 15000.'),
|
|
16
19
|
}).refine((data) => data.url || data.html, {
|
|
17
|
-
message: 'Provide
|
|
18
|
-
}).refine((data) => !(data.url && data.html), {
|
|
19
|
-
message: 'Provide either `url` or `html`, not both.',
|
|
20
|
+
message: 'Provide `url`, `html`, or both.',
|
|
20
21
|
});
|
|
21
22
|
export const pageToMarkdownDefinition = {
|
|
22
23
|
name: 'page_to_markdown',
|
|
23
24
|
title: 'Convert Page to Markdown',
|
|
24
|
-
description: '
|
|
25
|
-
'Provide a `url` to fetch, or `html` if you already have the page HTML from a browser tool. ' +
|
|
26
|
-
'When the Page2AI browser extension is connected via Agent Bridge, the extension converts ' +
|
|
27
|
-
'the page in the user\'s real browser (with cookies and JavaScript) and returns extension-quality Markdown. ' +
|
|
28
|
-
'Without the bridge, `url` fetches without cookies and runs no page scripts, so a page behind ' +
|
|
29
|
-
'a sign-in comes back as its login page; read those through a browser tool and pass the HTML here. ' +
|
|
25
|
+
description: 'Fetch a web page URL and convert it to clean Markdown optimized for LLM context. ' +
|
|
30
26
|
'Preserves headings, code blocks (with language hints), links, and tables; keeps the ' +
|
|
31
27
|
'main content and drops navigation, headers, footers, and sidebars. ' +
|
|
32
|
-
'
|
|
33
|
-
'
|
|
28
|
+
'It fetches without cookies and runs no page scripts, so a page behind a sign-in or one ' +
|
|
29
|
+
'rendered only by JavaScript comes back as its login page or with no content. For those, ' +
|
|
30
|
+
'pass the page HTML you already have from a browser tool as `html` (with its `url`, relative ' +
|
|
31
|
+
'links resolve and nothing is fetched), or ask the user to turn on Agent Bridge in the ' +
|
|
32
|
+
'Page2AI browser extension: while it is connected, `url` pages open in the user\'s own ' +
|
|
33
|
+
'browser with its cookies and scripts, and a page the extension declines is fetched by the ' +
|
|
34
|
+
'server, with a note saying why. ' +
|
|
35
|
+
'It requests only the URL given, as a browser opens a page, so docs sites return the page ' +
|
|
36
|
+
'itself, not a Markdown copy of it; a URL that names a Markdown or text file (a raw GitHub ' +
|
|
37
|
+
'README.md, an llms.txt) comes back as written. ' +
|
|
38
|
+
'Discovers tab groups statically and emits each panel as a `### Tab: {label}` section ' +
|
|
39
|
+
'instead of concatenating (prevents Python+TypeScript examples merging into one broken block). ' +
|
|
40
|
+
'Zero external API calls: pages are parsed locally (linkedom) or in the user\'s browser.',
|
|
34
41
|
inputSchema: {
|
|
35
42
|
type: 'object',
|
|
36
43
|
properties: {
|
|
37
44
|
url: {
|
|
38
45
|
type: 'string',
|
|
39
46
|
format: 'uri',
|
|
40
|
-
description:
|
|
47
|
+
description: URL_TEXT,
|
|
41
48
|
},
|
|
42
49
|
html: {
|
|
43
50
|
type: 'string',
|
|
44
51
|
maxLength: 10_000_000,
|
|
45
|
-
description:
|
|
52
|
+
description: HTML_TEXT,
|
|
46
53
|
},
|
|
47
54
|
include_images: {
|
|
48
55
|
type: 'boolean',
|
|
49
56
|
default: true,
|
|
50
|
-
description: 'Include image references () in the output.',
|
|
57
|
+
description: 'Include image references () in the output.' + BRIDGE_SETTINGS_TEXT,
|
|
51
58
|
},
|
|
52
59
|
include_frontmatter: {
|
|
53
60
|
type: 'boolean',
|
|
54
61
|
default: true,
|
|
55
|
-
description: 'Prepend a YAML frontmatter block with title, source URL, capture timestamp, language, description, and canonical URL.'
|
|
62
|
+
description: 'Prepend a YAML frontmatter block with title, source URL, capture timestamp, language, description, and canonical URL.' +
|
|
63
|
+
BRIDGE_SETTINGS_TEXT,
|
|
56
64
|
},
|
|
57
65
|
timeout_ms: {
|
|
58
66
|
type: 'integer',
|
|
@@ -71,6 +79,34 @@ export const pageToMarkdownDefinition = {
|
|
|
71
79
|
destructiveHint: false,
|
|
72
80
|
},
|
|
73
81
|
};
|
|
82
|
+
// The hosted endpoint (remote/) serves the contract OpenAI reviewed for the ChatGPT plugin
|
|
83
|
+
// (approved 2026-09-11). OpenAI rescans the live server and, after its automated checks,
|
|
84
|
+
// replaces a reviewed tool definition with the changed one, so editing these strings changes
|
|
85
|
+
// what ChatGPT runs. They stay the 0.4.1 definition: a URL only (no `html`) and no Agent
|
|
86
|
+
// Bridge, which a hosted server can never reach. tests/hosted-contract.test.ts pins them.
|
|
87
|
+
export const pageToMarkdownHostedInputSchema = z.object({
|
|
88
|
+
url: z.string().url().describe('Absolute HTTP or HTTPS URL of the web page to convert. Blocks private ranges, loopback, and cloud metadata endpoints.'),
|
|
89
|
+
include_images: z.boolean().optional().default(true).describe('Include image references () in the output. Default: true.'),
|
|
90
|
+
include_frontmatter: z.boolean().optional().default(true).describe('Prepend a YAML frontmatter block with title, source URL, capture timestamp, language, description, and canonical URL. Default: true.'),
|
|
91
|
+
timeout_ms: z.number().int().min(1000).max(60000).optional().default(15000).describe('Abort the fetch after N milliseconds. Range: 1000-60000. Default: 15000.'),
|
|
92
|
+
});
|
|
93
|
+
export const pageToMarkdownHostedDefinition = {
|
|
94
|
+
name: pageToMarkdownDefinition.name,
|
|
95
|
+
title: pageToMarkdownDefinition.title,
|
|
96
|
+
description: 'Fetch a web page URL and convert it to clean Markdown optimized for LLM context. ' +
|
|
97
|
+
'Preserves headings, code blocks (with language hints), links, and tables; keeps the ' +
|
|
98
|
+
'main content and drops navigation, headers, footers, and sidebars. ' +
|
|
99
|
+
'It fetches without cookies and runs no page scripts, so a page behind a sign-in or one ' +
|
|
100
|
+
'rendered only by JavaScript comes back as its login page or with no content; read those ' +
|
|
101
|
+
'through a browser tool instead. ' +
|
|
102
|
+
'It requests only the URL given, as a browser opens a page, so docs sites return the page ' +
|
|
103
|
+
'itself, not a Markdown copy of it; a URL that names a Markdown or text file (a raw GitHub ' +
|
|
104
|
+
'README.md, an llms.txt) comes back as written. ' +
|
|
105
|
+
'Discovers tab groups statically and emits each panel as a `### Tab: {label}` section ' +
|
|
106
|
+
'instead of concatenating (prevents Python+TypeScript examples merging into one broken block). ' +
|
|
107
|
+
'Zero external API calls — parses locally via linkedom.',
|
|
108
|
+
annotations: pageToMarkdownDefinition.annotations,
|
|
109
|
+
};
|
|
74
110
|
// Wraps a plain-text error into an MCP tool result with isError:true so the
|
|
75
111
|
// LLM sees the error message instead of a JSON-RPC failure.
|
|
76
112
|
const errorResult = (message) => ({
|
|
@@ -94,6 +130,8 @@ export const handlePageToMarkdown = async (rawInput) => {
|
|
|
94
130
|
return errorResult(`Invalid input: ${msg}`);
|
|
95
131
|
}
|
|
96
132
|
// --- Path 1: raw HTML provided → convert locally via htmlToMarkdown (mcp#1) ---
|
|
133
|
+
// A `url` given with it is the page's address, never fetched: relative links resolve
|
|
134
|
+
// against it and it fills the frontmatter's `source`.
|
|
97
135
|
if (input.html) {
|
|
98
136
|
try {
|
|
99
137
|
const result = htmlToMarkdown(input.html, {
|
|
@@ -113,6 +151,11 @@ export const handlePageToMarkdown = async (rawInput) => {
|
|
|
113
151
|
// url is guaranteed present here by the schema refinement (url || html required).
|
|
114
152
|
const url = input.url;
|
|
115
153
|
// --- Path 2: extension bridge connected → route through the user's browser ---
|
|
154
|
+
// A refusal (no site access, a sensitive or non-web URL) or a failed tab falls
|
|
155
|
+
// through to the server's own fetch, as if no extension were connected, with a
|
|
156
|
+
// note saying why; a timeout does not, since the fetch would spend the caller's
|
|
157
|
+
// time a second time.
|
|
158
|
+
let bridgeNote = null;
|
|
116
159
|
if (bridgeRef?.isConnected()) {
|
|
117
160
|
try {
|
|
118
161
|
const result = await bridgeRef.convert({
|
|
@@ -127,7 +170,10 @@ export const handlePageToMarkdown = async (rawInput) => {
|
|
|
127
170
|
}
|
|
128
171
|
catch (e) {
|
|
129
172
|
const msg = e instanceof Error ? e.message : String(e);
|
|
130
|
-
|
|
173
|
+
if (/TIMEOUT|timed out/i.test(msg))
|
|
174
|
+
return errorResult(`Bridge conversion failed: ${msg}`);
|
|
175
|
+
process.stderr.write(`[page2ai-mcp] bridge: ${msg}; fetching without the browser\n`);
|
|
176
|
+
bridgeNote = `Fetched without the browser: the Page2AI extension answered ${msg}`;
|
|
131
177
|
}
|
|
132
178
|
}
|
|
133
179
|
// --- Path 3: fetch + linkedom (current behavior) ---
|
|
@@ -138,21 +184,27 @@ export const handlePageToMarkdown = async (rawInput) => {
|
|
|
138
184
|
includeFrontmatter: input.include_frontmatter,
|
|
139
185
|
});
|
|
140
186
|
return {
|
|
141
|
-
content: [
|
|
187
|
+
content: [
|
|
188
|
+
{ type: 'text', text: result.markdown },
|
|
189
|
+
...(bridgeNote ? [{ type: 'text', text: bridgeNote }] : []),
|
|
190
|
+
],
|
|
142
191
|
};
|
|
143
192
|
}
|
|
144
193
|
catch (e) {
|
|
145
194
|
if (e instanceof SsrfBlockedError) {
|
|
146
|
-
return
|
|
195
|
+
return fetchError(`URL blocked by SSRF guard: ${e.message}`, bridgeNote);
|
|
147
196
|
}
|
|
148
197
|
if (e instanceof FetchProtectionError) {
|
|
149
|
-
return
|
|
198
|
+
return fetchError(`Fetch failed: ${e.message}`, bridgeNote);
|
|
150
199
|
}
|
|
151
200
|
if (e instanceof Error && e.name === 'AbortError') {
|
|
152
|
-
return
|
|
201
|
+
return fetchError(`Fetch timed out after ${input.timeout_ms}ms: ${url}`, bridgeNote);
|
|
153
202
|
}
|
|
154
203
|
const msg = e instanceof Error ? e.message : String(e);
|
|
155
|
-
return
|
|
204
|
+
return fetchError(`Unexpected error: ${msg}`, bridgeNote);
|
|
156
205
|
}
|
|
157
206
|
};
|
|
207
|
+
// A fetch error after a bridge refusal names both, so the agent can tell the
|
|
208
|
+
// user what to change in the extension.
|
|
209
|
+
const fetchError = (message, bridgeNote) => errorResult(bridgeNote ? `${message}\n${bridgeNote}` : message);
|
|
158
210
|
//# sourceMappingURL=page-to-markdown.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-to-markdown.js","sourceRoot":"","sources":["../../src/tools/page-to-markdown.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,+EAA+E;AAC/E,+EAA+E;AAC/E,qEAAqE;AACrE,+CAA+C;AAE/C,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAExG,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChD,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,
|
|
1
|
+
{"version":3,"file":"page-to-markdown.js","sourceRoot":"","sources":["../../src/tools/page-to-markdown.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,+EAA+E;AAC/E,+EAA+E;AAC/E,qEAAqE;AACrE,+CAA+C;AAE/C,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAExG,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,QAAQ,GACZ,wHAAwH;IACxH,oHAAoH,CAAC;AACvH,MAAM,SAAS,GACb,oFAAoF;IACpF,+FAA+F,CAAC;AAClG,MAAM,oBAAoB,GAAG,2EAA2E,CAAC;AAEzG,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChD,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC;IACnD,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,QAAQ,EAAE,CAAC,Q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QAC3E,CAAC;QACD,IAAI,CAAC,YAAY,oBAAoB,EAAE,CAAC;YACtC,OAAO,UAAU,CAAC,iBAAiB,CAAC,CAAC,OAAO,EAAE,EAAE,UAAU,CAAC,CAAC;QAC9D,CAAC;QACD,IAAI,CAAC,YAAY,KAAK,IAAI,CAAC,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;YAClD,OAAO,UAAU,CAAC,yBAAyB,KAAK,CAAC,UAAU,OAAO,GAAG,EAAE,EAAE,UAAU,CAAC,CAAC;QACvF,CAAC;QACD,MAAM,GAAG,GAAG,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QACvD,OAAO,UAAU,CAAC,qBAAqB,GAAG,EAAE,EAAE,UAAU,CAAC,CAAC;IAC5D,CAAC;AACH,CAAC,CAAC;AAEF,6EAA6E;AAC7E,wCAAwC;AACxC,MAAM,UAAU,GAAG,CAAC,OAAe,EAAE,UAAyB,EAAwB,EAAE,CACtF,WAAW,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,OAAO,KAAK,UAAU,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC"}
|
package/manifest.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"manifest_version": "0.3",
|
|
3
3
|
"name": "page2ai-mcp",
|
|
4
4
|
"display_name": "Page2AI — Web to Markdown",
|
|
5
|
-
"version": "0.5.
|
|
5
|
+
"version": "0.5.2",
|
|
6
6
|
"description": "Convert any web page to clean Markdown for LLM context",
|
|
7
7
|
"long_description": "Page2AI MCP converts a web page URL to Markdown for AI context windows. It keeps the page's main content (its <main> or dominant <article>), preserves code blocks with language hints, converts tables and lists, and drops navigation, headers, footers and sidebars. The only network requests go to the URL you pass it and the addresses it redirects to, asked for as a browser opens a page, so docs platforms return the page itself rather than a Markdown copy of it: pure Node + linkedom, no external services, no telemetry.\n\nAgent Bridge: when the Page2AI browser extension is connected, the tool routes through the user's real browser — cookies, JavaScript rendering, extension-quality extraction — so pages behind a sign-in and JS-rendered content are within reach. Without the bridge, a page behind a sign-in or rendered only by JavaScript is out of the tool's reach; pass its HTML directly via the `html` parameter.\n\nCompanion to the Page2AI browser extension (https://github.com/igorsaevets/page2ai-extension), which converts the live page in your own browser, including pages behind a sign-in. Built on the open-source @page2ai/core library.",
|
|
8
8
|
"author": {
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"tools": [
|
|
45
45
|
{
|
|
46
46
|
"name": "page_to_markdown",
|
|
47
|
-
"description": "Fetch a web page URL and convert it to clean Markdown. Preserves headings, code blocks, links, and tables; keeps the main content and drops navigation, headers, footers, and sidebars.
|
|
47
|
+
"description": "Fetch a web page URL, or take HTML you already have, and convert it to clean Markdown. Preserves headings, code blocks, links, and tables; keeps the main content and drops navigation, headers, footers, and sidebars. A fetch carries no cookies and runs no page scripts; with Agent Bridge on in the Page2AI browser extension, URLs open in your own browser instead."
|
|
48
48
|
}
|
|
49
49
|
],
|
|
50
50
|
"compatibility": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@page2ai/mcp",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"mcpName": "io.github.igorsaevets/page2ai-mcp",
|
|
5
5
|
"description": "MCP server that converts any web page URL to clean Markdown for LLM context. Processing is local and SSRF-guarded; no external APIs, no telemetry.",
|
|
6
6
|
"type": "module",
|
package/server.json
CHANGED
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
"source": "github"
|
|
9
9
|
},
|
|
10
10
|
"websiteUrl": "https://github.com/igorsaevets/page2ai-mcp#readme",
|
|
11
|
-
"version": "0.5.
|
|
11
|
+
"version": "0.5.2",
|
|
12
12
|
"packages": [
|
|
13
13
|
{
|
|
14
14
|
"registryType": "npm",
|
|
15
15
|
"identifier": "@page2ai/mcp",
|
|
16
|
-
"version": "0.5.
|
|
16
|
+
"version": "0.5.2",
|
|
17
17
|
"transport": {
|
|
18
18
|
"type": "stdio"
|
|
19
19
|
}
|