SM

seanivore/mcp-file-preview

Developer tools

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る

24 stars 8 forks 品質 72 トレンド 0MIT

HTMLファイルのプレビューと分析のためのMCPサーバー - OSで奇妙なものだったので、WIP

概要

HTMLファイルプレビューと解析機能を提供するモデルコンテキストプロトコル(MCP)サーバー。 ローカルHTMLファイルのフルページのスクリーンショットをキャプチャし、構造を分析することができます。 - : 適切なCSSスタイリングでHTMLファイルのフルページのスクリーンショットをキャプチャ - : HTML構造の分析(ヘッディング、段落、画像、リンク) - : ローカルファイルパスとリソースを処理する - : スクリーンショットを専用のディレクトリに保存する Claude または Cline MCP の設定にサーバーを追加します。 ~/Library/Application Support/Claude/claude desktop config.json に追加します。 スクリーンショットをキャプチャし、HTMLコンテンツを返します。 スクリーンショットは、プロジェクトフォルダのスクリーンショット/ディレクトリに保存されます。 戻り回数: - 見出し - パラグラフ - 画像 - リンク サーバは、MCP SDK の Server クラスを適切な初期化で使用します

概要(AI 翻訳)

HTMLファイルプレビューと解析機能を提供するモデルコンテキストプロトコル(MCP)サーバー。 ローカルHTMLファイルのフルページのスクリーンショットをキャプチャし、構造を分析することができます。

##特徴

-ファイルプレビュー: 適切なCSSスタイリングでHTMLファイルのフルページのスクリーンショットをキャプチャ -コンテンツ分析:HTML構造の分析(見出し、段落、画像、リンク)

  • ローカル ファイル サポート: ローカルファイルパスとリソースを処理する -スクリーンショット管理: スクリーンショットを専用のディレクトリに保存する

インストール

  1. リポジトリのクローン化:

  2. 依存関係を取付けて下さい:

  3. プロジェクトのビルド:

設定

Claude または Cline MCP の設定にサーバーを追加します。

##Claudeデスクトップアプリ ~/Library/Application Support/Claude/claude_desktop_config.json に追加します。

Cline VSCode 拡張子

VSCode の MCP 設定に追加します。

使用法

サーバは2つの主要なツールを提供しています。

##プレビュー ファイル スクリーンショットをキャプチャし、HTMLコンテンツを返します。

プロジェクトフォルダ内のscreenshots/ディレクトリに保存されます。

##分析 コンテンツ HTML構造を分析:

返品回数:

  • 見出し
  • パラグラフ
  • 画像
  • リンク

開発

  1. 依存関係を取付けて下さい:

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。

README

以下は原文 README の抜粋です。原文を見る。

MCP File Preview Server

A Model Context Protocol (MCP) server that provides HTML file preview and analysis capabilities. This server enables capturing full-page screenshots of local HTML files and analyzing their structure.

Features

  • File Preview: Capture full-page screenshots of HTML files with proper CSS styling
  • Content Analysis: Analyze HTML structure (headings, paragraphs, images, links)
  • Local File Support: Handle local file paths and resources
  • Screenshot Management: Save screenshots to a dedicated directory

Installation

  1. Clone the repository:
git clone https://github.com/your-username/mcp-file-preview.git
cd mcp-file-preview
  1. Install dependencies:
npm install
  1. Build the project:
npm run build

Configuration

Add the server to your Claude or Cline MCP settings:

Claude Desktop App

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

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

Cline VSCode Extension

Add to VSCode’s MCP settings:

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

Usage

The server provides two main tools:

preview_file

Captures a screenshot and returns HTML content:


file-preview
preview_file

{
  "filePath": "/path/to/file.html",
  "width": 1024,  // optional
  "height": 768   // optional
}

Screenshots are saved to screenshots/ directory in the project folder.

analyze_content

Analyzes HTML structure:


file-preview
analyze_content

{
  "filePath": "/path/to/file.html"
}

Returns counts of:

  • Headings
  • Paragraphs
  • Images
  • Links

Development

  1. Install dependencies:
npm install @modelcontextprotocol/sdk puppeteer typescript @types/node @types/puppeteer
  1. Make changes in src/
  2. Build:
npm run build
  1. Test locally:
npm run dev

Implementation Details

The server uses the MCP SDK’s Server class with proper initialization:

this.server = new Server(
  // Metadata object
  {
    name: 'file-preview-server',
    version: '0.1.0'
  },
  // Options object with capabilities
  {
    capabilities: {
      tools: {
        preview_file: {
          description: 'Preview local HTML file and capture screenshot',
          inputSchema: {
            // ... schema definition
          }
        }
      }
    }
  }
);

Key points:

  • Server constructor takes separate metadata and options objects
  • Tools are declared in capabilities.tools
  • Each tool needs a description and inputSchema
GitHub で README 全文を見る

インストール

npx @modelcontextprotocol/inspector
MCP 初心者?mcpskill.org のガイドから始めましょう →

設定

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