MCP File Preview Server

Xem trước các tệp HTML cục bộ và chụp ảnh màn hình, lưu chúng vào một thư mục cục bộ.

GitHub
24
Dùng thử MCP nàyĐược tài trợ

Tài liệu

mcp-file-preview

An MCP server that lets a coding model see the HTML it writes. It renders a local HTML file in headless Chrome and returns a screenshot, so the model can look at the page and improve it before a person reviews it.

Status: built in December 2024, in under an hour for under $4, and retired once this kind of tooling became standard in model releases. Updated in November 2026 to run on the current MCP SDK, and kept working.

Tools

  • preview_file
    • Arguments: filePath (required), width (default 1280), height (default 800), fullPage (default true), and stylesheets, an optional list of CSS files to inject after the page loads.
    • Returns: the screenshot as a PNG image, the path it was saved to, and the rendered HTML.
  • analyze_content
    • Arguments: filePath (required).
    • Returns: counts of headings, paragraphs, images, and links, as JSON.

Only .html and .htm files are accepted, and stylesheets must be .css files. Symlinks are followed before the check, so a link must point at a file of the right type. Relative paths resolve against the server's working directory, which the client chooses, so absolute paths are safer.

Screenshots are saved to mcp-file-preview/ in the system temp folder. Set MCP_FILE_PREVIEW_SCREENSHOT_DIR to save them somewhere else.

Install

Requires Node.js 22.12 or newer. npm install also downloads the Chrome build that Puppeteer uses.

git clone https://github.com/seanivore/mcp-file-preview.git
cd mcp-file-preview
npm install
npm run build
npm test

npm test builds the server, starts it over stdio, and calls both tools on a sample page.

Connect It

Claude Code:

claude mcp add file-preview -- node /absolute/path/to/mcp-file-preview/build/index.js

Claude Desktop, in claude_desktop_config.json:

{
  "mcpServers": {
    "file-preview": {
      "command": "node",
      "args": ["/absolute/path/to/mcp-file-preview/build/index.js"]
    }
  }
}

Other MCP clients take the same command and argument.

Development

  • npm run dev runs the server from source with tsx.
  • npx @modelcontextprotocol/inspector node build/index.js opens the MCP Inspector against the built server.
  • The MCP Inspector needs Node 22.23 or newer (its own engines field: ^22.23.4, ^24.22.1, or >=26.12.1). The server itself needs Node 22.12.

License

MIT