@aiquants/html-to-markdown 0.1.5 → 0.1.7
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/README.md +12 -12
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @aiquants/html-to-markdown
|
|
2
2
|
|
|
3
|
-
A tool to dynamically fetch a web page from a given URL and convert it to Markdown.
|
|
3
|
+
A tool to dynamically fetch a web page from a given URL and convert it to Markdown. Now with Model Context Protocol (MCP) server support!
|
|
4
4
|
|
|
5
5
|
This tool fetches the fully rendered HTML after JavaScript execution and converts it to Markdown. It supports complex pages, including footnotes and table structures.
|
|
6
6
|
|
|
@@ -10,9 +10,9 @@ This tool fetches the fully rendered HTML after JavaScript execution and convert
|
|
|
10
10
|
- **High-Fidelity Conversion**: Performs powerful AST (Abstract Syntax Tree)-based conversion using `rehype` and `remark`.
|
|
11
11
|
- **Preserves Table Content**: Retains HTML tags within table cells (`<td>`, `<th>`) as much as possible to maintain rich formatting.
|
|
12
12
|
- **Link Normalization**: Automatically converts relative links on the page to absolute links to prevent broken links.
|
|
13
|
-
- **Multiple Interfaces**: Usable as a Node.js library
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
- **Multiple Interfaces**: Usable as a Node.js library, command-line tool, and MCP server.
|
|
14
|
+
- **MCP Server Support**: Provides Model Context Protocol server functionality for AI assistants.
|
|
15
|
+
- **Streamable MCP Support**: Supports streamable MCP protocols for real-time progress updates.
|
|
16
16
|
|
|
17
17
|
## Installation
|
|
18
18
|
|
|
@@ -75,7 +75,7 @@ async function main() {
|
|
|
75
75
|
main();
|
|
76
76
|
```
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
### As an MCP Server
|
|
79
79
|
|
|
80
80
|
This package can be used as a Model Context Protocol (MCP) server, allowing AI assistants and MCP-compatible applications to convert web pages to Markdown.
|
|
81
81
|
|
|
@@ -88,14 +88,15 @@ This package can be used as a Model Context Protocol (MCP) server, allowing AI a
|
|
|
88
88
|
"html-to-md": {
|
|
89
89
|
"command": "npx",
|
|
90
90
|
"args": [
|
|
91
|
-
"
|
|
92
|
-
"mcp"
|
|
91
|
+
"--package=@aiquants/html-to-markdown",
|
|
92
|
+
"aiq-html2md-mcp"
|
|
93
93
|
],
|
|
94
94
|
"type": "stdio"
|
|
95
95
|
},
|
|
96
96
|
"html-to-md-streamable": {
|
|
97
97
|
"url": "http://127.0.0.1:4001/mcp",
|
|
98
|
-
"type": "http"
|
|
98
|
+
"type": "http",
|
|
99
|
+
"_comment": "Note: You need to start the streamable MCP server separately using 'npx --package=@aiquants/html-to-markdown aiq-html2md-mcp-stream'"
|
|
99
100
|
}
|
|
100
101
|
}
|
|
101
102
|
```
|
|
@@ -107,7 +108,7 @@ This package can be used as a Model Context Protocol (MCP) server, allowing AI a
|
|
|
107
108
|
"mcpServers": {
|
|
108
109
|
"html-to-markdown": {
|
|
109
110
|
"command": "npx",
|
|
110
|
-
"args": ["
|
|
111
|
+
"args": ["--package=@aiquants/html-to-markdown", "aiq-html2md-mcp"],
|
|
111
112
|
"description": "Convert HTML content from URLs to Markdown format"
|
|
112
113
|
}
|
|
113
114
|
}
|
|
@@ -119,14 +120,14 @@ This package can be used as a Model Context Protocol (MCP) server, allowing AI a
|
|
|
119
120
|
```bash
|
|
120
121
|
# Start the streamable MCP server (requires global installation)
|
|
121
122
|
npm install -g @aiquants/html-to-markdown
|
|
122
|
-
|
|
123
|
+
aiq-html2md-mcp-stream
|
|
123
124
|
```
|
|
124
125
|
|
|
125
126
|
Alternatively, you can use npx to run without global installation:
|
|
126
127
|
|
|
127
128
|
```bash
|
|
128
129
|
# Using npx with the streamable server binary
|
|
129
|
-
npx
|
|
130
|
+
npx --package=@aiquants/html-to-markdown aiq-html2md-mcp-stream
|
|
130
131
|
```
|
|
131
132
|
|
|
132
133
|
#### MCP Tools Available
|
|
@@ -151,7 +152,6 @@ await mcpServer.start(8000); // Port 8000
|
|
|
151
152
|
const streamableMcpServer = createStreamableMcpServer();
|
|
152
153
|
await streamableMcpServer.start(8000); // Port 8000
|
|
153
154
|
```
|
|
154
|
-
-->
|
|
155
155
|
|
|
156
156
|
## API
|
|
157
157
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiquants/html-to-markdown",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "HTML to Markdown converter",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"bin": {
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
16
|
+
"aiq-html2md": "./dist/main.js",
|
|
17
|
+
"aiq-html2md-mcp": "./dist/mcp.js",
|
|
18
|
+
"aiq-html2md-mcp-stream": "./dist/mcp-streamable.js"
|
|
19
19
|
},
|
|
20
20
|
"files": [
|
|
21
21
|
"dist",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"debug": "NODE_OPTIONS='--enable-source-maps' vite-node --inspect-brk=9229 main.ts --",
|
|
30
30
|
"start": "vite-node main.ts",
|
|
31
31
|
"build": "vite build",
|
|
32
|
+
"prepublishOnly": "npm run build",
|
|
32
33
|
"lint": "biome lint app/",
|
|
33
34
|
"format": "biome format --write",
|
|
34
35
|
"check": "biome check --fix src/",
|