Token导航 LogoToken导航TokenDH.com
Webpage Extract logo
浏览器工具未说明官方级别未说明来源级核验

Webpage Extract

MCP Server

一个用于获取网页内容并将其转换为可读Markdown、表格和元数据的服务器。

工具数

0

提示词数

0

GitHub Stars

1

资源数

0
浏览器自动化数据提取TypeScript文档处理

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

BUZDOLAPCI

提供方

BUZDOLAPCI

最后核验

2026/5/17 20:21

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

网页摘录

MCP服务器,用于获取网页并提取可读的Markdown、表格和元数据。

特性

  • 从URL获取原始HTML
  • 将HTML转换为干净易读的Markdown
  • 将结构化表数据提取为JSON
  • 提取元数据,包括Open Graph、JSON-LD等
  • 无需无头浏览器(轻量级HTML解析)

安装

npm install
npm run build

用法

HTTP传输(默认)

# Start with default HTTP transport on port 8080
npm start
# or
node dist/index.js

# Start with custom port
node dist/index.js --port 3000

STDIO交通(用于当地发展)

npm run dev:stdio
# or
node dist/index.js --stdio

工具

1. fetch_url

从具有可选自定义标头和超时的URL获取原始HTML。

输入:

{
  "url": "https://example.com",
  "headers": { "Accept-Language": "en-US" },
  "timeout_ms": 10000
}

输出:

{
  "ok": true,
  "data": {
    "html": "...",
    "status_code": 200,
    "content_type": "text/html; charset=utf-8",
    "final_url": "https://example.com/"
  },
  "meta": {
    "source": "https://example.com",
    "retrieved_at": "2024-01-15T12:00:00.000Z",
    "pagination": { "next_cursor": null },
    "warnings": []
  }
}

2. extract_readable_markdown

将HTML转换为可读的Markdown,删除样板、导航、广告和侧边栏。

输入:

{
  "html_or_url": "https://example.com/article"
}

或者使用原始HTML:

{
  "html_or_url": "
Title

Content
"
}

输出:

{
  "ok": true,
  "data": {
    "markdown": "# Title\n\nContent",
    "headings": [
      { "level": 1, "text": "Title" }
    ],
    "word_count": 2
  },
  "meta": {
    "source": "https://example.com/article",
    "retrieved_at": "2024-01-15T12:00:00.000Z",
    "pagination": { "next_cursor": null },
    "warnings": []
  }
}

3. extract_tables

将HTML中的所有数据表提取为结构化JSON。

输入:

{
  "html_or_url": "https://example.com/data"
}

输出:

{
  "ok": true,
  "data": {
    "tables": [
      {
        "headers": ["Name", "Age", "City"],
        "rows": [
          ["Alice", "30", "New York"],
          ["Bob", "25", "Los Angeles"]
        ],
        "caption": "User Data"
      }
    ],
    "count": 1
  },
  "meta": {
    "retrieved_at": "2024-01-15T12:00:00.000Z",
    "pagination": { "next_cursor": null },
    "warnings": []
  }
}

4. extract_metadata

提取元数据,包括规范URL、标题、描述、Open Graph标签、JSON-LD、作者和发布日期。

输入:

{
  "html_or_url": "https://example.com/article"
}

输出:

{
  "ok": true,
  "data": {
    "title": "Article Title",
    "description": "Article description",
    "canonical_url": "https://example.com/article",
    "author": "John Doe",
    "publish_date": "2024-01-15T12:00:00Z",
    "open_graph": {
      "title": "OG Title",
      "description": "OG Description",
      "image": "https://example.com/image.jpg",
      "type": "article"
    },
    "json_ld": [
      {
        "@context": "https://schema.org",
        "@type": "Article",
        "headline": "Article Title"
      }
    ],
    "meta_tags": {
      "author": "John Doe",
      "description": "Article description"
    }
  },
  "meta": {
    "retrieved_at": "2024-01-15T12:00:00.000Z",
    "pagination": { "next_cursor": null },
    "warnings": []
  }
}

响应信封

所有工具均以标准信封格式返回响应:

成功响应

{
  "ok": true,
  "data": {},
  "meta": {
    "source": "optional URL if fetched",
    "retrieved_at": "ISO-8601 timestamp",
    "pagination": { "next_cursor": null },
    "warnings": []
  }
}

错误响应

{
  "ok": false,
  "error": {
    "code": "ERROR_CODE",
    "message": "Human readable message",
    "details": {}
  },
  "meta": {
    "retrieved_at": "ISO-8601 timestamp"
  }
}

错误代码:

  • INVALID_INPUT -输入参数无效或缺失
  • UPSTREAM_ERROR -目标服务器出错(HTTP错误、连接失败)
  • RATE_LIMITED -请求受到费率限制
  • TIMEOUT -请求超时
  • PARSE_ERROR -解析HTML失败
  • INTERNAL_ERROR -意外内部错误

局限性

  1. 无JavaScript渲染 -此服务器仅处理静态HTML。JavaScript呈现的内容将不会被捕获。对于JavaScript密集型网站,可以考虑使用无头浏览器解决方案。
  1. 内容检测 -可读标记提取使用启发式方法来识别主要内容。复杂或不寻常的页面布局可能无法得到最佳处理。
  1. 表检测 -布局表(用于页面结构而非数据的表)使用启发式方法过滤掉。一些边缘案例可能被错误地分类。
  1. JSON-LD解析 -JSON-LD提取是最好的努力。格式错误的JSON-LD块会被自动跳过。
  1. 无需认证 -此服务器不处理身份验证。对需要登录的页面的请求将返回登录页面或错误。

发展

运行测试

# Run all tests
npm test

# Run tests in watch mode
npm run test:watch

项目结构

webpage-extract/
├── src/
│   ├── index.ts            # Main entry point
│   ├── cli.ts              # Command-line argument parsing
│   ├── config.ts           # Configuration management
│   ├── server.ts           # MCP server instance
│   ├── types.ts            # TypeScript type definitions
│   ├── tools/
│   │   ├── index.ts        # Tool exports
│   │   ├── fetch.ts        # fetch_url tool
│   │   ├── markdown.ts     # extract_readable_markdown tool
│   │   ├── tables.ts       # extract_tables tool
│   │   └── metadata.ts     # extract_metadata tool
│   └── transport/
│       ├── index.ts        # Transport exports
│       ├── http.ts         # HTTP transport
│       └── stdio.ts        # STDIO transport
├── tests/
│   ├── unit/
│   │   └── tools.test.ts   # Unit tests
│   └── e2e/
│       └── server.test.ts  # E2E tests
├── package.json
├── tsconfig.json
├── .env.example
└── README.md

配置

可以通过环境变量或命令行参数设置配置。

变量CLI标志默认值描述
TRANSPORT--transport, -thttp传输类型:“http”或“stdio”
PORT--port, -p8080HTTP服务器端口
DEFAULT_TIMEOUT_MS-30000默认请求超时(毫秒)
USER_AGENT-webpage-extract/1.0.0HTTP请求的用户代理

许可证

麻省理工学院

目录标签

目录标签

浏览器自动化数据提取TypeScript文档处理网页抓取本地部署HTML解析Markdown转换元数据提取

接入字段

传输方式(transport,传输协议)

未说明

鉴权方式(authType,认证方式)

none

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

未说明none部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP