Skip to main content
Glama
Safari Screenshot MCP Server

Safari Screenshot MCP Server

by rogerheykoop

Safariのスクリーンショット

macOS 上の Safari を使用してスクリーンショットをキャプチャするための Node.js MCP サーバー。

特徴

  • 特定のサイズでウィンドウのスクリーンショットをキャプチャする

  • さまざまなズームレベルのサポート

  • ページ読み込みの待機時間を設定可能

  • 捕獲後のクリーンアップ

  • ネイティブmacOSのスクリーンショット品質

Related MCP server: Website Screenshot MCP

使用法

import { takeScreenshot } from './screenshot.js';

// Basic window screenshot
await takeScreenshot({
	url: 'https://www.apple.com',
	outputPath: './screenshot.png',
	width: 1024, // Optional: window width (default: 1024)
	height: 768, // Optional: window height (default: 768)
	waitTime: 3, // Optional: seconds to wait for load (default: 3)
	zoomLevel: 1, // Optional: page zoom level (default: 1)
});

// Responsive design testing
await takeScreenshot({
	url: 'https://www.apple.com',
	outputPath: './mobile.png',
	width: 375, // iPhone SE width
	height: 667, // iPhone SE height
	zoomLevel: 1,
});

// High-resolution capture
await takeScreenshot({
	url: 'https://www.apple.com',
	outputPath: './desktop-hd.png',
	width: 1920, // Full HD width
	height: 1080, // Full HD height
	waitTime: 5, // Wait longer for HD content
	zoomLevel: 0.8, // Zoom out slightly
});

要件

  • macOS

  • サファリ

  • Node.js >= 14.0.0

  • ターミナルにはアクセシビリティ権限が必要です(システム環境設定→セキュリティとプライバシー→プライバシー→アクセシビリティ)

インストール

npm install safari-screenshot

オプション

オプション

タイプ

デフォルト

説明

URL

弦

必須

キャプチャするURL

出力パス

弦

自動車

スクリーンショットを保存する場所(デフォルト: ./screenshots/[hostname]-[timestamp].png)

幅

番号

1024

ウィンドウの幅(ピクセル単位)

身長

番号

768

ウィンドウの高さ(ピクセル単位)

待機時間

番号

3

ページの読み込みを待つ秒数

ズームレベル

番号

1

ページのズームレベル(1 = 100%)

一般的なビューポートサイズ

モジュールは、次の一般的なビューポート サイズでテストされています。

  • デスクトップ: 1920×1080 (フルHD)

  • ノートパソコン: 1366×768

  • タブレット横向き: 1024×768

  • タブレット縦向き: 768×1024

  • モバイル ラージ: 428×926 (iPhone 12 Pro Max)

  • モバイルミディアム: 390×844 (iPhone 12 Pro)

  • モバイル小: 375×667 (iPhone SE)

仕組み

  1. 指定されたウィンドウサイズでSafariを開きます

  2. URLを読み込み、ページの読み込みを待ちます

  3. 指定された場合はズームレベルを適用します

  4. ネイティブmacOSスクリーンキャプチャを使用してピクセルパーフェクトな結果を実現

  5. スクリーンショットが正常にキャプチャされたことを確認します

  6. Safariウィンドウをクリーンアップします

権限

このパッケージが動作するにはシステム イベント権限が必要です:

  1. システム環境設定 > セキュリティとプライバシー > プライバシー > アクセシビリティを開く

  2. 許可されたアプリのリストにターミナル(またはIDE)を追加します

カーソルの使用

カーソルで設定

  1. オープンカーソル

  2. 設定に移動し、「MCPサーバーを追加」

  3. 構成ダイアログで:

    • 名前: safari-screenshot

    • タイプ: command

    • コマンド: npx -y @rogerheykoop/mcp-safari-screenshot

    またはローカル開発の場合:

    • コマンド: npx -y /path/to/mcp-safari-screenshot/server.js

コマンド例

Cursor でサーバーに接続した後、次のコマンドを使用できます。

Take a screenshot of https://apple.com at desktop size

回答: 1920×1080でキャプチャします

Capture https://apple.com on iPhone 12 Pro

回答: 390×844でキャプチャします

Screenshot github.com at 50% zoom

応答:zoomLevel:0.5 でキャプチャします

サポートされているパラメータ

MCP サーバーは次の概念を理解します。

  • デバイス名(例:「iPhone」、「iPad」、「デスクトップ」)

  • サイズ(例:「1024x768」)

  • ズームレベル(例:「50% ズーム」、「2 倍ズーム」)

  • 待ち時間(例:「5秒お待ちください」)

ワークフローの例

  1. レスポンシブテスト

    Take screenshots of apple.com on iPhone, iPad, and desktop
  2. ズームテスト

    Capture github.com at 75% zoom and 125% zoom
  3. カスタムサイズ

    Screenshot example.com at 1440x900

ヒント

  • スクリーンショットはデフォルトでscreenshotsディレクトリに保存されます

  • デバイス名は適切な寸法を自動的に設定します

  • サーバーはSafariウィンドウのクリーンアップを処理します

  • 読み込みが遅いページには「X秒待つ」を使用してください

トラブルシューティング

問題が発生した場合:

  1. ターミナルにアクセシビリティ権限があるか確認する

  2. Safariがプライベートブラウジングモードになっていないことを確認する

  3. 作業ディレクトリが書き込み可能であることを確認する

  4. カーソルのコンソールでエラーメッセージを確認してください

ライセンス

マサチューセッツ工科大学

ローカルテスト

MCP 実装を直接テストできます。

# Test discovery
echo '{"type":"discover"}' | npx -y ./server.js

# Test screenshot
echo '{"type":"execute","tool":"take_screenshot","input":"Take a screenshot of https://apple.com","requestId":"123"}' | npx -y ./server.js

予想される応答:

  1. Discoverは機能を返します

  2. 実行すると次のようになります:

    • 進行状況をstderrに記録する

    • 結果のJSONを標準出力に返す

    • スクリーンショットを./screenshots/に保存します

Available Tools

1 tool
take_screenshotC

Take a screenshot of a webpage using Safari on macOS

Inputs: url (required), outputPath, width, height, +2 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.1/5.0

    Scored across 1 tool

    Disambiguation5/5

    With only one tool, there is no possibility of ambiguity or overlap between tools. The tool's purpose is singular and clearly defined, making it impossible for an agent to misselect between non-existent alternatives.

    Naming Consistency5/5

    A single tool inherently has perfect naming consistency as there are no other tools to compare against. The name 'take_screenshot' follows a clear verb_noun pattern, which would be consistent if more tools existed.

    Tool Count2/5

    One tool is too few for most server purposes, as it severely limits functionality and scope. While it matches the server's name, a single screenshot tool feels thin and incomplete for a broader screenshot or browser automation domain.

    Completeness2/5

    The tool surface is severely incomplete for a screenshot server. There are obvious gaps such as no options for different screenshot types (e.g., full-page, element-specific), no configuration settings, and no related operations like listing or managing screenshots.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • -
      license
      A
      quality
      Not graded
      maintenance
      A server that provides AI assistants programmatic control of Safari browser on macOS for web automation, testing, and debugging.
      16
      1
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides tools to capture pixel-perfect website screenshots as images or PDF. Supports configurable viewport, full-page capture, CSS injection, and returns either viewable images or base64-encoded content.
      MIT