Prysm MCP服务器(模型上下文协议服务器)
一种模型上下文协议服务器,使人工智能助手能够以高精度和灵活性抓取网页内容,支持多种抓取模式和内容格式选项。
MCP 服务配置
复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用
{
"mcpServers": {
"prysm-scraper": {
"args": [
"-y",
"@pinkpixel/prysm-mcp"
],
"command": "npx",
"env": {
"PRYSM_IMAGE_OUTPUT_DIR": "${workspaceFolder}/scrape_results/images",
"PRYSM_OUTPUT_DIR": "${workspaceFolder}/scrape_results"
}
}
}
}
该服务需要配置环境变量:PRYSM_OUTPUT_DIR
可用工具 (4 个)
该服务在 MCP 协议中暴露的工具,AI 可按需调用
scrapeFocused 9 个参数 需填 1 项
Fast web scraping optimized for speed (fewer scrolls, main content only)
必填参数:url
scrapeBalanced 10 个参数 需填 1 项
Balanced web scraping approach with good coverage and reasonable speed
必填参数:url
scrapeDeep 9 个参数 需填 1 项
Maximum extraction web scraping (slower but thorough)
必填参数:url
formatResult 4 个参数 需填 2 项
Format scraped data into different structured formats (markdown, HTML, JSON)
必填参数:data、format
服务介绍
🔍 Prysm MCP 服务器
Prysm MCP(Model Context Protocol)服务器使像 Claude 这样的 AI 助手能够以高准确性和灵活性抓取网页内容。
✨ 特性
- 🎯 多种抓取模式:选择聚焦(快速)、平衡(默认)或深度(全面)模式
- 🧠 内容分析:分析 URL 以确定最佳抓取方法
- 📄 格式灵活性:将结果格式化为 markdown、HTML 或 JSON
- 🖼️ 图片支持:可选提取甚至下载图片
- 🔍 智能滚动:为单页应用程序配置滚动行为
- 📱 响应式:适应不同的网站布局和结构
- 💾 文件输出:将格式化结果保存到您首选的目录
🚀 快速开始
安装
# Recommended: Install the LLM-optimized version
npm install -g @pinkpixel/prysm-mcp
# Or install the standard version
npm install -g prysm-mcp
# Or clone and build
git clone https://github.com/pinkpixel-dev/prysm-mcp.git
cd prysm-mcp
npm install
npm run build
集成指南
我们为流行的 MCP 兼容应用程序提供了详细的集成指南:
使用
有多种方式可以设置 Prysm MCP 服务器:
使用 mcp.json 配置
根据上述指南在适当的位置创建一个 mcp.json 文件。
{
"mcpServers": {
"prysm-scraper": {
"description": "Prysm web scraper with custom output directories",
"command": "npx",
"args": [
"-y",
"@pinkpixel/prysm-mcp"
],
"env": {
"PRYSM_OUTPUT_DIR": "${workspaceFolder}/scrape_results",
"PRYSM_IMAGE_OUTPUT_DIR": "${workspaceFolder}/scrape_results/images"
}
}
}
}
🛠️ 工具
服务器提供以下工具:
scrapeFocused
优化速度的快速网页抓取(较少滚动,仅主内容)。
Please scrape https://example.com using the focused mode
可用参数:
url(必需):要抓取的 URLmaxScrolls(可选):最大滚动尝试次数(默认:5)scrollDelay(可选):滚动之间的延迟(毫秒)(默认:1000)scrapeImages(可选):是否在结果中包含图片downloadImages(可选):是否本地下载图片maxImages(可选):要提取的最大图片数量output(可选):下载图片的输出目录
scrapeBalanced
具有良好覆盖率和合理速度的平衡网页抓取方法。
Please scrape https://example.com using the balanced mode
可用参数:
- 与
scrapeFocused相同,但默认值不同 maxScrolls默认:10scrollDelay默认:2000- 添加
timeout参数以限制总抓取时间(默认:30000ms)
scrapeDeep
最大提取网页抓取(较慢但全面)。
Please scrape https://example.com using the deep mode with maximum scrolls
可用参数:
- 与
scrapeFocused相同,但默认值不同 maxScrolls默认:20scrollDelay默认:3000maxImages默认:100
formatResult
将抓取的数据格式化为不同的结构化格式(markdown、HTML、JSON)。
Format the scraped data as markdown
可用参数:
data(required): 要格式化的抓取数据format(required): 输出格式 - "markdown", "html" 或 "json"includeImages(optional): 是否在输出中包含图片(默认:true)output(optional): 保存格式化结果的文件路径
您还可以通过指定输出路径将格式化结果保存到文件中:
Format the scraped data as markdown and save it to "my-results/output.md"
⚙️ 配置
输出目录
默认情况下,当保存格式化结果时,文件将被保存到 ~/prysm-mcp/output/。您可以以两种方式自定义此设置:
- 环境变量:设置环境变量到您首选的目录:
# Linux/macOS
export PRYSM_OUTPUT_DIR="/path/to/custom/directory"
export PRYSM_IMAGE_OUTPUT_DIR="/path/to/custom/image/directory"
# Windows (Command Prompt)
set PRYSM_OUTPUT_DIR=C:\path\to\custom\directory
set PRYSM_IMAGE_OUTPUT_DIR=C:\path\to\custom\image\directory
# Windows (PowerShell)
$env:PRYSM_OUTPUT_DIR="C:\path\to\custom\directory"
$env:PRYSM_IMAGE_OUTPUT_DIR="C:\path\to\custom\image\directory"
- 工具参数:在调用工具时直接指定输出路径:
# For general results
Format the scraped data as markdown and save it to "/absolute/path/to/file.md"
# For image downloads when scraping
Please scrape https://example.com and download images to "/absolute/path/to/images"
- MCP 配置:在您的 MCP 配置文件(例如
.cursor/mcp.json)中,您可以设置这些环境变量:
{
"mcpServers": {
"prysm-scraper": {
"command": "npx",
"args": ["-y", "@pinkpixel/prysm-mcp"],
"env": {
"PRYSM_OUTPUT_DIR": "${workspaceFolder}/scrape_results",
"PRYSM_IMAGE_OUTPUT_DIR": "${workspaceFolder}/scrape_results/images"
}
}
}
}
如果未指定 PRYSM_IMAGE_OUTPUT_DIR,它将默认为 PRYSM_OUTPUT_DIR 内的一个名为 images 的子文件夹。
如果您仅提供相对路径或文件名,它将相对于配置的输出目录保存。
路径处理规则
formatResult 工具按以下方式处理路径:
- 绝对路径:按提供的路径使用(如
/home/user/file.md) - 相对路径:相对于配置的输出目录保存(如
subfolder/file.md) - 仅文件名:保存在配置的输出目录中(如
output.md) - 目录路径:如果路径指向一个目录,则根据内容和时间戳自动生成文件名
🏗️ 开发
# Install dependencies
npm install
# Build the project
npm run build
# Run the server locally
node bin/prysm-mcp
# Debug MCP communication
DEBUG=mcp:* node bin/prysm-mcp
# Set custom output directories
PRYSM_OUTPUT_DIR=./my-output PRYSM_IMAGE_OUTPUT_DIR=./my-output/images node bin/prysm-mcp
通过 npx 运行
您可以直接使用 npx 运行服务器而无需安装:
# Run with default settings
npx @pinkpixel/prysm-mcp
# Run with custom output directories
PRYSM_OUTPUT_DIR=./my-output PRYSM_IMAGE_OUTPUT_DIR=./my-output/images npx @pinkpixel/prysm-mcp
📋 许可证
MIT
🙏 致谢
由 Pink Pixel 开发