Skip to content

Commit aa78ec0

Browse files
committed
update fetch server to use readability JS if node is installed
1 parent e3a33f2 commit aa78ec0

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

src/fetch/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ Presently the server only supports fetching HTML content.
1616

1717
## Installation
1818

19+
Optionally: Install node.js, this will cause the fetch serve to use a different HTML simplifier that is more robust.
20+
1921
### Using uv (recommended)
2022

2123
When using [`uv`](https://docs.astral.sh/uv/) no specific installation is needed. We will

src/fetch/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "mcp-server-fetch"
3-
version = "0.1.2"
3+
version = "0.1.3"
44
description = "A Model Context Protocol server providing tools to fetch and convert web content for usage by LLMs"
55
readme = "README.md"
66
requires-python = ">=3.10"

src/fetch/src/mcp_server_fetch/server.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@
2424

2525

2626
def extract_content(html: str) -> str:
27-
ret = readabilipy.simple_json.simple_json_from_html_string(html)
27+
ret = readabilipy.simple_json.simple_json_from_html_string(
28+
html, use_readability=True
29+
)
2830
if not ret["plain_content"]:
2931
return "<error>Page failed to be simplified from HTML</error>"
3032
content = markdownify.markdownify(
31-
ret["plain_content"],
33+
ret["content"],
3234
heading_style=markdownify.ATX,
3335
)
3436
return content

0 commit comments

Comments
 (0)