@rendershot/mcp服务器
模型上下文协议(MCP)服务器 渲染图 截图和PDF生成API。让AI代理(Claude、Cursor等)捕获屏幕截图,并直接作为工具调用生成PDF。
来源:
快速开始
无需安装--使用运行 npx:
RENDERSHOT_API_KEY=your_key npx @rendershot/mcp-serverClaude桌面设置
添加 ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"rendershot": {
"command": "npx",
"args": ["-y", "@rendershot/mcp-server"],
"env": {
"RENDERSHOT_API_KEY": "your_api_key_here"
}
}
}
}光标/VS代码设置
添加到MCP设置中:
{
"rendershot": {
"command": "npx",
"args": ["-y", "@rendershot/mcp-server"],
"env": {
"RENDERSHOT_API_KEY": "your_api_key_here"
}
}
}环境变量
| 变量 | 必填 | 默认 | 描述 |
|---|---|---|---|
RENDERSHOT_API_KEY | 是 | - | 您的Rendershot API密钥 |
RENDERSHOT_BASE_URL | 没有 | https://api.rendershot.io | API基本URL(用于自托管的覆盖) |
工具
take_screenshot
捕获URL或HTML字符串的屏幕截图。返回base64编码的图像。
| 参数 | 类型 | 默认值 | 说明 | ||||
|---|---|---|---|---|---|---|---|
url | string | -- | 要截图的页面URL *(需要url/html之一)* | ||||
html | string | -- | 要呈现的原始HTML *(需要url/html之一)* | ||||
format | png | jpeg | png | 输出图像格式 | |||
quality | 1–100 | 85 | JPEG质量(PNG忽略) | ||||
viewport_width | 1–3840 | 1280 | 视口宽度(像素) | ||||
viewport_height | 1–2160 | 720 | 视口高度(像素) | ||||
full_page | 布尔值 | false | 捕获完整的可滚动页面 | ||||
wait_for | 字符串 | dom_content_loaded | load | dom_content_loaded | network_idle | commit | CSS选择器 |
delay_ms | 0–10000 | 0 | 页面加载后的额外延迟(ms) | ||||
ai_cleanup | fast | thorough | -- | 在捕获之前删除cookie横幅/弹出窗口。 fast 使用JS启发式(1学分); thorough 增加LLM通行证(3学分) | |||
headers | { [name]: value } | -- | 与呈现请求一起发送的自定义HTTP标头。最多30个,值≤2KB。 Host / Cookie / Content-Length / Sec-* / Connection 拒绝 | ||||
cookies | array | -- | 要注入的会话Cookie。每个需求 name, value,其中之一 domain / url.可选: path, expires, http_only, secure, same_site (Lax | Strict | None).最多50 | ||
basic_auth | { username, password } | -- | HTTP基本身份验证。发送401挑战 |
generate_pdf
从URL或HTML字符串生成PDF。将PDF作为base64编码字符串返回。
| 参数 | 类型 | 默认值 | 说明 | |||
|---|---|---|---|---|---|---|
url | string | -- | 页面URL *(需要url/html之一)* | |||
html | string | -- | 原始HTML *(需要url/html之一)* | |||
format | A3 | A4 | Letter | Legal | A4 | 纸张尺寸 |
orientation | portrait | landscape | portrait | 页面方向 | ||
print_background | 布尔值 | true | 打印背景图形/颜色 | |||
wait_for | 字符串 | dom_content_loaded | 与截图相同 | |||
delay_ms | 0–10000 | 0 | 页面加载后的额外延迟(ms) | |||
ai_cleanup | fast | thorough | -- | 与截图相同 | ||
headers | { [name]: value } | -- | 与截图相同 | |||
cookies | array | -- | 与截图相同 | |||
basic_auth | { username, password } | -- | 与截图相同 |
bulk_render
一次通话最多可提交20个屏幕截图或PDF作业。所有作业并行运行,结果包括每个作业的base64输出。
| 参数 | 类型 | 说明 |
|---|---|---|
jobs | array(1–20) | 作业对象数组,每个对象都有 type: "screenshot" 或 type: "pdf" 加上与单个工具相同的字段 |
返回一个JSON对象 credits_used, credits_remaining和a results 数组包含 index, result (base64),以及任何 error 每个工作。
check_balance
检查剩余API信用和计划详细信息。没有参数。
备注
- 所有呈现调用都在内部使用异步模式并轮询,直到作业完成(最多5分钟)。
- 截图返回MCP
image内容——代理可以内联显示它们。 - PDF返回base64编码的文本;代理可以将它们保存到磁盘或传递。
- API的错误(利率限制、信用耗尽、无效URL)显示为原始错误代码的MCP错误。
需求
- Node.js 18+
许可证
麻省理工学院
